NeurodataWithoutBorders / nwbwidgets

Explore the hierarchical structure of NWB 2.0 files and visualize data with Jupyter widgets.
https://nwb-widgets.readthedocs.io/en/latest/
Other
48 stars 21 forks source link

[Bug]: #290

Closed bendichter closed 1 year ago

bendichter commented 1 year ago

What happened?

I'm really not sure where the issue is here yet. While trying to run on the DANDI Hub, I am getting a strange h5py error:

image

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File /opt/conda/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:766, in Widget._handle_msg(self, msg)
    764         if 'buffer_paths' in data:
    765             _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 766         self.set_state(state)
    768 # Handle a state request.
    769 elif method == 'request_state':

File /opt/conda/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:643, in Widget.set_state(self, sync_data)
    638         self._send(msg, buffers=echo_buffers)
    640 # The order of these context managers is important. Properties must
    641 # be locked when the hold_trait_notification context manager is
    642 # released and notifications are fired.
--> 643 with self._lock_property(**sync_data), self.hold_trait_notifications():
    644     for name in sync_data:
    645         if name in self.keys:

File /opt/conda/lib/python3.10/contextlib.py:142, in _GeneratorContextManager.__exit__(self, typ, value, traceback)
    140 if typ is None:
    141     try:
--> 142         next(self.gen)
    143     except StopIteration:
    144         return False

File /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:1502, in HasTraits.hold_trait_notifications(self)
   1500 for changes in cache.values():
   1501     for change in changes:
-> 1502         self.notify_change(change)

File /opt/conda/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:694, in Widget.notify_change(self, change)
    691     if name in self.keys and self._should_send_property(name, getattr(self, name)):
    692         # Send new state to front-end
    693         self.send_state(key=name)
--> 694 super().notify_change(change)

File /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:1517, in HasTraits.notify_change(self, change)
   1515 def notify_change(self, change):
   1516     """Notify observers of a change event"""
-> 1517     return self._notify_observers(change)

File /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:1564, in HasTraits._notify_observers(self, event)
   1561 elif isinstance(c, EventHandler) and c.name is not None:
   1562     c = getattr(self, c.name)
-> 1564 c(event)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:94, in dict2accordion.<locals>.on_selected_index(change)
     92 def on_selected_index(change):
     93     if change.new is not None and isinstance(change.owner.children[change.new], widgets.HTML):
---> 94         children[change.new] = nwb2widget(
     95             list(d.values())[change.new], neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs
     96         )
     97         change.owner.children = children

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:204, in nwb2widget(node, neurodata_vis_spec, **pass_kwargs)
    202             return lazy_tabs(spec, node)
    203         elif callable(spec):
--> 204             visualization = spec(node, neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs)
    205             return vis2widget(visualization)
    206 out1 = widgets.Output()

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:236, in processing_module(node, neurodata_vis_spec)
    235 def processing_module(node: ProcessingModule, neurodata_vis_spec: dict) -> widgets.Widget:
--> 236     return nwb2widget(node.data_interfaces, neurodata_vis_spec=neurodata_vis_spec)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:204, in nwb2widget(node, neurodata_vis_spec, **pass_kwargs)
    202             return lazy_tabs(spec, node)
    203         elif callable(spec):
--> 204             visualization = spec(node, neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs)
    205             return vis2widget(visualization)
    206 out1 = widgets.Output()

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:83, in dict2accordion(d, neurodata_vis_spec, **pass_kwargs)
     81 def dict2accordion(d: dict, neurodata_vis_spec: dict, **pass_kwargs) -> widgets.Widget:
     82     if len(d) == 1:
---> 83         return nwb2widget(list(d.values())[0], neurodata_vis_spec=neurodata_vis_spec)
     84     children = [widgets.HTML("Rendering...") for _ in d]
     85     accordion = widgets.Accordion(children=children, selected_index=None)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:204, in nwb2widget(node, neurodata_vis_spec, **pass_kwargs)
    202             return lazy_tabs(spec, node)
    203         elif callable(spec):
--> 204             visualization = spec(node, neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs)
    205             return vis2widget(visualization)
    206 out1 = widgets.Output()

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:355, in show_multi_container_interface(node, neurodata_vis_spec)
    352 else:
    353     cls_conf = node.__clsconf__
--> 355 return dict2accordion(
    356     {x["attr"]: getattr(node, x["attr"]) for x in cls_conf},
    357     neurodata_vis_spec=neurodata_vis_spec,
    358 )

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:83, in dict2accordion(d, neurodata_vis_spec, **pass_kwargs)
     81 def dict2accordion(d: dict, neurodata_vis_spec: dict, **pass_kwargs) -> widgets.Widget:
     82     if len(d) == 1:
