- Introduced by
- Kenneth Harris
- Year
- 2000
- Type
- Neuronal activity classification pipeline
- Family
- Single-unit electrophysiology
What does it do?
Spike sorting is an electrophysiological technique for identifying and isolating the action potentials of individual neurons from extracellular recordings.
It assigns spikes recorded on electrode arrays to their putative neuron of origin, so that each neuron's firing pattern, timing and interactions can be studied at single-cell resolution.
The intuition behind the method
Extracellular electrodes record voltage fluctuations from neurons near the electrode tip, so the spikes (action potentials) of several nearby neurons are mixed in one signal. Spike sorting separates this mixture into individual neuron contributions. Each neuron tends to produce a characteristic waveform shape, which depends on its geometry, its distance from the electrode and its conduction properties. Clustering similar waveforms groups together spikes that probably came from the same neuron, and the resulting spike trains show when each neuron fired. The separation is an inference from waveform similarity, so its reliability depends on how distinct the waveforms are.
History
Harris and colleagues described tetrode-based spike sorting for recording from multiple neurons. Advances in microelectrode arrays (silicon probes, polymer arrays) expanded channel counts from 4–32 to 100–1000+. Machine learning and deep learning approaches have since been applied to improve accuracy and scalability. Community toolboxes, including Kilosort, Ironclust and the toolbox described by Yger et al. (2018), which was tested on recordings with up to 4225 electrodes, have made the method more widely accessible.
When to use it
Choose spike sorting when the question depends on the activity of individual neurons, for example firing dynamics, neural coding of stimuli or choices, or the spike-timing relationships between units. It suits studies that correlate single-neuron firing with behaviour and analyses of circuits based on spike trains, provided the recording has enough signal-to-noise ratio to separate units. Do not use it when population-level activity answers the question; local field potentials are a common alternative for that purpose. Also avoid relying on it when the recording is so noisy or drifts so much that stable units cannot be isolated, because the resulting units will be unreliable. Its results rest on assumptions that should be checked: each unit should reflect a single neuron, spike waveforms should remain stable across the recording, and refractory-period violations are the usual sign of contamination.
Limitations and considerations
- Detection bias toward nearby neurons: units close to the electrode are overrepresented and distant neurons are underdetected, so the sorted population is not a representative sample of the surrounding tissue.
- Ambiguous isolation: contamination (noise or spikes from other neurons assigned to a unit) and merging (true spikes missed or split across units) are both common, and each distorts firing statistics.
- Weak ground truth: direct validation is rare. The Yger et al. (2018) toolbox was checked against simultaneous extracellular and loose-patch recordings in rodents, but such ground truth is not routinely available, so the accuracy of sorting in a given study is often difficult to verify directly.
- Computational demand: recordings with more than 1000 channels require sophisticated algorithms and hardware.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Single-cell resolution: spikes can be attributed to individual neurons rather than to a pooled population signal.
- Millisecond-scale timing: spike times allow analysis of precise timing relationships and synchrony between units.
- Applicable beyond the exposed cortical surface: penetrating electrodes can reach deeper regions, although yield remains biased toward neurons near the electrode (see limitations).
- Scales to many units: modern arrays record from hundreds to thousands of units.
Applications
- Cognitive neuroscience: recording from prefrontal and parietal cortex during decision-making to study neuronal coding of choices
- Sensory neuroscience: mapping receptive fields and population coding of sensory features in visual, auditory, and somatosensory cortex
- Learning and memory: tracking neuronal plasticity during learning via changes in firing patterns
- Circuit neuroscience: inferring putative connections between neurons from cross-correlations of spike trains
How it works
How it works
Record extracellular voltage continuously from electrode arrays (tetrodes, silicon probes and similar devices) during neural activity.
Apply a bandpass filter that keeps the spike band and removes slow field potentials and high-frequency noise, then detect spike times, typically by threshold crossing or another detection rule.
Extract the waveform around each detected spike (a short voltage snippet) and compute features such as peak amplitude, principal components or energy.
Cluster the spike waveforms with unsupervised methods (for example k-means, Gaussian mixture models, template matching or machine learning approaches) so that spikes from the same neuron fall into one group.
Assign spikes to units (putative neurons) and compute statistics such as firing rate, interspike interval and burst patterns, then analyse firing across the population of units.
Common pitfalls
- Over-clustering and under-clustering: amplitude variation can split one neuron into several units, while similar waveforms from distinct neurons can be merged.
- Ignoring contamination: some units contain a substantial fraction of spikes from other neurons. Estimate contamination per unit (for example from refractory-period violations) and report the estimate with the results.
- Assuming stable spike shapes: spike amplitudes can drift over hours as electrodes move. Segment the recording into epochs and re-sort if drift is detected.
- Neglecting state dependence: spike waveforms can vary with network state, so analyse waveform variability across brain states before treating a unit as stable.
Frequently asked questions
What waveform features should I use for clustering?
Common features are peak amplitude, trough amplitude, action potential width, principal components of the waveform and energy. No single feature set is agreed to be optimal. A common practice is to use more than one representation (raw waveforms, principal components, templates) and to check that clustering results hold across several algorithms, so that conclusions do not depend on one feature choice.
How do I estimate unit quality and spike contamination?
Contamination is commonly estimated from refractory-period violations: two spikes less than 2 ms apart (for example) suggest that spikes from two neurons were erroneously assigned to one unit. The refractory period used to flag violations is a choice and must be reported with the contamination estimate. The interspike-interval violation rate is therefore an indicator of contamination. Other metrics include isolation distance (distance from the cluster centre) and the L-ratio (overlap with noise). Report all the quality metrics you use. A 5% contamination level is sometimes used as an example exclusion guideline; the threshold should be chosen and justified for each study rather than treated as a fixed standard.
Can automated spike sorting replace manual curation?
Not fully. Automated tools such as Kilosort and Ironclust reduce the manual effort required, but manual inspection remains the usual check for over-clustering and under-clustering. As the number of units grows, full manual curation becomes harder, so automated sorting is usually followed by targeted expert validation.
How do I handle spike amplitude drift over recording time?
Drift occurs when electrodes move slightly during recording. Monitor spike waveforms over time; if clear amplitude changes occur, re-sort the recording in shorter blocks. The block length should be chosen and justified for each recording. Some algorithms, such as Kilosort, account for drift. Alternatively, drift can be estimated offline with template matching and used to correct the waveforms before the final spike sorting.
Related methods
Sources
Harris, K. D., Csicsvari, J., Hirase, H., et al. (2016). Accuracy of tetrode spike separation as determined by simultaneous intracellular and extracellular recordings. Journal of Neurophysiology, 84(1), 401–414.
Open publication referenceYger, P., Spampinato, G. L., Esposito, E., et al. (2018). A spike sorting toolbox for up to thousands of electrodes validated with ground truth recordings in vitro and in vivo. eLife, 7, e34518.
Open DOI reference