braintools.input.GaussianPulse#

class braintools.input.GaussianPulse(amplitude, center, sigma, duration)#

Generate Gaussian-shaped pulse input.

Creates a smooth, bell-shaped current pulse centered at a specific time. This is useful for modeling smooth synaptic inputs, sensory stimuli, or any input requiring a gradual rise and fall.

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

  • center (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Center time of the pulse peak.

  • sigma (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Standard deviation (width) of the pulse. Larger values create wider pulses.

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

amplitude#

The peak amplitude.

Type:

float

center#

The center time.

Type:

Quantity or float

sigma#

The standard deviation.

Type:

Quantity or float

duration#

The total duration.

Type:

Quantity or float

See also

DoubleExponential

For asymmetric pulse shapes.

ExponentialDecay

For one-sided decay.

Notes

The pulse follows the Gaussian formula: amplitude * exp(-0.5 * ((t - center) / sigma)^2)

Approximately 99.7% of the pulse is contained within center ± 3*sigma. This class uses the functional gaussian_pulse API internally.

Examples

Single Gaussian pulse:

>>> pulse = GaussianPulse(
...     amplitude=1.0 * u.nA,
...     center=100 * u.ms,
...     sigma=20 * u.ms,
...     duration=200 * u.ms
... )
>>> array = pulse()

Multiple overlapping pulses:

>>> pulse1 = GaussianPulse(1.0, 100 * u.ms, 20 * u.ms, 500 * u.ms)
>>> pulse2 = GaussianPulse(0.8, 300 * u.ms, 30 * u.ms, 500 * u.ms)
>>> double_pulse = pulse1 + pulse2

Train of Gaussian pulses:

>>> # Create evenly spaced pulses
>>> centers = [50, 150, 250, 350] * u.ms
>>> pulses = []
>>> for center in centers:
...     pulses.append(GaussianPulse(0.5, center, 10 * u.ms, 400 * u.ms))
>>> pulse_train = sum(pulses[1:], pulses[0])  # Sum all pulses

Amplitude modulation with Gaussian envelope:

>>> from braintools.input import Sinusoidal
>>> envelope = GaussianPulse(1.0, 250 * u.ms, 50 * u.ms, 500 * u.ms)
>>> carrier = Sinusoidal(1.0, 50 * u.Hz, 500 * u.ms)
>>> modulated = envelope * carrier

Noisy Gaussian pulse:

>>> from braintools.input import WienerProcess
>>> pulse = GaussianPulse(2.0, 100 * u.ms, 15 * u.ms, 200 * u.ms)
>>> noise = WienerProcess(200 * u.ms, sigma=0.1)
>>> noisy_pulse = pulse + noise

Wide and narrow pulses comparison:

>>> narrow = GaussianPulse(1.0, 100 * u.ms, 5 * u.ms, 200 * u.ms)
>>> wide = GaussianPulse(1.0, 100 * u.ms, 30 * u.ms, 200 * u.ms)
>>> # Combine with different weights
>>> mixed = 0.7 * narrow + 0.3 * wide

Inverted (inhibitory) pulse:

>>> inhibitory = GaussianPulse(-0.5, 150 * u.ms, 25 * u.ms, 300 * u.ms)
>>> # Or use negation operator
>>> excitatory = GaussianPulse(0.5, 150 * u.ms, 25 * u.ms, 300 * u.ms)
>>> inhibitory = -excitatory
__init__(amplitude, center, sigma, duration)[source]#

Initialize Gaussian pulse.

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

  • center (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Center time of the pulse.

  • sigma (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Standard deviation (width).

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

Methods

__init__(amplitude, center, sigma, duration)

Initialize Gaussian pulse.

apply(func)

Apply a custom function to the input.

clip([min_val, max_val])

Clip the input values to a range.

generate()

Generate the Gaussian pulse 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.