TimedArray class

(Shortest import: from brian2 import TimedArray)

class brian2.input.timedarray.TimedArray(values, dt, name=None)[source]

Bases: Function, Nameable, CacheKey

A function of time built from an array of values. The returned object can be used as a function, including in model equations etc. The resulting function has to be called as funcion_name(t) if the provided value array is one-dimensional and as function_name(t, i) if it is two-dimensional.

Attributes

implementations

Container for implementing functions for different targets This container can be extended by other codegeneration targets/devices The key has to be the name of the target, the value is a tuple of functions, the first for a 1d array, the second for a 2d array.

Methods

is_locally_constant(dt)

Return whether this function (if interpreted as a function of time) should be considered constant over a timestep.

Details

implementations

Container for implementing functions for different targets This container can be extended by other codegeneration targets/devices The key has to be the name of the target, the value is a tuple of functions, the first for a 1d array, the second for a 2d array. The functions have to take three parameters: (values, dt, name), i.e. the array values, their physical dimensions, the dt of the TimedArray, and the name of the TimedArray. The functions have to return a function that takes the owner argument (out of which they can get the context’s dt as owner.clock.dt_) and returns the code.

is_locally_constant(dt)[source]

Return whether this function (if interpreted as a function of time) should be considered constant over a timestep. This is most importantly used by TimedArray so that linear integration can be used. In its standard implementation, always returns False.