EMUsort
EMUsort sorts motor-unit action potentials (MUAPs) from high-density intramuscular arrays such as Myomatrix. It is a fork of Kilosort4, adapted to what makes muscle recordings hard: the same unit reaches channels at different times (conduction along the fibres), waveforms are complex and polyphasic, and units overlap heavily.
In dsp-kitchen it lives in the dspk-sorter-kilosort crate (feature emusort). It is written from the paper and the published defaults, with upstream’s code read to match its behaviour and no code copied, and is GPL-3.0 like upstream. Because it is a fork, it reuses every Kilosort4 stage with its own settings and adds two stages.
What EMUsort changes in Kilosort4
Section titled “What EMUsort changes in Kilosort4”| Change | Why (paper) |
|---|---|
| Channel-delay removal before detection | a MUAP reaches channels up to a few ms apart |
| 9 temporal PCs and 9 universal templates (Kilosort4: 6 and 6) | more complex waveforms |
Several clip thresholds [6, 9, 12, 15] (Kilosort4: one, 6) |
later-recruited, larger units were missed by one threshold |
| HDBSCAN outlier removal before the templates are clustered | movement artifacts contaminate the templates |
| No common average reference | a MUAP spans many channels; subtracting the average removes signal |
Template-learning stride nskip 2 (Kilosort4: 25) |
more MUAP waveforms for the templates |
| Clips scaled by one common factor (Kilosort4: each to unit norm) | keeps relative amplitudes, so the templates separate MUAP sizes |
What is implemented
Section titled “What is implemented”| Stage | Status |
|---|---|
Whole-recording run (Emusort::run, dspk sort), Kilosort4’s runner with EMUsort’s plan |
implemented |
| Channel-delay estimation and removal | implemented (device) |
| Universal templates learned with HDBSCAN outlier removal and several thresholds | implemented (device) |
| Universal-template detection and features | implemented (device, shared with Kilosort4) |
| Clustering, learned templates, learned-template matching, clustering of the matches | implemented (device, shared with Kilosort4) |
| Refractory (CCG) criteria, global merges, duplicate-spike removal | implemented (shared with Kilosort4) |
EMUsort’s unit score (cluster_score_threshold) |
not yet |
EMUsort learns its universal templates from every recording; it publishes no weight or template files.
Citation
Section titled “Citation”O’Connell S., Michaels J. A., Wang R., Mamidipaka S., Venkatesh M., Aresh N., Pachitariu M., Pruszynski J. A., Sober S. J., Pandarinath C. High performance sorting of motor unit action potentials with EMUsort. eLife 15:RP110417 (2026), reviewed preprint, CC-BY 4.0. doi:10.7554/eLife.110417.1. Preprint: bioRxiv, doi:10.64898/2026.01.06.697952.
@article{oconnell2026emusort, title = {High performance sorting of motor unit action potentials with {EMUsort}}, author = {O'Connell, Sean and Michaels, Jonathan A and Wang, Runming and Mamidipaka, Sahit and Venkatesh, Manikandan and Aresh, Nevin and Pachitariu, Marius and Pruszynski, J Andrew and Sober, Samuel J and Pandarinath, Chethan}, journal = {eLife}, year = {2026}, volume = {15}, pages = {RP110417}, doi = {10.7554/eLife.110417.1}}| Code | snel-repo/EMUsort (GPL-3.0, commit a06bb60) and its Kilosort4 fork snel-repo/Kilosort4 (GPL-3.0, compared against Kilosort4 v4.0.18) |
| Arrays | Myomatrix: Chung et al., Myomatrix arrays for high-definition muscle recording, eLife (2023), doi:10.7554/eLife.88551 |
Run it
Section titled “Run it”dspk sort emusort recording.bin -o sorted --format phyEvery setting and its default: EMUsort settings. How it works: pipeline. What to change: tuning.