braintools.input.burst

Contents

braintools.input.burst#

braintools.input.burst(burst_amp, burst_freq, burst_duration, inter_burst_interval, n_bursts, duration)#

Generate burst pattern input.

Creates a pattern of oscillatory bursts separated by quiet periods. Each burst consists of sinusoidal oscillations at a specified frequency. Useful for studying burst-induced plasticity or rhythmic stimulation.

Parameters:
  • burst_amp (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Amplitude of oscillation during burst. Supports current units.

  • burst_freq (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Frequency of oscillation within each burst. Must be in Hz units.

  • burst_duration (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Duration of each burst. Supports time units.

  • inter_burst_interval (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Time between end of one burst and start of next. Supports time units.

  • n_bursts (int) – Number of bursts to generate.

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

Returns:

current – The burst pattern input.

Return type:

ndarray or Quantity

Raises:

AssertionError – If burst_freq is not in Hz units.

Examples

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

Theta burst stimulation

>>> current = burst(
...     burst_amp=10 * u.pA,
...     burst_freq=100 * u.Hz,  # 100Hz within burst
...     burst_duration=50 * u.ms,  # 50ms bursts
...     inter_burst_interval=150 * u.ms,  # 150ms between bursts
...     n_bursts=5,
...     duration=1000 * u.ms
... )

Gamma burst pattern

>>> current = burst(
...     burst_amp=5 * u.nA,
...     burst_freq=40 * u.Hz,  # Gamma frequency
...     burst_duration=100 * u.ms,
...     inter_burst_interval=100 * u.ms,
...     n_bursts=10,
...     duration=2000 * u.ms
... )

High-frequency stimulation protocol

>>> current = burst(
...     burst_amp=20 * u.pA,
...     burst_freq=200 * u.Hz,
...     burst_duration=20 * u.ms,
...     inter_burst_interval=80 * u.ms,
...     n_bursts=20,
...     duration=2000 * u.ms
... )

Slow oscillatory bursts

>>> current = burst(
...     burst_amp=1 * u.nA,
...     burst_freq=5 * u.Hz,  # Slow oscillation
...     burst_duration=500 * u.ms,
...     inter_burst_interval=500 * u.ms,
...     n_bursts=3,
...     duration=3000 * u.ms
... )

Notes

  • Total period per burst = burst_duration + inter_burst_interval

  • Bursts that would extend beyond duration are truncated

  • The oscillation within each burst starts at phase 0