---> 83         return nwb2widget(list(d.values())[0], neurodata_vis_spec=neurodata_vis_spec)
     84     children = [widgets.HTML("Rendering...") for _ in d]
     85     accordion = widgets.Accordion(children=children, selected_index=None)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:204, in nwb2widget(node, neurodata_vis_spec, **pass_kwargs)
    202             return lazy_tabs(spec, node)
    203         elif callable(spec):
--> 204             visualization = spec(node, neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs)
    205             return vis2widget(visualization)
    206 out1 = widgets.Output()

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:83, in dict2accordion(d, neurodata_vis_spec, **pass_kwargs)
     81 def dict2accordion(d: dict, neurodata_vis_spec: dict, **pass_kwargs) -> widgets.Widget:
     82     if len(d) == 1:
---> 83         return nwb2widget(list(d.values())[0], neurodata_vis_spec=neurodata_vis_spec)
     84     children = [widgets.HTML("Rendering...") for _ in d]
     85     accordion = widgets.Accordion(children=children, selected_index=None)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/base.py:204, in nwb2widget(node, neurodata_vis_spec, **pass_kwargs)
    202             return lazy_tabs(spec, node)
    203         elif callable(spec):
--> 204             visualization = spec(node, neurodata_vis_spec=neurodata_vis_spec, **pass_kwargs)
    205             return vis2widget(visualization)
    206 out1 = widgets.Output()

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/timeseries.py:268, in show_timeseries(node, **kwargs)
    266 def show_timeseries(node, **kwargs):
    267     if len(node.data.shape) == 1:
--> 268         return SingleTracePlotlyWidget(node, **kwargs)
    269     elif len(node.data.shape) == 2:
    270         return BaseGroupedTraceWidget(node, **kwargs)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/timeseries.py:323, in SingleTracePlotlyWidget.__init__(self, timeseries, foreign_time_window_controller, **kwargs)
    317 def __init__(
    318     self,
    319     timeseries: TimeSeries,
    320     foreign_time_window_controller: StartAndDurationController = None,
    321     **kwargs,
    322 ):
--> 323     super().__init__(
    324         timeseries=timeseries,
    325         foreign_time_window_controller=foreign_time_window_controller,
    326         **kwargs,
    327     )

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/timeseries.py:291, in AbstractTraceWidget.__init__(self, timeseries, foreign_time_window_controller, **kwargs)
    288 self.out_fig = None
    290 if foreign_time_window_controller is None:
--> 291     tmin = get_timeseries_mint(timeseries)
    292     tmax = get_timeseries_maxt(timeseries)
    293     self.time_window_controller = StartAndDurationController(tmax, tmin)

File /opt/conda/lib/python3.10/site-packages/nwbwidgets/utils/timeseries.py:75, in get_timeseries_mint(node)
     62 """
     63 Returns the minimum time of any TimeSeries
     64 
   (...)
     72 
     73 """
     74 if node.timestamps is not None:
---> 75     return node.timestamps[0]
     76 elif np.isnan(node.starting_time):
     77     return 0

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File /opt/conda/lib/python3.10/site-packages/h5py/_hl/dataset.py:766, in Dataset.__getitem__(self, args, new_dtype)
    763 if new_dtype is None:
    764     new_dtype = getattr(self._local, 'astype', None)
--> 766 if self._fast_read_ok and (new_dtype is None):
    767     try:
    768         return self._fast_reader.read(args)

File /opt/conda/lib/python3.10/site-packages/h5py/_hl/base.py:534, in cached_property.__get__(self, obj, cls)
    531 if obj is None:
    532     return self
--> 534 value = obj.__dict__[self.func.__name__] = self.func(obj)
    535 return value

File /opt/conda/lib/python3.10/site-packages/h5py/_hl/dataset.py:745, in Dataset._fast_read_ok(self)
    741 @cached_property
    742 def _fast_read_ok(self):
    743     """Is this dataset suitable for simple reading"""
    744     return (
--> 745         self._extent_type == h5s.SIMPLE
    746         and isinstance(self.id.get_type(), (h5t.TypeIntegerID, h5t.TypeFloatID))
    747     )

File /opt/conda/lib/python3.10/site-packages/h5py/_hl/base.py:534, in cached_property.__get__(self, obj, cls)
    531 if obj is None:
    532     return self
--> 534 value = obj.__dict__[self.func.__name__] = self.func(obj)
    535 return value

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File /opt/conda/lib/python3.10/site-packages/h5py/_hl/dataset.py:634, in Dataset._extent_type(self)
    630 @cached_property
    631 @with_phil
    632 def _extent_type(self):
    633     """Get extent type for this dataset - SIMPLE, SCALAR or NULL"""
--> 634     return self.id.get_space().get_simple_extent_type()

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File h5py/h5d.pyx:347, in h5py.h5d.DatasetID.get_space()

ValueError: Invalid dataset identifier (invalid dataset identifier)

Steps to Reproduce

No response

Traceback

No response

Operating System

Linux

Python Version

3.10

Package Versions

No response

Code of Conduct

bendichter commented 1 year ago

duplicate of #264