This is nwbwidgets, widgets for viewing the contents of a NWB-file in Jupyter Notebooks using ipywidgets.
Project description
Explore NWB data in Jupyter
Table of Contents
About
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.
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
Using Panel
The easiest way to use NWB widgets is with the interactive Panel
:
from nwbwidgets.panel import Panel
Panel()
Using nwb2widget
If you’re working directly with a NWB file object in your Jupyter notebook, you can also explore it with NWB Widgets using
from pynwb import NWBHDF5IO
from nwbwidgets import nwb2widget
io = NWBHDF5IO('path/to/file.nwb', mode='r')
nwb = io.read()
nwb2widget(nwb)
Using Docker
You can also run the NWB Widgets Panel using Docker:
$ docker run -p 8866:8866 ghcr.io/NeurodataWithoutBorders/nwbwidgets-panel:latest
Demo
Documentation
See our ReadTheDocs page for full documentation, including a gallery of all supported formats.
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
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 nwbwidgets-0.11.1.tar.gz
.
File metadata
- Download URL: nwbwidgets-0.11.1.tar.gz
- Upload date:
- Size: 11.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c9d6c6536db34d9bfa9fa1a2e975813dbd160327de9038191611b55846ad45e |
|
MD5 | 3bb2ab6ede3057060efe9013ace4339b |
|
BLAKE2b-256 | 8b1ca5af26dd5de7f53623c797e1e77a0fe51b4d477db7457d09da62d5f6b78d |
File details
Details for the file nwbwidgets-0.11.1-py3-none-any.whl
.
File metadata
- Download URL: nwbwidgets-0.11.1-py3-none-any.whl
- Upload date:
- Size: 73.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 256cb0f5560f696fc44de806e82c810383a624334fde99b2bb4a3643b4aedaba |
|
MD5 | 61b5301088871127a49107e02b7d10d9 |
|
BLAKE2b-256 | c0b30f45a760be1eafe457d42b5b19af66ce36edf308c88d81b796bc28b1e9c2 |