def METHOD_NAME(self):
    def smooth(x):
        if x.shape[0] < 20:
            return x
        if np.isnan(np.min(x)):
            # interpolate the nan values, works for edges & middle nans
            mask = np.isnan(x)
            x[mask] = np.interp(
                np.flatnonzero(mask),
                np.flatnonzero(~mask),
                x[~mask],
            )
        window_length = self.window_length
        polyorder = self.polyorder
        if window_length is None and polyorder is None:
            window_length = floor(len(x) / 10) * 2 + 1
            polyorder = 3
        return savgol_filter(
            x,
            window_length=window_length,
            polyorder=polyorder,
            deriv=self.deriv,
            delta=self.delta,
            mode=self.mode,
            cval=self.cval,
        )
    return smooth