diff --git a/jdaviz/configs/imviz/tests/test_subset_centroid.py b/jdaviz/configs/imviz/tests/test_subset_centroid.py index 7221986520..3fcb00eb47 100644 --- a/jdaviz/configs/imviz/tests/test_subset_centroid.py +++ b/jdaviz/configs/imviz/tests/test_subset_centroid.py @@ -19,7 +19,7 @@ def test_centroiding_pixel(self): for data_label in ('fits_wcs[DATA]', 'gwcs[DATA]'): plg.dataset_selected = data_label plg.set_center((2, 2), update=True) # Move the Subset back first. - plg.vue_recenter_subset() + plg.recenter() # Calculate and move to centroid. for key in ("X Center (pixels)", "Y Center (pixels)"): @@ -40,27 +40,27 @@ def test_centroiding_wcs(self): self.imviz.link_data(align_by='wcs') reg = CirclePixelRegion(PixCoord(2, 2), 3).to_sky(self.wcs_1) - plg = self.imviz.plugins['Subset Tools']._obj + plg = self.imviz.plugins['Subset Tools'] plg.import_region(reg) - plg.subset_selected = 'Subset 1' - plg.dataset_selected = 'fits_wcs[DATA]' - plg.vue_recenter_subset() + plg.subset = 'Subset 1' + plg.recenter_dataset = 'fits_wcs[DATA]' + plg.recenter() # Pixel value is now w.r.t. fake WCS layer, not the selected data. for key in ("value", "orig"): # subset definition is now in sky coordinates. get RA and Dec and convert back to pixel # to compare with expected recentered position. - ra = plg._get_value_from_subset_definition(0, "RA Center (degrees)", key) * u.deg - dec = plg._get_value_from_subset_definition(0, "Dec Center (degrees)", key) * u.deg + ra = plg._obj._get_value_from_subset_definition(0, "RA Center (degrees)", key) * u.deg + dec = plg._obj._get_value_from_subset_definition(0, "Dec Center (degrees)", key) * u.deg x, y = SkyCoord(ra, dec).to_pixel(self.wcs_1) assert_allclose((x, y), -1) # GWCS does not extrapolate and this Subset is out of bounds, # so will get NaNs and enter the exception handling logic. - plg.dataset_selected = 'gwcs[DATA]' + plg.recenter_dataset = 'gwcs[DATA]' plg.set_center((2.6836, 1.6332), update=True) # Move the Subset back first. - plg.vue_recenter_subset() + plg.recenter() subsets = self.imviz.app.get_subsets(include_sky_region=True) subsets_sky = subsets['Subset 1'][0]['sky_region'] subsets_pix = subsets['Subset 1'][0]['region'] diff --git a/jdaviz/tests/test_subsets.py b/jdaviz/tests/test_subsets.py index d0afb98f46..b00dd5f6be 100644 --- a/jdaviz/tests/test_subsets.py +++ b/jdaviz/tests/test_subsets.py @@ -36,7 +36,7 @@ def test_region_from_subset_2d(cubeviz_helper): assert_allclose(reg.height, 6.6) assert_allclose(reg.angle.value, 0) - assert subset_plugin._obj.subset_selected == "Subset 1" + assert subset_plugin.subset == "Subset 1" assert subset_plugin._obj.subset_types == ["EllipticalROI"] assert subset_plugin._obj.is_centerable for key in ("orig", "value"): @@ -52,7 +52,7 @@ def test_region_from_subset_2d(cubeviz_helper): # Recenter GUI should not be exposed, but API call would raise exception. with pytest.raises(NotImplementedError, match='Cannot recenter'): - subset_plugin._obj.vue_recenter_subset() + subset_plugin.recenter() def test_region_from_subset_3d(cubeviz_helper): @@ -430,12 +430,12 @@ def test_recenter_linked_by_wcs(imviz_helper): RectanglePixelRegion(center=PixCoord(x=229, y=152), width=17, height=7).to_sky(w)) subset_plugin = imviz_helper.plugins['Subset Tools'] - subset_plugin._obj.subset_selected = "Subset 1" - subset_plugin._obj.dataset_selected = "gauss100_fits_wcs_block_reduced[PRIMARY,1]" + subset_plugin.subset = "Subset 1" + subset_plugin.recenter_dataset = "gauss100_fits_wcs_block_reduced[PRIMARY,1]" # Do it a few times to converge. for _ in range(5): - subset_plugin._obj.vue_recenter_subset() + subset_plugin.recenter() # If handled correctly, it won't change much. # But if not, it move down by 7 pix or so (229.05, 145.92) and fails the test. @@ -453,7 +453,7 @@ def test_recenter_linked_by_wcs(imviz_helper): # Do it a few times to converge. for _ in range(5): - subset_plugin._obj.vue_recenter_subset() + subset_plugin._obj.recenter() xy = imviz_helper.default_viewer._obj._get_real_xy( imviz_helper.app.data_collection[0], *subset_plugin.get_center("Subset 2"))[:2]