Class SpikeDetector

Class Documentation

class SpikeDetector

Public Functions

SpikeDetector(unsigned int nchannels, double threshold, unsigned int peak_life_time)
inline ~SpikeDetector()
void reset()
unsigned int nchannels() const
double threshold() const
void set_threshold(double value)
unsigned int peak_life_time() const
void set_peak_life_time(unsigned int value)
uint64_t timestamp_detected_spike() const
const std::vector<double> &amplitudes_detected_spike() const
template<typename ForwardIterator>
inline bool is_spike(const uint64_t timestamp, const ForwardIterator sample)

Spike detection algorithm:

  • operates sample by sample

  • looks for upwards deflections in at least one of the channels above a certain threshold

  • a spike is detected if the signal of at least one channel crosses the threshold and a local maxima is found in at least one channel (not necessarily the same of that of threshold crossing) within a certain duration (determined by the peak lifetime)

  • the timestamp of the detected spike corresponds to that one of the first sample that crossed the threshold first (independently on whether that sample belongs to the current or previous buffers)

  • in case a proper maximum is found on all channels, the peak values are returned, together with the threshold-crossing timestamp; however, if on one or more channels no peaks were found, the values of the signals at the threshold-crossing sample will be returned.

bool is_spike(const uint64_t timestamp, const std::vector<double> &sample)
uint64_t nspikes() const