Skip to content

Commit

Permalink
update to make use of FitTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Nov 8, 2022
1 parent 11543ab commit b41ee77
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def _update_plugin_marks(self, *args):
sp1d = self.export_extract_spectrum(add_data=False)
except Exception as e:
# NOTE: ignore error, but will be raised when clicking ANY of the export buttons
# NOTE: AutoTrace or manual background are often giving a
# NOTE: FitTrace or manual background are often giving a
# "background regions overlapped" error from specreduce
self.ext_specreduce_err = repr(e)
self.marks['extract'].clear()
Expand Down Expand Up @@ -621,11 +621,12 @@ def import_trace(self, trace):
if isinstance(trace, tracing.FlatTrace):
self.trace_type_selected = 'Flat'
self.trace_pixel = trace.trace_pos
elif isinstance(trace, tracing.AutoTrace):
self.trace_type_selected = 'Auto'
elif isinstance(trace, tracing.FitTrace):
self.trace_type_selected = trace.trace_model.__class__.__name__.strip('1D')
self.trace_pixel = trace.guess
self.trace_window = trace.window
self.trace_bins = trace.bins
self.trace_order = trace.degree
elif isinstance(trace, tracing.ArrayTrace): # pragma: no cover
raise NotImplementedError(f"cannot import ArrayTrace into plugin. Use viz.load_trace instead") # noqa
else: # pragma: no cover
Expand Down Expand Up @@ -664,12 +665,12 @@ def export_trace(self, add_data=False, **kwargs):

elif self.trace_type_selected in _model_cls:
trace_model = _model_cls[self.trace_type_selected](degree=self.trace_order)
trace = tracing.AutoTrace(self.trace_dataset.selected_obj.data,
guess=self.trace_pixel,
bins=int(self.trace_bins),
window=self.trace_window,
peak_method=self.trace_peak_method_selected.lower(),
trace_model=trace_model)
trace = tracing.FitTrace(self.trace_dataset.selected_obj.data,
guess=self.trace_pixel,
bins=int(self.trace_bins),
window=self.trace_window,
peak_method=self.trace_peak_method_selected.lower(),
trace_model=trace_model)

else:
raise NotImplementedError(f"trace_type={self.trace_type_selected} not implemented")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
type="number"
v-model.number="trace_pixel"
:rules="[() => trace_pixel!=='' || 'This field is required']"
:hint="trace_type_selected === 'Flat' ? 'Pixel row for flat trace.' : 'Pixel row initial guess for auto trace.'"
:hint="trace_type_selected === 'Flat' ? 'Pixel row for flat trace.' : 'Pixel row initial guess for fitting the trace.'"
persistent-hint
>
</v-text-field>
Expand Down

0 comments on commit b41ee77

Please sign in to comment.