Version:

salvus.opt.misfits.time_frequency_phase_misfit

salvus.opt.misfits.time_frequency_phase_misfit salvus opt misfits time_frequency_phase_misfit
Time-frequency phase misfit and adjoint sources.

Functions

time_frequency_phase_misfit_and_adjoint_source()

Compute a phase difference misfit in the time frequency domain together with an associated adjoint source.
SIGNATURE
def time_frequency_phase_misfit_and_adjoint_source(
    data_synthetic: np.ndarray,
    data_observed: np.ndarray,
    sampling_rate_in_hertz: float,
    segment_length_in_seconds: salvus._core.types.float_,
    segment_overlap_fraction: salvus._core.types.float_ = 0.75,
    frequency_limits: typing.Sequence[salvus._core.types.float_],
    absolute_value_threshold: salvus._core.types.float_ = 0.001,
    taper_type: str = "hanning",
    stft_window: str | tuple[str | float, ...] = "hann",
    plot: bool = False,
) -> tuple[float, np.ndarray]: ...
ARGUMENTS
Required
data_synthetic
Type:np.ndarray
Description:
Synthetic data.
Required
data_observed
Type:np.ndarray
Description:
Observed data.
Required
sampling_rate_in_hertz
Type:float
Description:
Sampling rate in Hertz.
Required
segment_length_in_seconds
Type:salvus._core.types.float_
Description:
Length of each segment for which an FFT will be computed. Should be at least as long and probably longer than the largest period of interest to be able to estimate their frequency domain representation. Longer windows create better frequency domain phase estimates but a worse temporal resolution. The algorithm will automatically select the next larger length that the FFT implementation can efficiently compute so no need to play any tricks here. It is always at a most a few samples more.
Optional
segment_overlap_fraction
Type:salvus._core.types.float_
Default value:0.75
Description:
The overlap between two successive windows as a fraction of the segment length. More overlap causes a better temporal resolution but comes with a higher computational cost.
Required
frequency_limits
Type:typing.Sequence[salvus._core.types.float_]
Description:
Either (f1, f2, f3, f4) or (f2, f3). In the latter case it will set f1 = 0.5 * f2 and f4 = 2 * f3. These are frequency limits for a Fourier domain bandpass filter. Every frequency smaller than f1 and larger than f4 will be completely filtered out, frequencies between f2 and f3 will be fully retained with them being tapered for f1 < f < f2 and f3 < f < f4.
Optional
absolute_value_threshold
Type:salvus._core.types.float_
Default value:0.001
Description:
Only perform the phase difference measurement for frequencies whose absolute value is at least this fraction of the maximum absolute value of all frequencies. This is important because phase measurements for frequencies with little energy would otherwise distort the result and could potentially even dominate it. Frequencies with absolute values smaller than 0.5 * absolute_value_threshold * max_abs_value will be fully muted, those in between both bounds will be tapered.
Optional
taper_type
Type:str
Default value:'hanning'
Description:
Tapering function to use for the frequency and thresholding tapers. Currently supported are "hanning", "tanh", and "linear".
Optional
stft_window
Type:str | tuple[str | float, ...]
Default value:'hann'
Description:
Desired window to use for the short term fourier transform used to compute the signals' time frequency representations. Passed to scipy.signal.get_window() so please refer to it for all available choices. This can have quite an impact on the resulting adjoint sources so make to have a look at them before using this in production.
Optional
plot
Type:bool
Default value:False
Description:
Optionally plot some details about the computation. Useful for debugging and tuning.
RETURNS
Return type: tuple[float, np.ndarray]
Tuple of misfit value and adjoint source.
PAGE CONTENTS