Skip to content

Commit 65fbb01

Browse files
authored
rename and deprecate Spectral Extraction plugins in specviz2d and cubeviz (#3691)
* rename and deprecate Spectral Extraction plugins in specviz2d and cubeviz to Spectral Extraction 2D and Cube Spectral Extraction * review comments
1 parent 9985c3d commit 65fbb01

File tree

21 files changed

+107
-87
lines changed

21 files changed

+107
-87
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ New Features
3333

3434
- Allow custom resolutions when exporting viewers to png or mp4. [#3478]
3535

36+
3637
Cubeviz
3738
^^^^^^^
3839

3940
- Ability to ingest and export ``SkyRegion`` objects. [#3502]
4041

4142
- Add sonified layer for each cube created by the Sonify Data plugin. [#3430, #3660]
4243

44+
- Renamed ``Spectral Extraction`` plugin to ``3D Spectral Extraction``. [#3691]
45+
4346
Imviz
4447
^^^^^
4548

@@ -76,6 +79,8 @@ Specviz2d
7679

7780
- New plugin to vizualize the cross-dispersion profile [#3552]
7881

82+
- Renamed ``Spectral Extraction`` plugin to ``2D Spectral Extraction``. [#3691]
83+
7984
API Changes
8085
-----------
8186

docs/cubeviz/export_data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To extract all the subsets created in the viewers, call the Subset Tools plugin:
3333
Documentation on how to export data from the ``spectrum-viewer``.
3434

3535
The following line of code can be used to extract 1D spectra.
36-
To use a ``function`` other than sum, use the :ref:`Spectral Extraction <spectral-extraction>` plugin
36+
To use a ``function`` other than sum, use the :ref:`3D Spectral Extraction <spectral-extraction>` plugin
3737
first to create a 1D spectrum and then refer to it by label in ``get_data``.
3838

3939
.. code-block:: python

docs/cubeviz/plugins.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ spectral region of interest.
287287

288288
.. _spectral-extraction:
289289

290-
Spectral Extraction
291-
===================
290+
3D Spectral Extraction
291+
======================
292292

293293
.. image:: ../img/cubeviz_spectral_extraction.png
294294

295295

296-
The Spectral Extraction plugin produces a 1D spectrum from a spectral
296+
The 3D Spectral Extraction plugin produces a 1D spectrum from a spectral
297297
cube. The 1D spectrum can be computed via the sum, mean, minimum, or
298298
maximum of the spatial dimensions in the spectral cube. Select an
299299
extraction operation from the :guilabel:`Function` dropdown, and
@@ -305,6 +305,12 @@ By default, if a mask was loaded with the cube, it will be applied to the
305305
cube when extracting in addition to any subsets chosen as an aperture. This
306306
is not currently done for Data Quality arrays, e.g. the DQ extension in JWST files.
307307

308+
To interact with the plugin via the API in a notebook, access the plugin object via:
309+
310+
.. code-block:: python
311+
312+
sp_ext = cubeviz.plugins['3D Spectral Extraction']
313+
308314
If using a simple subset (currently only works for a circular subset applied to data
309315
with spatial axis units in wavelength) for the spatial aperture, an option to
310316
make the aperture wavelength dependent will appear. If checked, this will

docs/specviz2d/plugins.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ Markers
4848

4949
.. _specviz2d-spectral-extraction:
5050

51-
Spectral Extraction
52-
===================
51+
2D Spectral Extraction
52+
======================
5353

54-
The Spectral Extraction plugin exposes `specreduce <https://specreduce.readthedocs.io>`_
54+
The 2D Spectral Extraction plugin exposes `specreduce <https://specreduce.readthedocs.io>`_
5555
methods for tracing, background subtraction, and spectral extraction from 2D spectra.
5656

5757
To interact with the plugin via the API in a notebook, access the plugin object via:
5858

5959
.. code-block:: python
6060
61-
sp_ext = specviz2d.plugins['Spectral Extraction']
61+
sp_ext = specviz2d.plugins['2D Spectral Extraction']
6262
6363
6464
Trace
@@ -100,7 +100,7 @@ Trace parameters can be set from the notebook by accessing the plugin.
100100
sp_ext.trace_peak_method = 'Gaussian'
101101
102102
To export and access the :py:class:`specreduce.tracing.Trace` object defined in the plugin,
103-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_trace`:
103+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_trace`:
104104

105105
.. code-block:: python
106106
@@ -115,7 +115,7 @@ via ``load``:
115115
specviz2d.load(my_trace, data_label="my trace")
116116
117117
or directly into the plugin
118-
via :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.import_trace`
118+
via :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.import_trace`
119119

120120
.. code-block:: python
121121
@@ -154,21 +154,21 @@ Background parameters can be set from the notebook by accessing the plugin.
154154
sp_ext.bg_width = 6
155155
156156
To export and access the :py:class:`specreduce.background.Background` object defined in the plugin,
157-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg`:
157+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_bg`:
158158

159159
.. code-block:: python
160160
161161
bg = sp_ext.export_bg()
162162
163163
To access the background image, background spectrum, or background-subtracted image as a
164164
:class:`~specutils.Spectrum` object,
165-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg_img`,
166-
:py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg_spectrum`,
167-
or :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg_sub`, respectively.
165+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_bg_img`,
166+
:py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_bg_spectrum`,
167+
or :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_bg_sub`, respectively.
168168

169169
To import the parameters from a :py:class:`specreduce.background.Background` object into the plugin,
170170
whether it's new or was exported and modified in the notebook,
171-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.import_bg`:
171+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.import_bg`:
172172

173173
.. code-block:: python
174174
@@ -205,21 +205,21 @@ Extraction parameters can be set from the notebook by accessing the plugin.
205205
sp_ext.ext_width = 8
206206
207207
To export and access
208-
the :py:class:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction` object defined
208+
the :py:class:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D` object defined
209209
in the plugin,
210-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_extract`:
210+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_extract`:
211211

212212
.. code-block:: python
213213
214214
ext = sp_ext.export_extract()
215215
216216
To access the extracted spectrum as a :class:`~specutils.Spectrum` object,
217-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_extract_spectrum`.
217+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.export_extract_spectrum`.
218218

219219
To import the parameters from
220-
a :py:class:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction` object
220+
a :py:class:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D` object
221221
(either a new object, or an exported one modified in the notebook) into the plugin,
222-
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.import_extract`:
222+
call :py:meth:`~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction2D.import_extract`:
223223

224224
.. code-block:: python
225225

jdaviz/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ def _link_new_data(self, reference_data=None, data_to_be_linked=None):
824824
dc.add_link(LinkSame(ref_wavelength_component, linked_wavelength_component))
825825
return
826826

827-
elif (linked_data.meta.get('Plugin', None) == 'Spectral Extraction' or
827+
elif (linked_data.meta.get('Plugin', None) == '3D Spectral Extraction' or
828828
(linked_data.meta.get('Plugin', None) == ('Gaussian Smooth') and
829829
linked_data.ndim < 3 and # Cube linking requires special logic. See below
830830
ref_data.ndim < 3)

jdaviz/configs/cubeviz/cubeviz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tray:
2525
- g-markers
2626
- cube-slice
2727
- g-unit-conversion
28-
- cubeviz-spectral-extraction
28+
- spectral-extraction-3d
2929
- g-gaussian-smooth
3030
- g-collapse
3131
- g-model-fitting

jdaviz/configs/cubeviz/helper.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,23 @@ def load_data(self, data, data_label=None, override_cube_limit=False, **kwargs):
8888

8989
super().load_data(data, parser_reference="cubeviz-data-parser", **kwargs)
9090

91-
if 'Spectral Extraction' not in self.plugins: # pragma: no cover
91+
if '3D Spectral Extraction' not in self.plugins: # pragma: no cover
9292
msg = SnackbarMessage(
93-
"Automatic spectral extraction requires the Spectral Extraction plugin to be enabled", # noqa
93+
"Automatic spectral extraction requires the 3D Spectral Extraction plugin to be enabled", # noqa
9494
color='error', sender=self, timeout=10000)
9595
self.app.hub.broadcast(msg)
9696
else:
9797
try:
98-
self.plugins['Spectral Extraction']._obj._extract_in_new_instance(auto_update=False, add_data=True) # noqa
98+
self.plugins['3D Spectral Extraction']._obj._extract_in_new_instance(auto_update=False, add_data=True) # noqa
9999
except Exception:
100100
msg = SnackbarMessage(
101101
"Automatic spectrum extraction for the entire cube failed."
102-
" See the spectral extraction plugin to perform a custom extraction",
102+
" See the 3D Spectral Extraction plugin to perform a custom extraction",
103103
color='error', sender=self, timeout=10000)
104104
else:
105105
msg = SnackbarMessage(
106106
"The extracted 1D spectrum was generated automatically for the entire cube."
107-
" See the spectral extraction plugin for details or to"
107+
" See the 3D Spectral Extraction plugin for details or to"
108108
" perform a custom extraction.",
109109
color='warning', sender=self, timeout=10000)
110110
self.app.hub.broadcast(msg)
@@ -137,22 +137,24 @@ def specviz(self):
137137
def get_data(self, data_label=None, spatial_subset=None, spectral_subset=None,
138138
cls=None, use_display_units=False):
139139
"""
140-
Returns data with name equal to ``data_label`` of type ``cls`` with subsets applied from
141-
``spectral_subset``, if applicable.
140+
Returns data with name equal to ``data_label`` of type ``cls`` with
141+
subsets applied from ``spectral_subset``, if applicable.
142142
143143
Parameters
144144
----------
145145
data_label : str, optional
146146
Provide a label to retrieve a specific data set from data_collection.
147147
spatial_subset : str, optional
148-
Spatial subset applied to data. Only applicable if ``data_label`` points to a cube or
149-
image. To extract a spectrum from a cube, use the spectral extraction plugin instead.
148+
Spatial subset applied to data. Only applicable if ``data_label``
149+
points to a cube or image. To extract a spectrum from a cube, use
150+
the 3D Spectral Extraction plugin instead.
150151
spectral_subset : str, optional
151152
Spectral subset applied to data.
152153
cls : `~specutils.Spectrum`, `~astropy.nddata.CCDData`, optional
153154
The type that data will be returned as.
154155
use_display_units : bool, optional
155-
Specify whether the returned data is in native units or the current display units.
156+
Specify whether the returned data is in native units or the current
157+
display units.
156158
157159
Returns
158160
-------

jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@
2828
from jdaviz.configs.cubeviz.plugins.viewers import WithSliceIndicator
2929

3030

31-
__all__ = ['SpectralExtraction']
31+
__all__ = ['SpectralExtraction3D']
3232

3333

3434
@tray_registry(
35-
'cubeviz-spectral-extraction', label="Spectral Extraction"
35+
'spectral-extraction-3d', label="3D Spectral Extraction"
3636
)
37-
class SpectralExtraction(PluginTemplateMixin, ApertureSubsetSelectMixin,
38-
DatasetSelectMixin, AddResultsMixin):
37+
class SpectralExtraction3D(PluginTemplateMixin, ApertureSubsetSelectMixin,
38+
DatasetSelectMixin, AddResultsMixin):
3939
"""
40-
See the :ref:`Spectral Extraction Plugin Documentation <spectral-extraction>` for more details.
40+
See the :ref:`3D Spectral Extraction Plugin Documentation <spectral-extraction>`
41+
for more details.
4142
4243
Only the following attributes and methods are available through the
4344
:ref:`public plugin API <plugin-apis>`:
@@ -279,8 +280,8 @@ def _aperture_items_changed(self, msg):
279280

280281
def _extract_in_new_instance(self, dataset=None, function='Sum', subset_lbl=None,
281282
auto_update=False, add_data=False):
282-
# create a new instance of the Spectral Extraction plugin (to not affect the instance in
283-
# the tray) and extract the entire cube with defaults.
283+
# create a new instance of the 3D Spectral Extraction plugin (to not
284+
# affect the instance in the tray) and extract the entire cube with defaults.
284285
plg = self.new()
285286
plg.dataset.selected = self.dataset.selected if dataset is None else dataset
286287
if subset_lbl is not None:

jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<j-tray-plugin
33
:config="config"
4-
:plugin_key="plugin_key || 'Spectral Extraction'"
4+
:plugin_key="plugin_key || '3D Spectral Extraction'"
55
:api_hints_enabled.sync="api_hints_enabled"
66
:description="docs_description"
77
:link="docs_link || 'https://jdaviz.readthedocs.io/en/'+vdocs+'/'+config+'/plugins.html#spectral-extraction'"

0 commit comments

Comments
 (0)