Skip to content

Commit

Permalink
Merge pull request #2846 from bmorris3/cubeviz-spec-extract-user-api
Browse files Browse the repository at this point in the history
Hide flux_unit from unit conversion
  • Loading branch information
bmorris3 authored May 3, 2024
2 parents a7f7c10 + 71c8197 commit 83863e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand All @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 83863e2

Please sign in to comment.