braintools.input.DoubleExponential#

class braintools.input.DoubleExponential(amplitude, tau_rise, tau_decay, duration, t_start=None, t_end=None)#

Generate double exponential (alpha function) input.

Creates an input with distinct rise and decay phases, commonly used to model synaptic currents. The shape is characterized by a rapid rise followed by a slower decay, creating an asymmetric pulse.

Parameters:
  • amplitude (float) – Peak amplitude of the pulse. Can include units.

  • tau_rise (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Rise time constant. Smaller values give faster rise.

  • tau_decay (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Decay time constant. Should be larger than tau_rise.

  • duration (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Total duration of the input signal.

  • t_start (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – Start time of the pulse. Default is 0.

  • t_end (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – End time of the pulse. Default is duration.

amplitude#

The peak amplitude.

Type:

float

tau_rise#

The rise time constant.

Type:

Quantity or float

tau_decay#

The decay time constant.

Type:

Quantity or float

duration#

The total duration.

Type:

Quantity or float

t_start#

The pulse start time.

Type:

Quantity or float or None

t_end#

The pulse end time.

Type:

Quantity or float or None

See also

ExponentialDecay

For single exponential dynamics.

GaussianPulse

For symmetric pulse shapes.

Notes

The alpha function follows: amplitude * (exp(-t/tau_decay) - exp(-t/tau_rise)) for t >= 0

The function is normalized so the peak equals the specified amplitude. Time to peak: t_peak = (tau_rise * tau_decay)/(tau_decay - tau_rise) * ln(tau_decay/tau_rise) This class uses the functional double_exponential API internally.

Examples

AMPA-like synaptic current:

>>> ampa = DoubleExponential(
...     amplitude=1.0 * u.nA,
...     tau_rise=0.5 * u.ms,
...     tau_decay=5 * u.ms,
...     duration=50 * u.ms
... )
>>> array = ampa()

NMDA-like synaptic current (slower dynamics):

>>> nmda = DoubleExponential(
...     amplitude=0.5 * u.nA,
...     tau_rise=2 * u.ms,
...     tau_decay=50 * u.ms,
...     duration=200 * u.ms
... )

Synaptic current with noise:

>>> from braintools.input import WienerProcess
>>> alpha = DoubleExponential(1.0, 5 * u.ms, 20 * u.ms, 200 * u.ms)
>>> noise = WienerProcess(200 * u.ms, sigma=0.05)
>>> synaptic = alpha + noise

Train of synaptic inputs:

>>> # Multiple EPSPs at different times
>>> times = [10, 30, 55, 80] * u.ms
>>> epsps = []
>>> for t in times:
...     epsps.append(DoubleExponential(
...         1.0, 1 * u.ms, 10 * u.ms, 150 * u.ms, t_start=t
...     ))
>>> epsp_train = sum(epsps[1:], epsps[0])

Paired-pulse facilitation:

>>> # Second pulse larger than first
>>> pulse1 = DoubleExponential(1.0, 2 * u.ms, 15 * u.ms, 100 * u.ms, t_start=20 * u.ms)
>>> pulse2 = DoubleExponential(1.5, 2 * u.ms, 15 * u.ms, 100 * u.ms, t_start=40 * u.ms)
>>> ppf = pulse1 + pulse2

Combined fast and slow components:

>>> fast = DoubleExponential(0.7, 0.5 * u.ms, 5 * u.ms, 100 * u.ms)
>>> slow = DoubleExponential(0.3, 5 * u.ms, 50 * u.ms, 100 * u.ms)
>>> mixed = fast + slow

Inhibitory synaptic current:

>>> ipsc = DoubleExponential(
...     amplitude=-0.8 * u.nA,  # Negative for inhibition
...     tau_rise=1 * u.ms,
...     tau_decay=20 * u.ms,
...     duration=100 * u.ms
... )
__init__(amplitude, tau_rise, tau_decay, duration, t_start=None, t_end=None)[source]#

Initialize double exponential.

Parameters:
  • amplitude (float) – Peak amplitude.

  • tau_rise (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Rise time constant.

  • tau_decay (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Decay time constant.

  • duration (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Total duration of the input.

  • t_start (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – Start time of the pulse. Default is 0.

  • t_end (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – End time of the pulse. Default is duration.

Methods

__init__(amplitude, tau_rise, tau_decay, ...)

Initialize double exponential.

apply(func)

Apply a custom function to the input.

clip([min_val, max_val])

Clip the input values to a range.

generate()

Generate the double exponential array using functional API.

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.