Skip to content

Loading Plexon data into Python

John Pearson edited this page Feb 17, 2017 · 2 revisions

How to load Plexon data from the FHC into Python

Why this guide

The FHC (intraoperative rig) can export to old-style Plexon files. Unfortunately, Plexon only provides C/C++ and Matlab code to read these files. Some intrepid folks have replicated this functionality in Python, but it's a bit more fragile.

Our approach

We'll use Neo. More specifically, we'll use our own fork of the code on GitHub. We need to use the GitHub code instead of the package on PyPI (what you get from pip install) because there's a bug in the 0.4.1 release that's only currently (Feb 2017) fixed on master. We need to use our own fork because the FHC export removes the date from the file but Neo assumes the date information in the plx file constitutes a valid date-time. I modified the code in our fork to remedy that.

What you need to do

  1. Clone the Neo code:

    git clone [email protected]:pearsonlab/python-neo
    
  2. Check out my modified branch:

    git checkout jmp/nodt
    
  3. Add the python-neo directory to your system's PYTHONPATH variable. If you're on a Mac, you'll add the following line at the end of the .bash_profile file in your home directory. If you're on Linux, you'll add it to .profile in the same place:

    export PYTHONPATH="$HOME/<path-to>/python-neo:$PYTHONPATH"

    where <path-to> is replaced by the path to python-neo. For instance, on my machine, where the path to the library is ~/code/python-neo, I'd have

    export PYTHONPATH="$HOME/code/python-neo:$PYTHONPATH"
  4. With the data in <current directory>/data, you should then be able to run something like this gist.