Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract on SubsetCreateMessage #3238

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here for debugging to expose the error.

msg = SnackbarMessage(
f"Automatic {self.resulting_product_name} extraction for {subset_lbl} failed", # noqa
color='error', sender=self, timeout=10000)
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise
msg = SnackbarMessage(
f"Extracting uncertainties on subset for {aperture.selected} failed", # noqa
color='error', sender=self, timeout=10000)
self.app.hub.broadcast(msg)

This would at least let the subset propagate to the spectral extraction tool, even if uncertainties are (initially) missing. I'd expect them to be available after the first modification (move/resize) to the subset, since I don't see the snackbar message repeated then, but could not find anything where nddate.uncertainty is used.

uncertainties = None
else:
uncertainties = None

Expand Down
2 changes: 2 additions & 0 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,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))
Comment on lines +2008 to +2009
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped that I could just replace the trigger for this from SubsetUpdateMessage to SubsetCreateMessage, but it didn't work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably cannot work as a drop-in replacement since SubsetCreateMessage does not have an attribute (in fact, does nothing). Wondering if this would need something equivalent of LayerSelect._on_subset_created, or if _update_subset can tricked into doing the right action some other way.

self.hub.subscribe(self, SubsetDeleteMessage,
handler=lambda msg: self._delete_subset(msg.subset))
self.hub.subscribe(self, SubsetRenameMessage,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading