Skip to content

Commit 5cfd416

Browse files
authored
Merge pull request #120 from MetaCell/release/0.3.0
Release/0.3.0 download source file, cumulative fixes
2 parents b7cd8fa + b3feb93 commit 5cfd416

9 files changed

Lines changed: 30 additions & 27 deletions

File tree

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*pyc
44
/static/
55
/dependencies/
6-
/webapp/build/
7-
/webapp/node_modules/
6+
# webapp/build/
7+
# /webapp/node_modules/
88
/webapp/geppetto-client/
99
.DS_Store
1010
*.egg-info/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
NWB Explorer is a web application that can be used by scientists to read, visualize and explore
88
the content of NWB:N 2 files.
99

10+
![nwbexplorer](https://user-images.githubusercontent.com/39889/67516734-24c1e380-f66f-11e9-9fba-5151118f5e4d.gif)
11+
1012
Learn more about the [Neurodata Without Borders](https://www.nwb.org/).
1113

1214
## Getting Started

nwb_explorer/api.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,4 @@ def new_notebook(handler: IPythonHandler, path):
7979
if not os.path.exists(path):
8080
logging.info("Creating notebook {}".format(path))
8181
createNotebook(path)
82-
return handler.render_template('notebook.html',
83-
notebook_path=path,
84-
notebook_name=path.split('/')[-1],
85-
kill_kernel=False,
86-
mathjax_url=handler.mathjax_url,
87-
mathjax_config=handler.mathjax_config,
88-
get_custom_frontend_exporters=get_custom_frontend_exporters
89-
)
82+
handler.redirect('notebooks/' + path)

nwb_explorer/nwb_model_interpreter/nwb_model_interpreter.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ def assign_name_to_type(pynwb_obj):
2626
class NWBModelInterpreter(ModelInterpreter):
2727

2828
def __init__(self, nwb_file_name):
29+
2930
logging.info(f'Creating a Model Interpreter for {nwb_file_name}')
30-
self.nwb_file_name = nwb_file_name
31+
self.nwb_file_name = nwb_file_name if isinstance(nwb_file_name, str) else 'in-memory file'
3132
self.nwb_reader = NWBReader(nwb_file_name)
3233
self.library = GeppettoLibrary(name='nwbfile', id='nwbfile')
3334

@@ -45,7 +46,7 @@ def create_model(self):
4546

4647
geppetto_model.libraries.append(self.library)
4748

48-
obj_type = ImportType(autoresolve=True)
49+
obj_type = ImportType(autoresolve=True, url=self.nwb_file_name, id="nwbfile", name='nwbfile')
4950
self.library.types.append(obj_type)
5051
obj_variable = Variable(id='nwbfile', name='nwbfile', types=(obj_type,))
5152
geppetto_model.variables.append(obj_variable)
@@ -58,7 +59,7 @@ def importType(self, url, type_name, library, geppetto_model_access: GeppettoMod
5859
mapper = GenericCompositeMapper(model_factory, library)
5960
# build compositeTypes for pynwb objects
6061
root_type = mapper.create_type(self.get_nwbfile(), type_name=type_name, type_id=type_name)
61-
if isinstance(self.nwb_file_name, str) and url == 'nwbfile':
62+
if isinstance(self.nwb_file_name, str) and type_name == 'nwbfile':
6263
from nwb_explorer.nwb_data_manager import CACHE_DIRNAME
6364
root_type.variables.append(
6465
model_factory.create_url_variable(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
setuptools.setup(
1818
name="nwb_explorer",
19-
version="0.2",
19+
version="0.3",
2020
url="https://github.com/tarelli/nwb-explorer",
2121
author="MetaCell",
2222
author_email="info@metacell.us",

webapp/components/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export default class App extends React.Component{
3636
const { loadNWBFile, loadNotebook, notebookReady, nwbFileLoaded, raiseError } = this.props;
3737
self = this;
3838

39-
const cookieName = 'nwbloadurl'
39+
const cookieName = 'nwbloadurl';
4040
const nwbCookie = document.cookie.split(';').find(cookie => cookie.includes(cookieName))
4141
if (nwbCookie) {
42-
const [_, nwbFileUrl] = nwbCookie.replace(/"/g, '').split("=")
43-
if (nwbFileUrl && document.location.href.includes("nwbexplorer.opensourcebrain.org")) {
42+
const [_, nwbFileUrl] = nwbCookie.replace(/"/g, '').split("=");
43+
if (nwbFileUrl) {
4444
document.cookie = `${cookieName}= ; path=/`;
4545
loadNWBFile(nwbFileUrl);
4646
}

webapp/middleware/nwbMiddleware.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ function handleShowWidget (store, next, action) {
1616
if (action.data.type === 'TimeSeries') { // Instances.getInstance(path).getType().wrappedObj.name
1717
store.dispatch(updateDetailsWidget(action.data.instancePath));
1818
return handlePlotTimeseries(store, next, action);
19-
}
20-
if (action.data.type === 'ImageSeries') { // Instances.getInstance(path).getType().wrappedObj.name
19+
} else if (action.data.type === 'ImageSeries') { // Instances.getInstance(path).getType().wrappedObj.name
2120
store.dispatch(updateDetailsWidget(action.data.instancePath));
2221
return handleImportTimestamps(store, next, action);
22+
} else {
23+
return next(action);
2324
}
24-
return next(action);
2525
}
2626

2727
function handleImportTimestamps (store, next, action) {
@@ -75,11 +75,13 @@ function handlePlotTimeseries (store, next, action) {
7575
}
7676

7777
const nwbMiddleware = store => next => action => {
78-
next(action);
78+
7979
switch (action.type) {
8080

8181
case LOAD_NWB_FILE:
82+
next(action);
8283
Project.loadFromURL(action.data.nwbFileUrl);
84+
8385
GEPPETTO.on('jupyter_geppetto_extension_ready', data => { // It's triggered once
8486

8587
console.log("Initializing Python extension");
@@ -95,28 +97,33 @@ const nwbMiddleware = store => next => action => {
9597

9698

9799
case LOAD_NWB_FILE_IN_NOTEBOOK:
100+
next(action);
98101
nwbFileService.loadNWBFileInNotebook(store.getState().nwbfile.nwbFileUrl).then(
99102
() => store.dispatch(loadedNWBFileInNotebook)
100103
);
104+
101105
break;
102106

103107
case UNLOAD_NWB_FILE_IN_NOTEBOOK:
108+
next(action);
104109
Utils.execPythonMessage('del nwbfile');
110+
105111
break;
106112

107113
case NOTEBOOK_READY:
114+
next(action);
108115
// FIXME for some reason the callback for python messages is not being always called
109116
Utils.execPythonMessage('from nwb_explorer.nwb_main import main');
110117
store.dispatch(loadNWBFileInNotebook);
111-
118+
112119
break;
113120

114121
case UPDATE_WIDGET:
115122
case ADD_WIDGET:
116-
return handleShowWidget(store, next, action);
117-
118123
case ADD_PLOT_TO_EXISTING_WIDGET:
119-
return handlePlotTimeseries(store, next, action)
124+
return handleShowWidget(store, next, action);
125+
126+
default: next(action);
120127
}
121128

122129

webapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nwb-explorer",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "NWB Explorer is an application that can be used by scientists to read, visualize and explore the content of NWB 2 files.",
55
"repository": "https://github.com/MetaCell/geppetto-nwbexplorer",
66
"license": "MIT",

webapp/services/NotebookService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function getNotebookPath () {
77
if (nwbFileParam){
88
return "notebook?path=" + nwbFileParam.split('/').slice(-1) + '.ipynb';
99
}
10-
return "notebook?path=notebook.ipynb";
10+
return "notebook?path=nwbnotebook.ipynb";
1111
}
1212

1313
var console = null;

0 commit comments

Comments
 (0)