Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/pineko/fonll.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def theorycard_no_fns_pto(self):
continue
if card[key] != theorycards[0][key]:
differ.append(key)
del theorycards[0][key]

if len(differ) > 0:
raise ValueError(
Expand Down
34 changes: 27 additions & 7 deletions src/pineko/theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@
logger = logging.getLogger(__name__)


def _check_for_scale_variations(tcard, grid_path):
"""Check that the grid is compatible with the requested scale_variations (if any).

Parameters
----------
tcard : dict
theory card
grid_path : pathlib.Path
path to grid
"""
grid = pineappl.grid.Grid.read(grid_path)
xir = tcard["XIR"]
xif = tcard["XIF"]
max_al = 0 # We don't do SV for alpha
max_as = 1 + int(tcard["PTO"])
# In FONLL-B we might need to change max_as
if check.is_fonll_mixed(tcard["FNS"], grid.convolutions):
max_as += 1
if not np.isclose(xir, 1.0):
check_scvar_evolve(grid, max_as, max_al, check.Scale.REN)
if not np.isclose(xif, 1.0) and evolve.sv_scheme(tcard) is None:
check_scvar_evolve(grid, max_as, max_al, check.Scale.FACT)


def get_eko_names(grid_path, name, filter=True):
"""Get the names of the ekos depending on the types of convolutions.

Expand Down Expand Up @@ -276,6 +300,9 @@ def opcard(self, name, grid, tcard):
tcard : dict
theory card
"""
# Before creating the operator card, check whether this grid is legal or not
_check_for_scale_variations(tcard, grid)

opcard_path = self.operator_cards_path / f"{name}.yaml"
if opcard_path.exists():
if not self.overwrite:
Expand Down Expand Up @@ -436,7 +463,6 @@ def fk(self, name, grid_path, tcard, pdfs):

# check if grid contains SV if theory is requesting them (in particular
# if theory is requesting scheme A or C)
sv_method = evolve.sv_scheme(tcard)
xir = tcard["XIR"]
xif = tcard["XIF"]
xia = 1.0 # TODO: modify into `tcard["XIA"]`
Expand Down Expand Up @@ -473,12 +499,6 @@ def fk(self, name, grid_path, tcard, pdfs):
rich.print("[green] Skipping empty grid.")
return

# check for sv
if not np.isclose(xir, 1.0):
check_scvar_evolve(grid, max_as, max_al, check.Scale.REN)
if sv_method is None:
if not np.isclose(xif, 1.0):
check_scvar_evolve(grid, max_as, max_al, check.Scale.FACT)
# TODO: Add fragmentation scale variations
# loading ekos to produce a tmp copy
n_ekos = len(eko_filename)
Expand Down