Data.SG_Filter

Data.SG_Filter(col=None, xcol=None, points=15, poly=1, order=0, pad=True, result=None, replace=False, header=None)

Implement a Savitsky-Golay filtering of data for smoothing and differentiating data.

Parameters
  • col (column index) – Column of Data to be filtered. if None, first y-column in setas is filtered.

  • points (int) – Number of data points to use in the filtering window. Should be an odd number > poly+1 (default 15)

Keyword Arguments
  • xcol (coilumn index) – If order>1 then can be used to specify an x-column to differentiate with respect to.

  • poly (int) – Order of polynomial to fit to the data. Must be equal or greater than order (default 1)

  • order (int) – Order of differentiation to carry out. Default=0 meaning smooth the data only.

  • pad (bool or float) – Pad the start and end of the array with the mean value (True, default) or specired value (float) or leave as is.

  • result (None,True, or column_index) – If not None, column index to insert new data, or True to append as last column

  • header (string or None) – Header for new column if result is not None. If header is Nne, a suitable column header is generated.

Returns

(numpy array or self) – If result is None, a numpy array representing the smoothed or differentiated data is returned. Otherwise, a copy of the modified AnalysisMixin object is returned.

Notes

If col is not specified or is None then the DataFile.setas column assignments are used to set an x and y column. If col is a tuple, then it is assumed to secify and x-column and y-column for differentiating data. This is now a pass through to scipy.signal.savgol_filter()

Padding can help stop wildly wrong artefacts in the data at the start and enf of the data, particularly when the differntial order is >1.

See also

User guide section Smoothing and Filtering Data