Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache harmonics sums for the as2 anomalous dimensions #179

Closed
wants to merge 17 commits into from
Closed
Changes from 3 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
260 changes: 57 additions & 203 deletions tests/eko/evolution_operator/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,183 +28,40 @@ def test_quad_ker(monkeypatch):
monkeypatch.setattr(ns, "dispatcher", lambda *args: 1.0)
monkeypatch.setattr(qed_ns, "dispatcher", lambda *args: 1.0)
monkeypatch.setattr(s, "dispatcher", lambda *args: np.identity(2))
for is_log in [True, False]:
res_ns = quad_ker(
u=0,
order=(1, 0),
mode0=br.non_singlet_pids_map["ns+"],
mode1=0,
method="",
is_log=is_log,
logx=0.0,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_ns, 0.0)
res_ns = quad_ker(
u=0,
order=(3, 1),
mode0=br.non_singlet_pids_map["ns+u"],
mode1=0,
method="",
is_log=is_log,
logx=0.0,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_ns, 0.0)
res_s = quad_ker(
u=0,
order=(1, 0),
mode0=100,
mode1=100,
method="",
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_s, 1.0)
res_s = quad_ker(
u=0,
order=(1, 1),
mode0=100,
mode1=100,
method="iterate-exact",
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_s, 1.0)
res_s = quad_ker(
u=0,
order=(1, 0),
mode0=100,
mode1=21,
method="",
is_log=is_log,
logx=0.0,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_s, 0.0)
res_s = quad_ker(
u=0,
order=(1, 1),
mode0=100,
mode1=21,
method="iterate-exact",
is_log=is_log,
logx=0.0,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_s, 0.0)
res_v = quad_ker(
u=0,
order=(1, 1),
mode0=10200,
mode1=10200,
method="iterate-exact",
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_v, 1.0)
res_v = quad_ker(
u=0,
order=(1, 1),
mode0=10200,
mode1=10204,
method="iterate-exact",
is_log=is_log,
logx=0.123,
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_v, 0.0)
params = [
((1, 0), br.non_singlet_pids_map["ns+"], 0, "", 0.0, 0.0),
((3, 1), br.non_singlet_pids_map["ns+u"], 0, "", 0.0, 0.0),
((1, 0), 100, 100, "", 0.123, 1.0),
((1, 0), 100, 21, "", 0.0, 0.0),
((1, 1), 100, 100, "iterate-exact", 0.123, 1.0),
((1, 1), 100, 21, "iterate-exact", 0.123, 0.0),
((1, 1), 10200, 10200, "iterate-exact", 0.123, 1.0),
((1, 1), 10200, 10204, "iterate-exact", 0.123, 0.0),
]
for p in params:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe better for order,mode0,mode1,bla,bla in params?

for is_log in [True, False]:
res_ns = quad_ker(
u=0,
order=p[0],
mode0=p[1],
mode1=p[2],
method=p[3],
is_log=is_log,
logx=p[4],
areas=np.zeros(3),
as1=1,
as0=2,
as_raw=1,
aem_list=[0.00058],
alphaem_running=False,
nf=3,
L=0,
ev_op_iterations=0,
ev_op_max_order=(0, 0),
sv_mode=1,
is_threshold=False,
)
np.testing.assert_allclose(res_ns, p[5])
for label in [(br.non_singlet_pids_map["ns+"], 0), (100, 100)]:
for sv in [2, 3]:
res_sv = quad_ker(
Expand Down Expand Up @@ -287,14 +144,23 @@ def test_quad_ker(monkeypatch):
np.testing.assert_allclose(res_ns, 0.0)


class FakeCoupling:
def __init__(self):
self.alphaem_running = None
self.q2_ref = 0.0

def a(self, scale_to=None, fact_scale=None, nf_to=None):
return (0.1, 0.01)

def compute_aem_as(self, aem_ref, as_from, as_to, nf):
return aem_ref


fake_managers = {"couplings": FakeCoupling()}


class TestOperator:
def test_labels(self, theory_ffns, operator_card, tmp_path):
tcard: TheoryCard = theory_ffns(3)
tcard.xif = 2.0
ocard: OperatorCard = operator_card
ocard.configs.scvar_method = ScaleVariationsMethod.EXPONENTIATED
r = eko.runner.legacy.Runner(tcard, ocard, path=tmp_path / "eko.tar")
g = r.op_grid
def test_labels(self):
o = Operator(
dict(
order=(3, 0),
Expand All @@ -303,7 +169,7 @@ def test_labels(self, theory_ffns, operator_card, tmp_path):
n_integration_cores=1,
ModSV=None,
),
g.managers,
fake_managers,
3,
1,
2,
Expand All @@ -317,20 +183,14 @@ def test_labels(self, theory_ffns, operator_card, tmp_path):
n_integration_cores=1,
ModSV=None,
),
g.managers,
fake_managers,
3,
1,
2,
)
assert sorted(o.labels) == []

def test_labels_qed(self, theory_ffns, operator_card, tmp_path):
tcard: TheoryCard = theory_ffns(3)
tcard.xif = 2.0
ocard: OperatorCard = operator_card
ocard.configs.scvar_method = ScaleVariationsMethod.EXPONENTIATED
r = eko.runner.legacy.Runner(tcard, ocard, path=tmp_path / "eko.tar")
g = r.op_grid
def test_labels_qed(self):
o = Operator(
dict(
order=(3, 1),
Expand All @@ -340,7 +200,7 @@ def test_labels_qed(self, theory_ffns, operator_card, tmp_path):
ModSV=None,
ev_op_iterations=1,
),
g.managers,
fake_managers,
3,
1,
2,
Expand All @@ -355,24 +215,18 @@ def test_labels_qed(self, theory_ffns, operator_card, tmp_path):
ModSV=None,
ev_op_iterations=1,
),
g.managers,
fake_managers,
3,
1,
2,
)
assert sorted(o.labels) == []

def test_n_pools(self, theory_ffns, operator_card, tmp_path):
def test_n_pools(self):
excluded_cores = 3
# make sure we actually have more the those cores (e.g. on github we don't)
if os.cpu_count() <= excluded_cores:
return
tcard: TheoryCard = theory_ffns(3)
tcard.xif = 2.0
ocard: OperatorCard = operator_card
ocard.configs.scvar_method = ScaleVariationsMethod.EXPONENTIATED
r = eko.runner.legacy.Runner(tcard, ocard, path=tmp_path / "eko.tar")
g = r.op_grid
o = Operator(
dict(
order=(2, 0),
Expand All @@ -381,7 +235,7 @@ def test_n_pools(self, theory_ffns, operator_card, tmp_path):
n_integration_cores=-excluded_cores,
ModSV=None,
),
g.managers,
fake_managers,
3,
1,
10,
Expand Down