@@ -1305,24 +1305,25 @@ def produce_fitthcovmat(
13051305
13061306 if use_thcovmat_if_present and thcovmat_present :
13071307 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 )
13081311
1309- # User covmat + point prescriptions
1310- if (tables_path / "datacuts_theory_theorycovmatconfig_total_theory_covmat.csv" ).exists ():
1311- covmat_path = (tables_path / "datacuts_theory_theorycovmatconfig_total_theory_covmat.csv" )
1312- # Only point prescriptions
1313- elif (tables_path / "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv" ).exists ():
1314- covmat_path = (
1315- tables_path / "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv"
1316- )
1317- # Only user covmat
1318- elif (tables_path / "datacuts_theory_theorycovmatconfig_user_covmat.csv" ).exists ():
1319- covmat_path = (tables_path / "datacuts_theory_theorycovmatconfig_user_covmat.csv" )
1320- else :
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
1321+ if not covmat_path .exists ():
13211322 raise ConfigError (
13221323 "Fit appeared to use theory covmat in fit but the file was not at the "
13231324 f"usual location: { covmat_path } ."
13241325 )
1325- logging .info (f"Using theory covmat from fit: { covmat_path } " )
1326+ logging .info (f"Using theory covmat in fit: { covmat_path } " )
13261327 fit_theory_covmat = ThCovMatSpec (covmat_path )
13271328 else :
13281329 fit_theory_covmat = None
0 commit comments