Python package for parsing Open Ephys data.
Python reader for Open Ephys.
In order to install the pyopenephys package, open a terminal and run:
pip install pyopenephys
If you want to install from sources and get the latest updates, clone the repo and install locally:
git clone https://github.com/CINPLA/pyopenephys cd pyopenephys python setup.py install # use 'python setup.py develop' to install fixed bugs
Pyopenephys allows the user to load data recorded with Open Ephys. Currently, only the binary (recommended) and openephys (support for this format will be dropped in future releases) are supported.
The first step is creating a
File object. It only requires to pass the paht to the recording folder.
import pyopenephys file = pyopenephys.File("path-to-recording-folder")
The file object contains the different experiments (corresponding to different settings files) and each experiment contains a set of recordings.
# all experiments experiments = file.experiments print(len(experiments)) # recordings of first experiment experiment = experiments recordings = experiment.recordings print(len(experiments)) # access first recording recording = recordings
Experiments store some useful information:
experiment.datetimecontains the starting date and time of the experiment creation
experiment.sig_chainis a dictionary containing the processors and nodes in the signal chain
experiment.settingsis a dictionary with the parsed setting.xml file
experiment.acquisition_systemcontains the system used to input continuous data (e.g. 'Rhythm FPGA')
Recordings contain the actual data:
recording.durationis the duration of the recording (in seconds)
recording.sample_rateis the sampling frequency (in Hz)
recording.analog_signalsis list of
AnalogSignalobjects, which in turn have a
times(in s), and
recording.eventsis list of
EventDataobjects, which in turn have a
recording.trackingis list of
TrackingDataobjects , which in turn have a
metadatafields. Tracking data are recorded with the
Trackingplugin (https://github.com/CINPLA/tracking-plugin) and are save in binary format only (not in openephys format).
recording.spiketrainsis list of
SpikeTrainobjects, which in turn have a
metadatafields. Spiketrains are saved by the
Spike Viewersink in the Open Ephys GUI, in combination with either the
With a few lines of code, the data and relevant information can be easily parsed and accessed:
import pyopenephys import matplotlib.pylab as plt file = pyopenephys.File("path-to-recording-folder") # experiment 1 (0 in Python) experiment = file.experiments # recording 1 recording = experiment.recordings print('Duration: ', recording.duration) print('Sampling Rate: ', recording.sample_rate) analog_signals = recording.analog_signals events_data = recording.events spiketrains = recording.spiketrains # tracking_data are accessible only using binary format tracking_data = recording.tracking # plot analog signal of channel 4 signals = analog_signals fig_an, ax_an = plt.subplots() ax_an.plot(signals.times, signals.signal) # plot raster for spike trains fig_sp, ax_sp = plt.subplots() for i_s, sp in enumerate(spiketrains): ax_sp.plot(sp.times, i_s*np.ones(len(sp.times)), '|') plt.show()
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyopenephys-1.1.4-py3-none-any.whl (27.2 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size pyopenephys-1.1.4.tar.gz (15.8 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for pyopenephys-1.1.4-py3-none-any.whl