Skip to content

Commit

Permalink
Rename matching method
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jul 22, 2024
1 parent 1b1e4ce commit c88627f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 31 deletions.
34 changes: 14 additions & 20 deletions src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
logger = logging.getLogger(__name__)


class BackwardsMethods(enum.IntEnum):
class MatchingMethods(enum.IntEnum):
"""Enumerate backward methods."""

FORWARD = enum.auto()
EXACT = enum.auto()
EXPANDED = enum.auto()
BACKWARD_EXACT = enum.auto()
BACKWARD_EXPANDED = enum.auto()


def bw_method(s: InversionMethod) -> BackwardsMethods:
"""Return the backward method.
def matching_method(s: InversionMethod) -> MatchingMethods:
"""Return the matching method.
Parameters
----------
Expand All @@ -44,8 +44,8 @@ def bw_method(s: InversionMethod) -> BackwardsMethods:
"""
if s is not None:
return BackwardsMethods[s.value.upper()]
return BackwardsMethods.FORWARD
return MatchingMethods[s.value.upper()]
return MatchingMethods.FORWARD


@nb.njit(cache=True)
Expand All @@ -60,7 +60,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 : BackwardsMethods
backward_method : MatchingMethods
empty or method for inverting the matching condition (exact or expanded)
Returns
Expand All @@ -79,7 +79,7 @@ def build_ome(A, matching_order, a_s, backward_method):
ome = np.eye(len(A[0]), dtype=np.complex_)
A = A[:, :, :]
A = np.ascontiguousarray(A)
if backward_method is BackwardsMethods.EXPANDED:
if backward_method is MatchingMethods.BACKWARD_EXPANDED:
# expended inverse
if matching_order[0] >= 1:
ome -= a_s * A[0]
Expand All @@ -96,7 +96,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 is BackwardsMethods.EXACT:
if backward_method is MatchingMethods.BACKWARD_EXACT:
ome = np.linalg.inv(ome)
return ome

Expand Down Expand Up @@ -244,7 +244,7 @@ class OperatorMatrixElement(Operator):

def __init__(self, config, managers, nf, q2, is_backward, L, is_msbar):
super().__init__(config, managers, Segment(q2, q2, nf))
self.backward_method = bw_method(
self.backward_method = matching_method(
config["backward_inversion"] if is_backward else None
)
if is_backward:
Expand All @@ -271,10 +271,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 is not BackwardsMethods.FORWARD
):
if self.is_intrinsic or self.backward_method is not MatchingMethods.FORWARD:
# 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 @@ -290,10 +287,7 @@ def labels(self):
(br.matching_hplus_pid, 100),
]
)
if (
self.is_intrinsic
or self.backward_method is not BackwardsMethods.FORWARD
):
if self.is_intrinsic or self.backward_method is not MatchingMethods.FORWARD:
labels.extend(
[
(21, br.matching_hplus_pid),
Expand Down Expand Up @@ -365,7 +359,7 @@ def compute(self):
self.log_label,
self.order[0],
self.order[1],
BackwardsMethods(self.backward_method).name,
MatchingMethods(self.backward_method).name,
)

self.integrate()
2 changes: 1 addition & 1 deletion src/ekomark/data/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ev_op_max_order=10,
ev_op_iterations=10,
backward_inversion="expanded",
n_integration_cores=0,
n_integration_cores=1,
debug_skip_non_singlet=False,
debug_skip_singlet=False,
mugrid=[10],
Expand Down
20 changes: 10 additions & 10 deletions tests/eko/evolution_operator/test_ome.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from eko import interpolation, mellin
from eko import scale_variations as sv
from eko.evolution_operator.operator_matrix_element import (
BackwardsMethods,
MatchingMethods,
OperatorMatrixElement,
build_ome,
quad_ker,
Expand All @@ -34,7 +34,7 @@ def test_build_ome_as():
aS = A_singlet((o, 0), N, nf, L, is_msbar)

for a in [aNS, aS]:
for method in BackwardsMethods:
for method in MatchingMethods:
dim = len(a[0])
if o != 1:
assert len(a) == o
Expand All @@ -54,7 +54,7 @@ def test_build_ome_nlo():
aNSi = A_non_singlet((1, 0), N, nf, L)
aSi = A_singlet((1, 0), N, nf, L, is_msbar)
for a in [aNSi, aSi]:
for method in BackwardsMethods:
for method in MatchingMethods:
dim = len(a[0])
# hh
assert a[0, -1, -1] != 0.0
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_quad_ker_errors():
is_log=True,
logx=0.123,
areas=[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]],
backward_method=BackwardsMethods.FORWARD,
backward_method=MatchingMethods.FORWARD,
a_s=0.0,
nf=3,
L=0.0,
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_quad_ker(monkeypatch):
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
backward_method=BackwardsMethods.FORWARD,
backward_method=MatchingMethods.FORWARD,
a_s=0.0,
nf=3,
L=0.0,
Expand All @@ -139,7 +139,7 @@ def test_quad_ker(monkeypatch):
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
backward_method=BackwardsMethods.FORWARD,
backward_method=MatchingMethods.FORWARD,
a_s=0.0,
nf=3,
L=0.0,
Expand All @@ -158,7 +158,7 @@ def test_quad_ker(monkeypatch):
is_log=is_log,
logx=0.0,
areas=np.zeros(3),
backward_method=BackwardsMethods.FORWARD,
backward_method=MatchingMethods.FORWARD,
a_s=0.0,
nf=3,
L=0.0,
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_quad_ker(monkeypatch):
is_log=True,
logx=0.123,
areas=np.zeros(3),
backward_method=BackwardsMethods.EXPANDED,
backward_method=MatchingMethods.BACKWARD_EXPANDED,
a_s=0.0,
nf=3,
L=0.0,
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_quad_ker(monkeypatch):
is_log=True,
logx=0.123,
areas=np.zeros(3),
backward_method=BackwardsMethods.EXACT,
backward_method=MatchingMethods.BACKWARD_EXACT,
a_s=0.0,
nf=3,
L=0.0,
Expand All @@ -253,7 +253,7 @@ def test_quad_ker(monkeypatch):
is_log=True,
logx=0.0,
areas=np.array([0.01, 0.1, 1.0]),
backward_method=BackwardsMethods.FORWARD,
backward_method=MatchingMethods.FORWARD,
a_s=0.0,
nf=3,
L=0.0,
Expand Down

0 comments on commit c88627f

Please sign in to comment.