Skip to content

Commit 7e6a97c

Browse files
committed
Allow multiplicative factor for user covmat
1 parent 8d7aaf5 commit 7e6a97c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

validphys2/src/validphys/config.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ def produce_loaded_theory_covmat(
877877
# change ordering according to exp_covmat (so according to runcard order)
878878
tmp = theory_covmat.droplevel(0, axis=0).droplevel(0, axis=1)
879879
bb = [str(i) for i in data_input]
880+
import ipdb; ipdb.set_trace()
880881
return tmp.reindex(index=bb, columns=bb, level=0).values
881882

882883
@configparser.explicit_node
@@ -1276,6 +1277,21 @@ def produce_nnfit_theory_covmat(
12761277
f = user_covmat_fitting
12771278

12781279
return f
1280+
1281+
def produce_mult_factor_user_covmat(self, mult_factor: float = None, user_covmat_path: str = None):
1282+
"""
1283+
Multiplicative factors for the user covmat provided by mult_factors_user_covmat in the runcard.
1284+
If no factors are provided, returns None.
1285+
For use in theorycovariance.construction.user_covmat.
1286+
"""
1287+
# Check that if mult_factors is provided, user_covmat_paths is also provided
1288+
if mult_factor is not None and user_covmat_path is None:
1289+
raise ConfigError("If mult_factors is provided, user_covmat_paths must also be provided.")
1290+
1291+
if mult_factor is None:
1292+
return 1.0 if user_covmat_path is not None else None
1293+
else:
1294+
return mult_factor
12791295

12801296
def produce_fitthcovmat(
12811297
self, use_thcovmat_if_present: bool = False, fit: (str, type(None)) = None

validphys2/src/validphys/theorycovariance/construction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def fromfile_covmat(covmatpath, groups_data_by_process, procs_index):
531531

532532

533533
@table
534-
def user_covmat(groups_data_by_process, procs_index, loaded_user_covmat_path):
534+
def user_covmat(groups_data_by_process, procs_index, loaded_user_covmat_path, mult_factor_user_covmat):
535535
"""
536536
General theory covariance matrix provided by the user.
537537
Useful for testing the impact of externally produced
@@ -541,7 +541,7 @@ def user_covmat(groups_data_by_process, procs_index, loaded_user_covmat_path):
541541
``user_covmat_path`` in ``theorycovmatconfig`` in the
542542
runcard. For more information see documentation.
543543
"""
544-
return fromfile_covmat(loaded_user_covmat_path, groups_data_by_process, procs_index)
544+
return mult_factor_user_covmat * fromfile_covmat(loaded_user_covmat_path, groups_data_by_process, procs_index)
545545

546546

547547
@table

0 commit comments

Comments
 (0)