From 2468e0a1b394d268b598440c80299b7a03a6361d Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Thu, 24 Oct 2024 16:29:04 -0400 Subject: [PATCH 01/10] Remove UI elements deprecated since 3.9 --- jdaviz/app.vue | 2 +- .../plugins/moment_maps/moment_maps.vue | 60 ------------------- .../default/plugins/collapse/collapse.vue | 60 ------------------- 3 files changed, 1 insertion(+), 121 deletions(-) diff --git a/jdaviz/app.vue b/jdaviz/app.vue index 6ca646dc6f..5f67b89839 100644 --- a/jdaviz/app.vue +++ b/jdaviz/app.vue @@ -114,7 +114,7 @@
- {{ trayItem.label == 'Orientation' ? 'Orientation (prev. Links Control)' : trayItem.label }} + {{ trayItem.label }} diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue index 5cf4b7ea7b..3ffc5e73af 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.vue @@ -173,65 +173,5 @@ Cannot calculate moment: Must set reference wavelength for output in velocity units. - - Results - -
-
-
- - - - - - - - DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from Moment Maps plugin in a future release. - - - - - - Save as FITS - - - - -
-
- - - - - -
- A file with this name is already on disk. Overwrite? -
-
- - - - Cancel - Overwrite - - -
- -
- - -
diff --git a/jdaviz/configs/default/plugins/collapse/collapse.vue b/jdaviz/configs/default/plugins/collapse/collapse.vue index 196cf52862..8a2e4f9a49 100644 --- a/jdaviz/configs/default/plugins/collapse/collapse.vue +++ b/jdaviz/configs/default/plugins/collapse/collapse.vue @@ -59,65 +59,5 @@ :api_hints_enabled="api_hints_enabled" @click:action="collapse" > - - Results - -
-
-
- - - - - - - - - DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from here in a future release. - - - - - - Save as FITS - - - - -
-
- - - - - -
- A file with this name is already on disk. Overwrite? -
-
- - - - Cancel - Overwrite - - -
- -
- -
From 67d35a655db8a6ca1a5aab916c8b5f922d8fca2c Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Fri, 25 Oct 2024 09:47:09 -0400 Subject: [PATCH 02/10] Add change log --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 76a5861034..6d6b73ebfb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -73,6 +73,9 @@ Cubeviz - Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231] +- Remove the ``save as fits`` option from the Collapse and Moment Maps plugin; use the Export plugin instead. [#3256] + + Imviz ^^^^^ From 32b024631d198259e6a40a523909f06133bec730 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Fri, 25 Oct 2024 10:54:02 -0400 Subject: [PATCH 03/10] Remove deprecated save as fits in spectral extraction plugin --- .../spectral_extraction.vue | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue index e30cb7d28d..2f0dbd12a6 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.vue @@ -271,65 +271,5 @@ - Results - -
-
-
- - - - - - - - - DeprecationWarning: Save as FITS functionality has moved to the Export plugin as of v3.9 and will be removed from here in a future release. - - - - - - Save as FITS - - - - -
-
- - - - - -
- A file with this name is already on disk. Overwrite? -
-
- - - - Cancel - Overwrite - - -
- -
-
-
- From c069dc07e7a33b1313b95da4e56ea107ecdd8d70 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Fri, 25 Oct 2024 11:04:10 -0400 Subject: [PATCH 04/10] Remove unused tooltips --- jdaviz/components/tooltip.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/jdaviz/components/tooltip.vue b/jdaviz/components/tooltip.vue index 341f97fa3b..a31a05a8ae 100644 --- a/jdaviz/components/tooltip.vue +++ b/jdaviz/components/tooltip.vue @@ -101,9 +101,7 @@ const tooltips = { 'plugin-line-lists-spectral-range': 'Toggle filter to only lines observable within the range of the Spectrum Viewer', 'plugin-line-analysis-sync-identify': 'Lock/unlock selection with identified line', 'plugin-line-analysis-assign': 'Assign the centroid wavelength and update the redshift', - 'plugin-moment-save-fits': 'Save moment map as FITS file', 'plugin-extract-save-fits': 'Save spectral extraction as FITS file', - 'plugin-collapse-save-fits': 'Save collapsed cube as FITS file', 'plugin-link-apply': 'Apply linking to data', 'plugin-footprints-color-picker': 'Change the color of the footprint overlay', 'plugin-dq-show-all': 'Show all quality flags', From 48fbf4e8742ddb475ea8cbc6c997bac86e83e7fd Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Fri, 25 Oct 2024 11:24:39 -0400 Subject: [PATCH 05/10] Remove unused vue write methods --- .../plugins/moment_maps/moment_maps.py | 43 ------------------ .../spectral_extraction.py | 44 ------------------- .../default/plugins/collapse/collapse.py | 43 ------------------ 3 files changed, 130 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py index ca4a099d1c..a36169ef8b 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py @@ -359,46 +359,3 @@ def spectral_unit_selected(self): def vue_calculate_moment(self, *args): self.calculate_moment(add_data=True) - - def vue_save_as_fits(self, *args): - self._write_moment_to_fits() - - def vue_overwrite_fits(self, *args): - """Attempt to force writing the moment map if the user confirms the desire to overwrite.""" - self.overwrite_warn = False - self._write_moment_to_fits(overwrite=True) - - def _write_moment_to_fits(self, overwrite=False, *args): - if self.moment is None or not self.filename: # pragma: no cover - return - if not self.export_enabled: - # this should never be triggered since this is intended for UI-disabling and the - # UI section is hidden, but would prevent any JS-hacking - raise ValueError("Writing out moment map to file is currently disabled") - - # Make sure file does not end up in weird places in standalone mode. - path = os.path.dirname(self.filename) - if path and not os.path.exists(path): - raise ValueError(f"Invalid path={path}") - elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover - filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename - else: - filename = Path(self.filename).resolve() - - if filename.exists(): - if overwrite: - # Try to delete the file - filename.unlink() - if filename.exists(): - # Warn the user if the file still exists - raise FileExistsError(f"Unable to delete {filename}. Check user permissions.") - else: - self.overwrite_warn = True - return - - filename = str(filename) - self.moment.write(filename) - - # Let the user know where we saved the file. - self.hub.broadcast(SnackbarMessage( - f"Moment map saved to {os.path.abspath(filename)}", sender=self, color="success")) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index f45d8db878..96fa9f477d 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -672,50 +672,6 @@ def vue_spectral_extraction(self, *args, **kwargs): def vue_create_bg_spec(self, *args, **kwargs): self.extract_bg_spectrum(add_data=True) - def vue_save_as_fits(self, *args): - self._save_extracted_spec_to_fits() - - def vue_overwrite_fits(self, *args): - """Attempt to force writing the spectral extraction if the user - confirms the desire to overwrite.""" - self.overwrite_warn = False - self._save_extracted_spec_to_fits(overwrite=True) - - def _save_extracted_spec_to_fits(self, overwrite=False, *args): - - if not self.export_enabled: - # this should never be triggered since this is intended for UI-disabling and the - # UI section is hidden, but would prevent any JS-hacking - raise ValueError(f"Writing out extracted {self.resulting_product_name} to file is currently disabled") # noqa - - # Make sure file does not end up in weird places in standalone mode. - path = os.path.dirname(self.filename) - if path and not os.path.exists(path): - raise ValueError(f"Invalid path={path}") - elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover - filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename - else: - filename = Path(self.filename).resolve() - - if filename.exists(): - if overwrite: - # Try to delete the file - filename.unlink() - if filename.exists(): - # Warn the user if the file still exists - raise FileExistsError(f"Unable to delete {filename}. Check user permissions.") - else: - self.overwrite_warn = True - return - - filename = str(filename) - self.extracted_spec.write(filename) - - # Let the user know where we saved the file. - self.hub.broadcast(SnackbarMessage( - f"Extracted {self.resulting_product_name} saved to {os.path.abspath(filename)}", - sender=self, color="success")) - @observe('aperture_selected', 'function_selected') def _set_default_results_label(self, event={}): if not hasattr(self, 'aperture'): diff --git a/jdaviz/configs/default/plugins/collapse/collapse.py b/jdaviz/configs/default/plugins/collapse/collapse.py index 671051a51b..87067f9db4 100644 --- a/jdaviz/configs/default/plugins/collapse/collapse.py +++ b/jdaviz/configs/default/plugins/collapse/collapse.py @@ -143,46 +143,3 @@ def collapse(self, add_data=True): def vue_collapse(self, *args, **kwargs): self.collapse(add_data=True) - - def vue_save_as_fits(self, *args): - self._save_collapsed_spec_to_fits() - - def vue_overwrite_fits(self, *args): - """Attempt to force writing the file if the user confirms the desire to overwrite.""" - self.overwrite_warn = False - self._save_collapsed_spec_to_fits(overwrite=True) - - def _save_collapsed_spec_to_fits(self, overwrite=False, *args): - - if not self.export_enabled: - # this should never be triggered since this is intended for UI-disabling and the - # UI section is hidden, but would prevent any JS-hacking - raise ValueError("Writing out collapsed cube to file is currently disabled") - - # Make sure file does not end up in weird places in standalone mode. - path = os.path.dirname(self.filename) - if path and not os.path.exists(path): - raise ValueError(f"Invalid path={path}") - elif (not path or path.startswith("..")) and os.environ.get("JDAVIZ_START_DIR", ""): # noqa: E501 # pragma: no cover - filename = Path(os.environ["JDAVIZ_START_DIR"]) / self.filename - else: - filename = Path(self.filename).resolve() - - if filename.exists(): - if overwrite: - # Try to delete the file - filename.unlink() - if filename.exists(): - # Warn the user if the file still exists - raise FileExistsError(f"Unable to delete {filename}. Check user permissions.") - else: - self.overwrite_warn = True - return - - filename = str(filename) - self.collapsed_spec.write(filename) - - # Let the user know where we saved the file. - self.hub.broadcast(SnackbarMessage( - f"Collapsed cube saved to {os.path.abspath(filename)}", - sender=self, color="success")) From 358c041a884aa00236b2cab2d021e0044ba99de3 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Fri, 25 Oct 2024 12:28:38 -0400 Subject: [PATCH 06/10] Update tests after removing the deprecated methods --- .../plugins/collapse/tests/test_collapse.py | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py b/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py index d140afaeed..a88ac18113 100644 --- a/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py +++ b/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py @@ -38,7 +38,7 @@ def test_linking_after_collapse(cubeviz_helper, spectral_cube_wcs): assert dc.external_links[3].cids2[0] == dc[-1].pixel_component_ids[0] -def test_save_collapsed_to_fits(cubeviz_helper, spectral_cube_wcs, tmp_path): +def test_collapsed_to_extract_plugin(cubeviz_helper, spectral_cube_wcs, tmp_path): cubeviz_helper.load_data(Spectrum1D(flux=np.ones((3, 4, 5)) * u.nJy, wcs=spectral_cube_wcs)) @@ -58,31 +58,7 @@ def test_save_collapsed_to_fits(cubeviz_helper, spectral_cube_wcs, tmp_path): assert collapse_plugin._obj.filename == fname collapse_plugin._obj.filename = str(tmp_path / fname) - # save output file with default name, make sure it exists - collapse_plugin._obj.vue_save_as_fits() - assert (tmp_path / fname).is_file() - - # read file back in, make sure it matches - dat = CCDData.read(collapse_plugin._obj.filename) - np.testing.assert_array_equal(dat.data, collapse_plugin._obj.collapsed_spec.data) - assert dat.unit == collapse_plugin._obj.collapsed_spec.unit - - # make sure correct error message is raised when export_enabled is False - # this won't appear in UI, but just to be safe. - collapse_plugin._obj.export_enabled = False - msg = "Writing out collapsed cube to file is currently disabled" - with pytest.raises(ValueError, match=msg): - collapse_plugin._obj.vue_save_as_fits() - collapse_plugin._obj.export_enabled = True # set back to True - - # check that trying to overwrite without overwrite=True sets overwrite_warn to True, to - # display popup in UI - assert collapse_plugin._obj.overwrite_warn is False - collapse_plugin._obj.vue_save_as_fits() - assert collapse_plugin._obj.overwrite_warn - - # check that writing out to a non existent directory fails as expected - collapse_plugin._obj.filename = '/this/path/doesnt/exist.fits' - with pytest.raises(ValueError, match="Invalid path=/this/path/doesnt"): - collapse_plugin._obj.vue_save_as_fits() - collapse_plugin._obj.filename == fname # set back to original filename + label = collapse_plugin._obj.add_results.label + export_plugin = cubeviz_helper.plugins['Export']._obj + + assert label in export_plugin.data_collection.labels From 259767204a6fd71f8ee2cf27ddee14ce8f489655 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Mon, 28 Oct 2024 10:09:28 -0400 Subject: [PATCH 07/10] Update change log --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6d6b73ebfb..2073dac500 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -73,7 +73,7 @@ Cubeviz - Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231] -- Remove the ``save as fits`` option from the Collapse and Moment Maps plugin; use the Export plugin instead. [#3256] +- Remove the ``save as fits`` option from the Collapse, Moment Maps and Spectral Extraction plugin; use the Export plugin instead. [#3256] Imviz From d15bb57a47e5de60290e7d49341222eb7d2eea42 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Mon, 28 Oct 2024 10:22:45 -0400 Subject: [PATCH 08/10] Update tests and fix code style --- .../plugins/moment_maps/moment_maps.py | 8 ++--- .../moment_maps/tests/test_moment_maps.py | 35 +++---------------- .../spectral_extraction.py | 3 -- .../tests/test_spectral_extraction.py | 34 +++--------------- .../default/plugins/collapse/collapse.py | 3 -- .../plugins/collapse/tests/test_collapse.py | 1 - 6 files changed, 13 insertions(+), 71 deletions(-) diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py index a36169ef8b..3aad940765 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py @@ -1,6 +1,3 @@ -import os -from pathlib import Path - import numpy as np import specutils from astropy import units as u @@ -80,7 +77,6 @@ class MomentMap(PluginTemplateMixin, DatasetSelectMixin, SpectralSubsetSelectMix n_moment = IntHandleEmpty(0).tag(sync=True) filename = Unicode().tag(sync=True) moment_available = Bool(False).tag(sync=True) - overwrite_warn = Bool(False).tag(sync=True) output_unit_items = List().tag(sync=True) output_radio_items = List().tag(sync=True) output_unit_selected = Unicode().tag(sync=True) @@ -359,3 +355,7 @@ def spectral_unit_selected(self): def vue_calculate_moment(self, *args): self.calculate_moment(add_data=True) + + def vue_overwrite_fits(self, *args): + """Attempt to force writing the moment map if the user confirms the desire to overwrite.""" + self.overwrite_warn = False diff --git a/jdaviz/configs/cubeviz/plugins/moment_maps/tests/test_moment_maps.py b/jdaviz/configs/cubeviz/plugins/moment_maps/tests/test_moment_maps.py index 4448193356..3aab8e711c 100644 --- a/jdaviz/configs/cubeviz/plugins/moment_maps/tests/test_moment_maps.py +++ b/jdaviz/configs/cubeviz/plugins/moment_maps/tests/test_moment_maps.py @@ -1,11 +1,9 @@ -import os import warnings from pathlib import Path import numpy as np import pytest from astropy import units as u -from astropy.io import fits from astropy.nddata import CCDData from astropy.tests.helper import assert_quantity_allclose from astropy.wcs import WCS @@ -144,11 +142,6 @@ def test_moment_calculation(cubeviz_helper, spectrum1d_cube, "World 13h39m59.9731s +27d00m00.3600s (ICRS)", "204.9998877673 27.0001000000 (deg)") - assert mm._obj.filename == 'moment0_test_FLUX.fits' # Auto-populated on calculate. - mm._obj.filename = str(tmp_path / mm._obj.filename) # But we want it in tmp_path for testing. - mm._obj.vue_save_as_fits() - assert os.path.isfile(mm._obj.filename) - mm._obj.n_moment = 1 mm._obj.output_unit_selected = "Spectral Unit" assert mm._obj.results_label == 'moment 1' @@ -258,7 +251,6 @@ def test_write_momentmap(cubeviz_helper, spectrum1d_cube, tmp_path): # Simulate an existing file on disk to check for overwrite warning test_file = tmp_path / "test_file.fits" - test_file_str = str(test_file) existing_sentinel_text = "This is a simulated, existing file on disk" test_file.write_text(existing_sentinel_text) @@ -266,34 +258,15 @@ def test_write_momentmap(cubeviz_helper, spectrum1d_cube, tmp_path): warnings.filterwarnings("ignore", message="No observer defined on WCS.*") cubeviz_helper.load_data(spectrum1d_cube, data_label='test') plugin = cubeviz_helper.plugins['Moment Maps'] - moment = plugin.calculate_moment() - - # By default, we shouldn't be warning the user of anything - assert plugin._obj.overwrite_warn is False + plugin.calculate_moment() - # Attempt to write the moment map to the same file we created earlier. - plugin._obj.filename = test_file_str - plugin._obj.vue_save_as_fits() - - # We should get an overwrite warning - assert plugin._obj.overwrite_warn is True # and shouldn't have written anything (the file should be intact) assert test_file.read_text() == existing_sentinel_text - # Force overwrite the existing file - plugin._obj.vue_overwrite_fits() - - # Read back in the file and check that it is equal to the one we calculated - with fits.open(test_file_str) as pf: - assert_allclose(pf[0].data, moment.data) - w = WCS(pf[0].header) - sky = w.pixel_to_world(0, 0) - assert_allclose(sky.ra.deg, 204.9998877673) - assert_allclose(sky.dec.deg, 27.0001) + label = plugin._obj.add_results.label + export_plugin = cubeviz_helper.plugins['Export']._obj - plugin._obj.filename = "fake_path/test_file.fits" - with pytest.raises(ValueError, match="Invalid path"): - plugin._obj.vue_save_as_fits() + assert label in export_plugin.data_collection.labels @pytest.mark.remote_data diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py index 96fa9f477d..5d009cb76b 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/spectral_extraction.py @@ -1,6 +1,4 @@ -import os from functools import cached_property -from pathlib import Path import numpy as np import astropy @@ -105,7 +103,6 @@ class SpectralExtraction(PluginTemplateMixin, ApertureSubsetSelectMixin, function_selected = Unicode('Sum').tag(sync=True) filename = Unicode().tag(sync=True) extraction_available = Bool(False).tag(sync=True) - overwrite_warn = Bool(False).tag(sync=True) results_units = Unicode().tag(sync=True) spectrum_y_units = Unicode().tag(sync=True) diff --git a/jdaviz/configs/cubeviz/plugins/spectral_extraction/tests/test_spectral_extraction.py b/jdaviz/configs/cubeviz/plugins/spectral_extraction/tests/test_spectral_extraction.py index 3d79e3cff1..6b0dc0cf57 100644 --- a/jdaviz/configs/cubeviz/plugins/spectral_extraction/tests/test_spectral_extraction.py +++ b/jdaviz/configs/cubeviz/plugins/spectral_extraction/tests/test_spectral_extraction.py @@ -144,7 +144,7 @@ def test_subset( assert_array_equal(collapsed_spec_2.uncertainty.array, expected_uncert) -def test_save_collapsed_to_fits(cubeviz_helper, spectrum1d_cube_with_uncerts, tmp_path): +def test_extracted_file_in_export_plugin(cubeviz_helper, spectrum1d_cube_with_uncerts, tmp_path): cubeviz_helper.load_data(spectrum1d_cube_with_uncerts) @@ -165,34 +165,10 @@ def test_save_collapsed_to_fits(cubeviz_helper, spectrum1d_cube_with_uncerts, tm assert extract_plugin._obj.filename == fname extract_plugin._obj.filename = str(fname_path) - # save output file with default name, make sure it exists - extract_plugin._obj.vue_save_as_fits() - assert fname_path.is_file() - - # read file back in, make sure it matches - dat = Spectrum1D.read(fname_path) - assert_array_equal(dat.data, extract_plugin._obj.extracted_spec.data) - assert dat.unit == extract_plugin._obj.extracted_spec.unit - - # make sure correct error message is raised when export_enabled is False - # this won't appear in UI, but just to be safe. - extract_plugin._obj.export_enabled = False - with pytest.raises( - ValueError, match="Writing out extracted spectrum to file is currently disabled"): - extract_plugin._obj.vue_save_as_fits() - extract_plugin._obj.export_enabled = True # set back to True - - # check that trying to overwrite without overwrite=True sets overwrite_warn to True, to - # display popup in UI - assert extract_plugin._obj.overwrite_warn is False - extract_plugin._obj.vue_save_as_fits() - assert extract_plugin._obj.overwrite_warn - - # check that writing out to a non existent directory fails as expected - extract_plugin._obj.filename = '/this/path/doesnt/exist.fits' - with pytest.raises(ValueError, match="Invalid path=/this/path/doesnt"): - extract_plugin._obj.vue_save_as_fits() - extract_plugin._obj.filename == fname # set back to original filename + label = extract_plugin._obj.add_results.label + export_plugin = cubeviz_helper.plugins['Export']._obj + + assert label in export_plugin.data_collection.labels def test_aperture_markers(cubeviz_helper, spectrum1d_cube): diff --git a/jdaviz/configs/default/plugins/collapse/collapse.py b/jdaviz/configs/default/plugins/collapse/collapse.py index 87067f9db4..ad6382c0b1 100644 --- a/jdaviz/configs/default/plugins/collapse/collapse.py +++ b/jdaviz/configs/default/plugins/collapse/collapse.py @@ -1,5 +1,3 @@ -import os -from pathlib import Path import warnings from astropy.nddata import CCDData @@ -43,7 +41,6 @@ class Collapse(PluginTemplateMixin, DatasetSelectMixin, SpectralSubsetSelectMixi function_selected = Unicode('Sum').tag(sync=True) filename = Unicode().tag(sync=True) collapsed_spec_available = Bool(False).tag(sync=True) - overwrite_warn = Bool(False).tag(sync=True) # export_enabled controls whether saving to a file is enabled via the UI. This # is a temporary measure to allow server-installations to disable saving server-side until # saving client-side is supported diff --git a/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py b/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py index a88ac18113..eec8067aa1 100644 --- a/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py +++ b/jdaviz/configs/default/plugins/collapse/tests/test_collapse.py @@ -1,6 +1,5 @@ import numpy as np import pytest -from astropy.nddata import CCDData from astropy import units as u from specutils import Spectrum1D From e03b81c52502bcdf33f99ff6cc8628d2c685181a Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Mon, 28 Oct 2024 12:12:40 -0400 Subject: [PATCH 09/10] Update changelog --- CHANGES.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2073dac500..e476396fb3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -73,8 +73,7 @@ Cubeviz - Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231] -- Remove the ``save as fits`` option from the Collapse, Moment Maps and Spectral Extraction plugin; use the Export plugin instead. [#3256] - +- Removed the deprecated ``save as fits`` option from the Collapse, Moment Maps, and Spectral Extraction plugins; use the Export plugin instead. [#3256] Imviz ^^^^^ From baf3f6b37a24a8e62431e39e6bf5d611ccd059f6 Mon Sep 17 00:00:00 2001 From: Hatice Karatay Date: Mon, 28 Oct 2024 13:02:55 -0400 Subject: [PATCH 10/10] Update the changelog --- CHANGES.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index e476396fb3..fdf3397283 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -44,6 +44,7 @@ Bug Fixes Cubeviz ^^^^^^^ +- Removed the deprecated ``save as fits`` option from the Collapse, Moment Maps, and Spectral Extraction plugins; use the Export plugin instead. [#3256] Imviz ^^^^^ @@ -73,8 +74,6 @@ Cubeviz - Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231] -- Removed the deprecated ``save as fits`` option from the Collapse, Moment Maps, and Spectral Extraction plugins; use the Export plugin instead. [#3256] - Imviz ^^^^^