Skip to content

Commit

Permalink
remove use_theorycovmat key
Browse files Browse the repository at this point in the history
This key was only used in a check, where it is forced to be set to true, though an error is raised if this is not the case, so it serves little purpose. Probably a remnant of a time where it could be used to toggle the use of the theory covmat.
  • Loading branch information
RoyStegeman committed Nov 18, 2024
1 parent 9baef9e commit 70147ca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
8 changes: 1 addition & 7 deletions validphys2/src/validphys/checks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 2 19:35:40 2016
@author: Zahari Kassabov
"""

from collections import Counter
import logging
import platform
Expand Down Expand Up @@ -51,12 +51,6 @@ def check_pdf_is_hessian(pdf, **kwargs):
)


@make_argcheck
def check_using_theory_covmat(use_theorycovmat):
"""Check that the `use_theorycovmat` is set to True"""
check(use_theorycovmat, "Expecting `use_theorycovmat: true`")


@make_argcheck
def check_not_using_pdferr(use_pdferr=False, **kwargs):
check(
Expand Down
12 changes: 5 additions & 7 deletions validphys2/src/validphys/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,11 @@ def procs_corrmat(procs_covmat):
def results(dataset: DataSetSpec, pdf: PDF, covariance_matrix, sqrt_covmat):
"""Tuple of data and theory results for a single pdf. The data will have an associated
covariance matrix, which can include a contribution from the theory covariance matrix which
is constructed from scale variation. The inclusion of this covariance matrix by default is used
where available, however this behaviour can be modified with the flag `use_theorycovmat`.
is constructed from scale variation.
The theory is specified as part of the dataset (a remnant of the old C++ layout)
A group of datasets is also allowed.
"""
# TODO: is the message about the usage of the theory covariance matrix here true?
# probably not in most cases...
return (
DataResult(dataset, covariance_matrix, sqrt_covmat),
ThPredictionsResult.from_convolution(pdf, dataset),
Expand Down Expand Up @@ -580,9 +577,10 @@ def results_with_theory_covmat(dataset, results, theory_covmat_dataset):
Most notably, this can be used to compute the chi2 including theory errors while plotting
data theory covariance in which the experimental uncertainties are not stained by the thcovmat
"""
# TODO: in principle this function could be removed, and `results` could automagically
# include the theory covmat when `use_theorycovmat: true` by changing the nodes in `config.py`
# however at the moment config.py _loads_ theory covmats and we need to compute it on the fly
# TODO: in principle this function could be removed, and `results` could automagically include
# the theory covmat when a key, let's call it `use_theorycovmat: true`, by changing the nodes in
# `config.py` however at the moment config.py _loads_ theory covmats and we need to compute it
# on the fly
from .covmats import sqrt_covmat

data_result, central_th_result = results
Expand Down
1 change: 0 additions & 1 deletion validphys2/src/validphys/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def data_config():
def thcovmat_config(data_config):
"""Same as data_config but with additional info for the thcovmat production."""
new_config = dict(data_config)
new_config["use_theorycovmat"] = "true"
new_config["use_cuts"] = "internal"
new_config.update(theoryid=708)
new_config.update(dataset_inputs=DATA_THCOVMAT)
Expand Down
8 changes: 3 additions & 5 deletions validphys2/src/validphys/theorycovariance/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

from reportengine import collect
from reportengine.table import table
from validphys.checks import check_using_theory_covmat

pass
from validphys.results import results, results_central
from validphys.theorycovariance.theorycovarianceutils import (
check_correct_theory_combination,
Expand All @@ -25,10 +26,7 @@
each_dataset_results_central_bytheory = collect("results_central_bytheoryids", ("data",))


@check_using_theory_covmat
def theory_covmat_dataset(
results, results_central_bytheoryids, point_prescription, use_theorycovmat # for the check
):
def theory_covmat_dataset(results, results_central_bytheoryids, point_prescription):
"""
Compute the theory covmat for a collection of theoryids for a single dataset.
Expand Down

0 comments on commit 70147ca

Please sign in to comment.