obspy.core.trace.Trace.taper

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.

Parameters
  • 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.

Note

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

Note

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.

Note

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'

Cosine taper, for additional options like taper percentage see: obspy.signal.invsim.cosine_taper().

'barthann'

Modified Bartlett-Hann window. (uses: scipy.signal.windows.barthann())

'bartlett'

Bartlett window. (uses: scipy.signal.windows.bartlett())

'blackman'

Blackman window. (uses: scipy.signal.windows.blackman())

'blackmanharris'

Minimum 4-term Blackman-Harris window. (uses: scipy.signal.windows.blackmanharris())

'bohman'

Bohman window. (uses: scipy.signal.windows.bohman())

'boxcar'

Boxcar window. (uses: scipy.signal.windows.boxcar())

'chebwin'

Dolph-Chebyshev window. (uses: scipy.signal.windows.chebwin())

'flattop'

Flat top window. (uses: scipy.signal.windows.flattop())

'gaussian'

Gaussian window with standard-deviation std. (uses: scipy.signal.windows.gaussian())

'general_gaussian'

Generalized Gaussian window. (uses: scipy.signal.windows.general_gaussian())

'hamming'

Hamming window. (uses: scipy.signal.windows.hamming())

'hann'

Hann window. (uses: scipy.signal.windows.hann())

'kaiser'

Kaiser window with shape parameter beta. (uses: scipy.signal.windows.kaiser())

'nuttall'

Minimum 4-term Blackman-Harris window according to Nuttall. (uses: scipy.signal.windows.nuttall())

'parzen'

Parzen window. (uses: scipy.signal.windows.parzen())

'slepian'

Slepian window. (uses: scipy.signal.windows.slepian())

'triang'

Triangular window. (uses: scipy.signal.windows.triang())