Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
pyhyperiso.core.Common.ParamId.ParamId Class Reference
Collaboration diagram for pyhyperiso.core.Common.ParamId.ParamId:

Public Member Functions

 __post_init__ (self)
 
 set_parameter_type (self, ParameterType param_type)
 
 to_dict (self)
 
"ParamId" from_cpp (cls, common.ParamId cpp_obj)
 
 to_cpp (self)
 
 __repr__ (self)
 
 __eq__ (self, other)
 
 __hash__ (self)
 

Public Attributes

 code
 
 block
 
 type
 

Static Public Attributes

Optional type = None
 
str block = "NULL"
 
Union code = field(default_factory=lambda: LhaID(0))
 

Protected Attributes

 _cpp_obj
 

Static Protected Attributes

common _cpp_obj = field(init=False, repr=False)
 

Detailed Description

Python wrapper around the C++ ``ParamId`` composite identifier.

A ``ParamId`` uniquely identifies a parameter in LHA/SLHA-like structures by:
  - an optional semantic parameter type (``ParameterType``),
  - a block name (``BlockName`` with alias support),
  - an index or multi-index within that block (``LhaID``).

This mirrors the C++ struct:

- ``type`` is optional (can be unset / ``None``),
- ``block`` is a block identifier with aliases,
- ``code`` is an ``LhaID`` (single-part or multi-part).

Attributes:
    type (Optional[ParameterType]): Optional high-level parameter category.
        ``None`` means "unset" (equivalent to ``std::nullopt`` in C++).
    block (Union[str, BlockName]): Block identifier. The dataclass field is
        declared as ``str`` for convenience, but after initialization it is
        normalized to a ``BlockName`` instance.
    code (Union[LhaID, int, str, List[int]]): Parameter index / multi-index.
        After initialization it is normalized to a ``LhaID`` instance.

Notes:
    - The default/null ``ParamId`` corresponds to:
      ``type=None``, ``block="NULL"``, ``code=0``.
    - This class keeps an underlying C++ object in ``_cpp_obj``.

Definition at line 12 of file ParamId.py.

Member Function Documentation

◆ __eq__()

pyhyperiso.core.Common.ParamId.ParamId.__eq__ (   self,
  other 
)

Definition at line 141 of file ParamId.py.

◆ __hash__()

pyhyperiso.core.Common.ParamId.ParamId.__hash__ (   self)

Definition at line 154 of file ParamId.py.

◆ __post_init__()

pyhyperiso.core.Common.ParamId.ParamId.__post_init__ (   self)
Build and normalize the underlying C++ ``ParamId`` after init.

This method:
  1) Normalizes ``code`` to ``PyLhaID`` if needed.
  2) Normalizes ``block`` to ``PyBlockName`` if needed.
  3) Constructs the C++ ``ParamId`` depending on whether ``type`` is set
     and whether the (block, code) pair corresponds to the default/null
     sentinel.

Raises:
    TypeError: If ``block`` or ``code`` cannot be converted to the expected
        wrapper types.

Definition at line 46 of file ParamId.py.

◆ __repr__()

pyhyperiso.core.Common.ParamId.ParamId.__repr__ (   self)
Return a debug representation.

Returns:
    str: Debug-style string including type, block and code.

Definition at line 133 of file ParamId.py.

◆ from_cpp()

"ParamId" pyhyperiso.core.Common.ParamId.ParamId.from_cpp (   cls,
common.ParamId  cpp_obj 
)
Wrap an existing bound C++ ``ParamId`` instance.

Args:
    cpp_obj (common.ParamId): C++ object coming from pybind.

Returns:
    PyParamId: A Python wrapper around the provided C++ object.

Definition at line 109 of file ParamId.py.

◆ set_parameter_type()

pyhyperiso.core.Common.ParamId.ParamId.set_parameter_type (   self,
ParameterType  param_type 
)
Set or overwrite the parameter type.

Args:
    param_type (ParameterType): New parameter type to assign.

Definition at line 78 of file ParamId.py.

◆ to_cpp()

pyhyperiso.core.Common.ParamId.ParamId.to_cpp (   self)
Return the underlying bound C++ object.

Returns:
    common.ParamId: The wrapped pybind11 C++ instance.

Definition at line 125 of file ParamId.py.

◆ to_dict()

pyhyperiso.core.Common.ParamId.ParamId.to_dict (   self)
Serialize this identifier into a Python dictionary.

The output is intended for logging/debugging and lightweight serialization.

Returns:
    dict: A mapping with keys:
      - ``"type"``: type name as ``str`` or ``None`` if unset,
      - ``"block"``: the current ``PyBlockName`` object,
      - ``"code"``: canonical string representation of the ``LhaID``.

Notes:
    If you need a JSON-serializable dict, you may want:
    ``{"block": str(self.block)}`` instead of returning the object.

Definition at line 87 of file ParamId.py.

Member Data Documentation

◆ _cpp_obj [1/2]

common pyhyperiso.core.Common.ParamId.ParamId._cpp_obj = field(init=False, repr=False)
staticprotected

Definition at line 44 of file ParamId.py.

◆ _cpp_obj [2/2]

pyhyperiso.core.Common.ParamId.ParamId._cpp_obj
protected

Definition at line 67 of file ParamId.py.

◆ block [1/2]

str pyhyperiso.core.Common.ParamId.ParamId.block = "NULL"
static

Definition at line 42 of file ParamId.py.

◆ block [2/2]

pyhyperiso.core.Common.ParamId.ParamId.block

Definition at line 63 of file ParamId.py.

◆ code [1/2]

Union pyhyperiso.core.Common.ParamId.ParamId.code = field(default_factory=lambda: LhaID(0))
static

Definition at line 43 of file ParamId.py.

◆ code [2/2]

pyhyperiso.core.Common.ParamId.ParamId.code

Definition at line 60 of file ParamId.py.

◆ type [1/2]

Optional pyhyperiso.core.Common.ParamId.ParamId.type = None
static

Definition at line 41 of file ParamId.py.

◆ type [2/2]

pyhyperiso.core.Common.ParamId.ParamId.type

Definition at line 74 of file ParamId.py.


The documentation for this class was generated from the following file: