Skip to content

Commit

Permalink
backup commit
Browse files Browse the repository at this point in the history
  • Loading branch information
t7phy committed Mar 15, 2023
1 parent feb2dce commit 7307c6e
Show file tree
Hide file tree
Showing 9 changed files with 1,242 additions and 187 deletions.
146 changes: 146 additions & 0 deletions benchmarks/FF_LHAPDF_bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
r"""Benchmark FFs from LHAPDF"""

from banana import register

from eko import interpolation
from ekomark.benchmark.runner import Runner

register(__file__)

base_operator = {"ev_op_iterations": 1, "backward_inversion": "exact"}

base_theory = {
"Qref": 91.2,
"mc": 1.51,
"mb": 4.92,
"mt": 172.5,
"kcThr": 1.0,
"kbThr": 1.0,
"ktThr": 1.0,
"alphas": 0.118000,
"alphaqed": 0.007496,
"FNS": "ZM-VFNS",
"ModEv": "TRN",
}

FF_sets_lo = [
"NNFF10_PIm_lo",
"NNFF10_PIp_lo",
"NNFF10_PIsum_lo",
"NNFF10_KAm_lo",
"NNFF10_KAp_lo",
"NNFF10_KAsum_lo",
"NNFF10_PRm_lo",
"NNFF10_PRp_lo",
"NNFF10_PRsum_lo",
]
FF_sets_nlo = [
"NNFF10_PIm_nlo",
"NNFF10_PIp_nlo",
"NNFF10_PIsum_nlo",
"NNFF10_KAm_nlo",
"NNFF10_KAp_nlo",
"NNFF10_KAsum_nlo",
"NNFF10_PRm_nlo",
"NNFF10_PRp_nlo",
"NNFF10_PRsum_nlo",
"MAPFF10NLOPIm",
"MAPFF10NLOPIp",
"MAPFF10NLOPIsum",
"MAPFF10NLOKAm",
"MAPFF10NLOKAp",
"MAPFF10NLOKAsum",
]
FF_sets_nnlo = [
"NNFF10_PIm_nnlo",
"NNFF10_PIp_nnlo",
"NNFF10_PIsum_nnlo",
"NNFF10_KAm_nnlo",
"NNFF10_KAp_nnlo",
"NNFF10_KAsum_nnlo",
"NNFF10_PRm_nnlo",
"NNFF10_PRp_nnlo",
"NNFF10_PRsum_nnlo",
"MAPFF10NNLOPIm",
"MAPFF10NNLOPIp",
"MAPFF10NNLOPIsum",
"MAPFF10NNLOKAm",
"MAPFF10NNLOKAp",
"MAPFF10NNLOKAsum",
]


class BenchmarkFF(Runner):
external = "LHAPDF"
rotate_to_evolution_basis = True

def skip_pdfs(self, _theory):
return [
-6,
6,
22,
"ph",
"T35",
"V35",
]

def benchmark_lo(self, Q0=10, Q2grid=(10000, 1000000)):
theory_card = {
**base_theory,
"PTO": 0,
"QED": 0,
"Q0": Q0,
"MaxNfPdf": 5,
"MaxNfAs": 5,
}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(100, 0.01),
}

self.run([theory_card], [operator_card], [FF_sets_lo[7]])

def benchmark_nlo(self, Q0=1.65, Q2grid=(10000,)):
theory_card = {
**base_theory,
"PTO": 1,
"QED": 0,
"Q0": Q0,
"MaxNfPdf": 5,
"MaxNfAs": 5,
}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(5, 0.01),
}

self.run([theory_card], [operator_card], [FF_sets_nlo[11]])

def benchmark_nnlo(self, Q0=10, Q2grid=(10000,)):
theory_card = {
**base_theory,
"PTO": 2,
"QED": 0,
"Q0": Q0,
"MaxNfPdf": 5,
"MaxNfAs": 5,
}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(100, 0.01),
}

self.run([theory_card], [operator_card], [FF_sets_nnlo[10]])


if __name__ == "__main__":
BenchmarkFF().benchmark_nlo()
61 changes: 59 additions & 2 deletions benchmarks/NNPDF_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
from banana import register

from eko import interpolation
from ekomark.benchmark.runner import Runner

register(__file__)
Expand All @@ -30,6 +31,21 @@ def skip_pdfs(self, _theory):
]


class BenchmarkNNFF(Runner):
external = "LHAPDF"
rotate_to_evolution_basis = True

