From b1c8c78deabda2863581fd79248c3ea5ff96897f Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Wed, 17 Jul 2024 13:06:53 +0200 Subject: [PATCH] remove ekocomaptibility --- src/pineko/ekompatibility.py | 33 --------------------------------- src/pineko/evolve.py | 25 ++++++++++++++++++++----- 2 files changed, 20 insertions(+), 38 deletions(-) delete mode 100644 src/pineko/ekompatibility.py diff --git a/src/pineko/ekompatibility.py b/src/pineko/ekompatibility.py deleted file mode 100644 index b658f904..00000000 --- a/src/pineko/ekompatibility.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Compatibility layer for EKO migration.""" - -from eko import EKO, basis_rotation -from pineappl.grid import PyOperatorSliceInfo, PyPidBasis - - -def pineappl_layout(operator: EKO) -> list: - """Extract information required by :func:`pineappl.grid.Grid.convolve_eko`. - - Parameters - ---------- - operator: eko.EKO - evolution operator in the new layout - - Returns - ------- - dict - a minimal object, with all and only the information consumed by PineAPPL - - """ - eko_iterator = [] - for (q2, _), op in operator.items(): - info = PyOperatorSliceInfo( - fac0=operator.mu20, - x0=operator.bases.inputgrid.raw, - pids0=basis_rotation.evol_basis_pids, - fac1=q2, - x1=operator.bases.targetgrid.raw, - pids1=operator.bases.targetpids, - pid_basis=PyPidBasis.Pdg, - ) - eko_iterator.append((info, op.operator)) - return eko_iterator diff --git a/src/pineko/evolve.py b/src/pineko/evolve.py index eec37c67..b0e7acf5 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -15,12 +15,14 @@ import rich.box import rich.panel import yaml +from eko import basis_rotation from eko.io.types import ScaleVariationsMethod from eko.matchings import Atlas, nf_default from eko.quantities import heavy_quarks from pineappl.fk_table import PyFkAssumptions +from pineappl.grid import PyOperatorSliceInfo, PyPidBasis -from . import check, comparator, ekompatibility, version +from . import check, comparator, version logger = logging.getLogger(__name__) @@ -370,18 +372,31 @@ def xgrid_reshape(operators): ) for mur2 in mur2_grid ] - # We need to use ekompatibility in order to pass a dictionary to pineappl + + def prepare(operator, items): + (q2, _), op = items + info = PyOperatorSliceInfo( + fac0=operator.mu20, + x0=operator.bases.inputgrid.raw, + pids0=basis_rotation.evol_basis_pids, + fac1=q2, + x1=operator.bases.targetgrid.raw, + pids1=operator.bases.targetpids, + pid_basis=PyPidBasis.Pdg, + ) + return (info, op.operator) + if operators_b is not None: fktable = grid.evolve_with_slice_iter2( - iter(ekompatibility.pineappl_layout(operators_a)), - iter(ekompatibility.pineappl_layout(operators_b)), + map(lambda it: prepare(operators_a, it), operators_a.items()), + map(lambda it: prepare(operators_b, it), operators_b.items()), alphas_table=alphas_values, xi=(xir, xif), order_mask=order_mask, ) else: fktable = grid.evolve_with_slice_iter( - iter(ekompatibility.pineappl_layout(operators_a)), + map(lambda it: prepare(operators_a, it), operators_a.items()), ren1=mur2_grid, alphas=alphas_values, xi=(xir, xif),