Skip to content

Commit

Permalink
spectral-extraction: support floats when possible
Browse files Browse the repository at this point in the history
* for all trace positions, widths, separations
  • Loading branch information
kecnry committed Sep 16, 2022
1 parent f1849e8 commit 22e4f30
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------------

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

0 comments on commit 22e4f30

Please sign in to comment.