@@ -51,8 +51,11 @@ class SpectralExtraction(PluginTemplateMixin):
5151 * :attr:`trace_pixel` :
5252 pixel of the trace. If ``trace_type`` is not ``Flat``, then this
5353 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.
5457 * :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`` .
5659 * :attr:`trace_window` :
5760 full width of the trace.
5861 * :meth:`import_trace`
@@ -111,6 +114,7 @@ class SpectralExtraction(PluginTemplateMixin):
111114 trace_peak_method_items = List ().tag (sync = True )
112115 trace_peak_method_selected = Unicode ().tag (sync = True )
113116
117+ trace_do_binning = Bool (True ).tag (sync = True )
114118 trace_bins = IntHandleEmpty (20 ).tag (sync = True )
115119 trace_window = IntHandleEmpty (0 ).tag (sync = True )
116120
@@ -311,7 +315,8 @@ def user_api(self):
311315 return PluginUserApi (self , expose = ('interactive_extract' ,
312316 'trace_dataset' , 'trace_type' ,
313317 'trace_order' , 'trace_peak_method' ,
314- 'trace_pixel' , 'trace_bins' , 'trace_window' ,
318+ 'trace_pixel' ,
319+ 'trace_do_binning' , 'trace_bins' , 'trace_window' ,
315320 'import_trace' ,
316321 'export_trace' ,
317322 'bg_dataset' , 'bg_type' ,
@@ -483,7 +488,7 @@ def marks(self):
483488 @observe ('trace_dataset_selected' , 'trace_type_selected' ,
484489 'trace_trace_selected' , 'trace_offset' , 'trace_order' ,
485490 'trace_pixel' , 'trace_peak_method_selected' ,
486- 'trace_bins' , 'trace_window' , 'active_step' )
491+ 'trace_do_binning' , ' trace_bins' , 'trace_window' , 'active_step' )
487492 def _interaction_in_trace_step (self , event = {}):
488493 if not self .plugin_opened or not self ._do_marks :
489494 return
@@ -626,6 +631,7 @@ def import_trace(self, trace):
626631 self .trace_pixel = trace .guess
627632 self .trace_window = trace .window
628633 self .trace_bins = trace .bins
634+ self .trace_do_binning = True
629635 if hasattr (trace .trace_model , 'degree' ):
630636 self .trace_order = trace .trace_model .degree
631637 elif isinstance (trace , tracing .ArrayTrace ): # pragma: no cover
@@ -668,7 +674,7 @@ def export_trace(self, add_data=False, **kwargs):
668674 trace_model = _model_cls [self .trace_type_selected ](degree = self .trace_order )
669675 trace = tracing .FitTrace (self .trace_dataset .selected_obj ,
670676 guess = self .trace_pixel ,
671- bins = int (self .trace_bins ),
677+ bins = int (self .trace_bins ) if self . trace_do_binning else None ,
672678 window = self .trace_window ,
673679 peak_method = self .trace_peak_method_selected .lower (),
674680 trace_model = trace_model )
0 commit comments