FrequencyDomainSpikeDetector#
- class neurodent.core.FrequencyDomainSpikeDetector[source]#
Bases:
objectStatic class for frequency-domain spike detection using STFT and SNEO.
This detector implements a multi-stage pipeline: 1. Preprocessing (bandpass + notch filtering) 2. STFT analysis at specific frequency bands 3. SNEO detection with multi-band consensus voting 4. Spike refinement and morphological validation 5. Temporal clustering and deduplication
- DEFAULT_PARAMS = {'baseline_ms': 500.0, 'bp': [3.0, 40.0], 'cluster_gap_ms': 80.0, 'freq_slices': [10.0, 20.0], 'k_sigma': 3.0, 'notch': 60.0, 'notch_q': 30.0, 'search_ms': 160.0, 'smooth_len': 5, 'smooth_window': 7, 'sneo_percentile': 99.99, 'vote_k': 2, 'window_s': 0.125}#
- static detect_spikes_recording(recording: BaseRecording, detection_params: dict | None = None, chunk_duration_s: float = 3600, multiprocess_mode: Literal['dask', 'serial'] = 'serial') tuple[list[ndarray], mne.io.RawArray][source]#
Detect spikes in a recording using frequency-domain analysis.
When
chunk_duration_sis set, the recording is processed in overlapping time chunks so that the entire recording is analysed without loading it all into RAM at once. Spike indices from adjacent chunks are merged with deduplication at chunk boundaries.- Parameters:
recording (
si.BaseRecording) – The recording to analyzedetection_params (
dict, optional) – Detection parameters. Uses DEFAULT_PARAMS if Nonechunk_duration_s (
float) – Duration in seconds of each processing chunk. Defaults to 3600 (1 hour). Set toNoneto load the full recording into memory at once (fastest, highest RAM).multiprocess_mode (
Literal["dask", "serial"]) – Processing mode
- Returns:
- (spike_indices_per_channel, mne_raw_with_annotations)
spike_indices_per_channel: List of arrays with spike sample indices per channel
mne_raw_with_annotations: MNE RawArray built from the raw/unfiltered recording traces, with spike annotations. Spike detection itself is performed on preprocessed (filtered) chunks; the unfiltered signal is stored so that downstream consumers can inspect waveform context without filtering artifacts.
- Return type:
tuple