From 71c8197ae16d610c1d854848f69afb3d687d6a70 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Fri, 3 May 2024 10:45:16 -0400 Subject: [PATCH] hide flux_unit from unit conversion --- .../plugins/unit_conversion/tests/test_unit_conversion.py | 8 +++----- .../specviz/plugins/unit_conversion/unit_conversion.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/jdaviz/configs/specviz/plugins/unit_conversion/tests/test_unit_conversion.py b/jdaviz/configs/specviz/plugins/unit_conversion/tests/test_unit_conversion.py index b7ff19ab43..813df897a1 100644 --- a/jdaviz/configs/specviz/plugins/unit_conversion/tests/test_unit_conversion.py +++ b/jdaviz/configs/specviz/plugins/unit_conversion/tests/test_unit_conversion.py @@ -27,7 +27,7 @@ def test_value_error_exception(specviz_helper, spectrum1d, new_spectral_axis, ne if "reverting selection to" not in repr(e): raise try: - plg.flux_unit = new_flux + plg._obj.flux_unit_selected = new_flux except ValueError as e: if "reverting selection to" not in repr(e): raise @@ -62,7 +62,7 @@ def test_conv_flux_only(specviz_helper, spectrum1d, uncert): viewer = specviz_helper.app.get_viewer("spectrum-viewer") plg = specviz_helper.plugins["Unit Conversion"] new_flux = "erg / (s cm2 Angstrom)" - plg.flux_unit = new_flux + plg._obj.flux_unit_selected = new_flux assert len(specviz_helper.app.data_collection) == 1 assert u.Unit(viewer.state.x_display_unit) == u.Unit('Angstrom') @@ -80,7 +80,7 @@ def test_conv_wave_flux(specviz_helper, spectrum1d, uncert): new_spectral_axis = "micron" new_flux = "erg / (s cm2 Angstrom)" plg.spectral_unit = new_spectral_axis - plg.flux_unit = new_flux + plg._obj.flux_unit_selected = new_flux assert len(specviz_helper.app.data_collection) == 1 assert u.Unit(viewer.state.x_display_unit) == u.Unit(new_spectral_axis) @@ -93,8 +93,6 @@ def test_conv_no_data(specviz_helper): plg = specviz_helper.plugins["Unit Conversion"] with pytest.raises(ValueError, match="no valid unit choices"): plg.spectral_unit = "micron" - with pytest.raises(ValueError, match="no valid unit choices"): - plg.flux_unit = "erg / (s cm2 Angstrom)" assert len(specviz_helper.app.data_collection) == 0 diff --git a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py index 56f4c95d92..b9838ecab2 100644 --- a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py +++ b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py @@ -79,7 +79,7 @@ def __init__(self, *args, **kwargs): @property def user_api(self): - return PluginUserApi(self, expose=('spectral_unit', 'flux_unit')) + return PluginUserApi(self, expose=('spectral_unit',)) def _on_glue_x_display_unit_changed(self, x_unit): if x_unit is None: