obspy.realtime.rttrace.RtTrace.taper

RtTrace.taper(max_percentage, type='hann', max_length=None, side='both', **kwargs)

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.barthann())
'bartlett'
Bartlett window. (uses: scipy.signal.bartlett())
'blackman'
Blackman window. (uses: scipy.signal.blackman())
'blackmanharris'
Minimum 4-term Blackman-Harris window. (uses: scipy.signal.blackmanharris())
'bohman'
Bohman window. (uses: scipy.signal.bohman())
'boxcar'
Boxcar window. (uses: scipy.signal.boxcar())
'chebwin'
Dolph-Chebyshev window. (uses: scipy.signal.chebwin())
'flattop'
Flat top window. (uses: scipy.signal.flattop())
'gaussian'
Gaussian window with standard-deviation std. (uses: scipy.signal.gaussian())
'general_gaussian'
Generalized Gaussian window. (uses: scipy.signal.general_gaussian())
'hamming'
Hamming window. (uses: scipy.signal.hamming())
'hann'
Hann window. (uses: scipy.signal.hann())
'kaiser'
Kaiser window with shape parameter beta. (uses: scipy.signal.kaiser())
'nuttall'
Minimum 4-term Blackman-Harris window according to Nuttall. (uses: scipy.signal.nuttall())
'parzen'
Parzen window. (uses: scipy.signal.parzen())
'slepian'
Slepian window. (uses: scipy.signal.slepian())
'triang'
Triangular window. (uses: scipy.signal.triang())