-
Notifications
You must be signed in to change notification settings - Fork 74
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
Ensure ImViz works well with arbitrary BaseCartesianData instances #1904
Conversation
self.label_mouseover.icon = self.jdaviz_app.state.layer_icons.get(active_layer.layer.label) # noqa | ||
icon = self.jdaviz_app.state.layer_icons.get(active_layer.layer.label) | ||
if icon is not None: | ||
self.label_mouseover.icon = icon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The icon doesn't work well for arbitrary BaseCartesianData instances at the moment, this needs to be investigated in glue-core but for now this ensures a graceful fallback if an icon is not found (which we should do anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably set to an empty string or have the icon itself smart enough to handle None in layer_viewer_icon.vue
(rather than just leave it at its previous value). I'm not sure why BaseCartesianData
would have any problem with the layer icon logic though, layer_icons
gets populated in
Lines 384 to 386 in f36f3b2
if layer_name not in self.state.layer_icons: | |
self.state.layer_icons = {**self.state.layer_icons, | |
layer_name: alpha_index(len(self.state.layer_icons))} |
AddDataMessage
. Is it possible the AddDataMessage
isn't being sent from glue for BaseCartesianData
?
@@ -126,8 +129,11 @@ def on_mouse_or_key_event(self, data): | |||
and x < image.shape[1] - 0.5 and y < image.shape[0] - 0.5 | |||
and hasattr(active_layer, 'attribute')): | |||
attribute = active_layer.attribute | |||
value = image.get_data(attribute)[int(round(y)), int(round(x))] | |||
unit = image.get_component(attribute).units | |||
value = image.get_data(attribute, view=[np.atleast_1d(y), np.atleast_1d(x)])[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that we only ever access the relevant pixel and don't accidentally load all the data then slice it.
if isinstance(image, Data): | ||
unit = image.get_component(attribute).units | ||
else: | ||
unit = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existence of components with units is only guaranteed for Data subclasses not BaseCartesianData subclasses
We also have to make sure this will play nice with #1908 |
This comment was marked as resolved.
This comment was marked as resolved.
p.s. Turning this to draft because this is still experimental. Thanks! |
Superseded by #1983 |
Description
This is part of work towards implementing image rotation via on-the-fly reprojection. The main changes here are to support the most general glue data class,
BaseCartesianData
of whichData
is one instance.Depends on:
Needs to make sure this also accounts for:
🐸
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.