Skip to main content

Crate dspk_sorter_ms5

Crate dspk_sorter_ms5 

Source
Expand description

MountainSort 5 (Chung et al., Neuron 2017; flatironinstitute/mountainsort5, Apache-2.0), ported from its source: locally exclusive detection (detect), masked snippets (snippets), PCA and the isosplit6 subdivision method (scheme1::subdivision, isosplit6: this crate’s port of magland/isosplit6), median templates and alignment (templates, scheme1), then per-channel classifiers over the whole recording (scheme2), driven by runner. Stages, settings and our choices: the book’s MountainSort 5 pages.

Re-exports§

pub use detect::DetectOptions;
pub use detect::Detections;
pub use detect::Detector;
pub use runner::run;
pub use runner::Mountainsort5Result;
pub use runner::MOUNTAINSORT5_SORTER;
pub use scheme1::cluster_events;
pub use scheme1::cluster_events_with_progress;
pub use scheme1::ClusteringParams;
pub use scheme1::Events;
pub use scheme1::Scheme1Output;
pub use scheme2::ClassifierParams;
pub use scheme2::Classifiers;
pub use snippets::MaskedSnippets;
pub use snippets::SnippetRows;
pub use scheme1::subdivision::isosplit6_subdivision;
pub use scheme1::subdivision::isosplit6_subdivision_with_progress;
pub use scheme1::subdivision::SubdivisionOptions;

Modules§

detect
MountainSort 5 spike detection on the device (mountainsort5/core/detect_spikes.py), then its remove_duplicate_times.
isosplit6
isosplit6: clustering with no cluster count or tuning parameter (Magland & Barnett, ISO-SPLIT, arXiv:1508.04841), ported from magland/isosplit6 (isosplit6.cpp, isocut6.cpp, jisotonic5.cpp, isosplit5.cpp helpers; Apache-2.0), the clustering of MountainSort 5. (Tridesclous 2 uses SpikeInterface’s Python port of it, a separate copy in dspk-sorter-si.)
runner
MountainSort 5 over a whole recording: halo windows streamed through the device, as the Kilosort4 runner (kilosort4::runner).
scheme1
MountainSort 5 scheme 1 (schemes/sorting_scheme1.py) after detection: the events’ masked snippets are clustered and aligned.
scheme2
MountainSort 5 scheme 2 after phase 1 (schemes/sorting_scheme2.py, core/SnippetClassifier.py): one classifier per channel, trained on the phase-1 units, then every spike of the recording classified.
snippets
MountainSort 5 snippets (core/extract_snippets.py): T1 samples before each event to T2 after, on the channels within mask_radius µm of the event’s channel (all channels when None); upstream stores them dense ([L, T, M], zeros off the mask), here only the masked channels are stored ([L, T, max_neighbours]): the same numbers in less memory. The dense form is rebuilt on the device a batch at a time for PCA (SnippetRows, flattened s · M + m as upstream’s reshape((L, T * M))).
templates
MountainSort 5 templates and alignment (core/compute_templates.py, sorting_scheme1.py).

Structs§

Mountainsort5
MountainSort 5 over a whole recording (run).
Mountainsort5Config
MountainSort 5 settings: the package’s defaults, and SpikeInterface’s wrapper’s where the package leaves them to the caller (book: MountainSort 5 parameters).

Enums§

Scheme
One pass (scheme 1) or train on a stretch and classify everything (scheme 2, the default).
TrainingSampling
Where scheme 2’s training stretch comes from.

Functions§

mountainsort5_provenance
Paper and code of MountainSort 5.