nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
61 stars 15 forks source link

TraitError in cnmfe notebook #229

Closed rly closed 10 months ago

rly commented 1 year ago

In cell 10 of https://github.com/nel-lab/mesmerize-core/blob/master/notebooks/cnmfe.ipynb ,

VBox([iw_gs.show(), slider_gsig_filt])

raises a TraitError:

---------------------------------------------------------------------------
TraitError                                Traceback (most recent call last)
Cell In[11], line 36
     32 iw_gs.reset_vmin_vmax()
     34 slider_gsig_filt.observe(force_update, "value")
---> 36 VBox([iw_gs.show(), slider_gsig_filt])

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/ipywidgets/widgets/widget_box.py:64, in Box.__init__(self, children, **kwargs)
     62 def __init__(self, children=(), **kwargs):
     63     kwargs['children'] = children
---> 64     super().__init__(**kwargs)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/ipywidgets/widgets/widget.py:503, in Widget.__init__(self, **kwargs)
    501 """Public constructor"""
    502 self._model_id = kwargs.pop('model_id', None)
--> 503 super().__init__(**kwargs)
    505 Widget._call_widget_constructed(self)
    506 self.open()

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:1374, in HasTraits.__init__(self, *args, **kwargs)
   1372 for key, value in kwargs.items():
   1373     if self.has_trait(key):
-> 1374         setattr(self, key, value)
   1375         changes[key] = Bunch(
   1376             name=key,
   1377             old=None,
   (...)
   1380             type="change",
   1381         )
   1382     else:
   1383         # passthrough args that don't set traits to super

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:748, in TraitType.__set__(self, obj, value)
    746     raise TraitError('The "%s" trait is read-only.' % self.name)
    747 else:
--> 748     self.set(obj, value)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:722, in TraitType.set(self, obj, value)
    721 def set(self, obj, value):
--> 722     new_value = self._validate(obj, value)
    723     try:
    724         old_value = obj._trait_values[self.name]

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:754, in TraitType._validate(self, obj, value)
    752     return value
    753 if hasattr(self, "validate"):
--> 754     value = self.validate(obj, value)
    755 if obj._cross_validation_lock is False:
    756     value = self._cross_validate(obj, value)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:3454, in Container.validate(self, obj, value)
   3451 if value is None:
   3452     return value
-> 3454 value = self.validate_elements(obj, value)
   3456 return value

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:3466, in Container.validate_elements(self, obj, value)
   3464     v = self._trait._validate(obj, v)
   3465 except TraitError as error:
-> 3466     self.error(obj, v, error)
   3467 else:
   3468     validated.append(v)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:837, in TraitType.error(self, obj, value, error, info)
    827         else:
    828             error.args = (
    829                 "The '{}' trait contains {} which "
    830                 "expected {}, not {}.".format(
   (...)
    835                 ),
    836             )
--> 837     raise error
    838 else:
    839     # this trait caused an error
    840     if self.name is None:
    841         # this is not the root trait

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:3464, in Container.validate_elements(self, obj, value)
   3462 for v in value:
   3463     try:
-> 3464         v = self._trait._validate(obj, v)
   3465     except TraitError as error:
   3466         self.error(obj, v, error)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:754, in TraitType._validate(self, obj, value)
    752     return value
    753 if hasattr(self, "validate"):
--> 754     value = self.validate(obj, value)
    755 if obj._cross_validation_lock is False:
    756     value = self._cross_validate(obj, value)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:2319, in Instance.validate(self, obj, value)
   2317     return value
   2318 else:
-> 2319     self.error(obj, value)

File ~/mambaforge/envs/mescore/lib/python3.11/site-packages/traitlets/traitlets.py:842, in TraitType.error(self, obj, value, error, info)
    838 else:
    839     # this trait caused an error
    840     if self.name is None:
    841         # this is not the root trait
--> 842         raise TraitError(value, info or self.info(), self)
    843     else:
    844         # this is the root trait
    845         if obj is not None:

TraitError: The 'children' trait of a VBox instance contains an Instance of a TypedTuple which expected a Widget, not the NoneType None.

The visualization still appears in the sidecar and seems to work just fine though.

kushalkolar commented 1 year ago

we have to update the demo nbs w.r.t. last week's release of fastplotlib