Skip to content

Commit

Permalink
remove 'use_scalevar_uncertainties' variable
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Nov 15, 2024
1 parent e0f7fb8 commit f009a9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
11 changes: 2 additions & 9 deletions doc/sphinx/source/tutorials/general_th_covmat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Instructions
############################################################################
theorycovmatconfig:
use_scalevar_uncertainties: False
user_covmat_path: "IeGM9CY8RxGcb5r6bIEYlQ==/topthcovmat.csv"
use_thcovmat_in_sampling: True
use_thcovmat_in_fitting: True
Expand All @@ -56,16 +55,10 @@ generation). The default is ``True`` for both.
Changing either of these to ``False`` will affect the fit outcome and should
be avoided unless you know what you are doing.


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``.

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

3. For an example runcard, see `here <https://github.com/NNPDF/nnpdf/tree/master/validphys2/examples/fit_with_user_covmat.yaml.>`_
2. 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_scalevar_uncertainties'] = thconfig.get(
'use_scalevar_uncertainties', True
)
# Fitting flag
file_content.update(N3FIT_FIXED_CONFIG)
return cls(file_content, *args, **kwargs)
Expand Down
18 changes: 4 additions & 14 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,6 @@ def produce_replicas(self, nreplica: int):
def parse_point_prescriptions(self, point_prescriptions):
return NSList(point_prescriptions, nskey="point_prescription")

def produce_inclusive_use_scalevar_uncertainties(
self, use_scalevar_uncertainties: bool = False, point_prescriptions: (list, None) = None
):
"""Whether to use a scale variation uncertainty theory covmat.
Checks whether a point prescription is included in the runcard and if so
assumes scale uncertainties are to be used."""
if not use_scalevar_uncertainties and point_prescriptions is not None:
use_scalevar_uncertainties = True
return use_scalevar_uncertainties

# TODO: load fit config from here
@element_of("fits")
@_id_with_label
Expand Down Expand Up @@ -784,7 +774,7 @@ def produce_loaded_theory_covmat(
output_path,
data_input,
user_covmat_path=None,
use_scalevar_uncertainties=True,
point_prescriptions=None,
use_thcovmat_in_sampling=False,
use_thcovmat_in_fitting=False,
):
Expand All @@ -797,7 +787,7 @@ def produce_loaded_theory_covmat(
# Load correct file according to how the thcovmat was generated by vp-setupfit
generic_path = "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv"
if user_covmat_path is not None:
if use_scalevar_uncertainties is True:
if point_prescriptions is not None:
generic_path = "datacuts_theory_theorycovmatconfig_total_theory_covmat.csv"
else:
generic_path = "datacuts_theory_theorycovmatconfig_user_covmat.csv"
Expand Down Expand Up @@ -1169,15 +1159,15 @@ def produce_loaded_user_covmat_path(self, user_covmat_path: str = ""):

@configparser.explicit_node
def produce_nnfit_theory_covmat(
self, inclusive_use_scalevar_uncertainties, user_covmat_path: str = None
self, point_prescriptions: list = None, user_covmat_path: str = None
):
"""
Return the theory covariance matrix used in the fit.
This function is only used in vp-setupfit to store the necessary covmats as .csv files in
the tables directory.
"""
if inclusive_use_scalevar_uncertainties:
if point_prescriptions is not None:
if user_covmat_path is not None:
# Both scalevar and user uncertainties
from validphys.theorycovariance.construction import total_theory_covmat_fitting
Expand Down

0 comments on commit f009a9b

Please sign in to comment.