braintools.input.exponential_decay#
- braintools.input.exponential_decay(amplitude, tau, duration, t_start=None, t_end=None)#
Generate exponentially decaying input.
Creates an input that decays exponentially from an initial amplitude. Useful for modeling synaptic currents or adaptation processes.
- Parameters:
amplitude (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Initial amplitude of the exponential decay. Supports current units.tau (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Time constant of the exponential decay. 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 decay. Before this, current is 0. Default is 0.t_end (
Array|ndarray|bool|number|bool|int|float|complex|Quantity|None) – End time of the decay. After this, current is 0. Default is duration.
- Returns:
current – The exponentially decaying input.
- Return type:
ndarray or Quantity
Examples
>>> import brainunit as u >>> import brainstate >>> brainstate.environ.set(dt=0.1 * u.ms)
Simple exponential decay
>>> current = exponential_decay( ... amplitude=10 * u.pA, ... tau=20 * u.ms, ... duration=100 * u.ms ... )
Fast decay (mimicking AMPA receptor)
>>> current = exponential_decay( ... amplitude=1 * u.nA, ... tau=2 * u.ms, ... duration=20 * u.ms ... )
Slow decay (mimicking NMDA receptor)
>>> current = exponential_decay( ... amplitude=0.5 * u.nA, ... tau=100 * u.ms, ... duration=500 * u.ms ... )
Delayed decay
>>> current = exponential_decay( ... amplitude=5 * u.pA, ... tau=10 * u.ms, ... duration=100 * u.ms, ... t_start=20 * u.ms, # Start decay at 20ms ... t_end=80 * u.ms # End at 80ms ... )
Notes
The decay follows: I(t) = amplitude * exp(-t/tau)
At t=tau, the current is amplitude/e (~37% of initial)
At t=3*tau, the current is ~5% of initial amplitude