signal
Utility functions for Pyadjoint.
- copyright
adjTomo Dev Team (adjtomo@gmail.com), 2022 Lion Krischer (krischer@geophysik.uni-muenchen.de), 2015
- license
BSD 3-Clause (“BSD New” or “BSD Simplified”)
Module Contents
Functions
|
Convenience function to get window start and end times, and start and end |
|
Perform a number of basic sanity checks to assure the data is valid |
|
Helper function to taper a window within a data trace. |
|
Window taper function to taper a time series with various taper functions. |
|
Check for cycle skipping by looking at the smoothness of phi |
Attributes
- signal.get_window_info(window, dt)[source]
Convenience function to get window start and end times, and start and end samples. Repeated a lot throughout package so useful to keep it defined in one place.
- signal.sanity_check_waveforms(observed, synthetic)[source]
Perform a number of basic sanity checks to assure the data is valid in a certain sense.
It checks the types of both, the start time, sampling rate, number of samples, etc.
- Parameters
observed (
obspy.core.trace.Trace
) – The observed data.synthetic (
obspy.core.trace.Trace
) – The synthetic data.
- Raises
- signal.taper_window(trace, left_border_in_seconds, right_border_in_seconds, taper_percentage, taper_type, **kwargs)[source]
Helper function to taper a window within a data trace. This function modifies the passed trace object in-place.
- Parameters
trace (
obspy.core.trace.Trace
) – The trace to be tapered.left_border_in_seconds (float) – The left window border in seconds since the first sample.
right_border_in_seconds (float) – The right window border in seconds since the first sample.
taper_percentage (float) – Decimal percentage of taper at one end (ranging from
0.0
(0%) to0.5
(50%)).taper_type (str) – The taper type, supports anything
obspy.core.trace.Trace.taper()
can use.
Any additional keyword arguments are passed to the
obspy.core.trace.Trace.taper()
method.Example
>>> import obspy >>> tr = obspy.read()[0] >>> tr.plot()
>>> from pyadjoint.utils.signal import taper_window >>> taper_window(tr, 4, 11, taper_percentage=0.10, taper_type="hann") >>> tr.plot()
- signal.window_taper(signal, taper_percentage, taper_type)[source]
Window taper function to taper a time series with various taper functions. Affect arrays in place but also returns the array. Both will edit the array.
- signal.process_cycle_skipping(phi_w, nfreq_max, nfreq_min, wvec, phase_step=1.5)[source]
Check for cycle skipping by looking at the smoothness of phi
- Parameters
phi_w (np.array) – phase anomaly from transfer functions
nfreq_min (int) – minimum frequency for suitable MTM measurement
nfreq_max (int) – maximum frequency for suitable MTM measurement
phase_step (float) – maximum step for cycle skip correction (?)
wvec (np.array) – angular frequency array generated from Discrete Fourier Transform sample frequencies