Skip to content

Commit

Permalink
consolidate cubeviz/imviz logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Apr 19, 2024
1 parent b782acc commit 4e328c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
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
1 change: 0 additions & 1 deletion 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
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)


def layer_is_wcs_only(layer):
Expand Down

0 comments on commit 4e328c4

Please sign in to comment.