Skip to content

Commit bcbc163

Browse files
authored
Merge pull request #154 from MetaCell/release/0.4.0
Release/0.4.0
2 parents 5cfd416 + 3e09800 commit bcbc163

37 files changed

Lines changed: 2912 additions & 2231 deletions

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "9"
3+
- "13"
44
cache:
55
- pip
66
- npm

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ENV FOLDER=nwb-explorer
55
USER root
66
RUN apt-get update -qq &&\
77
apt-get install python3-tk vim nano unzip -qq
8+
RUN npm i -g npm@6
9+
10+
RUN chown -R 1000:100 $HOME/.npm
811
USER $NB_UID
912

1013
RUN jupyter labextension disable @jupyterlab/hub-extension

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,37 @@ conda create -n nwb-explorer python=3.7
3939
conda activate nwb-explorer
4040
```
4141

42-
### Local installation
42+
### Clone "nwb-explorer" Repository
4343

44-
Instructions to get a development environment running.
44+
Clone repository using the development branch:
4545

4646
```bash
4747
git clone -b development https://github.com/MetaCell/nwb-explorer
48+
```
49+
50+
### Run via Docker
51+
52+
There is a [Dockerfile](./Dockerfile) ready to build a container for NWB-Explorer:
53+
54+
```bash
55+
cd nwb-explorer
56+
docker build -t nwb-explorer .
57+
docker run -it -p8888:8888 nwb-explorer
58+
```
59+
Then, after the Docker contained has started, the application is ready at http://localhost:8888
60+
61+
### Local Installation without Docker
62+
63+
Instructions to get a development environment running.
64+
65+
```bash
4866
cd nwb-explorer
4967
python utilities/install.py
5068
```
5169

5270
## How to run NWB Explorer
5371

54-
After the installation is complete, run the script:
72+
After the local installation is complete, run the script:
5573

5674
```bash
5775
cd nwb-explorer
@@ -81,7 +99,7 @@ pip install -e .
8199

82100
### Javascript code from sources
83101

84-
JS/HTML code can be found inside `static/org.geppetto.frontend/src/main/webapp/`. The code needs to be rebuilt with webpack everytime there is a change. To avoid having to do so you can use the Webpack development server running in `/static/org.geppetto.frontend/src/main/webapp/` this command:
102+
JS/HTML code can be found inside `webapp/`. The code needs to be rebuilt with webpack everytime there is a change. To avoid having to do so you can use the Webpack development server running in `webapp/` this command:
85103

