From dd329aa1672d1790091a1a7bc9cd3dc2f9e0a4c8 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 29 Mar 2023 15:31:11 -0400 Subject: [PATCH] limit implementation to specviz * defer issues with syncing axes to image viewer (specviz2d, mosviz), and slice (cubeviz) --- CHANGES.rst | 4 ---- .../plugins/unit_conversion/unit_conversion.py | 18 +++++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 65e92a9551..e2978ea353 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,8 +9,6 @@ New Features Cubeviz ^^^^^^^ -* Re-enabled unit conversion support. [#2048] - Imviz ^^^^^ @@ -25,8 +23,6 @@ Specviz Specviz2d ^^^^^^^^^ -* Re-enabled unit conversion support. [#2048] - API Changes ----------- diff --git a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py index a620c42055..873bb6690d 100644 --- a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py +++ b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py @@ -36,10 +36,14 @@ class UnitConversion(PluginTemplateMixin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - # TODO: support for multiple viewers - # TODO: support for sky coordinate axes? - # TODO: support for z-axes in image viewers - # TODO: slice indicator broken after changing spectral_unit + if self.config not in ['specviz']: + # TODO [specviz2d, mosviz] x_display_unit is not implemented in glue for image viewer used by spectrum-2d-viewer + # TODO [mosviz]: add to yaml file + # TODO [cubeviz, slice]: slice indicator broken after changing spectral_unit + # TODO: support for multiple viewers and handling of mixed state from glue (or does this force all to sync?) + self.disabled_msg = f'This plugin is temporarily disabled in {self.config}. Effort to improve it is being tracked at GitHub Issue 1972.' # noqa + + # TODO [markers]: existing markers need converting self.spectrum_viewer.state.add_callback('x_display_unit', self._on_glue_x_display_unit_changed) self.spectrum_viewer.state.add_callback('y_display_unit', @@ -54,11 +58,7 @@ def __init__(self, *args, **kwargs): @property def user_api(self): - expose = [] - if self.config in ['specviz', 'specviz2d', 'cubeviz', 'mosviz']: - expose += ['spectral_unit'] - expose += ['flux_unit'] - return PluginUserApi(self, expose=expose) + return PluginUserApi(self, expose=('spectral_unit', 'flux_unit')) def _on_glue_x_display_unit_changed(self, x_unit): if x_unit is None: