Formula¶
-
class
minkit.
Formula
(name, formula, pars)[source]¶ Bases:
minkit.ParameterBase
Parameter representing an operation of many parameters. The formula can be expressed as a function of parameter names, as a function of indices or a mixture of the two, like:
Parameter names: “a * b” will multiply a and b.
Indices: “{0} * {1}” will multiply the first and second elements in pars.
Mixed: “{a} * {b} + {1}” will multiply a and b and sum the second element in pars.
- Parameters
Attributes Summary
Argument parameters this object depends on.
Argument parameters this object directly depends on.
Registry of parameters this instance depends on.
Value, evaluated from the values of the other parameters.
Methods Summary
copy
(pars)Create a copy of this instance.
from_json_object
(obj, pars)Build the parameter from a JSON object (a dictionary).
Enter a context where the attributes of the parameter will be restored on exit.
Represent this class as a JSON-like object.
Attributes Documentation
-
dependent
= True¶
Methods Documentation
-
copy
(pars)[source]¶ Create a copy of this instance.
- Parameters
pars (Registry) – parameter to build the class.
- Returns
A copy of this instance.
- Return type
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, pars)[source]¶ Build the parameter from a JSON object (a dictionary). This is meant to be used together with the
json
module.
-
restoring_state
()¶ Enter a context where the attributes of the parameter will be restored on exit.