#### Previous topic

scipy.signal.sosfilt_zi

#### Next topic

scipy.signal.hilbert

# scipy.signal.sosfiltfilt

`scipy.signal.``sosfiltfilt`(sos, x, axis=-1, padtype='odd', padlen=None)

  A forward-backward filter using cascaded second-order sections.

  See `filtfilt` for more complete information about this method.

  > Parameters: | sos : array_like Array of second-order filter coefficients, must have shape `(n_sections, 6)`. Each row corresponds to a second-order section, with the first three columns providing the numerator coefficients and the last three providing the denominator coefficients. x : array_like The array of data to be filtered. axis : int, optional The axis of x to which the filter is applied. Default is -1. padtype : str or None, optional Must be ‘odd’, ‘even’, ‘constant’, or None. This determines the type of extension to use for the padded signal to which the filter is applied. If padtype is None, no padding is used. The default is ‘odd’. padlen : int or None, optional The number of elements by which to extend x at both ends of axis before applying the filter. This value must be less than `x.shape[axis] - 1`. `padlen=0` implies no padding. The default value is:
  >     3 * (2 * len(sos) + 1 - min((sos[:, 2] == 0).sum(),
  >                                 (sos[:, 5] == 0).sum()))
  The extra subtraction at the end attempts to compensate for poles and zeros at the origin (e.g. for odd-order filters) to yield equivalent estimates of padlen to those of `filtfilt` for second-order section filters built with `scipy.signal` functions.
  Returns: | y : ndarray The filtered output with the same shape as x.

  See also

  `filtfilt`, `sosfilt`, `sosfilt_zi`, `sosfreqz`

  Notes

  New in version 0.18.0.