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

consider bitmap/contour_visible in logic for top image layer #2818

Merged
merged 3 commits into from
Apr 19, 2024
Merged
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
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Other Changes and Additions
3.9.1 (unreleased)
==================

- Fix mouseover display's top-layer logic to account for the visibility and contour toggles in
the plot options plugin. [#2818]

Bug Fixes
---------

Expand Down
5 changes: 0 additions & 5 deletions jdaviz/configs/cubeviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from astropy.io import fits
from astropy.io import registry as io_registry
from astropy.utils.decorators import deprecated
from glue.core import BaseData
from specutils import Spectrum1D
from specutils.io.registers import _astropy_has_priorities

Expand Down Expand Up @@ -181,10 +180,6 @@ def get_aperture_photometry_results(self):
return self.plugins['Aperture Photometry']._obj.export_table()


def layer_is_cube_image_data(layer):
return isinstance(layer, BaseData) and layer.ndim in (2, 3)


# TODO: We can remove this when specutils supports it, i.e.,
# https://github.com/astropy/specutils/issues/592 and
# https://github.com/astropy/specutils/pull/1009
Expand Down
13 changes: 0 additions & 13 deletions jdaviz/configs/cubeviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from jdaviz.core.registries import viewer_registry
from jdaviz.core.marks import SliceIndicatorMarks, ShadowSpatialSpectral
from jdaviz.configs.cubeviz.helper import layer_is_cube_image_data
from jdaviz.configs.default.plugins.viewers import JdavizViewerMixin
from jdaviz.configs.specviz.plugins.viewers import SpecvizProfileView
from jdaviz.core.events import AddDataMessage, RemoveDataMessage, GlobalDisplayUnitChanged
Expand Down Expand Up @@ -209,18 +208,6 @@ def _default_flux_viewer_reference_name(self):
def _default_uncert_viewer_reference_name(self):
return self.jdaviz_helper._default_uncert_viewer_reference_name

@property
def active_image_layer(self):
"""Active image layer in the viewer, if available."""
# Find visible layers
visible_layers = [layer for layer in self.state.layers
if (layer.visible and layer_is_cube_image_data(layer.layer))]

if len(visible_layers) == 0:
return None

return visible_layers[-1]

def _on_global_display_unit_changed(self, msg):
# Clear cache of slice values when units change
if 'slice_values' in self.__dict__:
Expand Down
3 changes: 2 additions & 1 deletion jdaviz/configs/default/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ def active_image_layer(self):
visible_layers = [layer for layer in self.state.layers
if (layer.visible and
layer_is_image_data(layer.layer) and
layer_is_not_dq(layer.layer))]
layer_is_not_dq(layer.layer) and
(layer.bitmap_visible or layer.contour_visible))]
Comment on lines +319 to +320
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting here (mostly for myself) that this will conflict with #2817.

if len(visible_layers) == 0:
return None

Expand Down
6 changes: 5 additions & 1 deletion jdaviz/configs/imviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ def layer_is_2d(layer):
return isinstance(layer, BaseData) and layer.ndim == 2


def layer_is_2d_or_3d(layer):
return isinstance(layer, BaseData) and layer.ndim in (2, 3)


def layer_is_image_data(layer):
return layer_is_2d(layer) and not layer.meta.get(_wcs_only_label, False)
return layer_is_2d_or_3d(layer) and not layer.meta.get(_wcs_only_label, False)
Comment on lines -402 to +406
Copy link
Member Author

Choose a reason for hiding this comment

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

Doing a search of the codebase, I don't expect this to have any actual consequences anywhere. For Imviz, there is no ability to load cube data, and for cubeviz whenever we call this we really want to include cubes.

Copy link
Contributor

Choose a reason for hiding this comment

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

But what about in the future when we want to support "flexible viz" and could possibly have 2D and 3D data both loaded and Imviz also loaded?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can rename this method if that would help (suggestions welcomed!)... but for now, all uses of it actually mean something that appears like an image on the screen (so either 2d or 3d image data).



def layer_is_wcs_only(layer):
Expand Down