- Visit the web-formatted version of the book.
- Read and interact with the Python code in your web browser.
- See below
This repository is a companion to the textbook Case Studies in Neural Data Analysis, by Mark Kramer and Uri Eden. That textbook used MATLAB to analyze examples of neuronal data. The material here is similar, except that we use Python.
The intended audience is the practicing neuroscientist - e.g., the students, researchers, and clinicians collecting neuronal data in the hospital or lab. The material can get pretty math-heavy, but we've tried to outline the main concepts as directly as possible, with hands-on implementations of all concepts. We focus on only two main types of data: spike trains and electric fields (such as the local field potential [LFP], or electroencephalogram [EEG]). If you're interested in other data (e.g., calcium imaging, or BOLD), you may still find the examples indirectly useful (for example, demonstrations of how to compute and interpret a power spectrum of a signal).
This repository was created by Emily Schlafly and Mark Kramer, with important contributions from Dr. Anthea Cheung.
There are multiple ways to interact with these notebooks.
-
Simple: Visit the web-formatted version of the notebooks.
-
Intermediate Open a notebook in Binder and interact with the notebooks through a JupyterHub server. Binder provides an easy interface to interact with this material; read about it in eLife.
-
Advanced: Run the notebooks locally on your computer in Jupyter. You'll then be able to read, edit and execute the Python code directly in your browser and you can save any changes you make or notes that you want to record. To access and download a notebook, visit the Contents. You will need to install Python and we recommend configure Python.
We assume you have installed Python and can get it running on your computer. Some useful references to do so include,
If this is your first time working with Python, using Anaconda is probably a good choice. It provides a simple, graphical interface to start Jupyter.
Once you have installed Anaconda or Miniconda, we recommend setting up an environment to run the notebooks. Type the following code into your terminal to create and activate an environment called csn.
conda create env --file csn.yml
conda activate csn
This will ensure that you have all the packages needed to run the notebooks. If you run a notebook at this point, you may notice that when you generate plots, they look different. If you want to match the formatting in the published version, you can run the following in your terminal:
mkdir ~/.jupyter
cp -ir assets/custom ~/.jupyter/
mkdir -p ~/.ipython/profile_default/
cp -ir startup ~/.ipython/profile_default/
Note that if you already have files in these directories, you will be prompted to overwrite them. In this case, you may prefer to append the contents to the end of the existing files. You can do this with the following:
for f in $(ls assets/custom); do echo $(assets/custom/$f) >> ~/.jupyter/custom/$f; done
for f in $(ls startup); do echo $(startup/$f) >> ~/.ipython/profile_default/startup/$f; done
- Introduction to Python
- The Event-Related Potential
- The Power Spectrum (Part 1)
- The Power Spectrum (Part 2)
- The Cross Covariance and Coherence
- Filtering Field Data
- Cross Frequency Coupling
- Basic Visualizations and Descriptive Statistics of Spike Train Data
- Modeling place Fields with Point Process Generalized Linear Models
- Analysis of Rhythmic Spiking in the Subthalamic Nucleus During a Movement Task
- Analysis of Spike-Field Coherence