obspy.core.trace.Trace¶
-
class
Trace
(data=array([], dtype=float64), header=None)[source]¶ Bases:
object
An object containing data of a continuous series, such as a seismic trace.
Parameters: - data (
ndarray
orMaskedArray
) – Array of data samples - header (dict or
Stats
) – Dictionary containing header fields
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
orMaskedArray
Note
The
.data
attribute containing the time series samples as anumpy.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 settingTrace._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__
__hash__
__module__
__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 Trace
.stats.response.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. 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 several traces. 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 of all samples in the Trace. 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 trace’s Stats
object._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__
Initialize self. __init_subclass__
This method is called when a class is subclassed. __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. __original_str__
Return short summary string of the current 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. __subclasshook__
Abstract classes can override this to customize issubclass(). __truediv__
Split Trace into new Stream containing num Traces of the same size. - data (