braintools.spike module#
Spike data: the SpikeTrains container, encoders and bitwise operations.
SpikeTrainsstores the spike times of a population in a padded, fixed-shape layout that works underjax.jitandjax.vmap, and converts to and from dense rasters, flat event lists and ragged lists.The encoders (
LatencyEncoder,PoissonEncoder, …) turn numbers or time series into spike rasters.The bitwise functions (
bitwise_or(),bitwise_and(), …) combine spike tensors element-wise and stay differentiable for surrogate-gradient spikes.
Spike data in one place: a fixed-shape container for spike times, encoders that turn numbers or time series into spike rasters, and element-wise bitwise operations on spike tensors.
Spike Trains#
SpikeTrains stores the spike times of a population as a padded
(n_neurons, capacity) array. It is a JAX pytree, so it can be built and
used inside jax.jit and jax.vmap, and it converts to and from dense
rasters (from_dense / to_dense), flat event lists (from_events /
to_events) and ragged per-neuron lists (from_list / to_list).
The braintools.visualize spike plots accept it directly.
Spike times of a population in a padded, fixed-shape layout. |
Spike Encoders#
Encoders that convert continuous-valued signals into spike trains (or, for
StepCurrentEncoder, into input currents) for spiking network
simulations. Before 0.4.0 they lived at the top level (braintools.RateEncoder
and so on); those names are deprecated aliases that will be removed in 1.0.0.
Encode input intensities as the time of a single spike (latency coding). |
|
Encode analog values into spike rates using various rate encoding methods. |
|
Encode inputs as Poisson spike trains. |
|
Encode scalar values using population coding. |
|
Encode inputs using independent Bernoulli processes. |
|
Encode a time series by send-on-delta (level-crossing) modulation. |
|
Encode inputs as step current injections for LIF neurons. |
|
Encode inputs as exact spike counts over time windows. |
|
Encode temporal patterns using synchronized spike timing. |
|
Encode inputs using rank order coding. |
Bitwise Operations#
Element-wise logical operations on spike tensors. Boolean inputs give boolean
results; numeric inputs use arithmetic identities that keep the dtype and stay
differentiable for surrogate-gradient spikes. The former top-level names
(braintools.spike_bitwise_or and so on) remain available as aliases.
Perform a bitwise OR operation on spike tensors. |
|
Perform a bitwise AND operation on spike tensors. |
|
Perform a bitwise IAND (Inverse AND) operation on spike tensors. |
|
Perform a bitwise NOT operation on spike tensors. |
|
Perform a bitwise XOR operation on spike tensors. |
|
Perform a bitwise IXOR (Inverse XOR) operation on spike tensors. |
|
Perform bitwise operations on spike tensors. |