Getting Started

What is Spykes?

Almost any electrophysiology study of neural spiking data relies on a battery of standard analyses. Raster plots and peri-stimulus time histograms aligned to stimuli and behavior provide a snapshot visual description of neural activity. Similarly, tuning curves are the most standard way to characterize how neurons encode stimuli or behavioral preferences. With increasing popularity of population recordings, maximum-likelihood decoders based on tuning models are becoming part of this standard.

Yet, virtually every lab relies on a set of in-house analysis scripts to go from raw data to summaries. We want to improve this status quo in order to enable easier sharing, better reproducibility and fewer bugs.

Spykes is a collection of Python tools to make the visualization and analysis of neural data easy and reproducible.

At present, spykes comes with four classes:

  • NeuroVis helps you plot beautiful spike rasters and peri-stimulus time histograms (PSTHs).
  • PopVis helps you plot population summaries of PSTHs as normalized averages or heat maps.
  • NeuroPop helps you estimate tuning curves of neural populations and decode stimuli from population vectors with maximum-likelihood decoding.
  • STRF helps you estimate spatiotemporal receptive fields.

Spykes deliberately does not aim to provide tools for spike sorting or file I/O with popular electrophysiology formats, but only aims to fill the missing niche for neural data analysis and easy visualization. For file I/O, see Neo and OpenElectrophy. For spike sorting, see Klusta.


For most cases (including following along with the examples) it is sufficient to just install the vanilla version.


This installs the current version from PyPi.

pip install spykes


This installs the most recent version from Github.

pip install git+git://

Local Version

This creates a local copy of the repo, where you can make changes to Spykes that get propagated to your project.

git clone  # Clone this somewhere useful
pip install -e .[develop]


The examples use real datasets. Instructions for downloading these datasets are included in the notebooks. We recommend deepdish for reading the HDF5 datafile.