Closed rosteen closed 2 years ago
The data is still added though. You see it in specviz.app.data_collection
after the crash still. This boils down to the following:
>>> specviz.app.data_collection[0].get_mask(specviz.app.data_collection[0].subsets[0].subset_state) # ok
>>> specviz.app.data_collection[1].get_mask(specviz.app.data_collection[1].subsets[0].subset_state) # crash
Wow, what is going on here? If you drill down:
>>> print(specviz.app.data_collection[0].subsets[0].subset_state)
<glue.core.subset.RangeSubsetState object at 0x7f7859b24bb0>
>>> print(specviz.app.data_collection[1].subsets[0].subset_state) # Same object
<glue.core.subset.RangeSubsetState object at 0x7f7859b24bb0>
>>> cid = specviz.app.data_collection[0].subsets[0].subset_state.att
>>> type(cid), cid.label
(glue.core.component_id.ComponentID, 'World 0')
>>> key = list(specviz.app.data_collection[1]._components.keys())[1]
>>> type(key), key.label
(glue.core.component_id.ComponentID, 'World 0')
>>> cid in specviz.app.data_collection[0]._components
True
>>> cid in specviz.app.data_collection[1]._components # ?????
False
>>> cid = specviz.app.data_collection[1].subsets[0].subset_state.att
>>> cid in specviz.app.data_collection[1]._components # ?????????
False
>>> specviz.app.data_collection[0]._components
OrderedDict([(Pixel Axis 0 [x], <glue.core.component.CoordinateComponent at 0x7f785a394550>),
(World 0, <glue.core.component.CoordinateComponent at 0x7f785a3945b0>),
(flux, <glue.core.component.Component at 0x7f785a394220>),
(uncertainty, <glue.core.component.Component at 0x7f785a394670>),
(mask, <glue.core.component.Component at 0x7f785a394790>)])
>>> specviz.app.data_collection[1]._components
OrderedDict([(Pixel Axis 0 [x], <glue.core.component.CoordinateComponent at 0x7f7859ae9ca0>),
(World 0, <glue.core.component.CoordinateComponent at 0x7f7859ae9b50>),
(flux, <glue.core.component.Component at 0x7f7859a87a30>),
(uncertainty, <glue.core.component.Component at 0x7f7859aebe80>)])
@astrofrog , any advice?
Describe the bug It looks like adding an additional spectrum to the
spectrum-viewer
after having created one or more subsets is broken.To Reproduce Steps to reproduce the behavior:
The problem appears to be in mask retrieval in
app.get_subsets_from_viewer()
as seen in the trace below. Note that you can add more spectra just fine as long as no subsets have been defined, and can even add subsets after the additional spectrum has been added. But once a spectrum is added post-subset-creation, subset retrieval breaks. It's unclear to me when this was introduced, I've tested with a slightly older version of Glue (1.2.2) and glue-jupyter 0.10.1 but haven't gone back further than that.Package versions (please complete the following information):
macOS-10.15.7-x86_64-i386-64bit Python 3.9.7 (default, Sep 16 2021, 08:50:36) [Clang 10.0.0 ] Numpy 1.22.2 astropy 5.0.1 specutils 1.7.0 spectral-cube 0.6.0 pyyaml 6.0 click 8.0.4 asteval 0.9.26 idna 3.3 traitlets 5.1.1 bqplot 0.12.33 bqplot-image-gl 1.4.5 glue-core 1.2.2 glue-jupyter 0.10.1 glue-astronomy 0.3.2 echo 0.6 ipyvue 1.7.0 ipyvuetify 1.8.2 ipysplitpanes 0.2.0 ipygoldenlayout 0.4.0 voila 0.3.2 vispy 0.9.6 Jdaviz 2.2.1.dev226+g7392da3b.d20220225