Parameter

class minkit.Parameter(name, value=None, bounds=None, ranges=None, error=None, constant=False, asym_errors=None, blind=None)[source]

Bases: minkit.ParameterBase

Object to represent a parameter for a PDF.

Parameters:
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_errors Asymmetric errors.
blinded Whether the parameter has been blinded.
bounds Bounds of the parameter, defining the full range.
constant Whether this parameter is marked as constant.
error Error of the parameter.
ranges Names of the parameter ranges.
value Value 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

asym_errors

Asymmetric errors.

Type:tuple(float, float)
blinded

Whether the parameter has been blinded.

Type:bool
bounds

Bounds of the parameter, defining the full range.

Type:numpy.ndarray
constant

Whether this parameter is marked as constant.

Type:bool
error

Error of the parameter.

Type:float
ranges

Names of the parameter ranges.

value

Value of the parameter.

Type:float

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 json module.

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:
  • offset (float or None) – prototype of the blinding offset.
  • scale (float or None) – prototype of the blinding scale.

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:
  • name (str) – name of the range.
  • values (tuple or tuple(tuple, ..)) – bounds of the range.
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.

to_json_object()[source]

Represent this class as a JSON-like object.

Returns:This class as a JSON-like object.
Return type:dict