savitzky_golay_piecewise

Math.least_squares.savitzky_golay_piecewise(xvals, data, kernel=11, order=4)

In cyclic voltammetry, voltage (being the abcissa) changes like a triangle wave. And in the signal there are cusps at the turning points (at switching potentials) which should never be smoothed. In this case, Savitzky-Golay smoothing should be done piecewise, ie. separately on pieces monotonic in x.