def skip_pdfs(self, _theory):
return [
-6,
6,
22,
"ph",
"T35",
"V35",
]


base_operator = {"ev_op_iterations": 1, "backward_inversion": "exact"}

base_theory = {
Expand Down Expand Up @@ -90,6 +106,44 @@ def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
self.run([theory_card], [operator_card], ["NNPDF40_nnlo_as_01180"])


class BenchmarkNNFF10(BenchmarkNNFF):
def benchmark_lo(self, Q0=1.65, Q2grid=(100,)):
theory_card = {**base_theory, "PTO": 0, "QED": 0, "Q0": Q0, "MaxNfPdf": 5}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(50, 0.01),
}

self.run([theory_card], [operator_card], ["NNFF10_PIm_lo"])

def benchmark_nlo(self, Q0=10, Q2grid=(10000,)):
theory_card = {**base_theory, "PTO": 1, "QED": 0, "Q0": Q0, "MaxNfPdf": 5}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(50, 0.01),
}

self.run([theory_card], [operator_card], ["MAPFF10NLOPIp"])

def benchmark_nnlo(self, Q0=100, Q2grid=(1000000,)):
theory_card = {**base_theory, "PTO": 2, "QED": 0, "Q0": Q0, "MaxNfPdf": 5}

operator_card = {
**base_operator,
"Q2grid": list(Q2grid),
"time_like": [True],
"interpolation_xgrid": interpolation.lambertgrid(100, 0.01),
}

self.run([theory_card], [operator_card], ["MAPFF10NNLOPIp"])


if __name__ == "__main__":
low2 = 4**2
high2 = 30**2
Expand All @@ -98,6 +152,9 @@ def benchmark_nnlo(self, Q0=1.65, Q2grid=(100,)):
# nn31.benchmark_nlo(Q0=np.sqrt(low2), Q2grid=[10])
# # test backward
# #nn31.benchmark_nlo(Q0=np.sqrt(high2), Q2grid=[low2])
nn40 = BenchmarkNNPDF40()
# nn40 = BenchmarkNNPDF40()
# nn40.benchmark_nnlo(Q2grid=[100])
nn40.benchmark_nnlo(Q0=np.sqrt(high2), Q2grid=[low2])
# nn40.benchmark_nnlo(Q0=np.sqrt(high2), Q2grid=[low2])
nnff10 = BenchmarkNNFF10()
# nnff10.benchmark_lo()
nnff10.benchmark_nnlo()
2 changes: 1 addition & 1 deletion benchmarks/apfel_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ def benchmark_sv(self, pto, svmode):
# obj.benchmark_sv(2, "exponentiated")
# obj.benchmark_kthr(2)
# obj.benchmark_msbar(2)
obj.benchmark_plain_tl(0)
obj.benchmark_plain_tl(1)
5 changes: 2 additions & 3 deletions src/ekomark/benchmark/external/lhapdf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ def compute_LHAPDF_data(operators, pdf, skip_pdfs, rotate_to_evolution_basis=Fal
ref : dict
output containing: target_xgrid, values
"""
# import pdb; pdb.set_trace()

target_xgrid = operators["xgrid"]
target_xgrid = operators["interpolation_xgrid"]

out_tabs = {}
for q2 in operators["Q2grid"]:

tab = {}
for pid in br.flavor_basis_pids:

if pid in skip_pdfs:
continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def gamma_ns(order, mode, n, nf):
gamma_ns_1 = as2.gamma_nsp(n, nf, None, False)
# To fill the full valence vector in NNLO we need to add gamma_ns^1 explicitly here
elif mode in [10201, 10200]:
gamma_ns_1 = as2.gamma_nsm(n, nf, None, False)
gamma_ns_1 = as2.gamma_nsm(n, nf)
else:
raise NotImplementedError("Non-singlet sector is not implemented")
gamma_ns[1] = gamma_ns_1
Expand Down Expand Up @@ -86,7 +86,7 @@ def gamma_singlet(order, n, nf):
gamma_s = np.zeros((order[0], 2, 2), np.complex_)
gamma_s[0] = as1.gamma_singlet(n, nf, None, True)
if order[0] >= 2:
gamma_s[1] = as2.gamma_singlet(n, nf, None, True)
gamma_s[1] = as2.gamma_singlet(n, nf, None)
if order[0] >= 3:
gamma_s[2] = as3.gamma_singlet(n, nf, None, True)
return gamma_s
Loading

0 comments on commit 7307c6e

Please sign in to comment.