From 7941aa4a7c7a21f85fae0988c42ec4c71f5a010f Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Sat, 20 Jul 2024 17:27:16 -0400 Subject: [PATCH] Local autocenter test --- .../tests/test_vo_imviz.py | 30 +++++++++++++++++++ .../plugins/virtual_observatory/vo_plugin.py | 3 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py diff --git a/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py b/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py new file mode 100644 index 0000000000..fd40d699cd --- /dev/null +++ b/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py @@ -0,0 +1,30 @@ +import pytest + +from jdaviz.configs.imviz.tests.utils import BaseImviz_WCS_WCS +from jdaviz.configs.default.plugins.virtual_observatory.vo_plugin import vo_plugin_label + + +# TODO: Update all _obj calls to formal API calls once Plugin API is available +class TestVOImvizLocal(BaseImviz_WCS_WCS): + def test_autocenter_coords(self): + # Create a second viewer and put each data in its own viewer + self.imviz.create_image_viewer() + self.imviz.app.remove_data_from_viewer('imviz-0','has_wcs_2[SCI,1]') + self.imviz.app.add_data_to_viewer('imviz-1','has_wcs_2[SCI,1]') + + # Check default viewer is "Manual" + vo_plugin = self.imviz.plugins[vo_plugin_label]._obj + assert vo_plugin.viewer_selected == "Manual" + + # Switch to first viewer and verify coordinates have switched + vo_plugin.viewer_selected = "imviz-0" + assert vo_plugin.source == "337.51894336761296 -20.832083054811765" + + # Switch to second viewer and verify coordinates + vo_plugin.viewer_selected = "imviz-1" + assert vo_plugin.source == "337.51924057481 -20.83208305686149" + + + @pytest.mark.remote_data + def test_M32(self): + pass diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py index 72cf2e57ed..fd75d2a500 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py @@ -19,9 +19,10 @@ ) __all__ = ["VoPlugin"] +vo_plugin_label = "Virtual Observatory" -@tray_registry("VoPlugin", label="Virtual Observatory") +@tray_registry("VoPlugin", label=vo_plugin_label) class VoPlugin(PluginTemplateMixin, AddResultsMixin, TableMixin): """Plugin to query the Virtual Observatory and load data into Imviz"""