Hough Spiker Algorithm
- hough_spiker(signal: ndarray, window_length: int) ndarray[source]¶
Perform spike detection using the Hough Spiker Algorithm (HSA).
This function detects spikes in an input signal by performing a progressive subtraction operation, where the signal is compared with a convolution result using a boxcar filter. If the signal value exceeds the filter result, the signal is modified by subtracting the filter, and a spike is recorded.
Refer to the Hough Spiker Encoding for a detailed explanation of the HSA.
Code Example
import numpy as np from spikify.encoding.temporal.deconvolution import hough_spiker signal = np.array([0.1, 0.2, 4.1, 1.0, 3.0, 0.3, 0.1]) window_length = 3 spikes = hough_spiker(signal, window_length)
- Parameters:
signal (numpy.ndarray) – The input signal to be analyzed. This should be a numpy ndarray.
window_length (int) – The length of the boxcar filter window.
- Returns:
A 1D numpy array representing the detected spikes.
- Return type:
- Raises:
ValueError – If the input signal is empty or if the window length is greater than the signal length.
TypeError – If the signal is not a numpy ndarray.