|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Public Member Functions | |
| None | __init__ (self) |
| None | write (self, PathLike destination) |
| None | write_blocks (self, PathLike destination, Iterable[str] block_names) |
| None | write_parameters (self, PathLike destination, Iterable[ParamId] parameter_ids) |
Protected Member Functions | |
| str | _destination (cls, PathLike destination) |
Protected Attributes | |
| _cpp_obj | |
Static Protected Attributes | |
| dict | _SUPPORTED_SUFFIXES = {".json", ".yaml", ".yml", ".lha", ".slha", ".flha"} |
Write current Core parameters as JSON, YAML or Les Houches files.
The writer operates on the database initialized by :class:`HyperisoMaster`.
The destination suffix selects the serializer:
- ``.json`` for JSON;
- ``.yaml`` or ``.yml`` for YAML;
- ``.lha``, ``.slha`` or ``.flha`` for Les Houches formats.
JSON and YAML preserve an optional ``imaginary_value`` field for complex
parameters. LHA-family exports preserve complex entries through ``IM...``
companion blocks, unless an explicit companion block already exists in the
database.
Examples:
>>> writer = DatabaseWriter()
>>> writer.write("database.json")
>>> writer.write_blocks("masses.yaml", ["MASS", "SMINPUTS"])
>>> writer.write_parameters("inputs.slha", [ParamId(block="MASS", code=25)])
Definition at line 16 of file DatabaseWriter.py.
| None pyhyperiso.core.Core.DatabaseWriter.DatabaseWriter.__init__ | ( | self | ) |
Create a writer bound to the current C++ Core database.
Definition at line 40 of file DatabaseWriter.py.
|
protected |
Validate and normalize an output path for the C++ binding.
Definition at line 45 of file DatabaseWriter.py.
| None pyhyperiso.core.Core.DatabaseWriter.DatabaseWriter.write | ( | self, | |
| PathLike | destination | ||
| ) |
Export the complete initialized database.
Args:
destination: Output filename. Its suffix selects JSON, YAML or LHA.
Raises:
RuntimeError: If HyperIso has not been initialized or writing fails.
ValueError: If the filename suffix is unsupported.
Definition at line 56 of file DatabaseWriter.py.
| None pyhyperiso.core.Core.DatabaseWriter.DatabaseWriter.write_blocks | ( | self, | |
| PathLike | destination, | ||
| Iterable[str] | block_names | ||
| ) |
Export only selected blocks.
Args:
destination: Output filename.
block_names: Non-empty iterable of block names or aliases.
Raises:
TypeError: If block names are not supplied as strings.
ValueError: If no block is supplied, the suffix is unsupported, or a
requested block does not exist.
RuntimeError: If HyperIso is not initialized or writing fails.
Definition at line 68 of file DatabaseWriter.py.
| None pyhyperiso.core.Core.DatabaseWriter.DatabaseWriter.write_parameters | ( | self, | |
| PathLike | destination, | ||
| Iterable[ParamId] | parameter_ids | ||
| ) |
Export selected parameters addressed by block and LHA identifier.
Args:
destination: Output filename.
parameter_ids: Non-empty iterable of :class:`ParamId` objects.
Raises:
TypeError: If an entry is not a ``ParamId``.
ValueError: If no parameter is supplied, the suffix is unsupported, or
a requested parameter does not exist.
RuntimeError: If HyperIso is not initialized or writing fails.
Definition at line 90 of file DatabaseWriter.py.
|
protected |
Definition at line 42 of file DatabaseWriter.py.
|
staticprotected |
Definition at line 38 of file DatabaseWriter.py.