scarlet.model¶
- class scarlet.model.Model(*parameters, children=None)[source]¶
Bases:
ABC
Model base class.
This class stores and provides access to parameters and sub-ordinate models.
- Parameters:
- parameters: list of `~scarlet.Parameter`
- children: list of `~scarlet.Model`
Subordinate models.
- Attributes:
children
List of child models
parameters
List of parameters, including from the children
Methods
Check that all parameters have finite elements
get_model
(*parameters, **kwargs)Get the model realization
get_models_of_children
(*parameters, **kwargs)Get realization of all child models
get_parameter
(i, *parameters)Access parameters by list index or by name
update
()Update internal state or configuration of the model
- check_parameters()[source]¶
Check that all parameters have finite elements
- Raises:
- ArithmeticError when non-finite elements are present
- property children¶
List of child models
- abstract get_model(*parameters, **kwargs)[source]¶
Get the model realization
- Parameters:
- parameters: tuple of optimimzation parameters
- Returns:
- model: array
Realization of the model
- get_models_of_children(*parameters, **kwargs)[source]¶
Get realization of all child models
- Parameters:
- parameters: tuple of optimimzation parameters
- Returns:
- model: list
Realization of the child models, ordered by child index
- get_parameter(i, *parameters)[source]¶
Access parameters by list index or by name
- Parameters:
- i: int, slice, str
Index, slice or name attribute of the requested parameter
- parameters: tuple
Parameters used during optimization. If not set, uses self
- Returns:
- Matching item or tuple of matching items
- property parameters¶
List of parameters, including from the children