Spike-Domain DSP¶
FIR/IIR filters, FFT, wavelet decomposition — all in spike domain.
Filters¶
sc_neurocore.spike_dsp.filters
¶
Spike-domain filtering: process spike trains without converting to float.
FIR: weighted sum of delayed spike trains via coincidence counting. IIR: recursive filtering with leaky integrator (LIF-based).
All operations stay in spike/binary domain for hardware deployment.
SpikeFIR
dataclass
¶
Finite Impulse Response filter in spike domain.
Computes weighted sum of delayed input spike trains. Output at time t = sum(coefficients[k] * input[t-k]) > threshold.
Parameters¶
coefficients : ndarray FIR tap weights. threshold : float Output spike threshold (on weighted sum).
Source code in src/sc_neurocore/spike_dsp/filters.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
filter(spikes)
¶
Apply FIR filter to spike train.
Parameters¶
spikes : ndarray of shape (T,) or (T, N)
Returns¶
ndarray of same shape, binary
Source code in src/sc_neurocore/spike_dsp/filters.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
SpikeIIR
dataclass
¶
Infinite Impulse Response filter using leaky integration.
Membrane-like dynamics: state = decay * state + input_spike. Fires when state exceeds threshold. Natural IIR in spike domain.
Parameters¶
decay : float Decay factor per timestep (0-1). threshold : float gain : float Input spike gain.
Source code in src/sc_neurocore/spike_dsp/filters.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
filter(spikes)
¶
Apply IIR filter to spike train.
Source code in src/sc_neurocore/spike_dsp/filters.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
spike_convolve(spikes, kernel, threshold=0.5)
¶
Convolve a spike train with a kernel in spike domain.
Parameters¶
spikes : ndarray of shape (T,) kernel : ndarray of shape (K,) threshold : float
Returns¶
ndarray of shape (T,), binary
Source code in src/sc_neurocore/spike_dsp/filters.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
Spectral¶
sc_neurocore.spike_dsp.spectral
¶
Spike-domain FFT and power spectrum via time-coded spiking Fourier transform.
Converts spike train to instantaneous firing rate, computes FFT, returns frequency components as spike-rate amplitudes. The firing-rate conversion uses a sliding window (kernel-based) that stays in the integer domain.
spike_fft(spikes, dt=0.001, window_size=50)
¶
Compute FFT of a spike train.
Parameters¶
spikes : ndarray of shape (T,) or (T, N) Binary spike train(s). dt : float Timestep in seconds. window_size : int Sliding window for instantaneous rate estimation.
Returns¶
(frequencies, magnitudes) tuple frequencies: ndarray of shape (F,) magnitudes: ndarray of shape (F,) or (F, N)
Source code in src/sc_neurocore/spike_dsp/spectral.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
spike_power_spectrum(spikes, dt=0.001, window_size=50)
¶
Compute power spectral density of a spike train.
Returns¶
(frequencies, psd) tuple
Source code in src/sc_neurocore/spike_dsp/spectral.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
Wavelets¶
sc_neurocore.spike_dsp.wavelets
¶
Spike-domain wavelet decomposition using multi-scale spike filtering.
spike_wavelet_decompose(spikes, n_scales=4, base_window=4)
¶
Decompose spike train into frequency bands via multi-scale filtering.
Uses cascaded moving-average filters at doubling window sizes: scale 0: window=base_window, scale 1: window=2*base_window, etc. Each scale captures a different frequency band.
Parameters¶
spikes : ndarray of shape (T,) or (T, N) n_scales : int Number of wavelet scales. base_window : int Window size for finest scale.
Returns¶
list of ndarray One array per scale, shape (T,) or (T, N). Binary spike representation of activity at each frequency band.
Source code in src/sc_neurocore/spike_dsp/wavelets.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |