salvus.opt.misfits.time_frequency_phase_misfit
Time-frequency phase misfit and adjoint sources.
Functions
time_frequency_phase_misfit_and_adjoint_source()
time_frequency_phase_misfit_and_adjoint_source()def time_frequency_phase_misfit_and_adjoint_source(
data_synthetic: numpy.ndarray,
data_observed: numpy.ndarray,
sampling_rate_in_hertz: float,
segment_length_in_seconds: Union[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
],
segment_overlap_fraction: Union[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = 0.75,
frequency_limits: Sequence[
Union[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
]
],
absolute_value_threshold: Union[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = 0.001,
taper_type: str = "hanning",
stft_window: Union[str, Tuple[Union[str, float], ...]] = "hann",
plot: bool = False,
) -> Tuple[float, numpy.ndarray]:
...Compute a phase difference misfit in the time frequency domain together with an associated adjoint source.
Parameters
data_syntheticnumpy.ndarray — Synthetic data.data_observednumpy.ndarray — Observed data.sampling_rate_in_hertzfloat — Sampling rate in Hertz.segment_length_in_secondsUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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.segment_overlap_fractionUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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.frequency_limitsSequence[Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]] — Either(f1, f2, f3, f4)or(f2, f3). In the latter case it will setf1 = 0.5 * f2andf4 = 2 * f3. These are frequency limits for a Fourier domain bandpass filter. Every frequency smaller thanf1and larger thanf4will be completely filtered out, frequencies betweenf2andf3will be fully retained with them being tapered forf1 < f < f2andf3 < f < f4.absolute_value_thresholdUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — 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 than0.5 * absolute_value_threshold * max_abs_valuewill be fully muted, those in between both bounds will be tapered.taper_typestr — Tapering function to use for the frequency and thresholding tapers. Currently supported are"hanning","tanh", and"linear".stft_windowUnion[str, Tuple[Union[str, float], ...]] — Desired window to use for the short term fourier transform used to compute the signals’ time frequency representations. Passed toscipy.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.plotbool — Optionally plot some details about the computation. Useful for debugging and tuning.
Returns Tuple[float, numpy.ndarray] — Tuple of misfit value and adjoint source.