Skip to content

Commit

Permalink
Merge branch 'master' into include-custom-widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
luiztauffer committed Nov 9, 2022
2 parents 19ea6f4 + 616ed9a commit 43bb21e
Show file tree
Hide file tree
Showing 45 changed files with 1,279 additions and 106 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -139,4 +139,7 @@ dmypy.json
*.code-workspace

# Local History for Visual Studio Code
.history/
.history/

# NWB streaming cache
*/nwb-cache
23 changes: 23 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,23 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
fail_on_warning: false # Eventually, you'll want this to be true

# Python requirements required to build your docs
python:
install:
- requirements: requirements-rtd.txt
- method: pip
path: .
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
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](https://badge.fury.io/py/nwbwidgets.svg)](https://badge.fury.io/py/nwbwidgets)
[![codecov](https://codecov.io/gh/NeurodataWithoutBorders/nwb-jupyter-widgets/branch/master/graph/badge.svg)](https://codecov.io/gh/NeurodataWithoutBorders/nwb-jupyter-widgets)
[![codecov](https://codecov.io/gh/NeurodataWithoutBorders/nwbwidgets/branch/master/graph/badge.svg)](https://codecov.io/gh/NeurodataWithoutBorders/nwbwidgets)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/NeurodataWithoutBorders/nwb-jupyter-widgets/master?filepath=examples%2FNWBWidgets-modality-demos.ipynb)

Expand Down
16 changes: 16 additions & 0 deletions docker/Dockerfile
@@ -0,0 +1,16 @@
FROM python:3.10

RUN cd ..
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install -r requirements.txt \
&& pip install git+https://github.com/NeurodataWithoutBorders/nwbwidgets.git

COPY notebook.ipynb .
RUN mkdir nwb-cache

EXPOSE 8866
CMD ["voila", "notebook.ipynb", "--port=8866", "--Voila.ip=0.0.0.0", "--enable_nbextensions=True", "--autoreload=True", "--no-browser"]

# EXPOSE 8888
# CMD ["jupyter", "notebook", "notebook.ipynb", "--port=8888", "--ip=0.0.0.0", "--no-browser", "--allow-root", "--NotebookApp.token=''"]
23 changes: 23 additions & 0 deletions docker/README.md
@@ -0,0 +1,23 @@
## Build Docker Image

From `/docker` directory, run:
```bash
$ docker build -t nwbwidgets-voila .
```

## Run Docker Image

To run with `Panel`:
```bash
$ docker run -p 8866:8866 nwbwidgets-voila
```

By default, the Panel will run with `enable_local_source=False` (see [Panel](https://nwb-widgets.readthedocs.io/en/latest/contents/quickstart.html#basic-usage-with-panel)). To allow for local files browsering, run the container with:
```bash
$ docker run -p 8866:8866 -e ENABLE_LOCAL_SOURCE=True nwbwidgets-voila
```

To run for a specific NWB file, pass the s3 url as an ENV variable to the container:
```bash
$ docker run -p 8866:8866 -e S3_URL_NWBFILE=<s3_url_to_nwb_file> nwbwidgets-voila
```
Binary file added docker/favicon.ico
Binary file not shown.
74 changes: 74 additions & 0 deletions docker/notebook.ipynb
@@ -0,0 +1,74 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"\n",
"s3_url = os.getenv(\"S3_URL_NWBFILE\", None)\n",
"enable_local_source = bool(os.getenv(\"ENABLE_LOCAL_SOURCE\", False))\n",
"\n",
"if s3_url:\n",
" from pynwb import NWBHDF5IO\n",
" from nwbwidgets import nwb2widget\n",
" from dandi.dandiapi import DandiAPIClient\n",
" import h5py\n",
" import fsspec\n",
" from fsspec.implementations.cached import CachingFileSystem\n",
" \n",
" # Create a virtual filesystem based on the http protocol and use caching to save accessed data to RAM.\n",
" fs = CachingFileSystem(\n",
" fs=fsspec.filesystem(\"http\"),\n",
" cache_storage=\"nwb-cache\", # Local folder for the cache\n",
" )\n",
" f = fs.open(s3_url, \"rb\")\n",
" file = h5py.File(f)\n",
" io = NWBHDF5IO(file=file, load_namespaces=True)\n",
" nwbfile = io.read()\n",
" w = nwb2widget(nwbfile)\n",
"else:\n",
" from nwbwidgets import Panel\n",
" w = Panel(enable_local_source=enable_local_source)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"w"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.5 ('base')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
},
"vscode": {
"interpreter": {
"hash": "698d109e506a444d1bfd677c8f66adf4920b11c19b28ee52fae9b02c95d46a98"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
35 changes: 35 additions & 0 deletions docker/requirements.txt
@@ -0,0 +1,35 @@
pynwb>=2.2.0
dandi>=0.46.6
nwbwidgets>=0.10.0
ndx-grayscalevolume==0.0.2
ndx-icephys-meta==0.1.0
ndx-spectrum==0.2.2
voila==0.3.6
numpy==1.23.3
matplotlib==3.6.1
scikit-image==0.19.3
plotly==5.10.0
ipydatagrid==1.1.13
ipydatawidgets==4.3.2
ipytree==0.2.2
ipyvolume==0.6.0a10
ipyvue==1.8.0
ipyvuetify==1.8.4
ipywebrtc==0.6.0
ipywidgets==7.7.2
ipykernel==6.16.0
ipympl==0.9.2
jupyter_client==7.4.2
jupyter_core==4.11.1
jupyter-server==1.21.0
jupyterlab==3.4.8
jupyterlab-pygments==0.2.2
jupyterlab_server==2.15.2
jupyterlab-widgets==1.1.1
tqdm>=4.36.0
zarr==2.13.3
aiohttp==3.8.3
tifffile==2022.10.10
trimesh==3.15.4
importlib-metadata<5.0
fsspec==2022.8.2
20 changes: 20 additions & 0 deletions docs/Makefile
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
11 changes: 11 additions & 0 deletions docs/README.md
@@ -0,0 +1,11 @@
## Build documentation

To run auto-doc for the API, from `/docs` run:
```bash
$ sphinx-apidoc -f -o ./source/api_reference ../nwbwidgets
```

To build the HTML, from `/docs` run:
```bash
$ sphinx-build -b html ./source ./build
```
35 changes: 35 additions & 0 deletions docs/make.bat
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Binary file added docs/source/_static/examples/example_ecephys.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/examples/example_icephys.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/examples/example_subject.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/examples/example_units.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/panel.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/source/api_reference/modules.rst
@@ -0,0 +1,7 @@
nwbwidgets
==========

.. toctree::
:maxdepth: 4

nwbwidgets
21 changes: 21 additions & 0 deletions docs/source/api_reference/nwbwidgets.analysis.rst
@@ -0,0 +1,21 @@
nwbwidgets.analysis package
===========================

Submodules
----------

nwbwidgets.analysis.spikes module
---------------------------------

.. automodule:: nwbwidgets.analysis.spikes
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: nwbwidgets.analysis
:members:
:undoc-members:
:show-inheritance:
37 changes: 37 additions & 0 deletions docs/source/api_reference/nwbwidgets.controllers.rst
@@ -0,0 +1,37 @@
nwbwidgets.controllers package
==============================

Submodules
----------

nwbwidgets.controllers.group\_and\_sort\_controllers module
-----------------------------------------------------------

.. automodule:: nwbwidgets.controllers.group_and_sort_controllers
:members:
:undoc-members:
:show-inheritance:

nwbwidgets.controllers.misc module
----------------------------------

.. automodule:: nwbwidgets.controllers.misc
:members:
:undoc-members:
:show-inheritance:

nwbwidgets.controllers.time\_window\_controllers module
-------------------------------------------------------

.. automodule:: nwbwidgets.controllers.time_window_controllers
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: nwbwidgets.controllers
:members:
:undoc-members:
:show-inheritance:
21 changes: 21 additions & 0 deletions docs/source/api_reference/nwbwidgets.dashboards.rst
@@ -0,0 +1,21 @@
nwbwidgets.dashboards package
=============================

Submodules
----------

nwbwidgets.dashboards.allen module
----------------------------------

.. automodule:: nwbwidgets.dashboards.allen
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: nwbwidgets.dashboards
:members:
:undoc-members:
:show-inheritance:

0 comments on commit 43bb21e

Please sign in to comment.