States
flowMC.resource.states
¤
TState = TypeVar('TState', bound='State')
module-attribute
¤
State
¤
Bases: Resource
A Resource class that holds the state of the system. This is essentially a wrapper around a dictionary such that it can be handled by flowMC.
We restrict the type of the state to be simple types including integers, booleans and strings. The main reason for this is State is expected to be used to indiciate stage of individual strategies instead of storing parameters to resources. I.e. State should hold whehter the sampler is in training phase or production phase. But not mass matrix of a kernel per se.
name: str = name
instance-attribute
¤
data: dict[str, int | bool | str] = data
instance-attribute
¤
__repr__()
¤
__init__(data: dict[str, int | bool | str], name: str = 'State')
¤
Initialize the state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
The data to initialize the state with. |
required |
name
|
str
|
The name of the state. |
'State'
|
update(key: list[str], value: list[int | bool | str])
¤
Update the state with new data.
This will modify the state in place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key to update. |
required |
value
|
int | bool | str
|
The value to update. |
required |