Trace.taper(max_percentage, type='hann', max_length=None, side='both', **kwargs)[source]

Taper the trace.

Optional (and sometimes necessary) options to the tapering function can be provided as kwargs. See respective function definitions in Supported Methods section below.

  • type (str) Type of taper to use for detrending. Defaults to 'hann'. See the Supported Methods section below for further details.
  • max_percentage (None, float) Decimal percentage of taper at one end (ranging from 0. to 0.5).
  • max_length (None, float) Length of taper at one end in seconds.
  • side (str) Specify if both sides should be tapered (default, “both”) or if only the left half (“left”) or right half (“right”) should be tapered.


To get the same results as the default taper in SAC, use max_percentage=0.05 and leave type as hann.


If both max_percentage and max_length are set to a float, the shorter tape length is used. If both max_percentage and max_length are set to None, the whole trace will be tapered.


This operation is performed in place on the actual data arrays. The raw data is not accessible anymore afterwards. To keep your original data, use copy() to create a copy of your trace object. This also makes an entry with information on the applied processing in stats.processing of this trace.

Supported Methods

Cosine taper, for additional options like taper percentage see: obspy.signal.invsim.cosine_taper().
Modified Bartlett-Hann window. (uses: scipy.signal.barthann())
Bartlett window. (uses: scipy.signal.bartlett())
Blackman window. (uses: scipy.signal.blackman())
Minimum 4-term Blackman-Harris window. (uses: scipy.signal.blackmanharris())
Bohman window. (uses: scipy.signal.bohman())
Boxcar window. (uses: scipy.signal.boxcar())
Dolph-Chebyshev window. (uses: scipy.signal.chebwin())
Flat top window. (uses: scipy.signal.flattop())
Gaussian window with standard-deviation std. (uses: scipy.signal.gaussian())
Generalized Gaussian window. (uses: scipy.signal.general_gaussian())
Hamming window. (uses: scipy.signal.hamming())
Hann window. (uses: scipy.signal.hann())
Kaiser window with shape parameter beta. (uses: scipy.signal.kaiser())
Minimum 4-term Blackman-Harris window according to Nuttall. (uses: scipy.signal.nuttall())
Parzen window. (uses: scipy.signal.parzen())
Slepian window. (uses: scipy.signal.slepian())
Triangular window. (uses: scipy.signal.triang())