pyke icon indicating copy to clipboard operation
pyke copied to clipboard

Consider using scikit-learn's robust linear estimator fitting inside `SFFCorrector`

Open barentsen opened this issue 7 years ago • 0 comments

Right now, in SFFCorrector, we fit the motion polynomials as follows:

            # Next, we fit the motion polynomial after removing outliers
            self.outlier_cent = sigma_clip(data=self.rot_col,
                                           sigma=sigma_2).mask
            coeffs = np.polyfit(self.rot_row[~self.outlier_cent],
                                self.rot_col[~self.outlier_cent], polyorder)
            self.poly = np.poly1d(coeffs)
            self.polyprime = np.poly1d(coeffs).deriv()

The fitting is made robust by applying sigma-clipping before polyfit. This isn't great because the sigma-clipping is not relative to e.g. the running mean.

It may be better to use a different robust fitting technique, e.g. see here: http://scikit-learn.org/stable/auto_examples/linear_model/plot_robust_fit.html

barentsen avatar Jan 15 '18 00:01 barentsen