Correlate

This recipe demonstrates how to use the Correlate module to cross-correlate a specific channel/time sample with other channel/time samples in a patch. The result is a new “correlate patch” that stores the cross-correlation output. We use the Ricker wavelet as an example signal and compute its cross-correlation using DASCore.

Load and visualize the Ricker wavelet

import dascore as dc

patch = dc.get_example_patch(
    "ricker_moveout",
    velocity=100,
    duration=2,
)

patch.viz.waterfall();

Compute Ricker wavelet’s cross-correlation

In this example, we cross-correlate all channels in the Ricker patch against channel 4 as the master channel (virtual source). In the correlate patch, the first three traces have negative time lag, and the fourth trace appears at 0.0 s lag (auto-correlation), followed by traces with positive lags. As expected, both the Ricker patch and the correlate patch show the same 100 m/s moveout.

import dascore as dc

patch = dc.get_example_patch(
    "ricker_moveout",
    velocity=100,
    duration=2,
)

corr = patch.correlate(distance=3, samples=True)

# Note we squeeze the last dimension to get 2D patch

corr.squeeze().viz.waterfall();