Hyperiso
1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ParameterSetter.py
Go to the documentation of this file.
1
"""Mutable parameter setter for central values and modes."""
2
3
from
__future__
import
annotations
4
5
from
typing
import
Union
6
7
from
pyhyperiso.phyperiso.pyhyperiso.core
import
ParameterSetter
as
_CppParameterSetter
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
ParameterSetter
:
14
"""Python wrapper around the C++ ``ParameterSetter``.
15
16
``ParameterSetter`` mutates stored parameter values directly. For workflows
17
that require recomputing observables after mutation, remember to call the
18
relevant reload/update method on the observable or statistic interface.
19
20
Examples:
21
>>> setter = ParameterSetter()
22
>>> setter.mutate(ParamId(ParameterType.SM, "MASS", 24), 80.379)
23
"""
24
25
def
__init__
(self) -> None:
26
"""Create a setter bound to the current C++ parameter storage."""
27
self.
_cpp_obj
= _CppParameterSetter()
28
29
def
mutate
(self, pid: ParamId, value: Union[float, complex, Scalar]) ->
None
:
30
"""Set a parameter value.
31
32
Args:
33
pid: Parameter to mutate.
34
value: New value. Numeric inputs are converted to ``Scalar``.
35
"""
36
self.
_cpp_obj
.
mutate
(pid._cpp_obj, _to_scalar(value)._cpp_obj)
37
38
def
change_mode
(self, pid: ParamId, mode: ParameterMode) ->
None
:
39
"""Change a parameter update mode.
40
41
Args:
42
pid: Parameter to update.
43
mode: New mode, such as ``ParameterMode.FIXED`` or
44
``ParameterMode.SHIFTABLE``.
45
"""
46
self.
_cpp_obj
.
change_mode
(pid._cpp_obj, mode.value)
47
48
49
__all__ = [
"ParameterSetter"
]
pyhyperiso.core.Core.ParameterSetter.ParameterSetter
Definition
ParameterSetter.py:13
pyhyperiso.core.Core.ParameterSetter.ParameterSetter._cpp_obj
_cpp_obj
Definition
ParameterSetter.py:27
pyhyperiso.core.Core.ParameterSetter.ParameterSetter.mutate
None mutate(self, ParamId pid, Union[float, complex, Scalar] value)
Definition
ParameterSetter.py:29
pyhyperiso.core.Core.ParameterSetter.ParameterSetter.__init__
None __init__(self)
Definition
ParameterSetter.py:25
pyhyperiso.core.Core.ParameterSetter.ParameterSetter.change_mode
None change_mode(self, ParamId pid, ParameterMode mode)
Definition
ParameterSetter.py:38
pyhyperiso.core.Common.ParamId
Definition
ParamId.py:1
pyhyperiso.core.Core.Parameter
Definition
Parameter.py:1
Hyperiso
pyhyperiso
core
Core
ParameterSetter.py
Generated by
1.9.8