braintools.input.Repeated

braintools.input.Repeated#

class braintools.input.Repeated(input_obj, n_times)#

Repeated version of an input pattern.

Repeats an input pattern multiple times, useful for creating periodic stimulation protocols.

Parameters:
  • input_obj (Input) – The input pattern to repeat.

  • n_times (int) – Number of times to repeat.

Notes

The total duration is n_times * original_duration.

Examples

>>> # Single burst
>>> burst = Step([0, 1, 0], [0, 10, 30], 50 * u.ms)
>>>
>>> # Burst train (10 bursts, 500ms total)
>>> train = Repeated(burst, 10)
>>>
>>> # Oscillation packets
>>> packet = Sinusoidal(1.0, 100 * u.Hz, 100 * u.ms)
>>> packets = Repeated(packet, 5)  # 500ms total
>>>
>>> # Usually created via repeat() method
>>> train = burst.repeat(10)
__init__(input_obj, n_times)[source]#

Initialize repeated input.

Parameters:
  • input_obj (Input) – The input pattern to repeat.

  • n_times (int) – Number of times to repeat.

Methods

__init__(input_obj, n_times)

Initialize repeated input.

apply(func)

Apply a custom function to the input.

clip([min_val, max_val])

Clip the input values to a range.

generate()

Generate the repeated input.

repeat(n_times)

Repeat the input pattern n times.

scale(factor)

Scale the input by a factor.

shift(time_shift)

Shift the input in time.

smooth(tau)

Apply exponential smoothing to the input.

Attributes

dt

Get the time step from global environment.

n_steps

Get the number of time steps.

shape

Get the shape of the input array.