Skip to content

Commit 4db4438

Browse files
committed
allow for the creation of a covmat from just a list of DataSetSpecs
1 parent cea84fc commit 4db4438

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

validphys2/src/validphys/covmats.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def covmat_from_systematics(
125125

126126
def dataset_inputs_covmat_from_systematics(
127127
dataset_inputs_loaded_cd_with_cuts,
128-
data_input,
128+
data_input=None,
129129
use_weights_in_covmat=True,
130130
norm_threshold=None,
131131
_list_of_central_values=None,
@@ -186,10 +186,16 @@ def dataset_inputs_covmat_from_systematics(
186186
special_corrs = []
187187
block_diags = []
188188
weights = []
189+
189190
if _list_of_central_values is None:
190191
# want to just pass None to systematic_errors method
191192
_list_of_central_values = [None] * len(dataset_inputs_loaded_cd_with_cuts)
192193

194+
if data_input is None:
195+
if use_weights_in_covmat:
196+
raise ValueError("if use_weights_in_covmat=True, ``data_input`` cannot be empty")
197+
data_input = [None] * len(dataset_inputs_loaded_cd_with_cuts)
198+
193199
for cd, dsinp, central_values in zip(
194200
dataset_inputs_loaded_cd_with_cuts, data_input, _list_of_central_values
195201
):
@@ -199,7 +205,8 @@ def dataset_inputs_covmat_from_systematics(
199205
else:
200206
sys_errors = cd.systematic_errors(central_values)
201207
stat_errors = cd.stat_errors.to_numpy()
202-
weights.append(np.full_like(stat_errors, dsinp.weight))
208+
if use_weights_in_covmat and dsinp is not None:
209+
weights.append(np.full_like(stat_errors, dsinp.weight))
203210
# separate out the special uncertainties which can be correlated across
204211
# datasets
205212
is_intra_dataset_error = sys_errors.columns.isin(INTRA_DATASET_SYS_NAME)

0 commit comments

Comments
 (0)