brainpy.inputs.spike_input

Contents

brainpy.inputs.spike_input#

brainpy.inputs.spike_input(sp_times, sp_lens, sp_sizes, duration, dt=None)[source]#

Format current input like a series of short-time spikes.

For example:

If you want to generate a spike train at 10 ms, 20 ms, 30 ms, 200 ms, 300 ms, and each spike lasts 1 ms and the spike current is 0.5, then you can use the following funtions:

>>> spike_input(sp_times=[10, 20, 30, 200, 300],
>>>             sp_lens=1.,  # can be a list to specify the spike length at each point
>>>             sp_sizes=0.5,  # can be a list to specify the current size at each point
>>>             duration=400.)
Parameters:
  • sp_times (list, tuple) – The spike time-points. Must be an iterable object.

  • sp_lens (int, float, list, tuple) – The length of each point-current, mimicking the spike durations.

  • sp_sizes (int, float, list, tuple) – The current sizes.

  • duration (int, float) – The total current duration.

  • dt (float) – The default is None.

Returns:

current – The formatted input current.

Return type:

bm.ndarray