From 3f94e4cba022eb12ad0131cd09535e59bebe6647 Mon Sep 17 00:00:00 2001 From: giacomomagni Date: Sat, 16 Mar 2024 09:39:59 +0100 Subject: [PATCH] pre-commit --- docs/source/theory/kfactors.rst | 6 +++--- src/pineko/kfactor.py | 2 +- src/pineko/scale_variations.py | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/source/theory/kfactors.rst b/docs/source/theory/kfactors.rst index 3fbe6d71..fc32398b 100644 --- a/docs/source/theory/kfactors.rst +++ b/docs/source/theory/kfactors.rst @@ -9,11 +9,11 @@ as a proper order in a grid. The usage is the following:: where ``GRIDS_FOLDER`` is the folder containing the grids to update, ``KFACTOR_FOLDER`` is the folder containing the kfactor files and ``YAMLDB_FILE`` is the path to the yamldb file of the requested dataset. The other inputs have already been described in the previous section. -``PTO_TO_UPDATE`` is the :math:`\alpha_s` perturbative order to update or create, with the convention that +``PTO_TO_UPDATE`` is the :math:`\alpha_s` perturbative order to update or create, with the convention that ``LO=1``, ``NLO=2`` and so on, irrespectively to the powers of alpha_s. Note that only pure QCD kfactors are taken into account. If the flag ``order_exists`` is passed the kfactor is applied to the specified perturbative order. For example to add the NNLO in a grid containing at most NLO one has to select ``PTO_TO_UPDATE=2``; -nn the other hand to reweight the NNLO present in a grid with a kfactor, -one should do ``PTO_TO_UPDATE=2 --order_exists``. \ No newline at end of file +nn the other hand to reweight the NNLO present in a grid with a kfactor, +one should do ``PTO_TO_UPDATE=2 --order_exists``. diff --git a/src/pineko/kfactor.py b/src/pineko/kfactor.py index 9a59c2c4..9d590638 100644 --- a/src/pineko/kfactor.py +++ b/src/pineko/kfactor.py @@ -9,7 +9,7 @@ from pineappl import import_only_subgrid from . import scale_variations -from . scale_variations import orders_as_tuple +from .scale_variations import orders_as_tuple DEFAULT_PDF_SET = "NNPDF40_nnlo_as_01180" diff --git a/src/pineko/scale_variations.py b/src/pineko/scale_variations.py index 33f9f7fe..da43ff44 100644 --- a/src/pineko/scale_variations.py +++ b/src/pineko/scale_variations.py @@ -30,9 +30,12 @@ def qcd(order: OrderTuple) -> int: """Extract the QCD order from an OrderTuple.""" return order[0] + def orders_as_tuple(grid: pineappl.grid.Grid) -> list[OrderTuple]: + """Return grid orders as a tuple.""" return [order.as_tuple() for order in grid.orders()] + def ren_sv_coeffs(m, max_as, logpart, which_part, nf): """Ren_sv coefficient for the requested part. @@ -139,7 +142,7 @@ def create_svonly(grid, order, new_order, scalefactor): def create_grids(gridpath, max_as, nf): """Create all the necessary scale variations grids for a certain starting grid.""" grid = pineappl.grid.Grid.read(gridpath) - grid_orders = orders_as_tuple(grid) + grid_orders = orders_as_tuple(grid) order_mask = pineappl.grid.Order.create_mask(grid.orders(), max_as, 0, True) grid_orders_filtered = list(np.array(grid_orders)[order_mask]) grid_orders_filtered.sort(key=qcd) @@ -246,9 +249,7 @@ def compute_ren_sv_grid( for sv_order, sv_grids in grid_list.items(): # if the new order is there, clean the old one. if sv_order in orders_as_tuple(grid): - grid = construct_and_dump_order_exists_grid( - grid, list(grid_list)[0] - ) + grid = construct_and_dump_order_exists_grid(grid, list(grid_list)[0]) for sv_grid in sv_grids: grid.merge(sv_grid) # save