NWB conversion scripts and tutorials.
Project description
jaeger-lab-data-to-nwb
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
Install
To clone the repository and set up a conda environment, do:
$ git clone https://github.com/ben-dichter-consulting/jaeger-lab-to-nwb.git
$ 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+https://github.com/ben-dichter-consulting/jaeger-lab-to-nwb.git
Use
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
}
conversion_function(source_paths=source_paths,
f_nwb=f_nwb,
metadata=metadata,
**kwargs_fields)
# Read nwb file and check its content
with pynwb.NWBHDF5IO(f_nwb, 'r') as io:
nwb = io.read()
print(nwb)
2. Command line:
Similarly, the conversion function can be called from the command line in terminal:
$ python conversion_module.py [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 conversion_module.py 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jaeger_lab_to_nwb-0.1.0.tar.gz
.
File metadata
- Download URL: jaeger_lab_to_nwb-0.1.0.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 011885f29d9f251fcb88fe9960a090b7d8461516be6393e515bcca6d69a405df |
|
MD5 | 7fda3dbc166091dfcfbbdd83e989e591 |
|
BLAKE2b-256 | 17d46b4dc9514cc6e0dfa800d2185af0662f8a26c95a0a34518d34b5af6e7d19 |
File details
Details for the file jaeger_lab_to_nwb-0.1.0-py2-none-any.whl
.
File metadata
- Download URL: jaeger_lab_to_nwb-0.1.0-py2-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4715bcea1aa3b1f597e8cc2372ad6d5cea3ffb979e45dd6d8b4c2d9f1b2e69 |
|
MD5 | 54ee7e004690e6c8213361901887b989 |
|
BLAKE2b-256 | 280a74fdbad1c5188e1bc69acae24876772f24e82c577385ec2219fdc690482e |