Fails to render tabs in neuronal units section.
I am attempting to inspect the nwb file named sub-699733573_ses-715093703.nwb here in Dandiset:000021. When clicking on the Units section, and clicking on any of the tabs Raster Grid , Tuning Curve, or Combined, this error shows up.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\ipywidgets\widgets\widget.py:756, in Widget._handle_msg(self, msg)
754 if 'buffer_paths' in data:
755 _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 756 self.set_state(state)
758 # Handle a state request.
759 elif method == 'request_state':
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\ipywidgets\widgets\widget.py:625, in Widget.set_state(self, sync_data)
622 if name in self.keys:
623 from_json = self.trait_metadata(name, 'from_json',
624 self._trait_from_json)
--> 625 self.set_trait(name, from_json(sync_data[name], self))
File ~\AppData\Local\Programs\Python\Python39\lib\contextlib.py:126, in _GeneratorContextManager.__exit__(self, typ, value, traceback)
124 if typ is None:
125 try:
--> 126 next(self.gen)
127 except StopIteration:
128 return False
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\traitlets\traitlets.py:1371, in HasTraits.hold_trait_notifications(self)
1369 for changes in cache.values():
1370 for change in changes:
-> 1371 self.notify_change(change)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\ipywidgets\widgets\widget.py:686, in Widget.notify_change(self, change)
683 if name in self.keys and self._should_send_property(name, getattr(self, name)):
684 # Send new state to front-end
685 self.send_state(key=name)
--> 686 super(Widget, self).notify_change(change)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\traitlets\traitlets.py:1386, in HasTraits.notify_change(self, change)
1384 def notify_change(self, change):
1385 """Notify observers of a change event"""
-> 1386 return self._notify_observers(change)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\traitlets\traitlets.py:1431, in HasTraits._notify_observers(self, event)
1428 elif isinstance(c, EventHandler) and c.name is not None:
1429 c = getattr(self, c.name)
-> 1431 c(event)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\nwbwidgets\base.py:161, in lazy_tabs.<locals>.on_selected_index(change)
159 def on_selected_index(change):
160 if isinstance(change.owner.children[change.new], widgets.HTML):
--> 161 children[change.new] = vis2widget(tabs_spec[change.new][1](node))
162 change.owner.children = children
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\nwbwidgets\misc.py:1188, in RasterGridWidget.__init__(self, units, trials, unit_index, units_trials_controller)
1179 units_trials_controller = UnitsAndTrialsControllerWidget(
1180 units=units,
1181 trials=trials,
1182 unit_index=unit_index
1183 )
1184 self.children = [units_trials_controller]
1186 self.fig = interactive_output(
1187 f=raster_grid,
-> 1188 controls=units_trials_controller.controls,
1189 fixed=units_trials_controller.fixed
1190 )
1192 self.children += tuple([self.fig])
AttributeError: 'UnitsAndTrialsControllerWidget' object has no attribute 'controls'
Hi there - sorry for the delayed response
Quick question while we look into this - what version of NWB Widgets are you using?
version 0.10.0
Can confirm this is still an issue in v0.10.1
For easy reproducibility
import h5py
import fsspec
from fsspec.implementations.cached import CachingFileSystem
from pynwb import NWBHDF5IO
s3_url = "https://dandiarchive.s3.amazonaws.com/blobs/f5f/175/f5f1752f-5227-47d5-8f75-cd71937878aa"
cfs = CachingFileSystem(
fs=fsspec.filesystem("http"),
cache_storage="/home/jovyan/fsspec_cache", # Local folder for the cache
)
file_system = cfs.open(s3_url, "rb")
file = h5py.File(file_system)
io = NWBHDF5IO(file=file, load_namespaces=True)
nwbfile = io.read()
Then navigate to Units/tuning tab
I was also surprised at how long the units section took to render, guessing that's due to it loading in all unit properties (including spike features like amplitude)