Skip to content

Commit

Permalink
Merge pull request #220 from NNPDF/rearrange-runcards-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido authored Mar 31, 2023
2 parents 769a019 + e3ec8ed commit b5deebe
Show file tree
Hide file tree
Showing 76 changed files with 1,355 additions and 913 deletions.
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

0 comments on commit b5deebe

Please sign in to comment.