Parameter¶
-
class
minkit.Parameter(name, value=None, bounds=None, ranges=None, error=None, constant=False, asym_errors=None, blind=None)[source]¶ Bases:
minkit.ParameterBaseObject to represent a parameter for a PDF.
Parameters: - name (str) – name of the parameter.
- value (float or None) – initial value.
- bounds (tuple, tuple(tuple, ..) or None) – bounds for the parameter. This defines the full range.
- ranges (dict(str, tuple) or dict(str, tuple(tuple, ..))) – possible ranges
- error (float or None) – error of the parameter.
- constant (bool) – whether to initialize this parameter as constant.
- asym_errors (tuple(float, float) or None) – asymmetric errors.
- blind (dict) – if provided, set the blinding configuration.
Arguments are forwarded to
Parameter.set_blinding_configuration().
Variables: name – name of the parameter.
Note
If the parameter is in blind status, then the attributes value error and asym_errors are blinded, in such a way that the returned values do not correspond to the true values, and setting the attributes forces the class to unblind the result (the input value is assumed to be blinded). On the other hand, if the object is saved into a JSON file, the blinding state is also preserved.
Attributes Summary
asym_errorsAsymmetric errors. blindedWhether the parameter has been blinded. boundsBounds of the parameter, defining the full range. constantWhether this parameter is marked as constant. errorError of the parameter. rangesNames of the parameter ranges. valueValue of the parameter. Methods Summary
blind([status])Enter a context where the blinding status is modified to that given. copy()Create a copy of this instance. from_json_object(obj)Build the parameter from a JSON object (a dictionary). get_range(name)Get the range with the given name. restoring_state()Enter a context where the attributes of the parameter will be restored on exit. set_blinding_configuration([offset, scale])Define the blinding configuration of the parameter. set_range(name, values)Define the range with name name. to_json_object()Represent this class as a JSON-like object. Attributes Documentation
-
bounds¶ Bounds of the parameter, defining the full range.
Type: numpy.ndarray
-
ranges¶ Names of the parameter ranges.
Methods Documentation
-
blind(status=True)[source]¶ Enter a context where the blinding status is modified to that given.
Parameters: status (bool) – blinding status. Raises: RuntimeError – If the parameter is requested to be blinded and no blinding configuration is present.
-
copy()[source]¶ Create a copy of this instance.
Warning
Avoid calling this method directly for sets of parameters and use the
Registry.copy()method instead, so the possible dependencies among parameters are correctly solved.
-
classmethod
from_json_object(obj)[source]¶ Build the parameter from a JSON object (a dictionary). This is meant to be used together with the
jsonmodule.Parameters: obj (dict) – object to use to construct the class. Returns: Parameter created from the JSON object. Return type: Parameter
-
get_range(name)[source]¶ Get the range with the given name.
Parameters: name (str) – name of the range. Returns: Attached range. Return type: numpy.ndarray
-
restoring_state()[source]¶ Enter a context where the attributes of the parameter will be restored on exit.
-
set_blinding_configuration(offset=None, scale=None)[source]¶ Define the blinding configuration of the parameter. Once this method is called, the parameter is considered to be on a blinded state. The keyword arguments depend on the method used.
Parameters: The blinding method depends on the provided arguments:
- offset:
- Use \(v^\prime = v + \beta\) as the transformation function. The absolute error of the blinded parameter is the same as as that of the true value. Only the argument offset is accepted.
- scale:
- The function \(v^\prime = \alpha v\) is used to blind values. This method allows to preserve the relative error after blinding. The argument scale is accepted.
- offset and scale:
- The blinding transformation is \(v^\prime = \alpha (v + \beta)\).
-
set_range(name, values)[source]¶ Define the range with name name. Must not be full.
Parameters: Raises: ValueError – If the value of the full range is changed.
Note
If you want to change the full range, modify the bounds of the parameter.