matcal.core.state
This module contains all data related to MatCal state parameters and all classes are meant for users.
Classes
The default state for MatCal if no state is specified by the user. |
|
|
The MatCal object that stores state information tied to a data set. |
|
A collection of |
- class matcal.core.state.State(name, **kwargs)[source]
The MatCal object that stores state information tied to a data set. State information is passed to the model at run time. State information can include model parameters or boundary condition information, but is intended to be a parameter/quantity that is unique to the experiment setup and needed to successfully simulate the experiment.
- Parameters:
name (str) – the name for this state. This must be a string that is valid for a directory name.
kwargs (dict(str, float or str)) – comma-delimited list of name/value pairs for each state variable (e.g., rate=1e-4, temperature=298, direction=’x’)
- update(update_dict)[source]
Updates the state using a dictionary where state variable names are the keys, and the corresponding values are the assigned state variable values. This can be used to update existing state variables or add new.
- Parameters:
update_dict (dict) – the dictionary of values to be added to the state.
- update_state_variable(state_var_name, value)[source]
Updates or adds a new specific state variable in a state.
- Parameters:
state_var_name (str) – state variable name
value (str or float) – state variable name
- property name
- Returns:
the state name
- Return type:
str
- property params
- Returns:
the state parameters and values
- Return type:
dict
- property solitary_state
- Returns:
true if it has no parameters, false if parameters are specified
- Return type:
bool
- class matcal.core.state.SolitaryState[source]
The default state for MatCal if no state is specified by the user.
- Parameters:
name (str) – the name for this state. This must be a string that is valid for a directory name.
kwargs (dict(str, float or str)) – comma-delimited list of name/value pairs for each state variable (e.g., rate=1e-4, temperature=298, direction=’x’)
- property name
- Returns:
the state name
- Return type:
str
- property params
- Returns:
the state parameters and values
- Return type:
dict
- property solitary_state
- Returns:
true if it has no parameters, false if parameters are specified
- Return type:
bool
- update(update_dict)
Updates the state using a dictionary where state variable names are the keys, and the corresponding values are the assigned state variable values. This can be used to update existing state variables or add new.
- Parameters:
update_dict (dict) – the dictionary of values to be added to the state.
- update_state_variable(state_var_name, value)
Updates or adds a new specific state variable in a state.
- Parameters:
state_var_name (str) – state variable name
value (str or float) – state variable name
- class matcal.core.state.StateCollection(name, *states)[source]
A collection of
Stateobjects. This is used to combine multiple state objects so that they can be passed to a MatCal study. MatCal will use all states in the state collections as the study states.- Parameters:
name (str) – The name of the state collection.
states (list(
Stateobjects).) – the states to be added to the collection.
- Raises:
CollectionValueError – If name is a an empty string.
CollectionTypeError – If name is not a string and the states to be added to the collection are not of the correct type.
- dict()
- Returns:
the collection as a dictionary of items with name/value pairs.
- classmethod get_collection_type()
- Returns:
the data type the collection stores
- get_item_names()
- Returns:
a list of the names of all items added to the collection.
- get_number_of_items()
- Returns:
the number of items in the collection
- items()
- Returns:
a list of tuples of key, value pairs contained in the collection.
- keys()
- Returns:
a list of all available keys in the collection.
- property name
- Returns:
the name of the collection
- Return type:
str
- set_name(name)
Sets the name of the collection.
- Parameters:
name (str) – the new collection name
- values()
- Returns:
a list of all values in the collection.