@@ -51,8 +51,11 @@ class SpectralExtraction(PluginTemplateMixin):
51
51
* :attr:`trace_pixel` :
52
52
pixel of the trace. If ``trace_type`` is not ``Flat``, then this
53
53
is the "guess" for the automated trace.
54
+ * :attr:`trace_do_binning` :
55
+ only applicable if ``trace_type`` is not ``Flat``. Bin the input data when fitting the
56
+ trace.
54
57
* :attr:`trace_bins` :
55
- only applicable if ``trace_type`` is not ``Flat``.
58
+ only applicable if ``trace_type`` is not ``Flat`` and ``trace_do_binning`` .
56
59
* :attr:`trace_window` :
57
60
full width of the trace.
58
61
* :meth:`import_trace`
@@ -111,6 +114,7 @@ class SpectralExtraction(PluginTemplateMixin):
111
114
trace_peak_method_items = List ().tag (sync = True )
112
115
trace_peak_method_selected = Unicode ().tag (sync = True )
113
116
117
+ trace_do_binning = Bool (True ).tag (sync = True )
114
118
trace_bins = IntHandleEmpty (20 ).tag (sync = True )
115
119
trace_window = IntHandleEmpty (0 ).tag (sync = True )
116
120
@@ -311,7 +315,8 @@ def user_api(self):
311
315
return PluginUserApi (self , expose = ('interactive_extract' ,
312
316
'trace_dataset' , 'trace_type' ,
313
317
'trace_order' , 'trace_peak_method' ,
314
- 'trace_pixel' , 'trace_bins' , 'trace_window' ,
318
+ 'trace_pixel' ,
319
+ 'trace_do_binning' , 'trace_bins' , 'trace_window' ,
315
320
'import_trace' ,
316
321
'export_trace' ,
317
322
'bg_dataset' , 'bg_type' ,
@@ -483,7 +488,7 @@ def marks(self):
483
488
@observe ('trace_dataset_selected' , 'trace_type_selected' ,
484
489
'trace_trace_selected' , 'trace_offset' , 'trace_order' ,
485
490
'trace_pixel' , 'trace_peak_method_selected' ,
486
- 'trace_bins' , 'trace_window' , 'active_step' )
491
+ 'trace_do_binning' , ' trace_bins' , 'trace_window' , 'active_step' )
487
492
def _interaction_in_trace_step (self , event = {}):
488
493
if not self .plugin_opened or not self ._do_marks :
489
494
return
@@ -626,6 +631,7 @@ def import_trace(self, trace):
626
631
self .trace_pixel = trace .guess
627
632
self .trace_window = trace .window
628
633
self .trace_bins = trace .bins
634
+ self .trace_do_binning = True
629
635
if hasattr (trace .trace_model , 'degree' ):
630
636
self .trace_order = trace .trace_model .degree
631
637
elif isinstance (trace , tracing .ArrayTrace ): # pragma: no cover
@@ -668,7 +674,7 @@ def export_trace(self, add_data=False, **kwargs):
668
674
trace_model = _model_cls [self .trace_type_selected ](degree = self .trace_order )
669
675
trace = tracing .FitTrace (self .trace_dataset .selected_obj ,
670
676
guess = self .trace_pixel ,
671
- bins = int (self .trace_bins ),
677
+ bins = int (self .trace_bins ) if self . trace_do_binning else None ,
672
678
window = self .trace_window ,
673
679
peak_method = self .trace_peak_method_selected .lower (),
674
680
trace_model = trace_model )
0 commit comments