braintools.input.TimeShifted

braintools.input.TimeShifted#

class braintools.input.TimeShifted(input_obj, time_shift)#

Time-shifted version of an input.

Shifts an input forward (delay) or backward (advance) in time. The total duration remains the same, with zero-padding added as needed.

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

  • time_shift (float | Quantity) – Amount to shift. Positive = delay (shift right), negative = advance (shift left).

Examples

>>> pulse = Step([1], [200 * u.ms], 500 * u.ms)
>>>
>>> # Delay by 100ms (pulse now at 300ms)
>>> delayed = TimeShifted(pulse, 100 * u.ms)
>>>
>>> # Advance by 50ms (pulse now at 150ms)
>>> advanced = TimeShifted(pulse, -50 * u.ms)
>>>
>>> # Usually created via shift() method
>>> delayed = pulse.shift(100 * u.ms)
__init__(input_obj, time_shift)[source]#

Initialize time-shifted input.

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

  • time_shift (float | Quantity) – Amount to shift (positive = delay, negative = advance).

Methods

__init__(input_obj, time_shift)

Initialize time-shifted 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 shifted 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.