Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Jan 9, 2024
1 parent 16d69f2 commit 3bc4fb7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 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, nl=3):
def beta_qed_aem2(nf, nl):
r"""Compute the first coefficient of the QED beta function.
Implements Eq. (7) of :cite:`Surguladze:1996hx`.
Expand Down Expand Up @@ -82,7 +82,7 @@ def beta_qcd_as3(nf):


@nb.njit(cache=True)
def beta_qed_aem3(nf, nl=3):
def beta_qed_aem3(nf, nl):
r"""Compute the second coefficient of the QED beta function.
Implements Eq. (7) of :cite:`Surguladze:1996hx`.
Expand Down Expand Up @@ -244,7 +244,7 @@ def beta_qcd(k, nf):


@nb.njit(cache=True)
def beta_qed(k, nf, nl=3):
def beta_qed(k, nf, nl):
r"""Compute value of a beta_qed coefficients.
Parameters
Expand Down Expand Up @@ -293,7 +293,7 @@ def b_qcd(k, nf):


@nb.njit(cache=True)
def b_qed(k, nf, nl=3):
def b_qed(k, nf, nl):
r"""Compute b_qed coefficient.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion src/eko/couplings.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def couplings_expanded_alphaem_running(
)
res_aem += (
-couplings_ref[1] ** 2
* b_qed((1, 2), nf)
* b_qed((1, 2), nf, nl)
* np.log(1 + beta0_qed * couplings_ref[0] * lmu)
)
return np.array([res_as, res_aem])
Expand Down
19 changes: 12 additions & 7 deletions tests/eko/test_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_beta_aem2():
"""Test first beta function coefficient"""
# from hep-ph/9803211
np.testing.assert_approx_equal(
beta.beta_qed_aem2(5), -4.0 / 3 * (3 + 3 * (2 * 4 / 9 + 3 * 1 / 9))
beta.beta_qed_aem2(5, 3), -4.0 / 3 * (3 + 3 * (2 * 4 / 9 + 3 * 1 / 9))
)


Expand All @@ -43,7 +43,7 @@ def test_beta_aem3():
"""Test second beta function coefficient"""
# from hep-ph/9803211
np.testing.assert_approx_equal(
beta.beta_qed_aem3(5), -4.0 * (3 + 3 * (2 * 16 / 81 + 3 * 1 / 81))
beta.beta_qed_aem3(5, 3), -4.0 * (3 + 3 * (2 * 16 / 81 + 3 * 1 / 81))
)


Expand All @@ -66,21 +66,26 @@ def test_beta_as5():
def test_beta():
"""beta-wrapper"""
nf = 3
nl = 3
np.testing.assert_allclose(beta.beta_qcd((2, 0), nf), beta.beta_qcd_as2(nf))
np.testing.assert_allclose(beta.beta_qcd((3, 0), nf), beta.beta_qcd_as3(nf))
np.testing.assert_allclose(beta.beta_qcd((4, 0), nf), beta.beta_qcd_as4(nf))
np.testing.assert_allclose(beta.beta_qcd((5, 0), nf), beta.beta_qcd_as5(nf))
np.testing.assert_allclose(beta.beta_qcd((2, 1), nf), beta.beta_qcd_as2aem1(nf))
np.testing.assert_allclose(beta.beta_qed((0, 2), nf), beta.beta_qed_aem2(nf))
np.testing.assert_allclose(beta.beta_qed((0, 3), nf), beta.beta_qed_aem3(nf))
np.testing.assert_allclose(beta.beta_qed((1, 2), nf), beta.beta_qed_aem2as1(nf))
np.testing.assert_allclose(
beta.beta_qed((0, 2), nf, nl), beta.beta_qed_aem2(nf, nl)
)
np.testing.assert_allclose(
beta.beta_qed((0, 3), nf, nl), beta.beta_qed_aem3(nf, nl)
)
np.testing.assert_allclose(beta.beta_qed((1, 2), nf, nl), beta.beta_qed_aem2as1(nf))
with pytest.raises(ValueError):
beta.beta_qcd((6, 0), 3)
with pytest.raises(ValueError):
beta.beta_qed((0, 4), 3)
beta.beta_qed((0, 4), 3, 3)


def test_b():
"""b-wrapper"""
np.testing.assert_allclose(beta.b_qcd((2, 0), 3), 1.0)
np.testing.assert_allclose(beta.b_qed((0, 2), 3), 1.0)
np.testing.assert_allclose(beta.b_qed((0, 2), 3, 3), 1.0)

0 comments on commit 3bc4fb7

Please sign in to comment.