holoviz-topics / neuro

HoloViz+Bokeh for Neuroscience
BSD 3-Clause "New" or "Revised" License
19 stars 5 forks source link

Add LFP large data handling notebook #81

Closed ianthomas23 closed 11 months ago

ianthomas23 commented 11 months ago

This PR adds a new notebook to illustrate LFP large data handling, from obtaining some realistic data through kerchunking it so that it can be lazily read, to interactively visualising it using Bokeh and Datashader.

droumis commented 11 months ago

Thank you for putting this together, Ian!

I'm getting an error when trying to interact with the plot (zoom or pan). Do you see this as well?

Traceback ``` ERROR:bokeh.server.protocol_handler:error handling message message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'bokeh_event', 'msg_data': {'type': 'event', 'name': 'rangesupdate', 'values': {'type': 'map', 'entries': [['model', {'id': 'p1243'}], ['x0', 65.49145226643604], ['x1', 82.25595374570582], ['y0', 37.11014311125485], ['y1', 71.6022776298967]]}}}]} error: NameError("name 'initialised' is not defined") Traceback (most recent call last): File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/server/protocol_handler.py", line 97, in handle work = await handler(message, connection) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/server/session.py", line 94, in _needs_document_lock_wrapper result = func(self, *args, **kwargs) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/server/session.py", line 286, in _handle_patch message.apply_to_document(self.document, self) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in apply_to_document invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter)) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc return f() File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter)) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/document.py", line 391, in apply_json_patch DocumentPatchedEvent.handle_event(self, event, setter) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/events.py", line 245, in handle_event event_cls._handle_event(doc, event) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/events.py", line 280, in _handle_event cb(event.msg_data) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 390, in trigger_event model._trigger_event(event) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/util/callback_manager.py", line 113, in _trigger_event self.document.callbacks.notify_event(cast(Model, self), event, invoke) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 260, in notify_event invoke_with_curdoc(doc, callback_invoker) File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc return f() File "/Users/droumis/opt/miniconda3/envs/lfp-large-data/lib/python3.9/site-packages/bokeh/util/callback_manager.py", line 109, in invoke cast(EventCallbackWithEvent, callback)(event) File "/var/folders/pp/zp63v9q50m79py9t866mvg3h0000gp/T/ipykernel_10647/598667354.py", line 30, in callback if not initialised: NameError: name 'initialised' is not defined ```

https://github.com/holoviz-topics/neuro/assets/6613202/ceae2be8-ce83-48f7-8723-62d500a13d50

ianthomas23 commented 11 months ago

Not so far, but I will retry with a fresh environment first thing in the morning.

Looking at it, I'm not sure that the global ... line is now correct. It is bad practice anyway, so I will rewrite it so that it is not needed.

ianthomas23 commented 11 months ago

@droumis I've updated it to use a class-based Bokeh doc, it should work fine now.

droumis commented 11 months ago

This works great now! merging