Skip to content

Commit 4467d10

Browse files
authored
Merge pull request #2379 from NNPDF/issue_2375
Solving issue 2375
2 parents b30f00f + 3e5d13c commit 4467d10

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

validphys2/src/validphys/config.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,16 +1304,26 @@ def produce_fitthcovmat(
13041304
thcovmat_present = False
13051305

13061306
if use_thcovmat_if_present and thcovmat_present:
1307-
# Expected path of theory covmat hardcoded
1308-
covmat_path = (
1309-
fit.path / "tables" / "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv"
1310-
)
1311-
# All possible valid files
1307+
tables_path = fit.path / "tables"
1308+
theorycovmatconfig = fit.as_input()["theorycovmatconfig"]
1309+
user_covmat_path = theorycovmatconfig.get("user_covmat_path", None)
1310+
point_prescriptions = theorycovmatconfig.get("point_prescriptions", None)
1311+
1312+
generic_name = "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv"
1313+
if user_covmat_path is not None:
1314+
# User covmat + point prescriptions
1315+
if point_prescriptions is not None and point_prescriptions != []:
1316+
generic_name = "datacuts_theory_theorycovmatconfig_total_theory_covmat.csv"
1317+
# Only user covmat
1318+
else:
1319+
generic_name = "datacuts_theory_theorycovmatconfig_user_covmat.csv"
1320+
covmat_path = tables_path / generic_name
13121321
if not covmat_path.exists():
13131322
raise ConfigError(
13141323
"Fit appeared to use theory covmat in fit but the file was not at the "
13151324
f"usual location: {covmat_path}."
13161325
)
1326+
logging.info(f"Using theory covmat in fit: {covmat_path}")
13171327
fit_theory_covmat = ThCovMatSpec(covmat_path)
13181328
else:
13191329
fit_theory_covmat = None

0 commit comments

Comments
 (0)