Hyperiso
1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ParameterShifter.py
Go to the documentation of this file.
1
"""Mutable parameter shifter for nuisance/scan workflows."""
2
3
from
__future__
import
annotations
4
5
from
typing
import
Union
6
7
from
pyhyperiso.phyperiso.pyhyperiso.core
import
ParameterShifter
as
_CppParameterShifter
8
from
pyhyperiso.core.Common.ParamId
import
ParamId
9
from
pyhyperiso.core.Core.Parameter
import
ParameterMode
10
from
pyhyperiso.core.Math.scalar
import
Scalar, _to_scalar
11
12
13
class
ParameterShifter
:
14
"""Python wrapper around the C++ ``ParameterShifter``.
15
16
This class exposes the same Python surface as ``ParameterSetter`` but is
17
backed by the C++ shifter object. It is useful for workflows that treat
18
parameter changes as shifts rather than direct value replacement in the C++
19
parameter layer.
20
"""
21
22
def
__init__
(self) -> None:
23
"""Create a shifter bound to the current C++ parameter storage."""
24
self.
_cpp_obj
= _CppParameterShifter()
25
26
def
mutate
(self, pid: ParamId, value: Union[float, complex, Scalar]) ->
None
:
27
"""Apply a new shifted value to a parameter.
28
29
Args:
30
pid: Parameter to shift.
31
value: Shifted value. Numeric inputs are converted to ``Scalar``.
32
"""
33
self.
_cpp_obj
.
mutate
(pid._cpp_obj, _to_scalar(value)._cpp_obj)
34
35
def
change_mode
(self, pid: ParamId, mode: ParameterMode) ->
None
:
36
"""Change a parameter update mode.
37
38
Args:
39
pid: Parameter to update.
40
mode: New mode, such as ``ParameterMode.FIXED`` or
41
``ParameterMode.SHIFTABLE``.
42
"""
43
self.
_cpp_obj
.
change_mode
(pid._cpp_obj, mode.value)
44
45
46
__all__ = [
"ParameterShifter"
]
pyhyperiso.core.Core.ParameterShifter.ParameterShifter
Definition
ParameterShifter.py:13
pyhyperiso.core.Core.ParameterShifter.ParameterShifter.mutate
None mutate(self, ParamId pid, Union[float, complex, Scalar] value)
Definition
ParameterShifter.py:26
pyhyperiso.core.Core.ParameterShifter.ParameterShifter.change_mode
None change_mode(self, ParamId pid, ParameterMode mode)
Definition
ParameterShifter.py:35
pyhyperiso.core.Core.ParameterShifter.ParameterShifter.__init__
None __init__(self)
Definition
ParameterShifter.py:22
pyhyperiso.core.Core.ParameterShifter.ParameterShifter._cpp_obj
_cpp_obj
Definition
ParameterShifter.py:24
pyhyperiso.core.Common.ParamId
Definition
ParamId.py:1
pyhyperiso.core.Core.Parameter
Definition
Parameter.py:1
Hyperiso
pyhyperiso
core
Core
ParameterShifter.py
Generated by
1.9.8