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

Reorganize runcards and metadata #220

Merged
merged 50 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
fcd77ed
Replace type aliases with newtypes
alecandido Feb 23, 2023
14184a8
Start developing recipes
alecandido Feb 23, 2023
c8aad50
Make NewType deserialization compatible with 3.5<=py<3.10
alecandido Feb 23, 2023
86badc2
Give up on NewTypes, start migration types->quantities
alecandido Feb 23, 2023
826f119
Migrate isobench to hq quantities
alecandido Feb 24, 2023
183982b
Add scales from ratios function
alecandido Feb 24, 2023
a62189f
Start sketching parts to migrate existing runner
alecandido Feb 25, 2023
6ff9af5
Specialize parts
alecandido Feb 25, 2023
ea1e312
Factorize masses computation
alecandido Feb 25, 2023
813cb86
Drop class factories in favor of generic classes
alecandido Feb 28, 2023
949e56f
Split test & tests scripts
alecandido Mar 7, 2023
d643db6
Make new types closer and more compatible with old ones
alecandido Mar 7, 2023
423dab4
Improve couplings serialization
alecandido Mar 7, 2023
c7d0074
Fix coupling ref type, use correct typebin bench evol unity
alecandido Mar 7, 2023
b543fe7
Use correct coupling ref type in coupling benchmarks
alecandido Mar 7, 2023
ef914ef
Fix test_msbar_masses
felixhekhorn Mar 9, 2023
7fe6188
Attempt fix for benchmark_msbar
felixhekhorn Mar 9, 2023
e424970
Remove duplicated typevar
alecandido Mar 9, 2023
47badf2
Fix tests in the same way of #217
alecandido Mar 10, 2023
cea89b4
Drop rotations and mu2grid from runcard
alecandido Mar 10, 2023
3ca71cb
Address @felixhekhorn comment on running docs
alecandido Mar 10, 2023
275c2e1
Fix evolve pdf benchmarks
alecandido Mar 10, 2023
9a0e6e8
Upgrade mugrid to host flavors, drop Q2grid
alecandido Mar 12, 2023
35400f4
Fix mu2grids handling in genpdf and mugrid specification in evolution…
alecandido Mar 12, 2023
046a074
Fix mu2grid iteration
alecandido Mar 12, 2023
ff4960c
Improve rotation serialization, add tests
alecandido Mar 12, 2023
92a2bfc
Make use of overwritable raw consistent
alecandido Mar 12, 2023
b316c03
Increase coverage of io
alecandido Mar 12, 2023
30d3039
Test dictlike with new-typed fields
alecandido Mar 12, 2023
16aeff7
Fix raw operator example and test it
alecandido Mar 12, 2023
dcabadd
Add placeholder test for compute
alecandido Mar 12, 2023
6d6d9e6
Introduce types in thresholds
alecandido Mar 19, 2023
7ecde84
Implement flavored mu2grid upgrade
alecandido Mar 19, 2023
90633b8
Scope heavy flavors constant
alecandido Mar 19, 2023
1ccf821
Drop rotations computations from legacy operator card conversion
alecandido Mar 19, 2023
b3208e1
Adjust docstrings
alecandido Mar 19, 2023
f01cdb5
Test classes inheriting from Generic
alecandido Mar 19, 2023
9737eaa
Drop large disclaimer, thanks to generic reimplementation
alecandido Mar 19, 2023
5c094aa
Update src/ekomark/data/operators.py
alecandido Mar 20, 2023
2811129
Fix runcards conversion, but HeavyQuarks deserialization
alecandido Mar 20, 2023
583c165
Enhance generic lists deserialization
alecandido Mar 20, 2023
ab4c5be
Add theory card heavy section, update relative tests
alecandido Mar 26, 2023
64f85b9
Updated isolated benchmarks with heavy quarks theory section
alecandido Mar 26, 2023
885f563
Split scale from couplings value, move couplings info
alecandido Mar 26, 2023
2b92f9a
Fix unit test for the new couplings layout
alecandido Mar 30, 2023
75ac907
Restore testing with poe test
alecandido Mar 30, 2023
3daf409
Fix evol to unity isobench
alecandido Mar 30, 2023
b609164
Fix isobench for msbar masses
alecandido Mar 30, 2023
90da30e
Fix isobench for strong coupling
alecandido Mar 30, 2023
e3ec8ed
Solve bug introduced in info file, fix related benchmark
alecandido Mar 31, 2023
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
12 changes: 6 additions & 6 deletions benchmarks/CT14_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BenchmarkCT14(Runner):
# Rotate to evolution basis
rotate_to_evolution_basis = False

def benchmark_llo_NF3(self, Q0=5, Q2grid=(100,)):
def benchmark_llo_NF3(self, Q0=5, mugrid=(10,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -47,7 +47,7 @@ def benchmark_llo_NF3(self, Q0=5, Q2grid=(100,)):
"MaxNfAs": 3,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [
-6,
-5,
Expand All @@ -66,7 +66,7 @@ def benchmark_llo_NF3(self, Q0=5, Q2grid=(100,)):
]
self.run([theory_card], [operator_card], ["CT14llo_NF3"])

def benchmark_llo_NF4(self, Q0=5, Q2grid=(100,)):
def benchmark_llo_NF4(self, Q0=5, mugrid=(10,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -79,7 +79,7 @@ def benchmark_llo_NF4(self, Q0=5, Q2grid=(100,)):
"MaxNfAs": 4,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [
-6,
-5,
Expand All @@ -94,7 +94,7 @@ def benchmark_llo_NF4(self, Q0=5, Q2grid=(100,)):
]
self.run([theory_card], [operator_card], ["CT14llo_NF4"])

def benchmark_llo_NF6(self, Q0=10, Q2grid=(1e6,)):
def benchmark_llo_NF6(self, Q0=10, mugrid=(30,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -107,7 +107,7 @@ def benchmark_llo_NF6(self, Q0=10, Q2grid=(1e6,)):
"MaxNfAs": 6,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [22, "ph"]
self.run([theory_card], [operator_card], ["CT14llo_NF6"])

Expand Down
12 changes: 6 additions & 6 deletions benchmarks/CT18_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BenchmarkCT18(Runner):
# Rotate to evolution basis
rotate_to_evolution_basis = True

def benchmark_nnlo(self, Q0=1.295, Q2grid=(1e4,)):
def benchmark_nnlo(self, Q0=1.295, mugrid=(1e4,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -43,7 +43,7 @@ def benchmark_nnlo(self, Q0=1.295, Q2grid=(1e4,)):
"MaxNfAs": 5,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [
-6,
6,
Expand All @@ -54,7 +54,7 @@ def benchmark_nnlo(self, Q0=1.295, Q2grid=(1e4,)):
]
self.run([theory_card], [operator_card], ["CT18NNLO"])

def benchmark_nnlo_qed(self, Q0=1.295, Q2grid=(1e4,)):
def benchmark_nnlo_qed(self, Q0=1.295, mugrid=(1e4,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -67,7 +67,7 @@ def benchmark_nnlo_qed(self, Q0=1.295, Q2grid=(1e4,)):
"MaxNfAs": 5,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [
-6,
6,
Expand All @@ -76,7 +76,7 @@ def benchmark_nnlo_qed(self, Q0=1.295, Q2grid=(1e4,)):
]
self.run([theory_card], [operator_card], ["CT18qed"])

def benchmark_znnlo(self, Q0=1.3, Q2grid=(1e4,)):
def benchmark_znnlo(self, Q0=1.3, mugrid=(1e4,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -90,7 +90,7 @@ def benchmark_znnlo(self, Q0=1.3, Q2grid=(1e4,)):
"mc": 1.4,
}
)
operator_card = {"Q2grid": list(Q2grid)}
operator_card = {"mugrid": list(mugrid)}
self.skip_pdfs = lambda _theory: [
-6,
6,
Expand Down
11 changes: 5 additions & 6 deletions benchmarks/DSSV_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Note that the PDF set is private, but can be obtained from the
authors upon request.
"""
import numpy as np
from banana import register

from eko import interpolation
Expand All @@ -23,7 +22,7 @@ class BenchmarkDSSV(Runner):
def skip_pdfs(self, _theory):
return [-6, 6, 5, -5, 4, -4, 22, "ph", "T35", "V35", "T24", "V24", "T15", "V15"]

def benchmark(self, Q0=1.65, Q2grid=(100,)):
def benchmark(self, Q0=1.65, mugrid=(100,)):
theory_card = {
"Qref": 1.0,
"mc": 1.4,
Expand All @@ -42,15 +41,15 @@ def benchmark(self, Q0=1.65, Q2grid=(100,)):
}

operator_card = {
"Q2grid": list(Q2grid),
"mugrid": list(mugrid),
"polarized": [True],
"interpolation_xgrid": interpolation.lambertgrid(50, 1e-5),
}
self.run([theory_card], [operator_card], ["DSSV_REP_LHAPDF6"])


if __name__ == "__main__":
low2 = 5**2
high2 = 30**2
low = 5
high = 30
dssv = BenchmarkDSSV()
dssv.benchmark(Q0=np.sqrt(low2), Q2grid=[high2])
dssv.benchmark(Q0=low, mugrid=[high])
4 changes: 2 additions & 2 deletions benchmarks/HERA20_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BenchmarkHERA20(Runner):
# Rotate to evolution basis
rotate_to_evolution_basis = True

def benchmark_nnlo(self, Q0=1.3, Q2grid=(1e4,)):
def benchmark_nnlo(self, Q0=1.3, mugrid=(100,)):
theory_card = base_theory.copy()
theory_card.update(
{
Expand All @@ -47,7 +47,7 @@ def benchmark_nnlo(self, Q0=1.3, Q2grid=(1e4,)):
}
)
operator_card = base_op.copy()
operator_card.update({"Q2grid": list(Q2grid)})
operator_card.update({"mugrid": list(mugrid)})
self.skip_pdfs = lambda _theory: [
-6,
6,
Expand Down
35 changes: 17 additions & 18 deletions benchmarks/NNPDF_bench.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Benchmark NNPDF pdf family
"""
import numpy as np
from banana import register

from eko import interpolation
Expand Down Expand Up @@ -51,22 +50,22 @@ def skip_pdfs(self, _theory):
class BenchmarkNNPDF31(BenchmarkNNPDF):
"""Benchmark NNPDF3.1"""

def benchmark_nlo(self, Q0=1.65, Q2grid=(100,)):
def benchmark_nlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
**base_theory,
"PTO": 1,
"QED": 0,
"Q0": Q0,
}

operator_card = {**base_operator, "Q2grid": list(Q2grid)}
operator_card = {**base_operator, "mugrid": list(mugrid)}
self.run([theory_card], [operator_card], ["NNPDF31_nlo_as_0118"])


class BenchmarkNNPDF31_luxqed(BenchmarkNNPDF):
"""Benchmark NNPDF3.1_luxqed"""

def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
**base_theory,
"PTO": 2,
Expand All @@ -84,7 +83,7 @@ def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"mugrid": list(mugrid),
"ev_op_iterations": 10,
}
self.run([theory_card], [operator_card], ["NNPDF31_nnlo_as_0118_luxqed"])
Expand All @@ -93,18 +92,18 @@ def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
class BenchmarkNNPDF40(BenchmarkNNPDF):
"""Benchmark NNPDF4.0"""

def benchmark_nlo(self, Q0=1.65, Q2grid=(100,)):
def benchmark_nlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
**base_theory,
"PTO": 1,
"QED": 0,
"Q0": Q0,
}

operator_card = {**base_operator, "Q2grid": list(Q2grid)}
operator_card = {**base_operator, "mugrid": list(mugrid)}
self.run([theory_card], [operator_card], ["NNPDF40_nlo_as_01180"])

def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
def benchmark_nnlo(self, Q0=1.65, mugrid=(10,)):
theory_card = {
**base_theory,
"PTO": 2,
Expand All @@ -114,14 +113,14 @@ def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
"Q0": Q0,
}

operator_card = {**base_operator, "Q2grid": list(Q2grid)}
operator_card = {**base_operator, "mugrid": list(mugrid)}
self.run([theory_card], [operator_card], ["NNPDF40_nnlo_as_01180"])


class BenchmarkNNPDFpol11(BenchmarkNNPDF):
"""Benchmark NNPDFpol11"""

def benchmark(self, Q0=1.65, Q2grid=(100,)):
def benchmark(self, Q0=1.65, mugrid=(10,)):
theory_card = {
"Qref": 91.2,
"mc": 1.41421,
Expand All @@ -140,25 +139,25 @@ def benchmark(self, Q0=1.65, Q2grid=(100,)):

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"mugrid": list(mugrid),
"polarized": True,
"interpolation_xgrid": interpolation.lambertgrid(50, 1e-5),
}
self.run([theory_card], [operator_card], ["NNPDFpol11_100"])


if __name__ == "__main__":
low2 = 5**2
high2 = 30**2
low = 5
high = 30
# nn31 = BenchmarkNNPDF31()
# # test forward
# nn31.benchmark_nlo(Q0=np.sqrt(low2), Q2grid=[10])
# nn31.benchmark_nlo(Q0=low, mugrid=[10])
# # test backward
# #nn31.benchmark_nlo(Q0=np.sqrt(high2), Q2grid=[low2])
# #nn31.benchmark_nlo(Q0=high, mugrid=[low])
nn40 = BenchmarkNNPDF40()
nn40.benchmark_nnlo(Q2grid=[100])
# nn40.benchmark_nnlo(Q0=np.sqrt(high2), Q2grid=[low2])
nn40.benchmark_nnlo(mugrid=[10])
# nn40.benchmark_nnlo(Q0=high, mugrid=[low])
# nnpol = BenchmarkNNPDFpol11()
# nnpol.benchmark(Q0=np.sqrt(low2), Q2grid=[high2])
# nnpol.benchmark(Q0=low, mugrid=[high])
# obj = BenchmarkNNPDF31_luxqed()
# obj.benchmark_nnlo(Q0=5.0)
2 changes: 1 addition & 1 deletion benchmarks/apfel_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def benchmark_msbar(self, pto):
"HQ": ["MSBAR"],
}
)
self.run(cartesian_product(th), operators.build({"Q2grid": [[100]]}), ["ToyLH"])
self.run(cartesian_product(th), operators.build({"mugrid": [[10]]}), ["ToyLH"])


class BenchmarkFFNS(ApfelBenchmark):
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def set_(flavors: int) -> TheoryCard:
@pytest.fixture
def operator_card():
card = cards.example.operator()
card.rotations.xgrid = interpolation.XGrid([0.1, 0.3, 0.5, 1.0])
card.xgrid = interpolation.XGrid([0.1, 0.3, 0.5, 1.0])
card.configs.interpolation_polynomial_degree = 2

return card
23 changes: 12 additions & 11 deletions benchmarks/eko/benchmark_evol_to_unity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pathlib
from math import nan

import numpy as np
import pytest
Expand All @@ -10,25 +9,27 @@
from eko.io import types
from eko.io.runcards import OperatorCard, TheoryCard
from eko.runner.legacy import Runner
from eko.quantities.couplings import CouplingsInfo

# from ekore.matching_conditions.operator_matrix_element import OperatorMatrixElement


def update_cards(theory: TheoryCard, operator: OperatorCard):
theory.couplings = types.CouplingsRef(
alphas=types.FloatRef(value=0.35, scale=float(np.sqrt(2))),
alphaem=types.FloatRef(value=0.007496, scale=nan),
theory.couplings = CouplingsInfo(
alphas=0.35,
alphaem=0.007496,
scale=float(np.sqrt(2)),
max_num_flavs=6,
num_flavs_ref=None,
)
theory.num_flavs_init = 4
theory.intrinsic_flavors = [4, 5]
theory.quark_masses.c.value = 1.0
theory.quark_masses.b.value = 4.75
theory.quark_masses.t.value = 173.0
theory.heavy.num_flavs_init = 4
theory.heavy.intrinsic_flavors = [4, 5]
theory.heavy.masses.c.value = 1.0
theory.heavy.masses.b.value = 4.75
theory.heavy.masses.t.value = 173.0
operator.mu0 = float(np.sqrt(2))
operator.mu2grid = [10]
operator.rotations.xgrid = XGrid(np.linspace(1e-1, 1, 30))
operator.mugrid = [(10, 5)]
operator.xgrid = XGrid(np.linspace(1e-1, 1, 30))
operator.configs.interpolation_polynomial_degree = 1
operator.configs.ev_op_max_order = (2, 0)
operator.configs.ev_op_iterations = 1
Expand Down
Loading