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

Pass nl as an argument in qed beta functions #336

Merged
merged 25 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
eb0004c
Pass nl as an argument in qed beta functions
niclaurenti Jan 9, 2024
ecec6f1
Restore check
niclaurenti Jan 9, 2024
16d69f2
Implement varying nl in the coupling running
niclaurenti Jan 9, 2024
3bc4fb7
Fix tests
niclaurenti Jan 9, 2024
0f46f58
Fix test sv
niclaurenti Jan 9, 2024
3628b3f
Fix typo in evolution_operator/init
niclaurenti Jan 9, 2024
bc956e2
Increase rtol to make bench pass
niclaurenti Jan 9, 2024
88c4dcc
Update src/eko/constants.py
niclaurenti Jan 10, 2024
6bcacc4
Update docstring
niclaurenti Jan 10, 2024
ce868a1
Move lepton_number in matchings
niclaurenti Jan 10, 2024
ace95a7
Merge branch 'activate_nl' of github.com:NNPDF/eko into activate_nl
niclaurenti Jan 10, 2024
c493ecc
Add check
niclaurenti Jan 10, 2024
1dc5238
Add check
niclaurenti Jan 10, 2024
1999d92
Call isort on src/eko/evolution_operator/__init__.py
niclaurenti Jan 10, 2024
c4951c7
Add numba decorator
niclaurenti Jan 10, 2024
e561cfd
Update src/eko/matchings.py
niclaurenti Jan 10, 2024
75bfca0
Add docstrings
niclaurenti Jan 10, 2024
b623f97
Force argument to self.nf
niclaurenti Jan 10, 2024
0e85444
Remove debugging print
niclaurenti Jan 11, 2024
efd4562
Add bench for alphaem
niclaurenti Jan 11, 2024
e52d0cd
Add cases in test_beta
niclaurenti Jan 11, 2024
8910ab5
add tests
niclaurenti Jan 11, 2024
981af57
Update benchmarks/eko/benchmark_alphaem.py
niclaurenti Jan 11, 2024
9e23e47
Fix docs of bench_alphaem
niclaurenti Jan 12, 2024
c807ef6
Merge branch 'master' into activate_nl
niclaurenti Jan 12, 2024
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
144 changes: 144 additions & 0 deletions benchmarks/eko/benchmark_alphaem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
"""This module benchmarks alpha_em against alphaQED23 and validphys.

alphaQED23 can be obtained from http://www-com.physik.hu-berlin.de/~fjeger/software.html .
"""

import numpy as np
import pytest

from eko.couplings import Couplings
from eko.quantities.couplings import CouplingEvolutionMethod, CouplingsInfo
from eko.quantities.heavy_quarks import QuarkMassScheme


@pytest.mark.isolated
class BenchmarkCouplings:
def test_alphaQED_high(self):
"""testing aginst alphaQED23 for high Q values"""
alphaQED23 = np.array(
[
0.0075683,
0.0075867,
0.0076054,
0.0076245,
0.0076437,
0.0076631,
0.0076827,
0.0077024,
0.0077222,
0.0077421,
0.0077621,
]
)
qvec = np.geomspace(10, 100, 11)
couplings = CouplingsInfo.from_dict(
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
em_running=True,
)
)
eko_alpha = Couplings(
couplings,
(3, 2),
method=CouplingEvolutionMethod.EXACT,
masses=[m**2 for m in [1.51, 4.92, 172.5]],
hqm_scheme=QuarkMassScheme.POLE,
thresholds_ratios=[1.0, 1.0, np.inf],
)
alpha_eko = np.array([eko_alpha.a_em(q**2) * 4 * np.pi for q in qvec])

np.testing.assert_allclose(alphaQED23, alpha_eko, rtol=1.8e-4)

def test_alphaQED_low(self):
"""testing aginst alphaQED23 for low Q values: they are close but not identical"""
alphaQED23 = np.array(
[
0.0074192,
0.007431,
0.0074434,
0.0074565,
0.0074702,
0.0074847,
0.0075,
0.0075161,
0.0075329,
0.0075503,
0.0075683,
]
)
qvec = np.geomspace(1, 10, 11)
couplings = CouplingsInfo.from_dict(
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
em_running=True,
)
)
eko_alpha = Couplings(
couplings,
(3, 2),
method=CouplingEvolutionMethod.EXACT,
masses=[m**2 for m in [1.51, 4.92, 172.5]],
hqm_scheme=QuarkMassScheme.POLE,
thresholds_ratios=[1.0, 1.0, np.inf],
)
alpha_eko = np.array([eko_alpha.a_em(q**2) * 4 * np.pi for q in qvec])

np.testing.assert_allclose(alphaQED23, alpha_eko, rtol=3.2e-3)

