From 3a1e6f82734c324e34176a0acfadb7e1e989d9fe Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Tue, 1 Oct 2024 10:59:08 -0400 Subject: [PATCH 01/10] Also listen to SubsetCreateMessage here --- jdaviz/core/template_mixin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 4bfeaebee0..cde00f0d2d 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -2025,6 +2025,8 @@ def __init__(self, plugin, items, selected, multiselect=None, selected_has_subre self.hub.subscribe(self, SubsetUpdateMessage, handler=lambda msg: self._update_subset(msg.subset, msg.attribute)) + self.hub.subscribe(self, SubsetCreateMessage, + handler=lambda msg: self._update_subset(msg.subset)) self.hub.subscribe(self, SubsetDeleteMessage, handler=lambda msg: self._delete_subset(msg.subset)) self.hub.subscribe(self, SubsetRenameMessage, From 5c1f786acf924b3eb09410bf185be7a5a9bc79f7 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Tue, 1 Oct 2024 12:57:45 -0400 Subject: [PATCH 02/10] Debugging --- .../spectral_extraction/spectral_extraction.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index c1f87223cc..2ce7be5315 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -263,6 +263,7 @@ def _aperture_items_changed(self, msg): self._extract_in_new_instance(subset_lbl=subset_lbl, auto_update=True, add_data=True) except Exception: + raise msg = SnackbarMessage( f"Automatic {self.resulting_product_name} extraction for {subset_lbl} failed", # noqa color='error', sender=self, timeout=10000) @@ -458,9 +459,14 @@ def _extract_from_aperture(self, cube, uncert_cube, mask_cube, aperture, subset_id=aperture.selected, cls=NDDataArray ) if uncert_cube: - uncertainties = uncert_cube.get_subset_object( - subset_id=aperture.selected, cls=StdDevUncertainty - ) + try: + # Subset may not be linked to the uncertainty cube at this point?? + uncertainties = uncert_cube.get_subset_object( + subset_id=aperture.selected, cls=StdDevUncertainty + ) + except ValueError: + raise + uncertainties = None else: uncertainties = None From 21f9f824035f73a66aed81a06cf0904676d4f5c7 Mon Sep 17 00:00:00 2001 From: gibsongreen Date: Wed, 8 Jan 2025 10:30:21 -0500 Subject: [PATCH 03/10] update glue pin --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 829b2f2c47..91e2654d6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "matplotlib>=3.6", "traitlets>=5.0.5", "bqplot>=0.12.37", - "glue-core>=1.20.0", + "glue-core @ git+https://github.com/glue-viz/glue.git@refs/pull/2515/head#egg=glue-core", "glue-jupyter>=0.23.0", "echo>=0.5.0", "ipykernel>=6.19.4", From 99e4c2ffe18301d473c51df1c42be97aede85d97 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Tue, 21 Jan 2025 10:45:02 -0500 Subject: [PATCH 04/10] Remove debugging code --- .../spectral_extraction/spectral_extraction.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index 2ce7be5315..ab98ad1e00 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -263,7 +263,6 @@ def _aperture_items_changed(self, msg): self._extract_in_new_instance(subset_lbl=subset_lbl, auto_update=True, add_data=True) except Exception: - raise msg = SnackbarMessage( f"Automatic {self.resulting_product_name} extraction for {subset_lbl} failed", # noqa color='error', sender=self, timeout=10000) @@ -459,14 +458,10 @@ def _extract_from_aperture(self, cube, uncert_cube, mask_cube, aperture, subset_id=aperture.selected, cls=NDDataArray ) if uncert_cube: - try: - # Subset may not be linked to the uncertainty cube at this point?? - uncertainties = uncert_cube.get_subset_object( - subset_id=aperture.selected, cls=StdDevUncertainty - ) - except ValueError: - raise - uncertainties = None + # Subset may not be linked to the uncertainty cube at this point?? + uncertainties = uncert_cube.get_subset_object( + subset_id=aperture.selected, cls=StdDevUncertainty + ) else: uncertainties = None From 40c85a6c53584285376199ce91fa75ae98c9ff28 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Tue, 21 Jan 2025 10:46:59 -0500 Subject: [PATCH 05/10] Remove comment --- .../cubeviz/plugins/spectral_extraction/spectral_extraction.py | 1 - 1 file changed, 1 deletion(-) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index ab98ad1e00..c1f87223cc 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -458,7 +458,6 @@ def _extract_from_aperture(self, cube, uncert_cube, mask_cube, aperture, subset_id=aperture.selected, cls=NDDataArray ) if uncert_cube: - # Subset may not be linked to the uncertainty cube at this point?? uncertainties = uncert_cube.get_subset_object( subset_id=aperture.selected, cls=StdDevUncertainty ) From c3ef0b1cdde423a825e4be6b61f827844cdcebaa Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Tue, 21 Jan 2025 10:48:18 -0500 Subject: [PATCH 06/10] Bump glue-core pin to last bugfix release --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 91e2654d6a..a4eb5ad1c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "matplotlib>=3.6", "traitlets>=5.0.5", "bqplot>=0.12.37", - "glue-core @ git+https://github.com/glue-viz/glue.git@refs/pull/2515/head#egg=glue-core", + "glue-core>=1.21.1", "glue-jupyter>=0.23.0", "echo>=0.5.0", "ipykernel>=6.19.4", From e7f3490866b084c01ac95ce423c1c453fbcaa76a Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Wed, 22 Jan 2025 14:07:13 -0500 Subject: [PATCH 07/10] Manually pass attribute when subset is created --- jdaviz/core/template_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index cde00f0d2d..94d27be48c 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -2026,7 +2026,7 @@ def __init__(self, plugin, items, selected, multiselect=None, selected_has_subre self.hub.subscribe(self, SubsetUpdateMessage, handler=lambda msg: self._update_subset(msg.subset, msg.attribute)) self.hub.subscribe(self, SubsetCreateMessage, - handler=lambda msg: self._update_subset(msg.subset)) + handler=lambda msg: self._update_subset(msg.subset, attribute="type")) self.hub.subscribe(self, SubsetDeleteMessage, handler=lambda msg: self._delete_subset(msg.subset)) self.hub.subscribe(self, SubsetRenameMessage, From 7928168d3c178ca7345afc25fb2473c4b38d5a9d Mon Sep 17 00:00:00 2001 From: Ricky O'Steen Date: Wed, 22 Jan 2025 14:12:55 -0500 Subject: [PATCH 08/10] Just trigger if attribute is None instead of passing inaccurate value --- jdaviz/core/template_mixin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 94d27be48c..05bf37c870 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -2026,7 +2026,7 @@ def __init__(self, plugin, items, selected, multiselect=None, selected_has_subre self.hub.subscribe(self, SubsetUpdateMessage, handler=lambda msg: self._update_subset(msg.subset, msg.attribute)) self.hub.subscribe(self, SubsetCreateMessage, - handler=lambda msg: self._update_subset(msg.subset, attribute="type")) + handler=lambda msg: self._update_subset(msg.subset)) self.hub.subscribe(self, SubsetDeleteMessage, handler=lambda msg: self._delete_subset(msg.subset)) self.hub.subscribe(self, SubsetRenameMessage, @@ -2104,7 +2104,8 @@ def _update_subset(self, subset, attribute=None): self.items = self.items + [self._subset_to_dict(subset)] # noqa else: # 'type' can be passed manually rather than coming from SubsetUpdateMessage.attribute - if attribute in ('style', 'type'): + # This will be None if triggered by SubsetCreateMessage + if attribute in ('style', 'type') or attribute is None: # TODO: may need to add label and then rebuild the entire list if/when # we add support for renaming subsets From c6c34ce954c22f03720a69a4e0eada04413d01be Mon Sep 17 00:00:00 2001 From: Ricky O'Steen <39831871+rosteen@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:51:25 -0500 Subject: [PATCH 09/10] Revert pin bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a4eb5ad1c4..829b2f2c47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "matplotlib>=3.6", "traitlets>=5.0.5", "bqplot>=0.12.37", - "glue-core>=1.21.1", + "glue-core>=1.20.0", "glue-jupyter>=0.23.0", "echo>=0.5.0", "ipykernel>=6.19.4", From c9cb48e44da07ec18da9d08c535126a239f74013 Mon Sep 17 00:00:00 2001 From: Ricky O'Steen <39831871+rosteen@users.noreply.github.com> Date: Fri, 24 Jan 2025 12:08:39 -0500 Subject: [PATCH 10/10] Update jdaviz/core/template_mixin.py Co-authored-by: Kyle Conroy --- jdaviz/core/template_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 05bf37c870..a1f8725344 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -2105,7 +2105,7 @@ def _update_subset(self, subset, attribute=None): else: # 'type' can be passed manually rather than coming from SubsetUpdateMessage.attribute # This will be None if triggered by SubsetCreateMessage - if attribute in ('style', 'type') or attribute is None: + if attribute in ('style', 'type', None): # TODO: may need to add label and then rebuild the entire list if/when # we add support for renaming subsets