From 84b30ad4d56cd90d09bfa47825989cf61bf5f5f1 Mon Sep 17 00:00:00 2001 From: Clare Shanahan Date: Wed, 11 Dec 2024 10:31:52 -0500 Subject: [PATCH] rename to get_regions --- CHANGES.rst | 2 +- .../cubeviz/plugins/tests/test_regions.py | 6 ++-- .../plugins/subset_tools/subset_tools.py | 8 ++--- .../subset_tools/tests/test_subset_tools.py | 30 ++++++++-------- jdaviz/configs/imviz/tests/test_linking.py | 4 +-- jdaviz/configs/imviz/tests/test_parser.py | 4 +-- jdaviz/configs/imviz/tests/test_regions.py | 34 +++++++++---------- jdaviz/configs/specviz/helper.py | 2 +- jdaviz/configs/specviz/tests/test_helper.py | 16 ++++----- jdaviz/core/helpers.py | 2 +- 10 files changed, 55 insertions(+), 53 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index bb733ab6a0..77b18c9f42 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -40,7 +40,7 @@ API Changes ``metadata_plugin.meta`` instead, which will return a Python dictionary instead of list of tuples. [#3292] -- Add ``get_subsets_as_regions`` method to subset plugin to retrieve spatial/spectral subsets as +- Add ``get_regions`` method to subset plugin to retrieve spatial/spectral subsets as ``regions`` or ``SpectralRegions``, deprecate ``get_interactive_regions`` and ``get_spectral_regions``. [#3340] Cubeviz diff --git a/jdaviz/configs/cubeviz/plugins/tests/test_regions.py b/jdaviz/configs/cubeviz/plugins/tests/test_regions.py index 7caf95c0a2..96488f35be 100644 --- a/jdaviz/configs/cubeviz/plugins/tests/test_regions.py +++ b/jdaviz/configs/cubeviz/plugins/tests/test_regions.py @@ -42,7 +42,7 @@ def test_regions_pixel(self): [my_reg], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('Subset 1', count=1) - assert len(self.cubeviz.plugins['Subset Tools']._obj.get_subsets_as_regions()) == 1 + assert len(self.cubeviz.plugins['Subset Tools']._obj.get_regions()) == 1 def test_regions_sky_has_wcs(self): sky = SkyCoord(205.4397, 27.0035, unit='deg') @@ -65,10 +65,10 @@ def test_spatial_spectral_mix(self): # Get spatial regions only. st = self.cubeviz.plugins['Subset Tools']._obj - spatial_subsets_as_regions = st.get_subsets_as_regions(region_type='spatial') + spatial_subsets_as_regions = st.get_regions(region_type='spatial') assert list(spatial_subsets_as_regions.keys()) == ['Subset 1'], spatial_subsets_as_regions assert isinstance(spatial_subsets_as_regions['Subset 1'], EllipsePixelRegion) - # ensure agreement between app.get_subsets and subset_tools.get_subsets_as_regions + # ensure agreement between app.get_subsets and subset_tools.get_regions ss = self.cubeviz.app.get_subsets() assert ss['Subset 1'][0]['region'] == spatial_subsets_as_regions['Subset 1'] diff --git a/jdaviz/configs/default/plugins/subset_tools/subset_tools.py b/jdaviz/configs/default/plugins/subset_tools/subset_tools.py index 33187a6983..f46c7dd35a 100644 --- a/jdaviz/configs/default/plugins/subset_tools/subset_tools.py +++ b/jdaviz/configs/default/plugins/subset_tools/subset_tools.py @@ -165,12 +165,12 @@ def __init__(self, *args, **kwargs): @property def user_api(self): - expose = ['subset', 'combination_mode', 'recenter_dataset', 'recente', - 'get_center', 'set_center', 'import_region', 'get_subsets_as_regions'] + expose = ['subset', 'combination_mode', 'recenter_dataset', 'recenter', + 'get_center', 'set_center', 'import_region', 'get_regions'] return PluginUserApi(self, expose) - def get_subsets_as_regions(self, region_type=None, list_of_subset_labels=None, - use_display_units=False): + def get_regions(self, region_type=None, list_of_subset_labels=None, + use_display_units=False): """ Return spatial and/or spectral subsets of ``region_type`` (spatial or spectral, default both) as ``regions`` or ``SpectralRegions`` objects, diff --git a/jdaviz/configs/default/plugins/subset_tools/tests/test_subset_tools.py b/jdaviz/configs/default/plugins/subset_tools/tests/test_subset_tools.py index 2e146778c8..3a038613b8 100644 --- a/jdaviz/configs/default/plugins/subset_tools/tests/test_subset_tools.py +++ b/jdaviz/configs/default/plugins/subset_tools/tests/test_subset_tools.py @@ -229,7 +229,9 @@ def test_import_spectral_regions_file(cubeviz_helper, spectrum1d_cube, tmp_path) plg.combination_mode = 'test' -def test_get_subsets_as_regions(cubeviz_helper, spectrum1d_cube, imviz_helper): +def test_get_regions(cubeviz_helper, spectrum1d_cube, imviz_helper): + + """Test Subset Tools.get regions.""" cubeviz_helper.load_data(spectrum1d_cube) plg = cubeviz_helper.plugins['Subset Tools'] @@ -241,21 +243,21 @@ def test_get_subsets_as_regions(cubeviz_helper, spectrum1d_cube, imviz_helper): spatial_reg = CirclePixelRegion(center=PixCoord(x=2, y=2), radius=2) plg.import_region(spatial_reg, combination_mode='new') - # call get_subsets_as_regions, which by default for cubeviz will return both - # spatial and spectral regoins - all_regions = plg.get_subsets_as_regions() + # call get_regions, which by default for cubeviz will return both + # spatial and spectral regions + all_regions = plg.get_regions() assert len(all_regions) == 2 # make sure filtering by subset label works - only_s1 = plg.get_subsets_as_regions(list_of_subset_labels=['Subset 1']) + only_s1 = plg.get_regions(list_of_subset_labels=['Subset 1']) assert len(only_s1) == 1 assert only_s1['Subset 1'] # now specify region type and check output - spatial_regions = plg.get_subsets_as_regions(region_type='spatial') + spatial_regions = plg.get_regions(region_type='spatial') assert len(spatial_regions) == 1 assert spatial_regions['Subset 2'] - spectral_regions = plg.get_subsets_as_regions(region_type='spectral') + spectral_regions = plg.get_regions(region_type='spectral') assert len(spectral_regions) == 1 assert spectral_regions['Subset 1'] @@ -264,26 +266,26 @@ def test_get_subsets_as_regions(cubeviz_helper, spectrum1d_cube, imviz_helper): sr2 = CirclePixelRegion(center=PixCoord(x=2.5, y=3), radius=2) plg.import_region(sr1, combination_mode='new') plg.import_region(sr2, combination_mode='and') - spatial_regions = plg.get_subsets_as_regions(region_type='spatial') + spatial_regions = plg.get_regions(region_type='spatial') assert spatial_regions['Subset 3'] # test errors with pytest.raises(ValueError, match='No spectral subests in imviz.'): - imviz_helper.plugins['Subset Tools'].get_subsets_as_regions('spectral') + imviz_helper.plugins['Subset Tools'].get_regions('spectral') with pytest.raises(ValueError, match="`region_type` must be 'spectral', 'spatial', or None for any."): # noqa E501 - plg.get_subsets_as_regions(region_type='fail') + plg.get_regions(region_type='fail') @pytest.mark.xfail(reason='Unskip once issue XXXX is resolved.') -def test_composite_get_subset_as_region(cubeviz_helper, spectrum1d_cube): +def test_get_regions_composite(cubeviz_helper, spectrum1d_cube): """ If you apply a circular subset mask to a circular subset to make a composite subset, and they aren't exactly aligned at the center to form a circular annulus, obtaining the region through ``get_interactive_regions`` - (now deprecated, replaced with get_subsets_as_regions in Subset Tools) fails. + (now deprecated, replaced with get_regions in Subset Tools) fails. However, you can retrieve the compound subset as a ``region`` with ``app.get_subsets``. This test ensures that a region is returned through - both ``app.get_subsets`` and ``get_subsets_as_regions``. + both ``app.get_subsets`` and ``get_regions``. """ cubeviz_helper.load_data(spectrum1d_cube) plg = cubeviz_helper.plugins['Subset Tools'] @@ -299,7 +301,7 @@ def test_composite_get_subset_as_region(cubeviz_helper, spectrum1d_cube): cubeviz_helper.default_viewer._obj.apply_subset_state(new_subset) # make sure Subset 3, the composite subset, is retrieved. - regions = plg.get_subsets_as_regions() + regions = plg.get_regions() ss_labels = ['Subset 1', 'Subset 2', 'Subset 3'] assert np.all([regions[ss] for ss in ss_labels]) diff --git a/jdaviz/configs/imviz/tests/test_linking.py b/jdaviz/configs/imviz/tests/test_linking.py index 81a597faec..bf168d90f3 100644 --- a/jdaviz/configs/imviz/tests/test_linking.py +++ b/jdaviz/configs/imviz/tests/test_linking.py @@ -122,11 +122,11 @@ def test_wcslink_affine_with_extras(self): all_labels = [layer.layer.label for layer in self.viewer.state.layers] # Retrieved subsets as sky regions from Subset plugin, and ensure they # match what was loaded and that they are in sky coordinates. - subset_as_regions = self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() + subset_as_regions = self.imviz.plugins['Subset Tools']._obj.get_regions() assert sorted(subset_as_regions) == ['Subset 1', 'Subset 2'] assert_allclose(subset_as_regions['Subset 1'].center.ra.deg, 337.519449) assert_allclose(subset_as_regions['Subset 2'].center.ra.deg, 337.518498) - # ensure agreement between app.get_subsets and subset_tools.get_subsets_as_regions + # ensure agreement between app.get_subsets and subset_tools.get_regions ss = self.imviz.app.get_subsets(include_sky_region=True) assert ss['Subset 1'][0]['sky_region'] == subset_as_regions['Subset 1'] assert ss['Subset 2'][0]['sky_region'] == subset_as_regions['Subset 2'] diff --git a/jdaviz/configs/imviz/tests/test_parser.py b/jdaviz/configs/imviz/tests/test_parser.py index d7eaa772ef..a194c15263 100644 --- a/jdaviz/configs/imviz/tests/test_parser.py +++ b/jdaviz/configs/imviz/tests/test_parser.py @@ -259,14 +259,14 @@ def test_parse_jwst_nircam_level2(self, imviz_helper): imviz_helper._apply_interactive_region('bqplot:rectangle', (982, 1088), (1008, 1077)) # Background - subsets = imviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = imviz_helper.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1', 'Subset 2'], subsets # check that retrieved subsets-as-regions from subset plugin match what was loaded. assert isinstance(subsets['Subset 1'], CirclePixelRegion) assert subsets['Subset 1'].center == PixCoord(970.95, 1116.05) assert isinstance(subsets['Subset 2'], RectanglePixelRegion) assert subsets['Subset 2'].center == PixCoord(995.0, 1082.5) - # ensure agreement between app.get_subsets and subset_tools.get_subsets_as_regions + # ensure agreement between app.get_subsets and subset_tools.get_regions ss = imviz_helper.app.get_subsets() assert ss['Subset 1'][0]['region'] == subsets['Subset 1'] assert ss['Subset 2'][0]['region'] == subsets['Subset 2'] diff --git a/jdaviz/configs/imviz/tests/test_regions.py b/jdaviz/configs/imviz/tests/test_regions.py index e978daa144..3fa22a78a9 100644 --- a/jdaviz/configs/imviz/tests/test_regions.py +++ b/jdaviz/configs/imviz/tests/test_regions.py @@ -70,7 +70,7 @@ def test_regions_invalid(self): # Make sure nothing is actually loaded self.verify_region_loaded('MaskedSubset 1', count=0) - assert self.imviz.plugins['Subset Tools'].get_subsets_as_regions() == {} + assert self.imviz.plugins['Subset Tools'].get_regions() == {} def test_regions_fully_out_of_bounds(self): """Glue ROI will not error when out of bounds.""" @@ -78,7 +78,7 @@ def test_regions_fully_out_of_bounds(self): bad_regions = self.subset_plugin.import_region([my_reg], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('Subset 1') - assert len(self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions()) == 1 + assert len(self.imviz.plugins['Subset Tools']._obj.get_regions()) == 1 def test_regions_mask(self): mask = np.zeros((10, 10), dtype=np.bool_) @@ -86,13 +86,13 @@ def test_regions_mask(self): bad_regions = self.subset_plugin.import_region([mask], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('MaskedSubset 1') - assert self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() == {} + assert self.imviz.plugins['Subset Tools']._obj.get_regions() == {} mask[1, 1] = True bad_regions = self.subset_plugin.import_region([mask], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('MaskedSubset 2') - assert self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() == {} + assert self.imviz.plugins['Subset Tools']._obj.get_regions() == {} # Also test deletion by label here. self.imviz._delete_region('MaskedSubset 1') @@ -103,7 +103,7 @@ def test_regions_mask(self): bad_regions = self.subset_plugin.import_region([mask], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('MaskedSubset 3') - assert self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() == {} + assert self.imviz.plugins['Subset Tools']._obj.get_regions() == {} # Deletion of non-existent label is silent no-op. self.imviz._delete_region('foo') @@ -115,7 +115,7 @@ def test_regions_pixel(self): combination_mode='new') assert len(bad_regions) == 0 self.verify_region_loaded('Subset 1') - assert len(self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions()) == 1 + assert len(self.imviz.plugins['Subset Tools']._obj.get_regions()) == 1 def test_regions_sky_has_wcs(self): # Mimic interactive region (before) @@ -141,7 +141,7 @@ def test_regions_sky_has_wcs(self): # Check interactive regions. We do not check if the translation is correct, # that check hopefully is already done in glue-astronomy. # Apparently, static region ate up one number... - subsets = self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = self.imviz.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1', 'Subset 2', 'Subset 3', 'Subset 5', 'Subset 6'], subsets # noqa: E501 assert isinstance(subsets['Subset 1'], CirclePixelRegion) assert isinstance(subsets['Subset 2'], CirclePixelRegion) @@ -161,7 +161,7 @@ def test_regions_annulus_from_load_data(self): # Test data is set up such that 1 pixel is 1 arcsec. subset_radii = {"Subset 1": [0.5, 1], "Subset 2": [1, 3]} - subsets = self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = self.imviz.plugins['Subset Tools']._obj.get_regions() subset_names = sorted(subsets.keys()) assert subset_names == ['Subset 1', 'Subset 2'] for n in subset_names: @@ -174,7 +174,7 @@ def test_photutils_pixel(self): bad_regions = self.subset_plugin.import_region([my_aper], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('Subset 1') - assert len(self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions()) == 1 + assert len(self.imviz.plugins['Subset Tools']._obj.get_regions()) == 1 def test_photutils_sky_has_wcs(self): sky = SkyCoord(ra=337.5202808, dec=-20.833333059999998, unit='deg') @@ -182,7 +182,7 @@ def test_photutils_sky_has_wcs(self): bad_regions = self.subset_plugin.import_region([my_aper_sky], return_bad_regions=True) assert len(bad_regions) == 0 self.verify_region_loaded('Subset 1') - assert len(self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions()) == 1 + assert len(self.imviz.plugins['Subset Tools']._obj.get_regions()) == 1 class TestLoadRegionsFromFile(BaseRegionHandler): @@ -204,7 +204,7 @@ def test_ds9_load_all(self, imviz_helper): assert len(bad_regions) == 1 # Will load 8/9 and 7 of that become ROIs. - subsets = imviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = imviz_helper.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1', 'Subset 2', 'Subset 3', 'Subset 4', 'Subset 5', 'Subset 6', 'Subset 7'], subsets @@ -217,7 +217,7 @@ def test_ds9_load_two_good(self, imviz_helper): bad_regions = imviz_helper.plugins['Subset Tools'].import_region( self.region_file, combination_mode='new', max_num_regions=2, return_bad_regions=True) assert len(bad_regions) == 0 - subsets = imviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = imviz_helper.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1', 'Subset 2'], subsets self.verify_region_loaded('MaskedSubset 1', count=0) @@ -227,7 +227,7 @@ def test_ds9_load_one_bad(self, imviz_helper): bad_regions = imviz_helper.plugins['Subset Tools'].import_region( self.raw_regions[6], return_bad_regions=True) assert len(bad_regions) == 1 - assert imviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() == {} + assert imviz_helper.plugins['Subset Tools']._obj.get_regions() == {} self.verify_region_loaded('MaskedSubset 1', count=0) def test_ds9_load_one_good_one_bad(self, imviz_helper): @@ -237,7 +237,7 @@ def test_ds9_load_one_good_one_bad(self, imviz_helper): [self.raw_regions[3], self.raw_regions[6]], return_bad_regions=True) assert len(bad_regions) == 1 - subsets = imviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = imviz_helper.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1'], subsets self.verify_region_loaded('MaskedSubset 1', count=0) @@ -250,13 +250,13 @@ def test_annulus(self): self.imviz._apply_interactive_region('bqplot:truecircle', (2, 2), (7, 7)) # At this point, there should be two normal circles. - subsets = self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = self.imviz.plugins['Subset Tools']._obj.get_regions() assert list(subsets.keys()) == ['Subset 1', 'Subset 2'], subsets assert isinstance(subsets['Subset 1'], CirclePixelRegion) assert isinstance(subsets['Subset 2'], CirclePixelRegion) assert subsets['Subset 1'].center == PixCoord(4.5, 4.5) assert subsets['Subset 2'].center == PixCoord(4.5, 4.5) - # ensure agreement between app.get_subsets and subset_tools.get_subsets_as_regions + # ensure agreement between app.get_subsets and subset_tools.get_regions ss = self.imviz.app.get_subsets() assert ss['Subset 1'][0]['region'] == subsets['Subset 1'] assert ss['Subset 2'][0]['region'] == subsets['Subset 2'] @@ -266,7 +266,7 @@ def test_annulus(self): new_subset = subset_groups[0].subset_state & ~subset_groups[1].subset_state self.viewer.apply_subset_state(new_subset) - subsets = self.imviz.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = self.imviz.plugins['Subset Tools']._obj.get_regions() assert len(self.imviz.app.data_collection.subset_groups) == 3 assert list(subsets.keys()) == ['Subset 1', 'Subset 2', 'Subset 3'], subsets assert isinstance(subsets['Subset 1'], CirclePixelRegion) diff --git a/jdaviz/configs/specviz/helper.py b/jdaviz/configs/specviz/helper.py index 627379ef27..066456198b 100644 --- a/jdaviz/configs/specviz/helper.py +++ b/jdaviz/configs/specviz/helper.py @@ -148,7 +148,7 @@ def get_spectra(self, data_label=None, spectral_subset=None, apply_slider_redshi return output_spectra - @deprecated(since="4.1", alternative="subset_tools.get_subsets_as_regions") + @deprecated(since="4.1", alternative="subset_tools.get_regions") def get_spectral_regions(self, use_display_units=False): """ A simple wrapper around the app-level call to retrieve only spectral diff --git a/jdaviz/configs/specviz/tests/test_helper.py b/jdaviz/configs/specviz/tests/test_helper.py index d70547630e..52f000f611 100644 --- a/jdaviz/configs/specviz/tests/test_helper.py +++ b/jdaviz/configs/specviz/tests/test_helper.py @@ -134,7 +134,7 @@ def test_get_spectral_regions_two(self): 7800*self.spec.spectral_axis.unit)) self.spec_app.plugins['Subset Tools'].import_region(subset, combination_mode='or') - spec_region = self.spec_app.plugins['Subset Tools']._obj.get_subsets_as_regions() + spec_region = self.spec_app.plugins['Subset Tools']._obj.get_regions() assert len(spec_region['Subset 1'].subregions) == 2 @@ -147,7 +147,7 @@ def test_get_spectral_regions_three(self): 7800*self.spec.spectral_axis.unit)) self.spec_app.plugins['Subset Tools'].import_region(subset, combination_mode='or') - spec_region = self.spec_app.plugins['Subset Tools']._obj.get_subsets_as_regions() + spec_region = self.spec_app.plugins['Subset Tools']._obj.get_regions() assert len(spec_region['Subset 1'].subregions) == 3 # Assert correct values for test with 3 subregions @@ -173,7 +173,7 @@ def test_get_spectral_regions_does_not_raise_value_error(self): 6*self.spec.spectral_axis.unit)) self.spec_app.plugins['Subset Tools'].import_region(subset, combination_mode='or') - spec_region = self.spec_app.plugins['Subset Tools']._obj.get_subsets_as_regions() + spec_region = self.spec_app.plugins['Subset Tools']._obj.get_regions() assert_quantity_allclose(spec_region['Subset 1'].subregions[0][0].value, 1, atol=1e-5) assert_quantity_allclose(spec_region['Subset 1'].subregions[0][1].value, @@ -194,7 +194,7 @@ def test_get_spectral_regions_composite_region(self): self.spec_app.plugins['Subset Tools'].import_region( subset, combination_mode=['new', 'andnot', 'and']) - spec_region = self.spec_app.plugins['Subset Tools']._obj.get_subsets_as_regions() + spec_region = self.spec_app.plugins['Subset Tools']._obj.get_regions() assert len(spec_region['Subset 1'].subregions) == 1 # Assert correct values for test with 3 subregions @@ -213,7 +213,7 @@ def test_get_spectral_regions_composite_region_multiple_and_nots(self): self.spec_app.plugins['Subset Tools'].import_region( subset, combination_mode=['new', 'andnot', 'andnot']) - spec_region = self.spec_app.plugins['Subset Tools']._obj.get_subsets_as_regions() + spec_region = self.spec_app.plugins['Subset Tools']._obj.get_regions() assert len(spec_region['Subset 1'].subregions) == 3 # Assert correct values for test with 3 subregions @@ -274,7 +274,7 @@ def test_get_spectral_regions_unit(specviz_helper, spectrum1d): 7000 * spectrum1d.spectral_axis.unit) specviz_helper.plugins['Subset Tools'].import_region(subset) - subsets = specviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions() + subsets = specviz_helper.plugins['Subset Tools']._obj.get_regions() reg = subsets.get('Subset 1') assert spectrum1d.spectral_axis.unit == reg.lower.unit @@ -317,12 +317,12 @@ def test_get_spectral_regions_unit_conversion(specviz_helper, spectrum1d): specviz_helper.plugins['Subset Tools'].import_region(subset) # Retrieve the Subset - ss = specviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions(use_display_units=False) + ss = specviz_helper.plugins['Subset Tools']._obj.get_regions(use_display_units=False) reg = ss.get('Subset 1') assert reg.lower.unit == u.Angstrom assert reg.upper.unit == u.Angstrom - ss = specviz_helper.plugins['Subset Tools']._obj.get_subsets_as_regions(use_display_units=True) + ss = specviz_helper.plugins['Subset Tools']._obj.get_regions(use_display_units=True) reg = ss.get('Subset 1') assert reg.lower.unit == u.um assert reg.upper.unit == u.um diff --git a/jdaviz/core/helpers.py b/jdaviz/core/helpers.py index df42464aae..61df7dc7bf 100644 --- a/jdaviz/core/helpers.py +++ b/jdaviz/core/helpers.py @@ -879,7 +879,7 @@ def load_regions(self, regions, max_num_regions=None, refdata_label=None, if return_bad_regions: return bad_regions - @deprecated(since="4.1", alternative="subset_tools.get_subsets_as_regions") + @deprecated(since="4.1", alternative="subset_tools.get_regions") def get_interactive_regions(self): """ Return spatial regions that can be interacted with in the viewer.