Skip to content

Commit

Permalink
add a check on convolution types
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Jul 24, 2024
1 parent 04a56f7 commit da1aa53
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/pineko/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def sv_scheme(tcard):
return modsv


def get_ekos_convolution_type(kv):
def get_grid_convolution_type(kv):
"""Retrieve the ekos convolution type.
Parameters
Expand Down Expand Up @@ -80,6 +80,17 @@ def get_ekos_convolution_type(kv):
return conv_type_1, conv_type_2


def check_convolution_types(grid, operators1, operators2):
"""Check that grid and eko convolution types are sorted correctly."""
grid_conv_1, grid_conv_2 = get_grid_convolution_type(grid.key_values())
grid_conv_1 = grid_conv_1 == "PolPDF"
grid_conv_2 = grid_conv_2 == "PolPDF"
eko_conv_1 = operators1.operator_card.configs.polarized
eko_conv_2 = operators2.operator_card.configs.polarized
if grid_conv_1 != eko_conv_1 or grid_conv_2 != eko_conv_2:
raise ValueError("Grid and Eko convolution types are not matching.")


def write_operator_card_from_file(
pineappl_path: os.PathLike,
default_card_path: os.PathLike,
Expand Down Expand Up @@ -193,7 +204,7 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard):

# switch on polarization ?
kv = pineappl_grid.key_values()
conv_type_1, conv_type_2 = get_ekos_convolution_type(kv)
conv_type_1, conv_type_2 = get_grid_convolution_type(kv)

# fragmentation function grid?
if "timelike" in kv:
Expand Down Expand Up @@ -391,6 +402,8 @@ def prepare(operator, items):
return (info, op.operator)

if operators2 is not None:
# check convolutions order
check_convolution_types(grid, operators1, operators2)
fktable = grid.evolve_with_slice_iter2(
map(lambda it: prepare(operators1, it), operators1.items()),
map(lambda it: prepare(operators2, it), operators2.items()),
Expand Down
2 changes: 1 addition & 1 deletion src/pineko/theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_eko_names(grid_path, name):
grid name, i.e. it's true stem
"""
grid_kv = pineappl.grid.Grid.read(grid_path).key_values()
conv_type_1, conv_type_2 = evolve.get_ekos_convolution_type(grid_kv)
conv_type_1, conv_type_2 = evolve.get_grid_convolution_type(grid_kv)
names = []
if conv_type_2 is None or conv_type_1 == conv_type_2:
names = [name]
Expand Down

0 comments on commit da1aa53

Please sign in to comment.