Skip to content

Commit

Permalink
get rid of 'use_user_uncertainties' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Nov 15, 2024
1 parent 7aa81a2 commit e0f7fb8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
7 changes: 3 additions & 4 deletions doc/sphinx/source/tutorials/general_th_covmat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Instructions
############################################################################
theorycovmatconfig:
use_scalevar_uncertainties: False
use_user_uncertainties: True
user_covmat_path: "IeGM9CY8RxGcb5r6bIEYlQ==/topthcovmat.csv"
use_thcovmat_in_sampling: True
use_thcovmat_in_fitting: True
Expand All @@ -58,15 +57,15 @@ generation). The default is ``True`` for both.
be avoided unless you know what you are doing.


4. The flag ``use_scalevar_uncertainties`` corresponds to whether or not a
1. The flag ``use_scalevar_uncertainties`` corresponds to whether or not a
theory covmat is to be constructed from a pointprescription with instructions
inside ``theorycovmatconfig``. Usually in cases where a custom covmat is
being loaded, this will be set to ``False``.

5. Make sure that datasets are grouped under one big experiment called "BIGEXP",
2. Make sure that datasets are grouped under one big experiment called "BIGEXP",
just like in :ref:`vptheorycov-index`.

6. For an example runcard, see `here <https://github.com/NNPDF/nnpdf/tree/master/validphys2/examples/fit_with_user_covmat.yaml.>`_
3. For an example runcard, see `here <https://github.com/NNPDF/nnpdf/tree/master/validphys2/examples/fit_with_user_covmat.yaml.>`_


Including both scale variation uncertainties and user uncertainties
Expand Down
3 changes: 0 additions & 3 deletions n3fit/src/n3fit/scripts/n3fit_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ def from_yaml(cls, o, *args, **kwargs):
N3FIT_FIXED_CONFIG['use_thcovmat_in_sampling'] = thconfig.get(
'use_thcovmat_in_sampling', 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
)
Expand Down
16 changes: 7 additions & 9 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def produce_loaded_theory_covmat(
self,
output_path,
data_input,
use_user_uncertainties=False,
user_covmat_path=None,
use_scalevar_uncertainties=True,
use_thcovmat_in_sampling=False,
use_thcovmat_in_fitting=False,
Expand All @@ -796,7 +796,7 @@ def produce_loaded_theory_covmat(
return 0.0
# Load correct file according to how the thcovmat was generated by vp-setupfit
generic_path = "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv"
if use_user_uncertainties is True:
if user_covmat_path is not None:
if use_scalevar_uncertainties is True:
generic_path = "datacuts_theory_theorycovmatconfig_total_theory_covmat.csv"
else:
Expand Down Expand Up @@ -1154,15 +1154,13 @@ def parse_lumi_channel(self, ch: str):
def produce_all_lumi_channels(self):
return {"lumi_channels": self.parse_lumi_channels(list(LUMI_CHANNELS))}

def produce_loaded_user_covmat_path(
self, user_covmat_path: str = "", use_user_uncertainties: bool = False
):
def produce_loaded_user_covmat_path(self, user_covmat_path: str = ""):
"""
Path to the user covmat provided by user_covmat_path in the runcard.
If no path is provided, returns None.
For use in theorycovariance.construction.user_covmat.
"""
if not use_user_uncertainties:
if user_covmat_path is None:
return None
else:
l = self.loader
Expand All @@ -1171,7 +1169,7 @@ def produce_loaded_user_covmat_path(

@configparser.explicit_node
def produce_nnfit_theory_covmat(
self, inclusive_use_scalevar_uncertainties, use_user_uncertainties: bool = False
self, inclusive_use_scalevar_uncertainties, user_covmat_path: str = None
):
"""
Return the theory covariance matrix used in the fit.
Expand All @@ -1180,7 +1178,7 @@ def produce_nnfit_theory_covmat(
the tables directory.
"""
if inclusive_use_scalevar_uncertainties:
if use_user_uncertainties:
if user_covmat_path is not None:
# Both scalevar and user uncertainties
from validphys.theorycovariance.construction import total_theory_covmat_fitting

Expand All @@ -1190,7 +1188,7 @@ def produce_nnfit_theory_covmat(
from validphys.theorycovariance.construction import theory_covmat_custom

f = theory_covmat_custom
elif use_user_uncertainties:
elif user_covmat_path is not None:
# Only user uncertainties
from validphys.theorycovariance.construction import user_covmat_fitting

Expand Down

0 comments on commit e0f7fb8

Please sign in to comment.