Skip to main content

This is nwbwidgets, widgets for viewing the contents of a NWB-file in Jupyter Notebooks using ipywidgets.

Project description

NWB Widgets

A library of widgets for visualization NWB data in a Jupyter notebook (or lab). The widgets allow you to navigate through the hierarchical structure of the NWB file and visualize specific data elements. It is designed to work out-of-the-box with NWB 2.0 files and to be easy to extend.

PyPI version codecov License Binder

Installation

nwbwidgets requires Python >= 3.7.

The latest published version can be installed by running:

pip install nwbwidgets

Note that there are some optional dependencies required for some widgets. If an NWB data file contains a data type that requires additional dependencies, you will see a list of extra modules needed for that specific widget. All other widgets in the file will still work.

Usage

from pynwb import NWBHDF5IO
from nwbwidgets import nwb2widget

io = NWBHDF5IO('path/to/file.nwb', mode='r')
nwb = io.read()

nwb2widget(nwb)

Demo

How it works

All visualizations are controlled by the dictionary neurodata_vis_spec. The keys of this dictionary are pynwb neurodata types, and the values are functions that take as input that neurodata_type and output a visualization. The visualizations may be of type Widget or matplotlib.Figure. When you enter a neurodata_type instance into nwb2widget, it searches the neurodata_vis_spec for that instance's neurodata_type, progressing backwards through the parent classes of the neurodata_type to find the most specific neurodata_type in neurodata_vis_spec. Some of these types are containers for other types, and create accordian UI elements for its contents, which are then passed into the neurodata_vis_spec and rendered accordingly.

Instead of supplying a function for the value of the neurodata_vis_spec dict, you may provide a dict or OrderedDict with string keys and function values. In this case, a tab structure is rendered, with each of the key/value pairs as an individual tab. All accordian and tab structures are rendered lazily- they are only called with that tab is selected. As a result, you can provide may tabs for a single data type without a worry. They will only be run if they are selected.

Extending

To extend NWBWidgets, all you need to a function that takes as input an instance of a specific neurodata_type class, and outputs a matplotlib figure or a jupyter widget.

Used in

Project details


Download files

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

Source Distribution

nwbwidgets-0.10.2.tar.gz (11.0 MB view details)

Uploaded Source

Built Distribution

nwbwidgets-0.10.2-py3-none-any.whl (72.7 kB view details)

Uploaded Python 3

File details

Details for the file nwbwidgets-0.10.2.tar.gz.

File metadata

  • Download URL: nwbwidgets-0.10.2.tar.gz
  • Upload date:
  • Size: 11.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nwbwidgets-0.10.2.tar.gz
Algorithm Hash digest
SHA256 f9cbba0c8c4617a427c862024099dd0240ff2bc58f75a89e2c3c0ff6869fe778
MD5 0df02176d64450930d2c66319d1b6eaf
BLAKE2b-256 c5e9ef97b5d88dcf30f559be57486e9e808a68f7b2f10d61bf38503d78c81ce5

See more details on using hashes here.

File details

Details for the file nwbwidgets-0.10.2-py3-none-any.whl.

File metadata

  • Download URL: nwbwidgets-0.10.2-py3-none-any.whl
  • Upload date:
  • Size: 72.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nwbwidgets-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7484ff76a3a84c5032148d6bf8948a55e7fc8f222c88a49de179d0a120adf320
MD5 2db81ca4eed9eabcb708ed3224b11c12
BLAKE2b-256 143627e49e78805e46daf55afe6a9f351dc1e2a4b7d2e9094b54eefe83ee8025

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page