Skip to content

Commit

Permalink
Add function to compute chi2
Browse files Browse the repository at this point in the history
  • Loading branch information
andreab1997 committed Mar 4, 2024
1 parent b20e99d commit f02bf4b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion validphys2/src/validphys/closuretest/closure_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@

underlying_results = collect("results", ("fitunderlyinglaw",))


def central_chi2_level0(dataset_inputs_results_central, data_fits_cv):
dt_ct, th_ct = dataset_inputs_results_central
preds = []
for ds in data_fits_cv:
preds.append(ds[0])
preds_conc = np.array([j for i in preds for j in i])
central_diff = preds_conc - th_ct.central_value
chi2s = calc_chi2(dt_ct.sqrtcovmat, central_diff)
return chi2s / (len(preds_conc))

@check_fit_isclosure
@check_use_fitcommondata
def bias_dataset(results, underlying_results, fit, use_fitcommondata):
Expand Down

0 comments on commit f02bf4b

Please sign in to comment.