braintools.input.ConstantValue

braintools.input.ConstantValue#

class braintools.input.ConstantValue(value, duration)#

A constant value input.

Parameters:
  • value (float) – The constant value.

  • duration (float | Quantity) – Duration for which to generate the constant.

Examples

>>> # Usually created implicitly
>>> sine = Sinusoidal(1.0, 10 * u.Hz, 100 * u.ms)
>>> with_offset = sine + 0.5  # Creates ConstantValue(0.5, 100*u.ms)
>>>
>>> # Direct construction
>>> baseline = ConstantValue(0.1, 500 * u.ms)
__init__(value, duration)[source]#

Initialize the Input base class.

Parameters:

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

Methods

__init__(value, duration)

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 constant array.

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.