modelrunner.run.compatibility.version1 module
Contains code necessary for loading results from format version 1
- class StateBase[source]
Bases:
object
Base class for specifying the state of a simulation
A state contains values of all degrees of freedom of a physical system (called the data) and some additional information (called attributes). The data is mutable and often a numpy array or a collection of numpy arrays. Conversely, the attributes are stroed in a dictionary with immutable values. To allow flexible storage, we define the properties _state_data and _state_attributes, which by default return attributes and data directly, but may be overwritten to process the data before storage (e.g., by additional serialization).
- classmethod from_data(attributes, data=<class 'modelrunner.run.compatibility.version1.NoData'>)[source]
create instance of any state class from attributes and data
- Parameters:
attributes (dict) – Additional (unserialized) attributes
data – The data of the degerees of freedom of the physical system
- Returns:
The object containing the given attributes and data
- Return type:
TState