Skip to content

Commit

Permalink
Run poetry lock, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jun 19, 2024
1 parent 7abe91e commit af435af
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 11 deletions.
50 changes: 46 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions tests/test_toy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
from scipy.integrate import quad

from banana import toy

pdf = toy.mkPDF("", 0)
ff = toy.mkPDF("ToyFF_unpolarized", 0)


def test_alpha():
Expand Down Expand Up @@ -31,11 +31,12 @@ def test_xf():

def test_toyFF():
"""Test the ToyFF_unpolarized with Eqn. 3.4 from 1501.00494."""
ff = toy.mkPDF("ToyFF_unpolarized", 0)

val_u = round(quad(lambda x: ff.xfxQ2(2, x, 1), 0, 1)[0], 3)
val_d = round(quad(lambda x: ff.xfxQ2(1, x, 1), 0, 1)[0], 3)
val_g = round(quad(lambda x: ff.xfxQ2(21, x, 1), 0, 1)[0], 3)
val_u = quad(lambda x: ff.xfxQ2(2, x, 1), 0, 1)[0]
val_d = quad(lambda x: ff.xfxQ2(1, x, 1), 0, 1)[0]
val_g = quad(lambda x: ff.xfxQ2(21, x, 1), 0, 1)[0]

assert val_u == 0.401
assert val_d == 0.094
assert val_g == 0.238
np.testing.assert_allclose(val_u, 0.401, atol=1e-4)
np.testing.assert_allclose(val_d, 0.094, atol=1e-4)
np.testing.assert_allclose(val_g, 0.238, atol=1e-4)

0 comments on commit af435af

Please sign in to comment.