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

Add t0 chi2 to comparefitsreport #1613

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions validphys2/src/validphys/comparefittemplates/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ We are comparing:

{@ summarise_fits @}

{@ dataspecs::t0_info t0_chi2_info_table @}
Zaharid marked this conversation as resolved.
Show resolved Hide resolved

Theory covariance summary
-------------------------
{@summarise_theory_covmat_fits@}
Expand Down
19 changes: 19 additions & 0 deletions validphys2/src/validphys/fitdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,25 @@ def summarise_fits(collected_fit_summaries):
return pd.concat(collected_fit_summaries, axis=1)


@checks.check_use_t0
@table
def t0_chi2_info_table(pdf, dataset_inputs_abs_chi2_data, t0pdfset, use_t0):
""" Provides table with
- t0pdfset name
- Central t0-chi-squared
- Average t0-chi-squared
"""
ndata = dataset_inputs_abs_chi2_data.ndata
central_chi2 = dataset_inputs_abs_chi2_data.central_result / ndata
member_chi2 = dataset_inputs_abs_chi2_data.replica_result.error_members() / ndata

VET = ValueErrorTuple
data = OrderedDict( (("t0pdfset", f"{t0pdfset}"),
(r"$\chi^2_{t0}$", f"{central_chi2:.5f}"),
(r"$<\chi^2_{t0}>$", f"{VET(np.mean(member_chi2), np.std(member_chi2))}")))

return pd.Series(data, index=data.keys(), name=pdf.label)

fits_replica_data = collect('replica_data', ('fits',))

#Do collect in two parts so we get a list for each fit instead of a single list
Expand Down