Skip to content

mhhennig/HS2

Repository files navigation

Herding Spikes 2 Lightning

Fast spike sorting for high density multielectrode arrays

PyPI version Build Status

Spikes


Update July 2024

This is a new version 0.4, which introduces new, fast and performant spike detection code.

The final legacy version is 0.3.104, which introduced compatibility with SpikeInterface. SpikeInterface wraps many spike sorters, can read almost any file format and contains other useful functionality into a single code base.

This new version still supports the old detection code and can be used to transition to the new code.


Software for high density electrophysiology

This software provides functionality for the detection, localisation and clustering of spike data from dense multielectrode arrays based on the methods described in the following papers:

J.-O. Muthmann, H. Amin, E. Sernagor, A. Maccione, D. Panas, L. Berdondini, U.S. Bhalla, M.H. Hennig MH (2015). Spike detection for large neural populations using high density multielectrode arrays. Front. Neuroinform. 9:28. doi: 10.3389/fninf.2015.00028.

G. Hilgen, M. Sorbaro, S. Pirmoradian, J.-O. Muthmann, I. Kepiro, S. Ullo, C. Juarez Ramirez, A. Puente Encinas, A. Maccione, L. Berdondini, V. Murino, D. Sona, F. Cella Zanacchi, E. Sernagor, M.H. Hennig (2016). Unsupervised spike sorting for large scale, high density multielectrode arrays. Cell Reports 18, 2521–2532. bioRxiv: http://dx.doi.org/10.1101/048645.

This implementation is highly efficient, spike sorting runs in real time on recordings from 4,096 channels or more at 20+kHz on a desktop PC. Large recordings with millions of events can be sorted in minutes. No GPU is required, and the code is fully parallelised.

Since we believe publicly funded research code should be free and open, this code is released under GPL-3.0.

Supported systems

  • any recording system supported by SpikeInterface
  • 3Brain BIOCAM and BIOCAM X (custom implementation only in versions 0.3.XXX), for Lightning use SpikeInterface to read raw data
  • this software was developed specifically for high density multielectrode arrays, for example the Neuropixels probe, the SinAPS probes, or high-density MEAs such as the BioCam or the MaxWell Biosystems HD-MEA
  • what herding spikes is not: performance is poor for recording systems with few recording channels and channels separated by more than 60 microns; for such recordings, use one of the many other sorters available in SpikeInterface](https://github.com/SpikeInterface/spikeinterface)

Installing Herdingspikes

The code has been tested with Python version 3.12. We suggest you use Miniconda, Anaconda or Mamba to set up a working Python system. We also recommend installing the code in a virtual environment, e.g.:

    conda create -n hs python cython numpy
    conda activate hs

A pip distribution is available and can be installed as follows:

    pip install numpy cython # if not already installed
    pip install herdingspikes

Windows and Mac users follow the instructions here.

From source

The module can automatically be installed, including all dependencies, by cloning this repository:

    git clone https://github.com/mhhennig/HS2.git

Then run:

    pip install numpy cython
    pip install -e .

Documentation

A quick start guide is available.

This document explains how to use Herdingspikes with SpikeInterface.

Example code is in the folder notebooks. These can be run without installing HS2 system-wide and requires to run python setup.py build_ext --inplace in the HS2 directory. Next, run jupyter notebook and navigate to the directory to try the code.

Contributors, alphabetical

Contact

The herders are based at the School of Informatics, University of Edinburgh. Contact us here, we are happy to help.