From 22927957b8eea3fb1878d756df52fe64028ab99d Mon Sep 17 00:00:00 2001 From: Hannu Parviainen Date: Tue, 26 Nov 2024 17:14:09 +0000 Subject: [PATCH] Changed FitTrace to use a linear fitter (LinearLSQFitter) when fitting a linear trace model. --- specreduce/tracing.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/specreduce/tracing.py b/specreduce/tracing.py index deb6af4..509bf70 100644 --- a/specreduce/tracing.py +++ b/specreduce/tracing.py @@ -394,9 +394,13 @@ def _fit_trace(self, img): y_bins = y_bins[y_finite] # use given model to bin y-values; interpolate over all wavelengths - fitter = (fitting.SplineSmoothingFitter() - if isinstance(self.trace_model, models.Spline1D) - else fitting.LMLSQFitter()) + if isinstance(self.trace_model, models.Spline1D): + fitter = fitting.SplineSmoothingFitter() + elif self.trace_model.linear: + fitter = fitting.LinearLSQFitter() + else: + fitter = fitting.LMLSQFitter() + self.trace_model_fit = fitter(self.trace_model, x_bins, y_bins) trace_x = np.arange(img.shape[self._disp_axis])