def test_validphys(self):
"""testing aginst validphys"""
alpha_vp = np.array(
[
0.007408255774054356,
0.007425240094018394,
0.007449051094996458,
0.007476301027742958,
0.007503751810862984,
0.007532299008699658,
0.007561621958607614,
0.007591174885612722,
0.007620960508577136,
0.00765098158940323,
0.007681240933888789,
0.007711741392602655,
0.007742485861781425,
0.007773477284247778,
0.007804718650351058,
0.007836212998930739,
0.00786796341830342,
0.007899973047274033,
0.007932245076171957,
0.00796478274791273,
]
)
qvec = np.geomspace(1, 1000, 20)
couplings = CouplingsInfo.from_dict(
dict(
alphas=0.118,
alphaem=7.7553e-03,
scale=91.2,
num_flavs_ref=5,
max_num_flavs=5,
em_running=True,
)
)
eko_alpha = Couplings(
couplings,
(3, 2),
method=CouplingEvolutionMethod.EXACT,
masses=[m**2 for m in [1.51, 4.92, 172.5]],
hqm_scheme=QuarkMassScheme.POLE,
thresholds_ratios=[1.0, 1.0, np.inf],
)
eko_alpha.decoupled_running = True
alpha_eko = np.array([eko_alpha.a_em(q**2) * 4 * np.pi for q in qvec])

np.testing.assert_allclose(alpha_vp, alpha_eko, rtol=5e-6)
24 changes: 15 additions & 9 deletions src/eko/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def beta_qcd_as2(nf):


@nb.njit(cache=True)
def beta_qed_aem2(nf):
def beta_qed_aem2(nf, nl):
niclaurenti marked this conversation as resolved.
Show resolved Hide resolved
r"""Compute the first coefficient of the QED beta function.

Implements Eq. (7) of :cite:`Surguladze:1996hx`.
Expand All @@ -41,6 +41,8 @@ def beta_qed_aem2(nf):
----------
nf : int
number of active flavors
nl : int
number of leptons partecipating to alphaem running

Returns
-------
Expand All @@ -50,7 +52,6 @@ def beta_qed_aem2(nf):
"""
nu = constants.uplike_flavors(nf)
nd = nf - nu
nl = 3 # TODO : pass nl as an argument??
beta_qed_aem2 = (
-4.0 / 3 * (nl + constants.NC * (nu * constants.eu2 + nd * constants.ed2))
)
Expand Down Expand Up @@ -83,7 +84,7 @@ def beta_qcd_as3(nf):


@nb.njit(cache=True)
def beta_qed_aem3(nf):
def beta_qed_aem3(nf, nl):
r"""Compute the second coefficient of the QED beta function.

Implements Eq. (7) of :cite:`Surguladze:1996hx`.
Expand All @@ -92,6 +93,8 @@ def beta_qed_aem3(nf):
----------
nf : int
number of active flavors
nl : int
number of leptons partecipating to alphaem running

Returns
-------
Expand All @@ -101,7 +104,6 @@ def beta_qed_aem3(nf):
"""
nu = constants.uplike_flavors(nf)
nd = nf - nu
nl = 3 # TODO : pass nl as an argument??
beta_qed_aem3 = -4.0 * (
nl + constants.NC * (nu * constants.eu2**2 + nd * constants.ed2**2)
)
Expand Down Expand Up @@ -246,7 +248,7 @@ def beta_qcd(k, nf):


@nb.njit(cache=True)
def beta_qed(k, nf):
def beta_qed(k, nf, nl):
r"""Compute value of a beta_qed coefficients.

Parameters
Expand All @@ -255,6 +257,8 @@ def beta_qed(k, nf):
perturbative order
nf : int
number of active flavors
nl : int
number of leptons partecipating to alphaem running

Returns
-------
Expand All @@ -264,9 +268,9 @@ def beta_qed(k, nf):
"""
beta_ = 0
if k == (0, 2):
beta_ = beta_qed_aem2(nf)
beta_ = beta_qed_aem2(nf, nl)
elif k == (0, 3):
beta_ = beta_qed_aem3(nf)
beta_ = beta_qed_aem3(nf, nl)
elif k == (1, 2):
beta_ = beta_qed_aem2as1(nf)
else:
Expand Down Expand Up @@ -295,7 +299,7 @@ def b_qcd(k, nf):


@nb.njit(cache=True)
def b_qed(k, nf):
def b_qed(k, nf, nl):
r"""Compute b_qed coefficient.

Parameters
Expand All @@ -304,11 +308,13 @@ def b_qed(k, nf):
perturbative order
nf : int
number of active flavors
nl : int
number of leptons partecipating to alphaem running

Returns
-------
b_qed : float
b_qed_k(nf)

"""
return beta_qed(k, nf) / beta_qed((0, 2), nf)
return beta_qed(k, nf, nl) / beta_qed((0, 2), nf, nl)
5 changes: 4 additions & 1 deletion src/eko/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
Defaults to :math:`\frac{N_C^2-1}{2N_C} = 4/3`.
"""

MTAU = 1.777
"""Mass of the tau."""

eu2 = 4.0 / 9
"""Up quarks charge squared."""

Expand Down Expand Up @@ -84,7 +87,7 @@ def uplike_flavors(nf):
nu : int

"""
if nf not in range(2, 6 + 1):
if nf > 6:
giacomomagni marked this conversation as resolved.
Show resolved Hide resolved
raise NotImplementedError("Selected nf is not implemented")
nu = nf // 2
return nu
Expand Down
Loading
Loading