neuropixels-analysis

Analyze Neuropixels extracellular recordings end-to-end with SpikeInterface. Covers loading SpikeGLX/Open Ephys/NWB data, preprocessing, drift/motion correction, Kilosort4 (and CPU) spike sorting, quality metrics, and unit curation (threshold-based, model-based UnitRefine, and AI-assisted visual review). Use when working with Neuropixels 1.0/2.0 recordings, spike sorting, or extracellular electrophysiology analysis.

Install

Hot:22

Download and extract to your skills directory

Copy command and send to AI Agent for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=k-dense-ai-skills-neuropixels-analysis&locale=en&source=copy

Neuropixels Data Analysis - An End-to-End Neural Recording Processing Tool

Skill Overview


neuropixels-analysis provides end-to-end analysis tools for high-density Neuropixels recordings based on SpikeInterface, covering the complete workflow from loading SpikeGLX/Open Ephys/NWB data to spike sorting, quality control, and unit selection.

Use Cases

1. Neuropixels Probe Data Processing


When you need to process extracellular electrophysiology recordings from Neuropixels 1.0 or 2.0 probes, this skill offers a standardized preprocessing pipeline. It supports SpikeGLX formats such as .ap.bin, .lf.bin, and .meta, as well as Open Ephys and NWB formats. It automatically performs high-frequency filtering, ADC phase correction, common reference, and bad channel detection to lay the foundation for subsequent analyses.

2. Spike Sorting and Quality Control


Run Kilosort4 (requires a CUDA GPU) or CPU-based sorters (SpykingCircus2, Mountainsort5, Tridesclous2) to classify neurons. It automatically computes quality metrics such as signal-to-noise ratio, ISI violations, presence ratio, and amplitude cutoff. It supports Allen Institute-style threshold-based filtering, the UnitRefine model for unit classification, and AI-assisted visual curation to help you quickly identify high-quality single units.

3. Visualization and Results Export


It generates visualizations including waveform plots, autocorrelograms, and drift raster maps. You can export results to Phy for manual review or save them in NWB format for long-term storage and sharing. A full set of script templates is included, from testing with 60-second data slices to full end-to-end batch processing, supporting both rapid iteration and deployment in production environments.

Core Features

1. Automated Preprocessing Pipeline


Integrates SpikeInterface best practices: performs high-frequency filtering (≥400 Hz), bad channel detection and removal, phase correction (Neuropixels 1.0), and a global median reference. It saves the preprocessed binary files to avoid redundant computation while meeting Kilosort4 input format requirements. Includes drift detection and optional motion correction (supports rigid and nonrigid modes) to handle signal degradation caused by probe movement during recordings.

2. Multi-Platform Spike Sorting


Supports GPU-accelerated Kilosort4 (recommended) as well as CPU-only SpykingCircus2, Mountainsort5, and Tridesclous2. External sorters can be run via Docker containers without needing to install complex dependencies locally. It automatically creates a SortingAnalyzer, computes waveform templates, peak amplitudes, unit locations, and template similarity, and outputs structured quality-metric tables.

3. Flexible Unit Selection Strategies


Provides a three-tier selection approach: fast threshold-based filtering (e.g., amplitude_cutoff < 0.1), UnitRefine model classification (noise vs neural; single-unit vs multi-unit), and AI-assisted review (using Claude API vision models to evaluate uncertain units). Combined with external tools such as Bombcell/UnitMatch, it balances automation with manual curation.

FAQs

What data formats does neuropixels-analysis support?


This skill natively supports SpikeGLX (.ap.bin, .lf.bin, .meta), Open Ephys (.continuous, .oebin), and NWB (.nwb). Data can be loaded using SpikeInterface’s read_spikeglx(), read_openephys(), and read_nwb() functions. It automatically detects available data streams (e.g., imec0.ap, imec0.lf). It supports Neuropixels 1.0 (960 electrodes, 384 channels) and 2.0 probes (1280 electrodes for single-probe, or 4-shank 5120 electrodes).

How do I choose a spike sorter?


Prioritize Kilosort4 (requires a CUDA GPU). It is the fastest and provides the highest classification accuracy. Without a GPU, SpykingCircus2, Mountainsort5, and Tridesclous2 are CPU implementations packaged with SpikeInterface, requiring no additional installation. For very large datasets or special needs, you can run external sorters like Kilosort2.5 via Docker containers. Use si.installed_sorters() to view the list of installed sorters.

Is motion correction mandatory?


It is recommended to always check for drift before spike sorting (using plot_drift_raster_map()). When drift exceeds about 10 μm, it significantly reduces spike sorting quality and increases false positives/false negatives. This skill provides several motion correction presets: rigid_fast (light correction), nonrigid_fast_and_accurate (balanced), and dredge (state-of-the-art but time-consuming). For short-term recordings or stable fixed experiments, you can skip correction; for freely moving animals or long-duration recordings, it is strongly recommended to perform it.