Skip to the content.

logo

GitHub

Overview

SimSort is a deep learning–based framework for spike sorting, pre-trained with large-scale biologically realistic simulations of extracellular recordings.

Currently, SimSort supports tetrode (4-channel) recordings. SimSort 2.0 for Neuropixels is on the way!


How To Install SimSort

πŸ”§ Installation (Linux/macOS/Windows)

We recommend installing SimSort in a conda environment with PyTorch + CUDA for optimal performance. CPU-only inference is supported but significantly slower.

Step 1. Clone the repository

git clone https://github.com/SimSortTool/SimSort-Tetrode.git
cd SimSort-Tetrode

Step 2. Set up environment

# Create and activate conda environment
conda create -n SimSort python=3.10 -y
conda activate SimSort
# Install Python dependencies
pip install -r model/requirements.txt

‼️ Additionally, you need to install PyTorch following the official setup guide depending on your system configuration.

Step 3. Download pre-trained models (Manual)

Please manually download the following two zip files:

Extract both zip files into the folder:

SimSort-Tetrode/model/simsort_pretrained/

After extraction, the directory structure should look like this:

model/simsort_pretrained/
β”œβ”€β”€ detector_bbp_L1-L5-8192/
β”‚   β”œβ”€β”€ detection_config.yaml
β”‚   β”œβ”€β”€ detection_aug_config.yaml
β”‚   └── saved_models/
β”‚       β”œβ”€β”€ checkpoint.pth
β”‚       └── args.yaml
└── extractor_bbp_L1-L5-8192/
    β”œβ”€β”€ config.yaml
    β”œβ”€β”€ aug_config.yaml
    └── saved_models/
        β”œβ”€β”€ checkpoint.pth
        └── args.yaml

πŸŽ‰ Running SimSort on Your Own Neural Data

Here is the example in model/SimSort_Tool_Demo.ipynb. You can run the Jupyter notebook directly from that location.

Setp 1. Load Your Recording

SimSort use SpikeInterface to load neural recordings, supporting common formats such as .plx, .mda, .npy, and binary .bin files.

Here’s an example of a .plx recording:

import spikeinterface.extractors as se
from task.custom_sorting import SortingTask

recording_file = r'custom_data/4chTetrodeDemoPLX.plx'
recording = se.PlexonRecordingExtractor(recording_file, stream_name='TETWB')

πŸ”Ž For more formats, see: Supported File Formats


Setp 2. Spike Sorting

sorting = SortingTask(recording=recording, verbose=False)
sorting.run()

SimSort’s sorting pipeline includes:


Step 3. Save Results

sorting.save_results(output_dir='./simsort_results')

This saves the spike waveforms, timestamps, and unit IDs to disk.


πŸ“š Advanced Usage

For more advanced usage such as model training and benchmarking (available on Linux/macOS or Windows via WSL):


πŸ“’ Questions?

Feel free to open issues on GitHub if you run into any problems!