Skip to content

Commit

Permalink
Merge pull request #247 from NNPDF/fix-back_match
Browse files Browse the repository at this point in the history
Fix backward matching
  • Loading branch information
niclaurenti authored Apr 21, 2023
2 parents 9538753 + f08143c commit 86fe3c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
17 changes: 9 additions & 8 deletions src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from .. import basis_rotation as br
from .. import scale_variations as sv
from ..io.types import InversionMethod
from . import Operator, QuadKerBase

logger = logging.getLogger(__name__)
Expand All @@ -31,7 +32,7 @@ def build_ome(A, matching_order, a_s, backward_method):
perturbation matching order
a_s : float
strong coupling, needed only for the exact inverse
backward_method : ["exact", "expanded" or ""]
backward_method : InversionMethod or None
empty or method for inverting the matching condition (exact or expanded)
Returns
Expand All @@ -49,7 +50,7 @@ def build_ome(A, matching_order, a_s, backward_method):
# .end
ome = np.eye(len(A[0]), dtype=np.complex_)
A = np.ascontiguousarray(A)
if backward_method == "expanded":
if backward_method is InversionMethod.EXPANDED:
# expended inverse
if matching_order[0] >= 1:
ome -= a_s * A[0]
Expand All @@ -66,7 +67,7 @@ def build_ome(A, matching_order, a_s, backward_method):
if matching_order[0] >= 3:
ome += a_s**3 * A[2]
# need inverse exact ? so add the missing pieces
if backward_method == "exact":
if backward_method is InversionMethod.EXACT:
ome = np.linalg.inv(ome)
return ome

Expand Down Expand Up @@ -114,7 +115,7 @@ def quad_ker(
number of active flavor below threshold
L : float
:math:``\ln(\mu_F^2 / m_h^2)``
backward_method : ["exact", "expanded" or ""]
backward_method : InversionMethod or None
empty or method for inverting the matching condition (exact or expanded)
is_msbar: bool
add the |MSbar| contribution
Expand All @@ -140,7 +141,7 @@ def quad_ker(
)
sx_ns = sx.copy()
if order[0] == 3 and (
(backward_method != "" and ker_base.is_singlet)
(backward_method is not None and ker_base.is_singlet)
or (mode0 == 100 and mode1 == 100)
):
# At N3LO for A_qq singlet or backward you need to compute
Expand Down Expand Up @@ -240,7 +241,7 @@ class OperatorMatrixElement(Operator):

def __init__(self, config, managers, nf, q2, is_backward, L, is_msbar):
super().__init__(config, managers, nf, q2, None)
self.backward_method = config["backward_inversion"] if is_backward else ""
self.backward_method = config["backward_inversion"] if is_backward else None
if is_backward:
self.is_intrinsic = True
else:
Expand All @@ -265,7 +266,7 @@ def labels(self):
logger.warning("%s: skipping non-singlet sector", self.log_label)
else:
labels.append((200, 200))
if self.is_intrinsic or self.backward_method != "":
if self.is_intrinsic or self.backward_method is not None:
# intrinsic labels, which are not zero at NLO
labels.append((br.matching_hminus_pid, br.matching_hminus_pid))
# These contributions are always 0 for the moment
Expand All @@ -281,7 +282,7 @@ def labels(self):
(br.matching_hplus_pid, 100),
]
)
if self.is_intrinsic or self.backward_method != "":
if self.is_intrinsic or self.backward_method is not None:
labels.extend(
[
(21, br.matching_hplus_pid),
Expand Down
12 changes: 6 additions & 6 deletions tests/eko/evolution_operator/test_ome.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_build_ome_as():
aS = A_singlet((o, 0), N, sx_singlet, nf, L, is_msbar, sx_ns)

for a in [aNS, aS]:
for method in ["", "expanded", "exact"]:
for method in [None, InversionMethod.EXPANDED, InversionMethod.EXACT]:
dim = len(a[0])
if o != 1:
assert len(a) == o
Expand All @@ -62,7 +62,7 @@ def test_build_ome_nlo():
aNSi = A_non_singlet((1, 0), N, sx, nf, L)
aSi = A_singlet((1, 0), N, sx, nf, L, is_msbar)
for a in [aNSi, aSi]:
for method in ["", "expanded", "exact"]:
for method in [None, InversionMethod.EXPANDED, InversionMethod.EXACT]:
dim = len(a[0])
# hh
assert a[0, -1, -1] != 0.0
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_quad_ker(monkeypatch):
is_log=True,
logx=0.123,
areas=np.zeros(3),
backward_method="expanded",
backward_method=InversionMethod.EXPANDED,
a_s=0.0,
nf=3,
L=0.0,
Expand Down Expand Up @@ -234,7 +234,7 @@ def test_quad_ker(monkeypatch):
is_log=True,
logx=0.123,
areas=np.zeros(3),
backward_method="exact",
backward_method=InversionMethod.EXACT,
a_s=0.0,
nf=3,
L=0.0,
Expand Down Expand Up @@ -306,7 +306,7 @@ def test_quad_ker(monkeypatch):
# "debug_skip_non_singlet": False,
# "ev_op_max_order": 1,
# "ev_op_iterations": 1,
# "backward_inversion": "",
# "backward_inversion": None,
# }
# g = OperatorGrid.from_dict(
# theory_card,
Expand All @@ -327,7 +327,7 @@ def test_quad_ker(monkeypatch):
# order=theory_card["PTO"],
# L=0,
# nf=4,
# backward_method="",
# backward_method=None,
# is_msbar=False,
# )

Expand Down

0 comments on commit 86fe3c5

Please sign in to comment.