Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
'5 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)']
'5bar point': ['(1, 1)', '(2, 2)', '(0.5, 0.5)', '(2, 0.5)', '(0.5, 2)']
'7 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)']
'7 point diagonal': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)']
'7 point sym envelope': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)']
'9 point': ['(1, 1)', '(2, 1)', '(0.5, 1)', '(1, 2)', '(1, 0.5)', '(2, 2)', '(0.5, 0.5)', '(2, 0.5)', '(0.5, 2)']

# IHOU Anomalous dimension
Expand Down
28 changes: 28 additions & 0 deletions validphys2/src/validphys/theorycovariance/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@ def covmat_7pt(name1, name2, deltas1, deltas2):
)
return s

def covmat_7pt_diag(name1, name2, deltas1, deltas2):
"""Returns diagonal theory covariance sub-matrix for 7pt prescription,
given two dataset names and collections of scale variation shifts"""
if name1 == name2:
s = (1 / 3) * sum(np.outer(d, d) for d in deltas1)
else:
s = (1 / 6) * (
2 * (np.outer(deltas1[0], deltas2[0]) + np.outer(deltas1[1], deltas2[1]))
+ (
np.outer((deltas1[2] + deltas1[3]), (deltas2[2] + deltas2[3]))
+ np.outer((deltas1[4] + deltas1[5]), (deltas2[4] + deltas2[5]))
)
)
return np.diag(np.diag(s))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here because if name1 != name2 then there's nothing in the diagonal right? Should this also error out in that case. Or return all 0s if we only want the diagonal?

I think right now this one would be filling up random diagonals across the datasetX - datasetY offdiagonals

def covmat_7pt_sym_envelope(name1, name2, deltas1, deltas2):
"""Returns the diagonal theory covariance sub-matrix constructed as the
symmetric envelope around the central scale of the 7pt variations"""
if name1 == name2:
deltas1_max = np.max(np.abs(deltas1), axis=0)

s = np.outer(deltas1_max, deltas1_max)
else:
sys.exit("Inconsistent process name")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sys.exit("Inconsistent process name")
raise ValueError("Inconsistent process name. This is a debugging prescription and should not be use for fits.")

Is this the intended behaviour?

return np.diag(np.diag(s))

def covmat_9pt(name1, name2, deltas1, deltas2):
"""Returns theory covariance sub-matrix for 9pt prescription,
Expand Down Expand Up @@ -255,6 +279,10 @@ def compute_covs_pt_prescrip(point_prescription, name1, deltas1, name2=None, del
elif point_prescription == "7 point":
# 7pt (Gavin)
s = covmat_7pt(name1, name2, deltas1, deltas2)
elif point_prescription == "7 point diagonal":
s = covmat_7pt_diag(name1, name2, deltas1, deltas2)
elif point_prescription == "7 point sym envelope":
s = covmat_7pt_sym_envelope(name1, name2, deltas1, deltas2)
elif point_prescription == "9 point":
s = covmat_9pt(name1, name2, deltas1, deltas2)
elif point_prescription == "ad ihou":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def check_correct_theory_combination_internal(
if point_prescription in ["7 point"]:
correct_xifs = [1.0, 2.0, 0.5, 1.0, 1.0, 2.0, 0.5]
correct_xirs = [1.0, 1.0, 1.0, 2.0, 0.5, 2.0, 0.5]
if point_prescription in ["7 point diagonal"]:
correct_xifs = [1.0, 2.0, 0.5, 1.0, 1.0, 2.0, 0.5]
correct_xirs = [1.0, 1.0, 1.0, 2.0, 0.5, 2.0, 0.5]
if point_prescription in ["7 point sym envelope"]:
correct_xifs = [1.0, 2.0, 0.5, 1.0, 1.0, 2.0, 0.5]
correct_xirs = [1.0, 1.0, 1.0, 2.0, 0.5, 2.0, 0.5]
if correct_xirs != None and correct_xifs != None:
# some covmats don't rely on scale variations so we don't explicitly check those
check(
Expand Down
Loading