Skip to content

Commit

Permalink
test: Compelte fk table test adaption from the grid one
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Apr 26, 2024
1 parent 2ec6091 commit 339d908
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pineappl_py/tests/test_fk_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

class TestFkTable:
def fake_grid(self, bins=None):
lumis = [pineappl.lumi.LumiEntry([(1, 21, 0.1)])]
lumis = [pineappl.lumi.LumiEntry([(1, 21, 1.0)])]
orders = [pineappl.grid.Order(0, 0, 0, 0)]
bin_limits = np.array([1e-7, 1e-3, 1] if bins is None else bins, dtype=float)
subgrid_params = pineappl.subgrid.SubgridParams()
g = pineappl.grid.Grid.create(lumis, orders, bin_limits, subgrid_params)
g.set_key_value("lumi_id_types", "pdg_mc_ids")
return g

def test_convolute_with_one(self):
Expand All @@ -27,14 +28,10 @@ def test_convolute_with_one(self):
g.set_subgrid(0, 0, 0, subgrid)
fk = pineappl.fk_table.FkTable.from_grid(g)
np.testing.assert_allclose(
fk.convolute_with_one(2212, lambda pid, x, q2: 0.0, lambda q2: 0.0),
fk.convolute_with_one(2212, lambda pid, x, q2: 0.0),
[0.0] * 2,
)
np.testing.assert_allclose(
fk.convolute_with_one(2212, lambda pid, x, q2: 1, lambda q2: 1.0),
[5e6 / 9999, 0.0],
)
np.testing.assert_allclose(
fk.convolute_with_one(2212, lambda pid, x, q2: 1, lambda q2: 2.0),
[2**3 * 5e6 / 9999, 0.0],
fk.convolute_with_one(2212, lambda pid, x, q2: 1),
[5e7 / 9999, 0.0],
)

0 comments on commit 339d908

Please sign in to comment.