86104
```bash
87105
npm run build-dev-noTest:watch
@@ -91,17 +109,6 @@ This will spawn a process that while left running will watch for any changes on
91109

92110
To check if a dependency is installed in development mode, run `pip list`.
93111

94-
### Run via Docker
95-
96-
There is a dockerfile ready to build a container for NWB-Explorer:
97-
98-
```bash
99-
cd nwb-explorer/k8s
100-
docker build -t nwb-explorer .
101-
docker run -it -p8888:8888 nwb-explorer
102-
```
103-
Then, after the docker contained has started, the application is ready http://localhost:8888/geppetto
104-
105112
## Built With
106113

107114
* [Geppetto](http://www.geppetto.org/) - Used to build a web-based application to interpret and visualize the NWB:N 2 files.
@@ -111,11 +118,11 @@ Then, after the docker contained has started, the application is ready http://lo
111118

112119
## Background
113120

114-
The NWB Explorer was initially created by MetaCell to showcase the features of the Geppetto platform to share
115-
neurophysiological data in Neurodata Without Borders format. It was further developed as part of a
116-
Google Summer of Code project with the OpenWorm project. It is currently being extended as part of the Open Source Brain
121+
The NWB Explorer was initially created by [MetaCell](http://metacell.us) to showcase the features of the [Geppetto](http://www.geppetto.org/) platform to share
122+
neurophysiological data in [Neurodata Without Borders](https://www.nwb.org/) format. It was further developed as part of a
123+
[Google Summer of Code](https://summerofcode.withgoogle.com/) project for the [OpenWorm project](http://openworm.org/). It is currently being extended as part of the [Open Source Brain](http://www.opensourcebrain.org/)
117124
project to provide both a standalone and online application for visualising and analysing the contents of NWB:N 2 files.
118-
This work is currently funded by the Wellcome Trust.
125+
This work is currently funded by the [Wellcome Trust](https://wellcome.ac.uk/).
119126

120127
## Authors
121128

k8s/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get(self):
3636
redirection = self.get_next_url(user)
3737
user.spawners[server_name].environment["NWBFILE"] = ''
3838

39-
if 'hub/nwbfile=' in self.request.uri:
39+
if 'nwbfile=' in self.request.uri:
4040
server_name = str(uuid.uuid4()).split('-').pop()
4141
redirection = f'/hub/spawn/{user.name}/{server_name}'
4242
url = self.request.uri.split('=').pop()

nwb-extensions/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Custom pynwb extensions
2+
3+
Place your extensions here

nwb-extensions/silverlab/init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pynwb.get_class('ZplanePockelsDataset', 'silverlab_extended_schema')
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
groups:
2+
- neurodata_type_def: SilverLabMetaData
3+
neurodata_type_inc: LabMetaData
4+
doc: A place to store Silver lab specific metadata
5+
attributes:
6+
- name: silverlab_api_version
7+
dtype: text
8+
doc: For potential future backwards compatibility, store the 'version' of this
9+
API that created the file.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespaces:
2+
- doc: Extensions for acousto-optic lens data
3+
full_name: Silver lab data extension to NWB format for acousto-optic lens experiments
4+
name: silverlab_extended_schema
5+
schema:
6+
- namespace: core
7+
neurodata_types:
8+
- LabMetaData
9+
- source: silverlab.ophys.yaml
10+
- source: silverlab.metadata.yaml
11+
version: '0.2'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
groups:
2+
- neurodata_type_def: SilverLabOptophysiology
3+
neurodata_type_inc: LabMetaData
4+
doc: A place to store Silver lab specific optophysiology data
5+
attributes:
6+
- name: cycle_time
7+
dtype: float
8+
doc: time in seconds for the microscope to acquire all ROIs once and return to
9+
its starting position
10+
- name: cycles_per_trial
11+
dtype: int
12+
doc: how many microscope cycles occur in each experimental trial
13+
- name: frame_size
14+
dtype: int
15+
shape:
16+
- 2
17+
doc: the 2d imaging frame size in voxels
18+
- name: imaging_mode
19+
dtype: text
20+
doc: the acquisition mode for the experiment; pointing = single-voxel ROIs, miniscan
21+
= 2d rectangular ROIs, volume = 3d cuboid ROIs
22+
datasets:
23+
- neurodata_type_def: ZplanePockelsDataset
24+
name: pockels
25+
shape:
26+
- null
27+
- 4
28+
doc: "pockels data set, recording calibration data for focusing at different z-planes\
29+
\ in four columns: Z offset from focal plane (micrometres), normalised Z, 'Pockels'\
30+
\ i.e. laser power in %, and z offset for drive motors"
31+
attributes:
32+
- name: columns
33+
dtype: text
34+
shape:
35+
- 4
36+
doc: column names for the zplane pockels dataset

nwb_explorer/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import logging
2+
import glob
3+
import os
4+
import pynwb
5+
from pynwb import load_namespaces
26

37
from jupyter_geppetto.webapi import RouteManager
48
from pygeppetto.services import model_interpreter, data_manager
@@ -7,6 +11,8 @@
711
from nwb_explorer.nwb_data_manager import NWBDataManager
812
from nwb_explorer.nwb_model_interpreter import NWBModelInterpreter
913

14+
EXTENSION_PATH = 'nwb-extensions'
15+
1016
# Add REST API
1117
RouteManager.add_controller(api.NWBController)
1218
logging.info("Adding NWBModelInterpreter")
@@ -16,3 +22,24 @@
1622
logging.info("Adding NWBDataManager")
1723
# Replace data manager
1824
data_manager.set_data_manager(NWBDataManager())
25+
26+
27+
# This should be temporary. Ideally namespaces should be cached in the NWB files
28+
# See https://github.com/SilverLabUCL/PySilverLabNWB/issues/26
29+
def init_extensions():
30+
31+
for namespace_file in glob.glob(EXTENSION_PATH + '/**/*.namespace.*ml'):
32+
extension_path = os.path.dirname(namespace_file)
33+
extension_name = os.path.basename(extension_path)
34+
logging.info('Initializing extension ' + extension_name)
35+
load_namespaces(namespace_file)
36+
37+
init_file = os.path.join(extension_path, 'init.py')
38+
if os.path.exists(init_file):
39+
try:
40+
with open(init_file) as f:
41+
for line in f:
42+
eval(line)
43+
except Exception as e:
44+
logging.error("Error evaluating extension init file " + init_file, exc_info=True)
45+
init_extensions()

0 commit comments

Comments
 (0)