diff --git a/CHANGES.rst b/CHANGES.rst index ad8c812541..4bcff3dbdd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -76,6 +76,9 @@ Specviz2d - Fixed default spectral extraction parameters when the background separation otherwise would have fallen directly on the edge of the image. [#1633] +- Spectral-extraction plugin: support floats for all input trace positions, separations, and widths. + [#1652] + Other Changes and Additions --------------------------- diff --git a/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py index b8152483e8..efb57595a8 100644 --- a/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py @@ -9,7 +9,7 @@ SelectPluginComponent, DatasetSelect, AddResults) -from jdaviz.core.custom_traitlets import IntHandleEmpty +from jdaviz.core.custom_traitlets import IntHandleEmpty, FloatHandleEmpty from jdaviz.core.marks import PluginLine from astropy.nddata import NDData, StdDevUncertainty, VarianceUncertainty, UnknownUncertainty @@ -36,7 +36,7 @@ class SpectralExtraction(PluginTemplateMixin): trace_type_items = List().tag(sync=True) trace_type_selected = Unicode().tag(sync=True) - trace_pixel = IntHandleEmpty(0).tag(sync=True) + trace_pixel = FloatHandleEmpty(0).tag(sync=True) trace_peak_method_items = List().tag(sync=True) trace_peak_method_selected = Unicode().tag(sync=True) @@ -51,10 +51,10 @@ class SpectralExtraction(PluginTemplateMixin): bg_type_items = List().tag(sync=True) bg_type_selected = Unicode().tag(sync=True) - bg_trace_pixel = IntHandleEmpty(0).tag(sync=True) + bg_trace_pixel = FloatHandleEmpty(0).tag(sync=True) - bg_separation = IntHandleEmpty(0).tag(sync=True) - bg_width = IntHandleEmpty(0).tag(sync=True) + bg_separation = FloatHandleEmpty(0).tag(sync=True) + bg_width = FloatHandleEmpty(0).tag(sync=True) bg_results_label = Unicode().tag(sync=True) bg_results_label_default = Unicode().tag(sync=True) @@ -79,7 +79,7 @@ class SpectralExtraction(PluginTemplateMixin): ext_type_items = List(['Boxcar', 'Horne']).tag(sync=True) ext_type_selected = Unicode('Boxcar').tag(sync=True) - ext_width = IntHandleEmpty(0).tag(sync=True) + ext_width = FloatHandleEmpty(0).tag(sync=True) ext_uncert_warn = Bool(False).tag(sync=True) ext_specreduce_err = Unicode().tag(sync=True) diff --git a/jdaviz/configs/specviz2d/plugins/spectral_extraction/tests/test_spectral_extraction.py b/jdaviz/configs/specviz2d/plugins/spectral_extraction/tests/test_spectral_extraction.py index 6c2dbf3ad1..ed0a5a18e6 100644 --- a/jdaviz/configs/specviz2d/plugins/spectral_extraction/tests/test_spectral_extraction.py +++ b/jdaviz/configs/specviz2d/plugins/spectral_extraction/tests/test_spectral_extraction.py @@ -73,8 +73,8 @@ def test_plugin(specviz2d_helper): assert len(bg.traces) == 1 assert bg.traces[0].trace[0] == 28 + 4 assert bg.width == 3 - bg = pext.export_bg(bg_width=5) - assert bg.width == 5 + bg = pext.export_bg(bg_width=3.3) + assert bg.width == 3.3 bg.width = 4 pext.import_bg(bg) assert pext.bg_width == 4