cosapp.utils.state_io

Functions

get_state(system)

Export system state (inputs and outputs) into a dictionary for quick serialization, without type check.

set_state(system, state)

Import system state (inputs and outputs) from a dictionary generated by get_state.

cosapp.utils.state_io.get_state(system: System)[source]

Export system state (inputs and outputs) into a dictionary for quick serialization, without type check.

Returns:

Recursive dictionary of the kind: {

‘ports: {
port_name: {

varname: value, …

}, ‘children’: {

child_name: {

‘ports’: {…}, ‘children: {…},

},

}

cosapp.utils.state_io.object__getstate__(self, /)

Helper for pickle.

cosapp.utils.state_io.set_state(system: System, state: SystemState) None[source]

Import system state (inputs and outputs) from a dictionary generated by get_state.