Skip to main content

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:

  1. IBL to NWB conversion (using API):

    1. 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
      
    2. 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'
      
    3. 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)
      
    4. 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.

  2. 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_conversion button. Check the animation below on how to navigate this gui:

  3. 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)
    

Metadata

Release files for ibl-to-nwb 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ibl-to-nwb 0.1.0
File Size Uploaded Provenance Actions
ibl_to_nwb-0.1.0.tar.gz 3.9 kB Without provenance Details for ibl_to_nwb-0.1.0.tar.gz

Release files / ibl_to_nwb-0.1.0.tar.gz

Download URL ibl_to_nwb-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3453c7209b250c86c89045900c88286872ae3ff8d5d5e3d87cee9787363d34d5
BLAKE2b-256 checksum
How to use checksums
fed094d2137cb83a643d79a1b6c9f6481d698459d47aadc713b63a6e3e4bdc7d
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for ibl-to-nwb 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page