Wrangling Spike Trains

In this chapter, we introduce the standard spike wrangling techniques that any neuroscientist should be familiar with. Specifically, we illustrate how to build programs that can analyze and display the information contained in spike trains. We start by showing how to represent and graph the spiking activity of a single neuron in a single spike train, then build toward creating a raster plot that depicts the spiking information of a single neuron over multiple trials. From there, we develop another useful representation of the information in a spike train, the peri-stimulus time histogram (or PSTH). We also cover how to compute latency to first spike and how to represent this joint information as a heat map. Throughout, we use this simple, but highly relevant, example from neuroscience to illustrate key concepts in programming, such as the perils of hard coding or the use of for loops.