IBL-to-nwb
This repository houses the modules used to convert IBL specific neurophysiology data in the open source ONE format (Alyx + ALF) into NWB data standard.
- Alyx: a data base that contains all the metadata associated with an experiment: session details, subject details, probe information etc. This data has a one-to-one mapping to supported metadata of NWB.
- ALF: format for storage of all the experimental data: electrophysiology time series (raw + processed), trials data, sorted spikes data, behavior (raw + processed), stimulus.
The figure below shows the mapping from ALF/ALyx to NWB:
Usage:
-
IBL to NWB conversion (using API):
-
Installation:
cd desired-path git clone https://github.com/catalystneuro/IBL-to-nwb.git cd IBL-to-nwb
create virtual environment and install dependencies from requirements.txt:
conda env create -f conda_environment.yaml conda activate IBL2NWB
-
Retrive the id of the experiment of interest using ONE api:
from oneibl.one import ONE one=ONE() # use the ONE doc to use correct search terms to retrieve the eid eid = one.search(date_range=['2020-03-23', '2020-03-24'],subject='CSH_ZAD_011')[0] # example eid: eid = 'da188f2c-553c-4e04-879b-c9ea2d1b9a93'
-
Using the eid, generate a json file containing all the collected data/metadata from the servers (Example output file):
from .ibl_nwb import Alyx2NWBMetadata metadata_object = Alyx2NWBMetadata(eid=eid,one_obj=one) # alternatively, you can also provide one search **kwargs directly: metadata_obj = Alyx2NWBMetadata(date_range=['2020-03-23', '2020-03-24'],subject='CSH_ZAD_011') json_save_loc = r'path-to-save-json-file.json' metadata_obj.write_metadata(json_save_loc)
-
Generate nwb file using the saved json file:
from .ibl_nwb import Alyx2NWBConverter nwb_saveloc = r'nwb-save-path.nwb' save_raw = False # keep as true if you want to add raw (ephysData.raw.* , camera.raw*) files, these are large files and will take time to download and create the nwbfile!! converter=Alyx2NWBConverter(nwb_metadata_file=json_save_loc, saveloc=nwb_saveloc, save_raw=save_raw) # alternatively you can also provide the metadata object: converter=Alyx2NWBConverter(metadata_obj=metadata_obj, saveloc=nwb_saveloc) # create nwb file: converter.run_conversion() converter.write_nwb()
This should create an nwb file. Example file.
-
-
IBL to NWB conversion (using GUI):
from .ibl_nwb import Alyx2NWBGui Alyx2NWBGui(eid=eid, nwbfile_saveloc=nwb_saveloc, metadata_fileloc=json_save_loc) #alternatively provide the one search kwargs: Alyx2NWBGui(nwbfile_saveloc=nwb_saveloc, metadata_fileloc=json_save_loc, dataset_types=['_iblmic_audioSpectrogram.frequencies''])
This opens up a gui which will allow you to edit nwbfile/ibl session related metadata and also convert to nwb using
run_conversionbutton. Check the animation below on how to navigate this gui: -
Visualization of nwbfile using nwbwigets in a Jupyter notebook:
from pynwb import NWBHDF5IO from nwbwidgets import nwb2widget from IPython.display import display io = NWBHDF5IO(r"path-to-saved-nwb-file.nwb", mode='r', load_namespaces=True) nwb = io.read() a=nwb2widget(nwb) display(a)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ibl_to_nwb-0.1.0.tar.gz.
File metadata
- Download URL: ibl_to_nwb-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3453c7209b250c86c89045900c88286872ae3ff8d5d5e3d87cee9787363d34d5
|
|
| MD5 |
125f5b45d94c73064caced355a34302e
|
|
| BLAKE2b-256 |
fed094d2137cb83a643d79a1b6c9f6481d698459d47aadc713b63a6e3e4bdc7d
|