Skip to content

Commit

Permalink
Remove things deprecated since v3.9 (#2878)
Browse files Browse the repository at this point in the history
* Remove things deprecated since v3.9

* DOC: Complete remove rotate canvas section
  • Loading branch information
pllim authored May 22, 2024
1 parent e1e0a80 commit d4f399e
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 369 deletions.
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,26 @@ Cubeviz
spectrum in ``dataset``. This affects: model fitting, gaussian smooth, line analysis,
and moment maps. [#2827]

- Removed deprecated ``cubeviz.select_slice()`` method. Use ``cubeviz.select_wavelength()``
instead. [#2878]

- In the Slice plugin, the following deprecated properties were removed: ``wavelength`` (use ``value``),
``wavelength_unit`` (use ``value_unit``), ``show_wavelength`` (use ``show_value``),
``slice`` (use ``value``). [#2878]

Imviz
^^^^^

- Deprecated Rotate Canvas plugin was removed; use Orientation plugin instead. [#2878]

Mosviz
^^^^^^

Specviz
^^^^^^^

- In the Line Analysis plugin, deprecated ``width`` was removed (use ``continuum_width``). [#2878]

Specviz2d
^^^^^^^^^

Expand Down
30 changes: 0 additions & 30 deletions docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ For an image with a valid WCS, the compass will show directions to North (N)
and East (E) for ICRS sky coordinates. It also shows the currently displayed
data label, the X and Y directions, and the zoom box.

Note that when the axes canvas is rotated (by :ref:`rotate-canvas`), the zoom box corresponds
to the set zoom limits, not the extent of the viewer. Instead, the compass image itself is
shown rotated/flipped to the same orientation.

When you have multiple viewers created in Imviz, use the Viewer dropdown menu
to change the active viewer that it tracks.

Expand Down Expand Up @@ -400,32 +396,6 @@ To import a regions file or object from the API:
fp.import_region(region)
.. _rotate-canvas:

Canvas Rotation
===============

.. note::

This plugin is deprecated in favor of rotation via :ref:`imviz-orientation` and will be removed
in a future release.

The canvas rotation plugin allows rotating and horizontally flipping the image to any arbitrary
value by rotating the canvas axes themselves. Note that this does not affect the underlying data, and
exporting data to the notebook via the API will therefore not exhibit the same rotation.

The :ref:`imviz-compass` will also rotate (and flip) accordingly, but will show the zoom box
corresponding to the zoom limits, not the region shown in the viewer itself.

Presets are provided to reset the orientation as well as to set north up and east either to the
right or the left, as well as a slider and input to set the angle and a switch to set whether the
axes should be flipped horizontally after applying the rotation (a vertical flip can be achieved
via a 180 deg rotation and a horizontal flip).

Due to browser limitations, Canvas Rotation is only available on Chromium-based browsers.


.. _imviz-export-plot:

Export
Expand Down
3 changes: 0 additions & 3 deletions docs/reference/api_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ Plugins API
.. automodapi:: jdaviz.configs.imviz.plugins.orientation.orientation
:no-inheritance-diagram:

.. automodapi:: jdaviz.configs.imviz.plugins.rotate_canvas.rotate_canvas
:no-inheritance-diagram:

.. automodapi:: jdaviz.configs.mosviz.plugins.row_lock.row_lock
:no-inheritance-diagram:

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

Expand Down Expand Up @@ -101,22 +100,6 @@ def load_data(self, data, data_label=None, override_cube_limit=False, **kwargs):
color='warning', sender=self, timeout=10000)
self.app.hub.broadcast(msg)

@deprecated(since="3.9", alternative="select_wavelength")
def select_slice(self, slice):
"""
Select a slice by index.
Parameters
----------
slice : int
Slice integer to select
"""
if not isinstance(slice, int):
raise TypeError("slice must be an integer")
if slice < 0:
raise ValueError("slice must be positive")
self.plugins['Slice'].slice = slice

def select_wavelength(self, wavelength):
"""
Select the slice closest to the provided wavelength.
Expand Down
34 changes: 1 addition & 33 deletions jdaviz/configs/cubeviz/plugins/slice/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import numpy as np
from astropy import units as u
from astropy.units import UnitsWarning
from astropy.utils.decorators import deprecated
from traitlets import Bool, Int, Unicode, observe

from jdaviz.configs.cubeviz.plugins.viewers import (WithSliceIndicator, WithSliceSelection,
Expand Down Expand Up @@ -149,40 +148,9 @@ def slice_selection_viewers(self):
def slice_indicator_viewers(self):
return [v for v in self.app._viewer_store.values() if isinstance(v, WithSliceIndicator)]

@property
@deprecated(since="3.9", alternative="value")
def wavelength(self):
return self.user_api.value

@property
@deprecated(since="3.9", alternative="value_unit")
def wavelength_unit(self):
return self.user_api.value_unit

@property
@deprecated(since="3.9", alternative="show_value")
def show_wavelength(self):
return self.user_api.show_value

@property
@deprecated(since="3.9", alternative="value")
def slice(self):
# this assumes the first slice_selection_viewer (and layer)
return self.slice_selection_viewers[0].slice

@slice.setter
@deprecated(since="3.9", alternative="value")
def slice(self, slice):
# this assumes the first slice_selection_viewer (and layer)
value = self.slice_selection_viewers[0].slice_values[slice]
self.value = value

@property
def user_api(self):
# NOTE: remove slice, wavelength, show_wavelength after deprecation period
expose = ['slice', 'wavelength', 'show_wavelength',
'value',
'show_indicator', 'show_value']
expose = ['value', 'show_indicator', 'show_value']
if self.allow_disable_snapping:
expose += ['snap_to_slice']
return PluginUserApi(self, expose=expose)
Expand Down
6 changes: 1 addition & 5 deletions jdaviz/configs/cubeviz/plugins/tests/test_cubeviz_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ def test_plugin_user_apis(cubeviz_helper):
for plugin_name, plugin_api in cubeviz_helper.plugins.items():
plugin = plugin_api._obj
for attr in plugin_api._expose:
if plugin_name == 'Slice' and attr in ('slice', 'wavelength',
'wavelength_unit', 'show_wavelength'):
# deprecated, so would raise a deprecation warning
continue
assert hasattr(plugin, attr)
assert hasattr(plugin, attr), f"{attr} not in {plugin_name}"


def test_remote_server_disable_save_serverside():
Expand Down
1 change: 0 additions & 1 deletion jdaviz/configs/imviz/imviz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ tray:
- imviz-aper-phot-simple
- imviz-catalogs
- imviz-footprints
- imviz-rotate-canvas
- export
viewer_area:
- container: col
Expand Down
1 change: 0 additions & 1 deletion jdaviz/configs/imviz/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
from .aper_phot_simple import * # noqa
from .line_profile_xy import * # noqa
from .catalogs import * # noqa
from .rotate_canvas import * # noqa
from .footprints import * # noqa
1 change: 0 additions & 1 deletion jdaviz/configs/imviz/plugins/rotate_canvas/__init__.py

This file was deleted.

137 changes: 0 additions & 137 deletions jdaviz/configs/imviz/plugins/rotate_canvas/rotate_canvas.py

This file was deleted.

Loading

0 comments on commit d4f399e

Please sign in to comment.