brainpy.inputs.constant_input

Contents

brainpy.inputs.constant_input#

brainpy.inputs.constant_input(I_and_duration, dt=None)[source]#

Format constant input in durations.

For example:

If you want to get an input where the size is 0 bwteen 0-100 ms, and the size is 1. between 100-200 ms.

>>> import brainpy.math as bm
>>> constant_input([(0, 100), (1, 100)])
>>> constant_input([(bm.zeros(100), 100), (bm.random.rand(100), 100)])
Parameters:
  • I_and_duration (list) – This parameter receives the current size and the current duration pairs, like [(Isize1, duration1), (Isize2, duration2)].

  • dt (float) – Default is None.

Returns:

current_and_duration – (The formatted current, total duration)

Return type:

tuple