Skip to content

Commit

Permalink
Merge pull request #1901 from NNPDF/restore_thcovmat_funcs
Browse files Browse the repository at this point in the history
Restore needed thcovmat functions
  • Loading branch information
andreab1997 authored Jan 15, 2024
2 parents f06ff00 + 8c71585 commit 59d3ef9
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 827 deletions.
32 changes: 0 additions & 32 deletions doc/sphinx/source/vp/theorycov/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,38 +154,6 @@ a comprehensive set of plots and tables describing the covariance matrices.
{@plot_diag_cov_comparison@}
{@endwith@}
Experimental $\chi^2$
---------------------
{@with default_theory@}
{@total_experiments_chi2@}
Total (exp. + th.) $\chi^2$
---------------------------
{@chi2_impact_custom@}
Experimental $\chi^2$ by dataset
--------------------------------
{@experiments_chi2_table@}
Total (exp. + th.) $\chi^2$ by dataset
--------------------------------------
{@experiments_chi2_table_theory@}
$\chi^2$ including only diagonal theory elements
------------------------------------------------
{@chi2_diag_only@}
Impact of theory covariance matrix on $\chi^2$s
-----------------------------------------------
{@plot_datasets_chi2_theory@}
{@endwith@}
Scale variations as a function of the kinematics
------------------------------------------------
{@with matched_datasets_from_dataspecs@}
[Plots for {@dataset_name@}]({@dataset_report report@})
{@endwith@}
Validation report
-----------------
Expand Down
34 changes: 1 addition & 33 deletions validphys2/examples/theory_covariance/template_matrix_plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,4 @@ Diagonal elements of covariance matrices
----------------------------------------
{@with default_theory@}
{@plot_diag_cov_comparison@}
{@endwith@}

Experimental $\chi^2$
---------------------
{@with default_theory@}
{@total_chi2_per_point_data@}

Total (exp. + th.) $\chi^2$
---------------------------
{@chi2_impact_custom@}

Experimental $\chi^2$ by dataset
--------------------------------
{@procs_chi2_table@}

Total (exp. + th.) $\chi^2$ by dataset
--------------------------------------
{@procs_chi2_table_theory@}

$\chi^2$ including only diagonal theory elements
------------------------------------------------
{@chi2_diag_only@}

Impact of theory covariance matrix on $\chi^2$s
-----------------------------------------------
{@plot_datasets_chi2_theory@}
{@endwith@}

Scale variations as a function of the kinematics
------------------------------------------------
{@with matched_datasets_from_dataspecs@}
[Plots for {@dataset_name@}]({@dataset_report report@})
{@endwith@}
{@endwith@}
16 changes: 6 additions & 10 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,20 +909,16 @@ def produce_theory_database(self):
"""Produces path to the theory.db file"""
return self.loader.theorydb_file

def produce_combined_shift_and_theory_dataspecs(self, theoryconfig, shiftconfig):
total_dataspecs = theoryconfig["dataspecs"] + shiftconfig["dataspecs"]
matched_datasets = self.produce_matched_datasets_from_dataspecs(total_dataspecs)
def produce_combined_shift_and_theory_dataspecs(self, dataspecs):
matched_datasets = self.produce_matched_datasets_from_dataspecs(dataspecs)
for ns in matched_datasets:
ns["dataspecs"] = self.produce_dataspecs_with_matched_cuts(ns["dataspecs"])
new_theoryconfig = []
new_shiftconfig = []
len_th = len(theoryconfig["dataspecs"])
new_dataspecs = []
len_th = len(dataspecs)
for s in matched_datasets:
new_theoryconfig.append(ChainMap({"dataspecs": s["dataspecs"][:len_th]}, s))
new_shiftconfig.append(ChainMap({"dataspecs": s["dataspecs"][len_th:]}, s))
new_dataspecs.append(ChainMap({"dataspecs": s["dataspecs"][len_th:]}, s))
return {
"shiftconfig": {"dataspecs": new_shiftconfig, "original": shiftconfig},
"theoryconfig": {"dataspecs": new_theoryconfig, "original": theoryconfig},
"dataspecs": {"dataspecs": new_dataspecs, "original": dataspecs },
}

# TODO: Worth it to do some black magic to not pass params explicitly?
Expand Down
Loading

0 comments on commit 59d3ef9

Please sign in to comment.