Skip to content

Commit

Permalink
add rescale factor to runcard
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Apr 10, 2024
1 parent 616e7e9 commit 1652d2c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions validphys2/src/validphys/theorycovariance/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
def theory_covmat_dataset(
results,
results_central_bytheoryids,
rescale_alphas_covmat,
use_theorycovmat, # for the check
point_prescription,
fivetheories=None,
Expand All @@ -58,7 +59,7 @@ def theory_covmat_dataset(
# Compute the theory contribution to the covmats
deltas = list((t.central_value - cv for t in theory_results))
thcovmat = compute_covs_pt_prescrip(
point_prescription, l, "A", deltas, fivetheories=fivetheories, seventheories=seventheories
point_prescription, l, "A", deltas, fivetheories=fivetheories, seventheories=seventheories, rescale_alphas_covmat=rescale_alphas_covmat,
)

return thcovmat
Expand Down Expand Up @@ -99,7 +100,7 @@ def combine_by_type(each_dataset_results_central_bytheory):
)
return process_info

def covmat_alphas(name1, name2, deltas1, deltas2):
def covmat_alphas(name1, name2, deltas1, deltas2, rescale_alphas_covmat):
"""Returns the covariance sub-matrix for 3-pt alpha_s
variation given two dataset names and collections of the
alpha_s shifts. This is equivalent to 3 point factorisation
Expand All @@ -111,7 +112,7 @@ def covmat_alphas(name1, name2, deltas1, deltas2):
# second order derivatives of the theory prediction wrt alpha_s. (see
# section 1.1 of 2105.05114)
# s = 0.5 * np.outer(deltas1[0] - deltas1[1], deltas2[0] - deltas2[1])
return s
return s*rescale_alphas_covmat

def covmat_3fpt(name1, name2, deltas1, deltas2):
"""Returns theory covariance sub-matrix for 3pt factorisation
Expand Down Expand Up @@ -271,6 +272,7 @@ def compute_covs_pt_prescrip(
deltas2=None,
fivetheories=None,
seventheories=None,
rescale_alphas_covmat=1,
):
"""Utility to compute the covariance matrix by prescription given the
shifts with respect to the central value for a pair of processes.
Expand Down Expand Up @@ -315,7 +317,7 @@ def compute_covs_pt_prescrip(

if l == 3:
if point_prescription.startswith("alpha_s"):
s = covmat_alphas(name1, name2, deltas1, deltas2)
s = covmat_alphas(name1, name2, deltas1, deltas2, rescale_alphas_covmat)
elif point_prescription == "3f point":
s = covmat_3fpt(name1, name2, deltas1, deltas2)
elif point_prescription == "3r point":
Expand Down Expand Up @@ -383,7 +385,7 @@ def compute_covs_pt_prescrip(


@check_correct_theory_combination
def covs_pt_prescrip(combine_by_type, theoryids, point_prescription, fivetheories, seventheories):
def covs_pt_prescrip(combine_by_type, theoryids, point_prescription, fivetheories, seventheories, rescale_alphas_covmat):
"""Produces the sub-matrices of the theory covariance matrix according
to a point prescription which matches the number of input theories.
If 5 theories are provided, a scheme 'bar' or 'nobar' must be
Expand Down Expand Up @@ -416,6 +418,7 @@ def covs_pt_prescrip(combine_by_type, theoryids, point_prescription, fivetheorie
deltas2,
fivetheories,
seventheories,
rescale_alphas_covmat,
)
start_locs = (start_proc[name1], start_proc[name2])
covmats[start_locs] = s
Expand Down

0 comments on commit 1652d2c

Please sign in to comment.