fracspy.location.utils.semblance_stack#
- fracspy.location.utils.semblance_stack(data, swsize=0)[source]#
Computes the semblance stack for a given input array.
The semblance_stack function computes the semblance, which is a measure of the coherence or similarity between the seismic traces. If swsize is 0, the semblance value at each time sample is calculated as the ratio of the numerator (the squared sum of amplitudes at each trace) to the denominator (the sum of squares of amplitudes at each trace, multiplied by the number of traces).
The formula for computing the semblance is:
\[S(it) = \frac{\left[\sum_{R=1}^{N_R} d_R(it)\right]^2} {N_R \sum_{R=1}^{N_R} \left[d_R(it)\right]^2} \]where \(N_R\) is the number of receivers, and \(d_R(it)\) is amplitude at trace \(R\) and time sample \(it\).
A sliding window approach is used when swsize > 0. For each time sample, it considers a window of size 2*swsize + 1 centered on that sample. The numerator and denominator are computed within this window for each time sample. At the edges of the data, where a full window is not available, the function uses as much data as is available.
The formula for computing the semblance with a sliding window \(W\) (defined by swsize) is:
\[S_W(it) = \frac{\sum_{k=max(0,it-W)}^{min(nt,it+W+1)}\left[\sum_{R=1}^{N_R} d_R(it)\right]^2} {N_R \sum_{k=max(0,it-W)}^{min(nt,it+W+1)}\sum_{R=1}^{N_R} \left[d_R(it)\right]^2}\]where \(nt\) is the maximum number of time samples.
- Parameters:
- data
numpy.ndarray
The input array with shape (nr, nt), where nr is the number of receivers and nt is the number of time samples, usually microseismic data with corrected moveout [nr, nt]
- swsize
int
, optional, default: 0 Sliding time window size for semblance, time steps
- data
- Returns:
- semblance_values:
numpy.ndarray
A 1D array with shape (nt,) containing the semblance values for each time sample.
- semblance_values:
Notes
The function initializes an array semblance_values with shape (nt,) to store the semblance values. It then computes the numerator and denominator of the semblance equation using NumPy and SciPy operations. To avoid division by zero, it sets any denominators that are equal to zero to a small value (1e-10). Finally, it returns the computed semblance values.