Evaluate NeurEco Discrete Dynamic model with the Python API#

To evaluate a NeurEco Discrete Dynamic model in Python API, import NeurEcoDynamic library:

from NeurEco import NeurEcoDynamic as Dynamic

Initialize a NeurEco object to handle the Discrete Dynamic problem:

model = Dynamic.DiscreteDynamic()

Build NeurEco Discrete Dynamic model with the Python API or load previously build and saved to “the/path/to/the/saved/discrete/dynamic/model.ernn” model:

model.load("the/path/to/the/saved/discrete/dynamic/model.ernn")

Once model contains a Discrete Dynamic model, call method evaluate with the parameters set accordingly to the data to evaluate:

model.evaluate(time, excitations,
             init_time=None,
             init_excitations=None,
             init_outputs=None)

Evaluates a Dynamic model.

time

list of NumPy column arrays or a column NumPy array

excitations

list of NumPy excitations arrays or a excitations NumPy array corresponding to time parameter

init_time

list of initial time column arrays or initial time column array

init_excitations

list of initial excitations arrays or initial excitations array

init_outputs

list of initial outputs arrays or initial outputs array

return

list of output NumPy arrays if multi-trajectory evaluation, NumPy array if single trajectory evaluation

For more information on the data format, see Data preparation for NeurEco Discrete Dynamic with the Python API.

Evaluation of a Dynamic model requires initialization. This initialization can be done in two ways:

  1. Recommended: provide explicitly the initialization of the trajectory to evaluate. The provided initialization contains:

    • Required: the initial outputs ** init_outputs** of the trajectory to evaluate

    • Optional: the excitations init_excitations and the timesteps init_time that correspond to these points

  2. If explicit initialization is not provided, NeurEco uses the Steady State Initialization: the beginning of the trajectory is computed from the steady state deduced from the model.