brainpy.dyn.runners.DSRunner#

class brainpy.dyn.runners.DSRunner(target, inputs=(), fun_inputs=None, dt=None, t0=0.0, **kwargs)[source]#

The runner for dynamical systems.

Parameters
  • target (DynamicalSystem) – The target model to run.

  • inputs (list, tuple) –

    The inputs for the target DynamicalSystem. It should be the format of [(target, value, [type, operation])], where target is the input target, value is the input value, type is the input type (such as “fix”, “iter”, “func”), operation is the operation for inputs (such as “+”, “-”, “*”, “/”, “=”).

    • target: should be a string. Can be specified by the absolute access or relative access.

    • value: should be a scalar, vector, matrix, iterable function or objects.

    • type: should be a string. “fix” means the input value is a constant. “iter” means the input value can be changed over time. “func” mean the input is obtained through the functional call.

    • operation: should be a string, support +, -, *, /, =.

    • Also, if you want to specify multiple inputs, just give multiple (target, value, [type, operation]), for example [(target1, value1), (target2, value2)].

  • fun_inputs (callable) – The functional inputs. Manually specify the inputs for the target variables. This input function should receive one argument shared which contains the shared arguments like time t, time step dt, and index i.

  • monitors (None, sequence of str, dict, Monitor) –

    Variables to monitor.

    • A list of string. Like monitors=[‘a’, ‘b’, ‘c’]

    • A list of string with index specification. Like monitors=[(‘a’, 1), (‘b’, [1,3,5]), ‘c’]

    • A dict with the explicit monitor target, like: monitors={‘a’: model.spike, ‘b’: model.V}

    • A dict with the index specification, like: monitors={‘a’: (model.spike, 0), ‘b’: (model.V, [1,2])}

  • fun_monitors (dict) – Monitoring variables by callable functions. Should be a dict. The key should be a string for the later retrieval by runner.mon[key]. The value should be a callable function which receives two arguments: t and dt.

  • jit (bool, dict) – The JIT settings.

  • progress_bar (bool) – Use progress bar to report the running progress or not?

  • dyn_vars (Optional, dict) – The dynamically changed variables. Instance of Variable.

  • numpy_mon_after_run (bool) – When finishing the network running, transform the JAX arrays into numpy ndarray or not?

__init__(target, inputs=(), fun_inputs=None, dt=None, t0=0.0, **kwargs)[source]#

Methods

__init__(target[, inputs, fun_inputs, dt, t0])

build_monitors(return_without_idx, ...)

f_predict([shared_args])

format_monitors()

predict([duration, inputs, ...])

Running a duration with the given target model.

reset_state()

run(*args, **kwargs)

Predict a series of input data with the given target model.

Attributes

target