Skip to content

Commit

Permalink
Start fixing grid
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn authored and alecandido committed May 3, 2023
1 parent 47b2220 commit 59f4323
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
3 changes: 1 addition & 2 deletions src/eko/evolution_operator/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ def get_threshold_operators(self, path: List[Segment]) -> List[Operator]:
ome = OperatorMatrixElement(
self.config,
self.managers,
seg.nf - shift + 3,
seg.target,
seg,
is_downward,
np.log(kthr),
self.config["HQ"] == "MSBAR",
Expand Down
8 changes: 2 additions & 6 deletions src/eko/evolution_operator/operator_matrix_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,8 @@ class OperatorMatrixElement(Operator):
configuration
managers : dict
managers
nf: int
number of active flavor below threshold
q2: float
matching scale
is_backward: bool
True for backward evolution
segment: Segment
path segment
L: float
:math:`\ln(\mu_F^2 / m_h^2)`
is_msbar: bool
Expand Down
27 changes: 10 additions & 17 deletions tests/eko/evolution_operator/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,26 @@ def test_compute_mu2grid(theory_ffns, operator_card, tmp_path):
opgrid = legacy.Runner(
theory_ffns(3), operator_card, path=tmp_path / "eko.tar"
).op_grid
# q2 has not be precomputed - but should work nevertheless
opgrid.compute(3)
# we can also pass a single number
opg = opgrid.compute()
assert len(opg) == len(mugrid)
assert all(k in op for k in ["operator", "error"] for op in opg.values())
opg = opgrid.compute(3)
assert len(opg) == 1
assert all(k in op for k in ["operator", "error"] for op in opg.values())


def test_grid_computation_VFNS(theory_card, operator_card, tmp_path):
"""Checks that the grid can be computed"""
mugrid = [(3, 4), (5, 5), (5, 4)]
operator_card.mugrid = mugrid
opgrid = legacy.Runner(
theory_card, operator_card, path=tmp_path / "eko.tar"
).op_grid
qgrid_check = [3, 5, 200**2]
operators = opgrid.compute(qgrid_check)
assert len(operators) == len(qgrid_check)
operators = opgrid.compute()
assert len(operators) == len(mugrid)


def test_mod_expanded(theory_card, theory_ffns, operator_card, tmp_path: pathlib.Path):
mugrid = [(3, 4)]
operator_card.mugrid = mugrid
operator_card.configs.scvar_method = eko.io.types.ScaleVariationsMethod.EXPANDED
theory_update = {
"order": (1, 0),
"ModSV": "expanded",
}
epsilon = 1e-1
path = tmp_path / "eko.tar"
for is_ffns, nf0 in zip([False, True], [5, 3]):
Expand All @@ -82,11 +75,11 @@ def test_mod_expanded(theory_card, theory_ffns, operator_card, tmp_path: pathlib
theory.heavy.num_flavs_init = nf0
path.unlink(missing_ok=True)
opgrid = legacy.Runner(theory, operator_card, path=path).op_grid
opg = opgrid.compute(3)
theory_update["XIF"] = 1.0 + epsilon
opg = opgrid.compute()
theory.xif = 1.0 + epsilon
path.unlink(missing_ok=True)
sv_opgrid = legacy.Runner(theory, operator_card, path=path).op_grid
sv_opg = sv_opgrid.compute(3)
sv_opg = sv_opgrid.compute()
np.testing.assert_allclose(
opg[3]["operator"], sv_opg[3]["operator"], atol=2.5 * epsilon
opg[(9, 4)]["operator"], sv_opg[(9, 4)]["operator"], atol=2.5 * epsilon
)

0 comments on commit 59f4323

Please sign in to comment.