pineappl package
Submodules
pineappl.bin module
pineappl.fk_table module
- class pineappl.fk_table.FkAssumptions(assumption)[source]
Bases:
PyWrapper
Python wrapper object to interface
PyFkAssumptions
.- Parameters:
assumption (str) – assumption identifier
- class pineappl.fk_table.FkTable(pyfktable)[source]
Bases:
PyWrapper
Python wrapper object to interface
PyFkTable
.- Parameters:
pyfktable (PyFkTable) – raw wrapper object
- convolute_with_one(pdg_id, xfx, bin_indices=array([], dtype=uint64), lumi_mask=array([], dtype=bool))[source]
Convolute FkTable with a pdf.
- Parameters:
pdg_id (int) – PDG Monte Carlo ID of the hadronic particle xfx is the PDF for
xfx (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
bin_indices (sequence(int)) – A list with the indices of the corresponding bins that should be calculated. An empty list means that all orders should be calculated.
lumi_mask (sequence(bool)) – Mask for selecting specific luminosity channels. The value True means the corresponding channel is included. An empty list corresponds to all channels being enabled.
- Returns:
cross sections for all bins, for each scale-variation tuple (first all bins, then the scale variation)
- Return type:
- optimize(assumptions='Nf6Ind')[source]
Optimize FK table storage.
In order to perform any relevant optimization, assumptions are needed, and they are passed as parameters to the function.
- Parameters:
assumptions (FkAssumptions or str) – assumptions about the FkTable properties, declared by the user, deciding which optimizations are possible
- classmethod read(path)[source]
Load an existing grid from file.
Convenience wrapper for
pineappl.pineappl.PyFkTable.read()
.- Parameters:
path (pathlike) – file path
- Returns:
grid object
- Return type:
pineappl.grid module
- class pineappl.grid.Grid(pygrid)[source]
Bases:
PyWrapper
Python wrapper object to interface
PyGrid
.To create an object, you should call either
create()
orread()
.- Parameters:
pygrid (PyGrid) – raw wrapper object
- convolute_eko(operators, mur2_grid, alphas_values, lumi_id_types='pdg_mc_ids', order_mask=(), xi=(1.0, 1.0))[source]
Create an FKTable with the EKO.
Convenience wrapper for
pineappl.pineappl.PyGrid.convolute_eko()
.- Parameters:
operators (dict) – EKO Output
alphas_values (list[float]) – alpha_s values associated to the renormalization scales
lumi_id_types (str) – kind of lumi types (e.g. “pdg_mc_ids” for flavor basis, “evol” for evolution basis)
order_mask (list(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
xi ((float, float)) – A tuple with the scale variation factors that should be used. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the tuple should be (1.0, 1.0).
- Returns:
raw grid as an FKTable
- Return type:
- convolute_with_one(pdg_id, xfx, alphas, order_mask=array([], dtype=bool), bin_indices=array([], dtype=uint64), lumi_mask=array([], dtype=bool), xi=((1.0, 1.0),))[source]
Convolute grid with pdf.
- Parameters:
pdg_id (int) – PDG Monte Carlo ID of the hadronic particle xfx is the PDF for
xfx (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
alphas (callable) – lhapdf like callable with arguments Q2 returning \(\alpha_s\)
order_mask (sequence(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
bin_indices (sequence(int)) – A list with the indices of the corresponding bins that should be calculated. An empty list means that all orders should be calculated.
lumi_mask (sequence(bool)) – Mask for selecting specific luminosity channels. The value True means the corresponding channel is included. An empty list corresponds to all channels being enabled.
xi (list((float, float))) – A list with the scale variation factors that should be used to calculate scale-varied results. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the list should contain (1.0, 1.0).
- Returns:
cross sections for all bins, for each scale-variation tuple (first all bins, then the scale variation)
- Return type:
- convolute_with_two(pdg_id1, xfx1, pdg_id2, xfx2, alphas, order_mask=array([], dtype=bool), bin_indices=array([], dtype=uint64), lumi_mask=array([], dtype=bool), xi=((1.0, 1.0),))[source]
Convolute grid with two pdfs.
- Parameters:
pdg_id1 (int) – PDG Monte Carlo ID of the hadronic particle xfx1 is the PDF for
xfx1 (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
pdg_id2 (int) – PDG Monte Carlo ID of the hadronic particle xfx2 is the PDF for
xfx2 (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
alphas (callable) – lhapdf like callable with arguments Q2 returning \(\alpha_s\)
order_mask (sequence(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
bin_indices (sequence(int)) – A list with the indices of the corresponding bins that should be calculated. An empty list means that all orders should be calculated.
lumi_mask (sequence(bool)) – Mask for selecting specific luminosity channels. The value True means the corresponding channel is included. An empty list corresponds to all channels being enabled.
xi (list((float, float))) – A list with the scale variation factors that should be used to calculate scale-varied results. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the list should contain (1.0, 1.0).
- Returns:
cross sections for all bins, for each scale-variation tuple (first all bins, then the scale variation)
- Return type:
- classmethod create(lumi, orders, bin_limits, subgrid_params)[source]
Create a grid object from its ingredients.
- delete_bins(bin_indices)[source]
Delete bins.
Repeated bins and those exceeding length are ignored.
- Parameters:
bin_indices (sequence(int)) – list of indices of bins to removed
- evolve(operators, mur2_grid, alphas_values, lumi_id_types='pdg_mc_ids', order_mask=(), xi=(1.0, 1.0))[source]
Create an FKTable with the EKO.
Convenience wrapper for
pineappl.pineappl.PyGrid.evolve()
.- Parameters:
operators (dict) – EKO Output
alphas_values (list[float]) – alpha_s values associated to the renormalization scales
lumi_id_types (str) – kind of lumi types (e.g. “pdg_mc_ids” for flavor basis, “evol” for evolution basis)
order_mask (list(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
xi ((float, float)) – A tuple with the scale variation factors that should be used. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the tuple should be (1.0, 1.0).
- Returns:
raw grid as an FKTable
- Return type:
- orders()[source]
Extract the available perturbative orders and scale variations.
Convenience wrapper for
pineappl.pineappl.PyGrid.orders()
.- Parameters:
list(Order) – list with perturbative orders and scale variations
- classmethod read(path)[source]
Load an existing grid from file.
Convenience wrapper for
pineappl.pineappl.PyGrid.read()
.- Parameters:
path (pathlike) – file path
- Returns:
grid object
- Return type:
- set_remapper(remapper)[source]
Set the normalizations.
Convenience wrapper for
pineappl.pineappl.PyGrid.set_remapper()
.- Parameters:
remapper (BinRemapper) – Remapper object
- set_subgrid(order, bin_, lumi, subgrid)[source]
Set the subgrid at the given position.
Convenience wrapper for
pineappl.pineappl.PyGrid.set_subgrid()
.- Parameters:
order (int) – index of order
bin (int) – index of bin
lumi (int) – index of luminosity
subgrid (ImportOnlySubgridV1) – subgrid content
pineappl.import_only_subgrid module
- class pineappl.import_only_subgrid.ImportOnlySubgridV1(array, q2_grid, x1_grid, x2_grid)[source]
Bases:
PyWrapper
Python wrapper object to
PyImportOnlySubgridV1
.- Parameters:
array (numpy.ndarray(float, dim=3)) – 3-dimensional subgrid content
q2_grid (sequence(float)) – scale grid
x1_grid (sequence(float)) – interpolation grid for \(x_1\)
x2_grid (sequence(float)) – interpolation grid for \(x_2\)
- class pineappl.import_only_subgrid.ImportOnlySubgridV2(array, mu2_grid, x1_grid, x2_grid)[source]
Bases:
PyWrapper
Python wrapper object to
PyImportOnlySubgridV2
.- Parameters:
array (numpy.ndarray(float, dim=3)) – 3-dimensional subgrid content
mu2_grid (sequence(float)) – scale grid
x1_grid (sequence(float)) – interpolation grid for \(x_1\)
x2_grid (sequence(float)) – interpolation grid for \(x_2\)
pineappl.lumi module
pineappl.pineappl module
PyO3 Python module that contains all exposed classes from Rust.
NOTE: this name has to match the one in Cargo.toml ‘lib.name’
- class pineappl.pineappl.PyBinRemapper(normalizations, limits)
Bases:
object
PyO3 wrapper to pineappl::bin::BinRemapper
Usage: yadism
- class pineappl.pineappl.PyEvolveInfo
Bases:
object
PyO3 wrapper to pineappl::evolution::EvolveInfo
- fac1
Squared factorization scales of the Grid.
- pids1
Particle identifiers of the Grid.
- ren1
Renormalization scales of the Grid.
- x1
x-grid coordinates of the Grid.
- class pineappl.pineappl.PyFkTable(grid)
Bases:
object
PyO3 wrapper to pineappl::fk_table::FkTable
Usage: pineko, yadism
- bin_dimensions()
Extract the number of dimensions for bins.
E.g.: two differential cross-sections will return 2.
- Returns:
bin dimension
- Return type:
- bin_left(dimension)
Extract the left edges of a specific bin dimension.
- Parameters:
dimension (int) – bin dimension
- Returns:
left edges of bins
- Return type:
- bin_normalizations()
Extract the normalizations for each bin.
- Returns:
bin normalizations
- Return type:
- bin_right(dimension)
Extract the right edges of a specific bin dimension.
- Parameters:
dimension (int) – bin dimension
- Returns:
right edges of bins
- Return type:
- convolute_with_one(pdg_id, xfx, bin_indices=None, lumi_mask=None)
Convolute grid with pdf.
Usage: pineko
- Parameters:
pdg_id (integer) – PDG Monte Carlo ID of the hadronic particle xfx is the PDF for
xfx (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
- Returns:
cross sections for all bins
- Return type:
- lumi()
Get luminsosity functions.
- optimize(assumptions)
Optimize FK table storage
In order to perform any relevant optimization, assumptions are needed, and they are passed as parameters to the function.
- Parameters:
assumptions (FkAssumptions) – assumptions about the FkTable properties, declared by the user, deciding which optimizations are possible
- static read(path)
- set_key_value(key, value)
Set a metadata key-value pair in the FK table.
- table()
Get cross section tensor.
- Returns:
4-dimensional tensor with indixes: bin, lumi, x1, x2
- Return type:
- x_grid()
Get (unique) interpolation grid.
- Returns:
x_grid – interpolation grid
- Return type:
- class pineappl.pineappl.PyGrid(lumi, orders, bin_limits, subgrid_params)
Bases:
object
PyO3 wrapper to pineappl::grid::Grid
Usage: yadism, pineko, FKTable interface
- axes()
Extract the necessary informations for EKO.
Usage: pineko
- Returns:
x_grid (numpy.ndarray(float)) – interpolation grid
pids (numpy.ndarray(int)) – particle ids
mur2_grid (numpy.ndarray(float)) – factorization scale list
muf2_grid (numpy.ndarray(float)) – factorization scale list
- bin_dimensions()
Extract the number of dimensions for bins.
Usage: pineko
E.g.: two differential cross-sections will return 2.
- Returns:
bin dimension
- Return type:
- bin_left(dimension)
Extract the left edges of a specific bin dimension.
Usage: pineko
- Parameters:
dimension (int) – bin dimension
- Returns:
left edges of bins
- Return type:
- bin_normalizations()
Extract the normalizations for each bin.
Usage: runcards
- Returns:
bin normalizations
- Return type:
np.ndarray
- bin_right(dimension)
Extract the right edges of a specific bin dimension.
Usage: pineko
- Parameters:
dimension (int) – bin dimension
- Returns:
right edges of bins
- Return type:
- convolute_eko(muf2_0, alphas, pids, x_grid, target_pids, target_x_grid, mur2_grid, muf2_grid, operator, lumi_id_types, order_mask, xi)
Convolute with with an evolution operator.
Usage: pineko
- Parameters:
muf2_0 (float) – reference scale
alphas (numpy.ndarray(float)) – list with \(\alpha_s(Q2)\) for the process scales
pids (numpy.ndarray(int)) – sorting of the particles in the tensor
x_grid (numpy.ndarray(float)) – interpolation grid
target_pids (numpy.ndarray(int)) – sorting of the particles in the tensor for final FkTable
target_x_grid (numpy.ndarray(float)) – final FKTable interpolation grid
mur2_grid (numpy.ndarray(float)) – list of renormalization scales
muf2_grid (numpy.ndarray(float)) – list of factorization scales
operator (numpy.ndarray(int, rank=5)) – evolution tensor
orders_mask (numpy.ndarray(bool)) – boolean mask to activate orders
- Returns:
produced FK table
- Return type:
- convolute_with_one(pdg_id, xfx, alphas, order_mask, bin_indices, lumi_mask, xi)
Convolute grid with pdf.
Usage: pineko
- Parameters:
pdg_id (int) – PDG Monte Carlo ID of the hadronic particle xfx is the PDF for
xfx (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
alphas (callable) – lhapdf like callable with arguments Q2 returning \(\alpha_s\)
order_mask (numpy.ndarray(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
bin_indices (numpy.ndarray(int)) – A list with the indices of the corresponding bins that should be calculated. An empty list means that all orders should be calculated.
lumi_mask (numpy.ndarray(bool)) – Mask for selecting specific luminosity channels. The value True means the corresponding channel is included. An empty list corresponds to all channels being enabled.
xi (list((float, float))) – A list with the scale variation factors that should be used to calculate scale-varied results. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the list should contain (1.0, 1.0).
- Returns:
cross sections for all bins, for each scale-variation tuple (first all bins, then the scale variation)
- Return type:
- convolute_with_two(pdg_id1, xfx1, pdg_id2, xfx2, alphas, order_mask, bin_indices, lumi_mask, xi)
Convolute grid with two pdfs.
Usage: pineko
- Parameters:
pdg_id1 (int) – PDG Monte Carlo ID of the hadronic particle xfx1 is the PDF for
xfx1 (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
pdg_id2 (int) – PDG Monte Carlo ID of the hadronic particle xfx2 is the PDF for
xfx2 (callable) – lhapdf like callable with arguments pid, x, Q2 returning x*pdf for \(x\)-grid
alphas (callable) – lhapdf like callable with arguments Q2 returning \(\alpha_s\)
order_mask (numpy.ndarray(bool)) – Mask for selecting specific orders. The value True means the corresponding order is included. An empty list corresponds to all orders being enabled.
bin_indices (numpy.ndarray(int)) – A list with the indices of the corresponding bins that should be calculated. An empty list means that all orders should be calculated.
lumi_mask (numpy.ndarray(bool)) – Mask for selecting specific luminosity channels. The value True means the corresponding channel is included. An empty list corresponds to all channels being enabled.
xi (list((float, float))) – A list with the scale variation factors that should be used to calculate scale-varied results. The first entry of a tuple corresponds to the variation of the renormalization scale, the second entry to the variation of the factorization scale. If only results for the central scale are need the list should contain (1.0, 1.0).
- Returns:
cross sections for all bins, for each scale-variation tuple (first all bins, then the scale variation)
- Return type:
- delete_bins(bin_indices)
Delete bins.
Repeated bins and those exceeding length are ignored.
- Parameters:
bin_indices (numpy.ndarray[int]) – list of indices of bins to removed
- evolve(operator, fac0, pids0, x0, fac1, pids1, x1, ren1, alphas, xi, lumi_id_types, order_mask)
Convolute with grid with an evolution operator.
- Parameters:
operator (numpy.ndarray(int, rank=5)) – evolution tensor
fac0 (float) – reference scale
pids0 (numpy.ndarray(int)) – sorting of the particles in the tensor for final FkTable
x0 (numpy.ndarray(float)) – final FKTable interpolation grid
fac1 (numpy.ndarray(float)) – list of factorization scales
pids1 (numpy.ndarray(int)) – sorting of the particles in the grid
x1 (numpy.ndarray(float)) – interpolation grid at process level
ren1 (numpy.ndarray(float)) – list of renormalization scales
alphas (numpy.ndarray(float)) – list with \(\alpha_s(Q2)\) for the process scales
xi ((float, float)) – factorization and renormalization variation
lumi_id_types (str) – type of luminosity identifier
order_mask (numpy.ndarray(bool)) – boolean mask to activate orders
- Returns:
produced FK table
- Return type:
- evolve_info(order_mask)
Convolute with grid with an evolution operator.
- Parameters:
order_mask (numpy.ndarray(bool)) – boolean mask to activate orders
- Returns:
produced FK table
- Return type:
- evolve_with_slice_iter(slices, order_mask, xi, ren1, alphas)
TODO
- Parameters:
slices (TODO)
order_mask (TODO)
- Return type:
TODO
- fill(x1, x2, q2, order, observable, lumi, weight)
Add a point to the grid.
- fill_all(x1, x2, q2, order, observable, weights)
Add a point to the grid for all lumis.
- fill_array(x1s, x2s, q2s, order, observables, lumi, weights)
Add an array to the grid.
Useful to avoid multiple python calls, leading to performance improvement.
- lumi()
Get luminsosity functions.
- merge(other)
Merge grid with another one
- merge_from_file(path)
Merge grid with another one, loaded from file
Note
For a current limitation with the implementation of the bound object Grid is not possible to operate with two Grid`s in memory, since is not possible to pass a `Grid by argument
- optimize()
Optimize grid content.
Usage: yadism
- orders()
Extract the available perturbative orders and scale variations.
- static read(path)
Load grid from file.
Usage: pineko, FKTable generation
- scale_by_bin(factors)
Scale subgrids bin by bin.
- Parameters:
factors (numpy.ndarray[float]) – bin-dependent factors by which scaling
- set_key_value(key, value)
Set a metadata key-value pair in the grid.
Usage: yadism
- set_remapper(remapper)
Set the normalizations.
Usage: yadism
- Parameters:
remapper (BinRemapper) – Remapper object
- set_subgrid(order, bin, lumi, subgrid)
Set a subgrid.
Usage: yadism
- subgrid(order, bin, lumi)
Retrieve a subgrid.
Usage: yadism
- class pineappl.pineappl.PyImportOnlySubgridV1(array, q2_grid, x1_grid, x2_grid)
Bases:
object
PyO3 wrapper to pineappl::import_only_subgrid::ImportOnlySubgridV1
Usage: yadism
- into()
Wrapper to match
pineappl.pineappl.PyGrid.set_subgrid()
- Returns:
casted object
- Return type:
- class pineappl.pineappl.PyImportOnlySubgridV2(array, mu2_grid, x1_grid, x2_grid)
Bases:
object
PyO3 wrapper to pineappl::import_only_subgrid::ImportOnlySubgridV2
Usage: pineko
- into()
Wrapper to match
pineappl.pineappl.PyGrid.set_subgrid()
- Returns:
casted object
- Return type:
- class pineappl.pineappl.PyLumiEntry(entry)
Bases:
object
PyO3 wrapper to pineappl::lumi::LumiEntry
Usage: yadism, FKTable interface
Each entry consists of a tuple, which contains, in the following order:
the PDG id of the first incoming parton
the PDG id of the second parton
a numerical factor that will multiply the result for this specific combination.
- class pineappl.pineappl.PyMu2(ren, fac)
Bases:
object
PyO3 wrapper to pineappl::subgrid::Mu2
- fac
- ren
- class pineappl.pineappl.PyOrder(alphas, alpha, logxir, logxif)
Bases:
object
PyO3 wrapper to pineappl::grid::Order
Usage: yadism
- as_tuple()
Tuple representation.
- Returns:
alphas (int) – power of \(\alpha_s\)
alpha (int) – power of \(\alpha\)
logxir (int) – power of :math:` ln(xi_r)`
logxif (int) – power of :math:` ln(xi_f)`
- static create_mask(orders, max_as, max_al, logs)
Return a mask suitable to pass as the order_mask parameter of [Grid::convolute]. The selection of orders is controlled using the max_as and max_al parameters, for instance setting max_as = 1 and max_al = 0 selects the LO QCD only, max_as = 2 and max_al = 0 the NLO QCD; setting max_as = 3 and max_al = 2 would select all NLOs, and the NNLO QCD.
See pineappl crate docs for relevant examples
- Returns:
boolean array, to be used as orders’ mask
- Return type:
- class pineappl.pineappl.PySubgridEnum
Bases:
object
PyO3 wrapper to pineappl::subgrid::SubgridEnum
- into()
- mu2_grid()
Return the array of mu2 objects of a subgrid
- to_array3()
Return the dense array of the subgrid.
- x1_grid()
Return the array of x1 of a subgrid
- x2_grid()
Return the array of x2 of a subgrid
- class pineappl.pineappl.PySubgridParams
Bases:
object
PyO3 wrapper to pineappl::subgrid::SubgridParams
Usage: yadism
- set_q2_order(q2_order)
Set interpolation order for \(Q^2_{grid}\).
- Parameters:
q2_order (float) – new q2_order
pineappl.subgrid module
- class pineappl.subgrid.SubgridParams[source]
Bases:
PyWrapper
Python wrapper object to
PySubgridParams
.