ekobox package

EKO user interface package.

Subpackages

Submodules

ekobox.apply module

Apply evolution operator to a PDF.

ekobox.apply.RawPdfResult

PDFs as raw grids.

The key is given by the associated evolution point. The values are tensors sorted by (replica, flavor, xgrid). It may be the PDF or the associated integration error.

ekobox.apply.LabeledPdfResult

PDFs labeled by their PDF identifier.

The outer key is given by the associated evolution point. The inner key is the PID. The inner values are the values for along the xgrid. It may be the PDF or the associated integration error.

ekobox.apply.apply_pdf(eko: EKO, lhapdf_like, targetgrid: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, rotate_to_evolution_basis: bool = False) tuple[dict[Tuple[float, int], dict[int, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]], dict[Tuple[float, int], dict[int, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]]][source]

Apply all available operators to the input PDF.

Parameters:
  • eko – eko output object containing all informations

  • lhapdf_like (Any) – object that provides an xfxQ2 callable (as lhapdf and ekomark.toyLH.toyPDF do) (and thus is in flavor basis)

  • targetgrid – if given, interpolates to the targetgrid (instead of xgrid)

  • rotate_to_evolution_basis – if True rotate to evoluton basis

Returns:

  • pdfs – PDFs for the computed evolution points

  • errors – Integration errors for PDFs for the computed evolution points

ekobox.apply.apply_pdf_flavor(eko: EKO, lhapdf_like, flavor_labels: Sequence[int], targetgrid: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, flavor_rotation: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) tuple[dict[Tuple[float, int], dict[int, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]], dict[Tuple[float, int], dict[int, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]]][source]

Apply all available operators to the input PDF.

Parameters:
  • eko – eko output object containing all informations

  • lhapdf_like (Any) –

    object that provides an xfxQ2 callable (as lhapdf and ekomark.toyLH.toyPDF do) (and thus is in flavor basis)

  • flavor_labels – flavor names

  • targetgrid – if given, interpolates to the targetgrid (instead of xgrid)

  • flavor_rotation – if give, rotate in flavor space

Returns:

  • pdfs – PDFs for the computed evolution points

  • errors – Integration errors for PDFs for the computed evolution points

ekobox.apply.rotate_result(eko: EKO, grids: dict[Tuple[float, int], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], flavor_labels: Sequence[int], targetgrid: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, flavor_rotation: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) dict[Tuple[float, int], dict[int, _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]][source]

Rotate and relabel PDFs.

Parameters:
  • eko – eko output object containing all informations

  • grids – Raw grids coming from evolution

  • flavor_labels – flavors names

  • targetgrid – if given, interpolates to the targetgrid (instead of xgrid)

  • flavor_rotation – if given, rotates in flavor space

Returns:

relabeled and, if requested rotated, PDFs

Return type:

pdfs

ekobox.apply.apply_grids(eko: EKO, input_grids: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) tuple[dict[Tuple[float, int], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], dict[Tuple[float, int], _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]][source]

Apply all available operators to the input grids.

Parameters:
  • eko – eko output object

  • input_grids – 3D PDF grids evaluated at the inital scale. The axis have to be (replica, flavor, xgrid)

Returns:

  • pdfs – output PDFs for the computed evolution points

  • errors – associated integration errors for the computed evolution points

ekobox.cards module

Tools to generate runcards.

class ekobox.cards.example[source]

Bases: object

Provide runcards examples.

classmethod theory() TheoryCard[source]

Provide example theory card object.

classmethod operator() OperatorCard[source]

Provide example operator card object.

classmethod raw_theory()[source]

Provide example theory card unstructured.

classmethod raw_operator()[source]

Provide example operator card unstructured.

ekobox.cards.dump(card: Dict[str, Any], path: PathLike)[source]

Export the operators card.

Parameters:
  • card (dict) – card to dump

  • path (str) – destination of the dumped card

ekobox.cards.load(path) Dict[str, Any][source]

Import the theory card specified by path.

Parameters:

path (str) – path to theory card in yaml format

Returns:

loaded card

Return type:

dict

ekobox.evol_pdf module

Tools to evolve actual PDFs.

ekobox.evol_pdf.evolve_pdfs(initial_PDF_list, theory_card, operators_card, path=None, store_path=None, targetgrid=None, install=False, name='Evolved_PDF', info_update=None)[source]

Evolves one or several initial_PDFs and dump the evolved PDFs in lhapdf format.

Parameters:
  • initial_PDF_list (list(lhapdf object)) – list of PDF members to be evolved

  • theory_card (dict) – theory card

  • operators_card (dict) – operators card

  • path (str) – path to cached eko output (if “None” it will be recomputed)

  • store_path (str) – path where the eko is stored (if “None” will not be saved)

  • targetgrid (list(float)) – target x-grid (if different from input x-grid)

  • install (bool) – set whether to install evolved PDF to lhapdf directory

  • name (str) – set name of evolved PDF

  • info_update (dict) – dict of info to add or update to default info file

ekobox.evol_pdf.collect_blocks(evolved_PDF: dict, q2block_per_nf: dict, xgrid: list)[source]

Collect all LHAPDF blocks for a given replica.

Parameters:
  • evolved_PDF – PDF evaluated at grid

  • q2block_per_nf – block coordinates

  • xgrid – x grid

ekobox.info_file module

LHAPDF info file utilities.

ekobox.info_file.build(theory_card: TheoryCard, operators_card: OperatorCard, num_members: int, info_update: dict) dict[source]

Generate a lhapdf info file.

Parameters:
  • theory_card – theory card

  • operators_card – operators card

  • num_members – number of pdf set members

  • info_update – additional info to update

Returns:

info file in lhapdf format

Return type:

dict

ekobox.info_file.build_alphas(theory_card: TheoryCard, operators_card: OperatorCard) dict[source]

Generate a couplings section of lhapdf info file.

Parameters:
  • theory_card (dict) – theory card

  • operators_card (dict) – operators card

Returns:

info file section in lhapdf format

Return type:

dict

ekobox.mock module

Mocking tools.

ekobox.mock.eko_identity(shape)[source]

Generate an identity operator with the given shape.

The operator has to be squared in PIDs and x grid, thus the last two elements of shape are not read, and they are considered to be equal to the second and third element respectively.

Parameters:

shape (5-tuple) – specifies the required output tuple (last two elements are ignored)

Returns:

rank 5 array, representing an identity operator of the requested shape

Return type:

np.array

ekobox.utils module

Generic utilities to work with EKOs.

ekobox.utils.ekos_product(eko_ini: EKO, eko_fin: EKO, rtol: float = 1e-06, atol: float = 1e-10, path: Path | None = None)[source]

Compute the product of two ekos.

Parameters:
  • eko_ini – initial eko operator

  • eko_fin – final eko operator

  • rtol – relative tolerance on Q2, used to check compatibility

  • atol – absolute tolerance on Q2, used to check compatibility

  • path – if not provided, the operation is done in-place, otherwie a new operator is written at the given path

ekobox.utils.regroup_evolgrid(evolgrid: list)[source]

Split evolution points by nf and sort by scale.