braintools.input.double_exponential

braintools.input.double_exponential#

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

Generate double exponential input (alpha function).

Creates an input with a rapid rise and slower decay, commonly used to model synaptic currents. The waveform follows: I(t) = A * N * (exp(-t/tau_decay) - exp(-t/tau_rise)) where N is a normalization factor ensuring peak amplitude equals A.

Parameters:
  • amplitude (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Peak amplitude of the double exponential. Supports current units.

  • tau_rise (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Rise time constant. Must be smaller than tau_decay. Supports time units.

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

  • 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 waveform. Default is 0.

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

Returns:

current – The double exponential input.

Return type:

ndarray or Quantity

Examples

>>> import brainunit as u
>>> import brainstate
>>> brainstate.environ.set(dt=0.1 * u.ms)

AMPA-like synaptic current

>>> current = double_exponential(
...     amplitude=1 * u.nA,
...     tau_rise=0.5 * u.ms,
...     tau_decay=5 * u.ms,
...     duration=30 * u.ms
... )

NMDA-like synaptic current

>>> current = double_exponential(
...     amplitude=0.5 * u.nA,
...     tau_rise=2 * u.ms,
...     tau_decay=100 * u.ms,
...     duration=500 * u.ms
... )

GABA-A like inhibitory current

>>> current = double_exponential(
...     amplitude=-0.8 * u.nA,  # Negative for inhibition
...     tau_rise=0.5 * u.ms,
...     tau_decay=10 * u.ms,
...     duration=50 * u.ms
... )

Delayed synaptic input

>>> current = double_exponential(
...     amplitude=2 * u.pA,
...     tau_rise=1 * u.ms,
...     tau_decay=15 * u.ms,
...     duration=100 * u.ms,
...     t_start=20 * u.ms  # Delay of 20ms
... )

Notes

  • Peak occurs at t_peak = tau_rise * tau_decay / (tau_decay - tau_rise) * ln(tau_decay/tau_rise)

  • The function is normalized so the peak value equals the specified amplitude

  • tau_decay must be greater than tau_rise for realistic waveforms