phase_weighted_stack

function of dascore.transform.hilbert source

phase_weighted_stack(
    patch: Patch ,
    stack_dim: str ,
    transform_dim: str | None[str, None] = None,
    power: float = 2.0,
    dim_reduce: str | collections.abc.Callable[str, Callable] = empty,
)-> ‘PatchType’

Apply phase weighted stacking to enhance coherent signals.

Phase weighted stacking uses the instantaneous phase coherence to weight the stacking process, enhancing coherent signals while suppressing incoherent noise.

Parameters

Parameter Description
patch The patch to stack.
stack_dim The dimension over which the data should be stacked. For typical
use cases this will be “distance”.
transform_dim The dimension along which to perform the Hilbert transform.
For typical use cases this will be “time”. If not provided, it will
be inferred as the other dimension besides stack dim. If the patch
has more than 2 dimensions and transform_dim is None, a ParameterError
is raised.
power The power to which the phase coherence is raised. Higher values
give more weight to coherent signals.
dim_reduce How to reduce the dimensional coordinate associated with the
aggregated axis. Can be the name of any valid aggregator, a callable,
“empty” (the default) which returns a length 1 partial coord, or
“squeeze” which drops the coordinate. For dimensions with datetime
or timedelta datatypes, if the operation fails it will automatically
be applied to the coordinates converted to floats then the output
converted back to the appropriate time type.

Returns

PatchType A patch with the phase-weighted stack along the specified dimension. The specified dimension will have length 1 unless dim_reduce="squeeze", in which case the dimension is removed.

Note

Phase weighted stacking is described in Schimmel and Paulssen (1997).

Examples

import dascore as dc
from dascore.examples import ricker_moveout
import numpy as np
import matplotlib.pyplot as plt

# Create ricker wavelet with noise
ricker_patch = ricker_moveout(velocity=0)
noise_level = ricker_patch.data.max() * 0.2
noise = np.random.normal(size=ricker_patch.data.shape) * noise_level
patch = ricker_patch + noise

# Make normal stack to phase weighted stack
stack = patch.mean("distance").squeeze().data
pws = patch.phase_weighted_stack("distance").squeeze().data

# Plot results
fig, ax = plt.subplots(1, 1)
time = ricker_patch.get_array("time")
_ = ax.plot(time, stack, label="linear")
_ = ax.plot(time, pws, label="pws")
_ = ax.set_xlabel("time")
_ = ax.set_ylabel("amplitude")
_ = ax.legend()

References

Schimmel, Martin, and Hanneke Paulssen. 1997. “Noise Reduction and Detection of Weak, Coherent Signals Through Phase-Weighted Stacks.” Geophysical Journal International 130 (2): 497–505.