diff --git a/n3fit/src/n3fit/scripts/n3fit_exec.py b/n3fit/src/n3fit/scripts/n3fit_exec.py index c57445e627..264acb4eee 100755 --- a/n3fit/src/n3fit/scripts/n3fit_exec.py +++ b/n3fit/src/n3fit/scripts/n3fit_exec.py @@ -147,10 +147,13 @@ def from_yaml(cls, o, *args, **kwargs): N3FIT_FIXED_CONFIG['actions_'].extend((training_action, validation_action)) #Theorycovmat flags and defaults N3FIT_FIXED_CONFIG['theory_covmat_flag'] = False + N3FIT_FIXED_CONFIG['use_thcovmat_in_fitting'] = False + N3FIT_FIXED_CONFIG['use_thcovmat_in_sampling'] = False if (thconfig:=file_content.get('theorycovmatconfig')) is not None: - N3FIT_FIXED_CONFIG['theory_covmat_flag'] = True N3FIT_FIXED_CONFIG['use_thcovmat_in_fitting'] = thconfig.get('use_thcovmat_in_fitting', True) - N3FIT_FIXED_CONFIG['use_thcovmat_in_sampling'] = thconfig.get('use_thcovmat_in_sampling', True) + N3FIT_FIXED_CONFIG['use_thcovmat_in_sampling'] = thconfig.get('use_thcovmat_in_sampling', True) + if N3FIT_FIXED_CONFIG['use_thcovmat_in_sampling'] or N3FIT_FIXED_CONFIG['use_thcovmat_in_fitting']: + N3FIT_FIXED_CONFIG['theory_covmat_flag'] = True N3FIT_FIXED_CONFIG['use_user_uncertainties'] = thconfig.get('use_user_uncertainties', False) N3FIT_FIXED_CONFIG['use_scalevar_uncertainties'] = thconfig.get('use_scalevar_uncertainties', True) #Sampling flags diff --git a/validphys2/src/validphys/config.py b/validphys2/src/validphys/config.py index 556db6a068..9bdc6532e2 100644 --- a/validphys2/src/validphys/config.py +++ b/validphys2/src/validphys/config.py @@ -1584,24 +1584,29 @@ def load_default_data_grouping(self, spec): # somebody will want to add to this at some point e.g for th. uncertainties allowed = { "standard_report": "experiment", + "thcovmat_fit": "ALL" } return allowed[spec] def produce_processed_data_grouping( - self, data_grouping=None, data_grouping_recorded_spec_=None + self, use_thcovmat_in_fitting=False, use_thcovmat_in_sampling=False, data_grouping=None, data_grouping_recorded_spec_=None ): """Process the data_grouping key from the runcard, or lockfile. If `data_grouping_recorded_spec_` is present then its value is taken, and the runcard is assumed to be a lockfile. - If data_grouping is None, then fall back to old behaviour of grouping - by experiment. + If data_grouping is None, then, if either use_thcovmat_in_fitting or use_thcovmat_in_sampling + (or both) are true (which means that the fit is a thcovmat fit), group all the datasets + together, otherwise fall back to the default behaviour of grouping by + experiment (called standard_report). Else, the user can specfiy their own grouping, for example metadata_process. """ if data_grouping is None: # fallback to old default behaviour, but still record to lockfile data_grouping = self.parse_data_grouping("standard_report") + if use_thcovmat_in_fitting or use_thcovmat_in_sampling: + data_grouping = self.parse_data_grouping("thcovmat_fit") if data_grouping_recorded_spec_ is not None: return data_grouping_recorded_spec_[data_grouping] return self.load_default_data_grouping(data_grouping) @@ -1653,17 +1658,6 @@ def produce_group_dataset_inputs_by_metadata( for name, group in res.items() ] - def produce_group_dataset_inputs_by_fitting_group( - self, data_input, theory_covmat_flag - ): - """ - Groups datasets all together in a group called ALL if the theory covariance matrix - is used in the fit, otherwise it groups them by experiment. - """ - if theory_covmat_flag: - return self.produce_group_dataset_inputs_by_metadata(data_input, "ALL") - return self.produce_group_dataset_inputs_by_metadata(data_input, "experiment") - def produce_fivetheories(self, point_prescription): if point_prescription == "5bar point": return "bar" diff --git a/validphys2/src/validphys/n3fit_data.py b/validphys2/src/validphys/n3fit_data.py index ef65723418..9a8633e7d9 100644 --- a/validphys2/src/validphys/n3fit_data.py +++ b/validphys2/src/validphys/n3fit_data.py @@ -311,7 +311,7 @@ def fitting_data_dict( return dict_out -exps_fitting_data_dict = collect("fitting_data_dict", ("group_dataset_inputs_by_fitting_group",)) +exps_fitting_data_dict = collect("fitting_data_dict", ("group_dataset_inputs_by_metadata",)) def replica_nnseed_fitting_data_dict(replica, exps_fitting_data_dict, replica_nnseed): diff --git a/validphys2/src/validphys/tests/conftest.py b/validphys2/src/validphys/tests/conftest.py index c96d8b70bc..080048efd3 100644 --- a/validphys2/src/validphys/tests/conftest.py +++ b/validphys2/src/validphys/tests/conftest.py @@ -58,7 +58,6 @@ def tmp(tmpdir): use_cuts='nocuts', dataset_inputs=DATA, theoryid=THEORYID, - use_fitthcovmat=False, Q=10, )