obspy.core.trace.Trace

class Trace(data=array(, []dtype=float64), header=None)[source]

Bases: builtins.object

An object containing data of a continuous series, such as a seismic trace.

Parameters:
Variables:
  • id A SEED compatible identifier of the trace.
  • stats A container Stats for additional header information of the trace.
  • data Data samples in a ndarray or MaskedArray

Note

The .data attribute containing the time series samples as a numpy.ndarray will always be made contiguous in memory. This way it is always safe to use .data in routines that internally pass the array to C code. On the other hand this might result in some unwanted copying of data in memory. Experts can opt-out by setting Trace._always_contiguous = False, in this case the user has to make sure themselves that no C operations are performed on potentially incontiguous data.

Supported Operations

trace = traceA + traceB
Merges traceA and traceB into one new trace object. See also: Trace.__add__().
len(trace)
Returns the number of samples contained in the trace. That is it es equal to len(trace.data). See also: Trace.__len__().
str(trace)
Returns basic information about the trace object. See also: Trace.__str__().

Attributes

__dict__
__doc__ str(object=’‘) -> str
__hash__
__module__ str(object=’‘) -> str
__weakref__ list of weak references to the object (if defined)
id Return a SEED compatible identifier of the trace.
meta

Public Methods

attach_response Search for and attach channel response to the trace as
copy Returns a deepcopy of the trace.
count Return number of data samples of the current trace.
decimate Downsample trace data by an integer factor.
detrend Remove a trend from the trace.
differentiate Differentiate the trace with respect to time.
filter Filter the data of the current trace.
get_id Return a SEED compatible identifier of the trace.
integrate Integrate the trace with respect to time.
interpolate Interpolate the data using various interpolation techniques.
max Returns the value of the absolute maximum amplitude in the trace.
normalize Normalize the trace to its absolute maximum.
plot Create a simple graph of the current trace.
remove_response Deconvolve instrument response.
remove_sensitivity Remove instrument sensitivity.
resample Resample trace data using Fourier method. Spectra are linearly
simulate Correct for instrument response / Simulate new instrument response.
slice Return a new Trace object with data going from start to end time.
slide Generator yielding equal length sliding windows of the Trace.
spectrogram Create a spectrogram plot of the trace.
split Split Trace object containing gaps using a NumPy masked array into
std Method to get the standard deviation of amplitudes in the trace.
taper Taper the trace.
times For convenient plotting compute a NumPy array with timing information
trigger Run a triggering algorithm on the data of the current trace.
trim Cut current trace to given start and end time.
verify Verify current trace object against available meta data.
write Save current trace into a file.

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

_get_response Search for and return channel response for the trace.
_internal_add_processing_info Add the given informational string to the processing field in the
_ltrim Cut current trace to given start time.
_repr_pretty_
_rtrim Cut current trace to given end time.

Special Methods

__add__ Add another Trace object to current trace.
__dir__ default dir() implementation
__div__ Split Trace into new Stream containing num Traces of the same size.
__eq__ Implements rich comparison of Trace objects for “==” operator.
__format__ default object formatter
__ge__ Too ambiguous, throw an Error.
__getitem__ __getitem__ method of Trace object.
__gt__ Too ambiguous, throw an Error.
__init__
__le__ Too ambiguous, throw an Error.
__len__ Return number of data samples of the current trace.
__lt__ Too ambiguous, throw an Error.
__mod__ Split Trace into new Stream containing Traces with num samples.
__mul__ Create a new Stream containing num copies of this trace.
__ne__ Implements rich comparison of Trace objects for ”!=” operator.
__new__ Create and return a new object.
__nonzero__ No data means no trace.
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__setattr__ __setattr__ method of Trace object.
__sizeof__ size of object in memory, in bytes
__str__ Monkey patch for the __str__ method of the Trace object. SEGY object do not
__subclasshook__ Abstract classes can override this to customize issubclass().
__truediv__ Split Trace into new Stream containing num Traces of the same size.