nwbwidgets
nwbwidgets copied to clipboard
valueerror when opening timestamps
I'm looking at a running speed. Rendering the data works fine but the timestamps fail as follows:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/miniconda3/envs/py37/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in _handle_msg(self, msg)
667 if 'buffer_paths' in data:
668 _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 669 self.set_state(state)
670
671 # Handle a state request.
~/miniconda3/envs/py37/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in set_state(self, sync_data)
537 from_json = self.trait_metadata(name, 'from_json',
538 self._trait_from_json)
--> 539 self.set_trait(name, from_json(sync_data[name], self))
540
541 def send(self, content, buffers=None):
~/miniconda3/envs/py37/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback)
117 if type is None:
118 try:
--> 119 next(self.gen)
120 except StopIteration:
121 return False
~/miniconda3/envs/py37/lib/python3.7/site-packages/traitlets/traitlets.py in hold_trait_notifications(self)
1129 for changes in cache.values():
1130 for change in changes:
-> 1131 self.notify_change(change)
1132
1133 def _notify_trait(self, name, old_value, new_value):
~/miniconda3/envs/py37/lib/python3.7/site-packages/ipywidgets/widgets/widget.py in notify_change(self, change)
598 # Send new state to front-end
599 self.send_state(key=name)
--> 600 super(Widget, self).notify_change(change)
601
602 def __repr__(self):
~/miniconda3/envs/py37/lib/python3.7/site-packages/traitlets/traitlets.py in notify_change(self, change)
1174 c = getattr(self, c.name)
1175
-> 1176 c(change)
1177
1178 def _add_notifiers(self, handler, name, type):
~/Desktop/nwb_janelia/nwb_jupyter/nwb-jupyter-widgets/nwbwidgets/view.py in on_selected_index(change)
25 def on_selected_index(change):
26 if change.new is not None and isinstance(change.owner.children[change.new], widgets.HTML):
---> 27 children[change.new] = nwb2widget(list(d.values())[change.new], neurodata_vis_spec=neurodata_vis_spec)
28 change.owner.children = children
29
~/Desktop/nwb_janelia/nwb_jupyter/nwb-jupyter-widgets/nwbwidgets/view.py in nwb2widget(node, neurodata_vis_spec)
90 return tab
91 elif callable(spec):
---> 92 return vis2widget(spec(node, neurodata_vis_spec=neurodata_vis_spec))
93 out1 = widgets.Output()
94 with out1:
~/Desktop/nwb_janelia/nwb_jupyter/nwb-jupyter-widgets/nwbwidgets/base.py in show_timeseries(node, **kwargs)
15 fig, ax = plt.subplots()
16 if node.timestamps:
---> 17 ax.plot(node.timestamps, node.data)
18 else:
19 ax.plot(np.arange(len(node.data)) / node.rate + node.starting_time, node.data)
~/miniconda3/envs/py37/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1808 "the Matplotlib list!)" % (label_namer, func.__name__),
1809 RuntimeWarning, stacklevel=2)
-> 1810 return func(ax, *args, **kwargs)
1811
1812 inner.__doc__ = _add_data_doc(inner.__doc__,
~/miniconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, *args, **kwargs)
1609 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D._alias_map)
1610
-> 1611 for line in self._get_lines(*args, **kwargs):
1612 self.add_line(line)
1613 lines.append(line)
~/miniconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axes/_base.py in _grab_next_args(self, *args, **kwargs)
391 this += args[0],
392 args = args[1:]
--> 393 yield from self._plot_args(this, kwargs)
394
395
~/miniconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
351 # downstream.
352 if any(v is None for v in tup):
--> 353 raise ValueError("x, y, and format string must not be None")
354
355 kw = {}
ValueError: x, y, and format string must not be None
A two-axis plot of the timestamps doesn't really make sense anyways - they are just points in one dimension.
I don't think you should have lone timestamps in your file in the first place