Skip to main content

NWB conversion scripts and tutorials.

Project description


Convert Jaeger lab data to NWB format.

Currently includes:

  • FRET optical imaging (rsd)
  • Intan electrophysiology (rhd)
  • Labview behavioral data (txt)
  • Optogenetics stimulation data (txt)
  • Treadmill behavior (csv)
  • Bpod behavioral data (mat)

Authors: Luiz Tauffer and Ben Dichter


To clone the repository and set up a conda environment, do:

$ git clone
$ conda env create -f jaeger_lab_to_nwb/make_env.yml
$ source activate jaeger_nwb

Alternatively, to install directly in an existing environment:

$ pip install git+


After activating the correct environment, the conversion function can be used in different forms:

1. Imported and run from a python script:
Here's an example: we'll grab the data from a specific experiment, with several electrophysiology and behavioral data files stored base_path, and save it to a single nwb file.

import pynwb
from jaeger_lab_to_nwb.conversion_module import conversion_function
from pathlib import Path
import yaml

base_path = Path(PATH_TO_FILES)

# Source files
source_paths = dict()
source_paths['dir_ecephys_rhd'] = {'type': 'dir', 'path': base_path}
source_paths['file_electrodes'] = {'type': 'file', 'path': base_path.joinpath('UD09_impedance_1.csv')}
source_paths['dir_behavior_treadmill'] = {'type': 'dir', 'path': base_path}

# Output .nwb file
f_nwb = 'my_experiment.nwb'

# Load metadata from YAML file
metafile = 'metafile.yml'
with open(metafile) as f:
    metadata = yaml.safe_load(f)

# Lab-specific kwargs
kwargs_fields = {
    'add_rhd': True,
    'add_treadmill': True


# Read nwb file and check its content
with pynwb.NWBHDF5IO(f_nwb, 'r') as io:
    nwb =

2. Command line:
Similarly, the conversion function can be called from the command line in terminal:

$ python [output_file] [metafile] [--file_behavior_bpod]
[--dir_behavior_treadmill] [--dir_ecephys_rhd] [--file_electrodes]
[--dir_behavior_labview] [--dir_cortical_imaging] [--add_bpod] [--add_rhd]
[--add_treadmill] [--add_labview] [--add_ophys]

For example, the same experiment converted above with a python script could be converted with this command line input:

$ python my_experiment.nwb metafile.yml --add_rhd --add_treadmill
--dir_behavior_treadmill PATH_TO_FILES --dir_ecepys_rhd PATH_TO_FILES
--file_electrodes PATH_TO_FILES\UD09_impedance_1.csv

3. Graphical User Interface:
To use the GUI, just type in the terminal:

$ nwbn-gui-jaeger [--experiment_name]

The GUI eases the task of editing the metadata of the resulting nwb file, it is integrated with the conversion module (conversion on-click) and allows for quick visual exploration the data in the end file with nwb-jupyter-widgets.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jaeger-lab-to-nwb, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size jaeger_lab_to_nwb-0.1.0-py2-none-any.whl (31.5 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size jaeger_lab_to_nwb-0.1.0.tar.gz (20.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page