piglot.parameter.ParameterSet

class ParameterSet[source]

Bases: object

Container class for a set of parameters.

This type should be used if the internal optimised parameters and the output parameters are equal. By default, the internal names are used for output name resolution.

Methods

add

Add a parameter to this set.

clip

Clamp the parameter set to the [lbound,ubound] interval.

hash

Build the hash for the current parameter values.

to_dict

Build a dict with name-value pairs given a list of values.

add(name: str, inital_value: float, lbound: float, ubound: float) None[source]

Add a parameter to this set.

Parameters

namestr

Parameter name.

inital_valuefloat

Initial value for the parameter.

lboundfloat

Lower bound of the parameter.

uboundfloat

Upper bound of the parameter.

Raises

RuntimeError

If a repeated parameter is given.

clip(values: ndarray) ndarray[source]

Clamp the parameter set to the [lbound,ubound] interval.

Parameters

valuesnp.ndarray

Values to clip. Their order is used for parameter resolution.

Returns

np.ndarray

Clamped parameters.

static hash(values) str[source]

Build the hash for the current parameter values.

Parameters

valuesarray

Parameters to hash.

Returns

str

Hex digest of the hash.

to_dict(values: ndarray) Dict[str, float][source]

Build a dict with name-value pairs given a list of values.

Parameters

valuesnp.ndarray

Values to pack. Their order is used for parameter resolution.

Returns

Dict[str, float]

Name-value pair for each parameter.