Skip to content

Commit

Permalink
Start fixing benchmarks/bench_theory.py (not fully working)
Browse files Browse the repository at this point in the history
  • Loading branch information
Radonirinaunimi committed Nov 22, 2024
1 parent c79d144 commit 709632f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
26 changes: 9 additions & 17 deletions src/pineko/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class AvailableAtMax(Enum):
SCVAR = auto()


def islepton(el):
"""Return True if el is a lepton PID, otherwise return False."""
if 10 < abs(el) < 17:
return True
return False


def in1d(a, b, rtol=1e-05, atol=1e-08):
"""Improved version of np.in1d.
Expand Down Expand Up @@ -118,26 +111,25 @@ def check_grid_and_eko_compatible(pineappl_grid, operators, xif, max_as, max_al)
raise ValueError("x grid in pineappl grid and eko operator are NOT compatible!")


def is_dis(lumi):
def is_dis(channels):
"""Check if the fktable we are computing is a DIS fktable.
Parameters
----------
lumi : list(list(tuple))
luminosity info
channels : list(list(tuple(list, float)))
object containing the information on the channels. From PineAPPL v1,
the tuple contains two elements. The first is a list containing the
PIDs of the partons. The length of the list coincides with the number
of partons involved, ie for DIS there is only one element, and for a
hadron production in pp collision there are three elements. The 2nd
element is the weight/multiplicative factor as usual.
Returns
-------
bool
true if the fktable is a DIS fktable
"""
for entry in lumi:
for el in entry:
if (not islepton(el[0])) and (not islepton(el[1])):
# If neither of the incoming particles is a lepton we are sure
# it is not DIS
return False
return True
return True if len(channels[0][0][0]) == 0 else False


def is_fonll_mixed(fns, lumi):
Expand Down
2 changes: 1 addition & 1 deletion src/pineko/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def write_operator_card(
operators_card["mugrid"] = [
(float(np.sqrt(q2)), nf_default(q2, atlas)) for q2 in q2_grid
]
if "integrability_version" in pineappl_grid.key_values():
if "integrability_version" in pineappl_grid.key_values:
x_grid = evol_info.x1
x_grid = np.append(x_grid, 1.0)
operators_card["configs"]["interpolation_polynomial_degree"] = 1
Expand Down
7 changes: 0 additions & 7 deletions tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
import pineko.check


def test_islepton():
el = 21
assert pineko.check.islepton(el) == False
el = -13
assert pineko.check.islepton(el) == True


def test_in1d():
to_check = np.array([0.3])
against_this = np.array(
Expand Down

0 comments on commit 709632f

Please sign in to comment.