pyrocko.multitrace¶
Multi-component waveform data model.
Classes
|
Container for multi-component waveforms with common time span and sampling. |
- class MultiTrace(traces=None, assemble='concatenate', data=None, codes=None, tmin=None, deltat=None)[source]¶
Bases:
Object
Container for multi-component waveforms with common time span and sampling.
Instances of this class can be used to efficiently represent multi-component waveforms of a single sensor or of a sensor array. The data samples are stored in a single 2D array where the first index runs over components and the second index over time. Metadata contains sampling rate, start-time and
CodesNSLCE
identifiers for the contained traces.The
data
is held as a NumPynumpy.ma.MaskedArray
where missing or invalid data is masked.- Parameters:
traces (
list
ofTrace
) – If given, construct multi-trace from given single-component waveforms (seeget_traces_data_as_array()
) and ignore any other arguments.
- ♦ codes¶
list
ofpyrocko.squirrel.model.CodesNSLCE
objects, default:[]
List of codes identifying the components.
- ♦ data¶
numpy.ndarray (
pyrocko.guts_array.Array
)Array containing the data samples indexed as
(icomponent, isample)
.
- ♦ tmin¶
pyrocko.util.get_time_float (
pyrocko.guts.Timestamp
), default:str_to_time('1970-01-01 00:00:00')
Start time.
- ♦ deltat¶
float
, default:1.0
Sampling interval [s]
- property summary¶
Textual summary of the waveform’s metadata attributes.
- copy(data='copy')[source]¶
Create a copy
- Parameters:
data (str) –
'copy'
to deeply copy the data, or'reference'
to create a shallow copy, referencing the original data.
- property tmax¶
End time (time of last sample, read-only).
- get_trace(i, span=slice(None, None, None))[source]¶
Get single component waveform (shared data).
- Parameters:
i (int) – Component index.
- nyquist_check(frequency, intro='Corner frequency', warn=True, raise_exception=False)[source]¶
Check if a given frequency is above the Nyquist frequency of the trace.
- Parameters:
intro (str) – String used to introduce the warning/error message.
warn (bool) – Whether to emit a warning message.
raise_exception (bool) – Whether to raise
AboveNyquist
.
- lfilter(b, a, demean=True)[source]¶
Filter waveforms with
scipy.signal.lfilter()
.Sample data is converted to type
float
, possibly demeaned and filtered usingscipy.signal.lfilter()
.
- lowpass(order, corner, nyquist_warn=True, nyquist_exception=False, demean=True)[source]¶
Filter waveforms using a Butterworth lowpass.
Sample data is converted to type
float
, possibly demeaned and filtered usingscipy.signal.lfilter()
. Filter coefficients are generated withscipy.signal.butter()
.- Parameters:
order (int) – Order of the filter.
corner (float) – Corner frequency of the filter [Hz].
demean (bool) – Subtract mean before filtering.
nyquist_warn (bool) – Warn if corner frequency is greater than Nyquist frequency.
nyquist_exception (bool) – Raise
pyrocko.trace.AboveNyquist
if corner frequency is greater than Nyquist frequency.
- highpass(order, corner, nyquist_warn=True, nyquist_exception=False, demean=True)[source]¶
Filter waveforms using a Butterworth highpass.
Sample data is converted to type
float
, possibly demeaned and filtered usingscipy.signal.lfilter()
. Filter coefficients are generated withscipy.signal.butter()
.- Parameters:
order (int) – Order of the filter.
corner (float) – Corner frequency of the filter [Hz].
demean (bool) – Subtract mean before filtering.
nyquist_warn (bool) – Warn if corner frequency is greater than Nyquist frequency.
nyquist_exception (bool) – Raise
AboveNyquist
if corner frequency is greater than Nyquist frequency.