Systems neuroscience with Python: peering into the "black box"

Narendra Mukherjee

Brandeis University

About me

Systems neuroscience

Study of neural circuits and the brain 'systems' they form in the context of animal behavior.

In-vivo electrophysiology (Ephys) is a crucial technique: recording the activity of neurons in awake, behaving animals.

The black box of Ephys

Peeking into the black box

Big data challenge!

Superpowers needed!

Hierarchical Data Format (HDF5)

Creating a HDF5 file

import tables

# Create hdf5 file
hf5 = tables.open_file(hdf5_name[-1]+'.h5', 'w',
          title = hdf5_name[-1])

# Node for raw electrode data
hf5.create_group('/', 'raw')

# Node for digital inputs
hf5.create_group('/', 'digital_in')

# Node for digital outputs
hf5.create_group('/', 'digital_out')

# Create an array with data
hf5.create_array('/raw', 'electrode1', electrode1_data)

Pytables loves Numpy

The data is extracted as numpy arrays following the hierarchy of the nodes in the HDF5 file

# Extract the spike waveforms of neuron 1
data = hf5.root.sorted_units.unit001.waveforms[:]

Meta-data resides in the same file

# Define a UnitDescriptor class to be used
# to add things (anything!) about the sorted
# units to a pytables table
class UnitDescriptor(tables.IsDescription):

    electrode_number = tables.Int32Col()

    # Is this a single neuron?
    single_unit = tables.Int32Col()

    # 2 types of single neurons
    regular_spiking = tables.Int32Col()
    fast_spiking = tables.Int32Col()

More utilities with Pytables

GNU Parallel for parallelizing processing

GUI for user inputs: easygui

import easygui

# Get name of directory with the data files
dir_name = easygui.diropenbox()

# Get the type of data files (.rhd or .dat)
file_type = easygui.multchoicebox(msg = 'File type',
                                  choices = ('.dat', '.rhd'))

Data analysis stack

Spike sorting "transparent box"

Results: spikes from single neurons

More details

Paper in Proceedings of Scipy 2017

Katz lab website

Github: narendramukherjee/blech_clust

Email: narendra(at)brandeis(dot)edu

All thanks to...

Right, Down, Page DownNext slide
Left, Up, Page UpPrevious slide
POpen presenter console
HToggle this help