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 index e0fa8f7f82..3ab99e8315 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/tests/test_vo_imviz.py @@ -217,7 +217,7 @@ def _init_voplugin_M51(self, imviz_helper): vo_plugin.viewer_selected = "Manual" vo_plugin.source = "M51" vo_plugin.radius_val = 1 - vo_plugin.radius_unit = "deg" + vo_plugin.radius_unit.selected = "deg" vo_plugin.waveband_selected = "optical" return vo_plugin @@ -289,7 +289,7 @@ def test_target_lookup_warnings(self, imviz_helper): vo_plugin.viewer_selected = "Manual" vo_plugin.source = "ThisIsAFakeTargetThatWontResolveToAnything" vo_plugin.radius_val = 1 - vo_plugin.radius_unit = "deg" + vo_plugin.radius_unit.selected = "deg" # If we have coverage filtering on, we should get an error vo_plugin.resource_filter_coverage = True diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py index 0fe121649b..edf75884e1 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.py @@ -23,6 +23,7 @@ AddResultsMixin, TableMixin, ViewerSelect, + UnitSelectPluginComponent, ) __all__ = ["VoPlugin"] @@ -49,7 +50,8 @@ class VoPlugin(PluginTemplateMixin, AddResultsMixin, TableMixin): coordframes = List([]).tag(sync=True) coordframe_selected = Unicode("icrs").tag(sync=True) radius_val = Float(1).tag(sync=True) - radius_unit = Unicode("deg").tag(sync=True) + radius_unit_items = List().tag(sync=True) + radius_unit_selected = Unicode("deg").tag(sync=True) results_loading = Bool(False).tag(sync=True) data_loading = Bool(False).tag(sync=True) @@ -60,6 +62,11 @@ def __init__(self, *args, **kwargs): self, "viewer_items", "viewer_selected", manual_options=["Manual"] ) + self.radius_unit = UnitSelectPluginComponent( + self, items="radius_unit_items", selected="radius_unit_selected" + ) + self.radius_unit.choices = ["deg", "rad", "arcmin", "arcsec"] + # Waveband properties to filter available registry resources self.wavebands = [ w.lower() for w in vocabularies.get_vocabulary("messenger")["terms"] @@ -187,7 +194,7 @@ def vue_query_registry_resources(self, _=None): ) registry_args.append( registry.Spatial( - (coord, (self.radius_val * u.Unit(self.radius_unit))), + (coord, (self.radius_val * u.Unit(self.radius_unit.selected))), intersect="overlaps", ) ) @@ -256,7 +263,7 @@ def vue_query_resource(self, _=None): sia_results = sia_service.search( coord, size=( - (self.radius_val * u.Unit(self.radius_unit)) + (self.radius_val * u.Unit(self.radius_unit.selected)) if self.radius_val > 0.0 else None ), diff --git a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue index adafdd558a..fe15fe5a98 100644 --- a/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue +++ b/jdaviz/configs/default/plugins/virtual_observatory/vo_plugin.vue @@ -53,9 +53,9 @@