Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Mar 16, 2024
1 parent 8dc15f0 commit 3f94e4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/source/theory/kfactors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
nn the other hand to reweight the NNLO present in a grid with a kfactor,
one should do ``PTO_TO_UPDATE=2 --order_exists``.
2 changes: 1 addition & 1 deletion src/pineko/kfactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
9 changes: 5 additions & 4 deletions src/pineko/scale_variations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3f94e4c

Please sign in to comment.