From d62dac4e332529f016f7e139cad28cf17bfd77a8 Mon Sep 17 00:00:00 2001 From: Giacomo Magni Date: Tue, 16 Jul 2024 13:35:25 +0200 Subject: [PATCH] update ekocompatibility layout --- src/pineko/ekompatibility.py | 35 ++++++++++++++++------------------- src/pineko/evolve.py | 16 +++++++++------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/pineko/ekompatibility.py b/src/pineko/ekompatibility.py index 028c2498..b658f904 100644 --- a/src/pineko/ekompatibility.py +++ b/src/pineko/ekompatibility.py @@ -1,12 +1,11 @@ """Compatibility layer for EKO migration.""" -from typing import Any, Dict - from eko import EKO, basis_rotation +from pineappl.grid import PyOperatorSliceInfo, PyPidBasis -def pineappl_layout(operator: EKO) -> Dict[str, Any]: - """Extract information required by :func:`pineappl.grid.Grid.convolute_eko`. +def pineappl_layout(operator: EKO) -> list: + """Extract information required by :func:`pineappl.grid.Grid.convolve_eko`. Parameters ---------- @@ -19,18 +18,16 @@ def pineappl_layout(operator: EKO) -> Dict[str, Any]: a minimal object, with all and only the information consumed by PineAPPL """ - oldgrid = {} - oldgrid["Q2grid"] = {} - for q2, op in operator.items(): - oldop = dict(operators=op.operator) - oldgrid["Q2grid"][q2[0]] = oldop - - oldgrid["q2_ref"] = operator.mu20 - oldgrid["targetpids"] = operator.bases.targetpids - oldgrid["targetgrid"] = operator.bases.targetgrid.raw - # The EKO contains the rotation matrix but we pass the list of - # evol basis pids to pineappl. - oldgrid["inputpids"] = basis_rotation.evol_basis_pids - oldgrid["inputgrid"] = operator.bases.inputgrid.raw - - return oldgrid + 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 9cd0b22b..eec37c67 100644 --- a/src/pineko/evolve.py +++ b/src/pineko/evolve.py @@ -18,6 +18,7 @@ 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 . import check, comparator, ekompatibility, version @@ -285,11 +286,11 @@ def evolve_grid( Parameters ---------- grid : pineappl.grid.Grid - unconvoluted grid + unconvolved grid operators_a : eko.EKO evolution operator fktable_path : str - target path for convoluted grid + target path for convolved grid max_as : int maximum power of strong coupling max_al : int @@ -372,21 +373,22 @@ def xgrid_reshape(operators): # We need to use ekompatibility in order to pass a dictionary to pineappl if operators_b is not None: fktable = grid.evolve_with_slice_iter2( - ekompatibility.pineappl_layout(operators_a), - ekompatibility.pineappl_layout(operators_b), + iter(ekompatibility.pineappl_layout(operators_a)), + iter(ekompatibility.pineappl_layout(operators_b)), alphas_table=alphas_values, xi=(xir, xif), order_mask=order_mask, ) else: fktable = grid.evolve_with_slice_iter( - ekompatibility.pineappl_layout(operators_a), - alphas_table=alphas_values, + iter(ekompatibility.pineappl_layout(operators_a)), + ren1=mur2_grid, + alphas=alphas_values, xi=(xir, xif), order_mask=order_mask, ) rich.print(f"Optimizing for {assumptions}") - fktable.optimize(assumptions) + fktable.optimize(PyFkAssumptions(assumptions)) fktable.set_key_value("eko_version", operators_a.metadata.version) fktable.set_key_value("eko_theory_card", json.dumps(operators_a.theory_card.raw))