Deconvolution Decoder
- deconvolution_decoder(spikes: ndarray, fir_bank: ndarray, shift: ndarray, norm: ndarray | None = None) ndarray[source]¶
Perform signal reconstruction via deconvolution decoding of a spike train.
The Deconvolution Decoder reverses the encoding performed by spike-based deconvolution algorithms such as the Hough Spiker (HSA), its Modified variant (MHSA) and Bens Spiker (BSA). Given a binary spike train and the FIR filter bank produced during encoding, it reconstructs an approximation of the original continuous signal by applying each feature’s filter to its corresponding spike train using causal linear filtering.
Note
The
fir_bank,shift, andnormparameters should be the values returned directly by the encoder algorithm to ensure accurate inversion of all pre-processing steps.If
normisNone, no amplitude rescaling is applied; only the per-feature shift is restored. Passnormexplicitly whenever the encoder performed normalization. Only MHSA and HSA have normalization steps, while BSA does not.
Code Example:
import numpy as np from spikify.encoders.temporal.deconvolution import modified_hough_spiker from spikify.decoders.temporal.deconvolution import deconvolution_decoder signal = np.array([0.1, 0.2, 0.3, 1.0, 0.5, 0.3, 0.1]) window_length = 3 threshold = 0.5 cutoff = 0.1 spikes, fir_bank, shift, norm = modified_hough_spiker(signal, window_length, cutoff, threshold) reconstructed = deconvolution_decoder(spikes, fir_bank, shift, norm)
- Parameters:
spikes (numpy.ndarray) – Binary spike train to decode (values in {0, 1}), as produced by any of the deconvolution family encoders (HSA, MHSA, BSA).
fir_bank (numpy.ndarray) – FIR filter coefficients used during encoding. Each column corresponds to the filter applied to one feature or channel. This is the
fir_bankvalue returned directly by the encoder.shift (numpy.ndarray) – Per-feature shift values subtracted during encoding to ensure signal non-negativity. This is the
shiftvalue returned directly by the encoder.norm (numpy.ndarray | None) – Per-feature normalization values used during encoding to scale the signal to [0, 1]. If
None, no amplitude rescaling is applied and only the shift is restored. This is thenormvalue returned directly by the encoder.
- Returns:
A numpy array representing the reconstructed continuous signal approximation.
- Return type:
- Raises:
ValueError – If the input spike train is empty.