braintools.input.Sequential

braintools.input.Sequential#

class braintools.input.Sequential(*inputs)#

Sequential composition of two inputs.

Concatenates two inputs in time, with the second input following immediately after the first.

Parameters:

*inputs (Any) – All sequential inputs.

Examples

>>> # Three-phase protocol
>>> baseline = Step([0], [0], 500 * u.ms)
>>> stimulus = Ramp(0, 1, 1000 * u.ms)
>>> recovery = Step([0], [0], 500 * u.ms)
>>>
>>> # Chain using & operator
>>> protocol = baseline & stimulus & recovery
>>> # Total duration is 2000 ms
>>>
>>> # Direct construction
>>> two_phase = Sequential(baseline, stimulus)
__init__(*inputs)[source]#

Initialize the Input base class.

Parameters:

duration (float or Quantity) – The total duration of the input.

Methods

__init__(*inputs)

Initialize the Input base class.

apply(func)

Apply a custom function to the input.

clip([min_val, max_val])

Clip the input values to a range.

generate()

Generate the sequential 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.