Formula¶
-
class
minkit.Formula(name, formula, pars)[source]¶ Bases:
minkit.ParameterBaseParameter 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
all_argsArgument parameters this object depends on. argsArgument parameters this object directly depends on. dependenciesRegistry of parameters this instance depends on. valueValue, 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). restoring_state()Enter a context where the attributes of the parameter will be restored on exit. to_json_object()Represent this class as a JSON-like object. Attributes Documentation
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: Formula 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
jsonmodule.Parameters: Returns: Parameter created from the JSON object.
Return type:
-
restoring_state()¶ Enter a context where the attributes of the parameter will be restored on exit.