Automated spike sorting pipeline for OpenEphys recordings with Kilosort4 and SpikeInterface.
uv seems to be simpler and faster alternative to conda. (SpikeInterface's tips on uv)
Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Exit and reopen your terminal after installation.
git clone https://github.com/Senzai-Lab/kilosort_pipeline.git
cd kilosort_pipeline
uv syncLinux:
source .venv/bin/activateWindows (CMD):
.venv\Scripts\activate- Edit
config.yaml:
session_name: "session_name" # timestamp auto-appended
recording_paths: # OpenEphys session folders containing structure.oebin file
- "/path/to/session1"
- "/path/to/session2"
local_output: "/local/disk" # path to local SSD
base_output: "/remote/storage" # path to fsmresfiles
# Optional parameters
target_fs: 1250 # EEG downsampling (Hz)
save_kwargs:
n_jobs: 16
chunk_duration: '2s'
mp_context: 'spawn' # for Windows; use 'fork' for macOS/Linux- Run pipeline:
# Process all probes
python -m run_pipeline
# Process from common config
python -m run_pipeline --config R:/remote_path/config.yaml
# Process specific probe(s)
python -m run_pipeline --probe ProbeA
python -m run_pipeline --probe ProbeA ProbeB{local_output}/{session_name}/
├── {session_name}_{timestamp}.log # Timestamped log file
├── ProbeA/
│ ├── concat/
│ │ └── traces_cached_seg0.raw # Concatenated binary file
│ ├── eeg/
│ │ └── eeg_data.bin # Downsampled EEG (if target_fs set)
│ ├── kilosort/ # Kilosort4 outputs
│ │ ├── spike_times.npy
│ │ ├── spike_clusters.npy
│ │ └── ...
│ └── sync/ # Synchronized spikes
│ └── spike_times_synced.npy # Spike times in ADC time scale
└── ProbeB/
├── ...