Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic simple_calibration #108

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/chi2fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ function chi2fit(f_fit::Function, x::AbstractVector{<:Union{Real,Measurement{<:R
# gof
chi2min = res.objective
dof = length(x) - length(v_chi2)
pvalue = ccdf(Chisq(dof), chi2min)
if dof == 0
pvalue = NaN
@warn "The number of fit parameters is equivalent to number of data points --> dof = 0 ; p-value not meaningful, set to NaN"
else
pvalue = ccdf(Chisq(dof), chi2min)
end

function get_y_pred_err(f_fit, x_val, x_err, pars) # get final uncertainties for normalized residuals
dual_x = ForwardDiff.Dual{UncertTag}(x_val, x_err)
dual_y = f_fit(dual_x, pars...)
Expand Down