import dascore as dc
from scipy.ndimage import gaussian_filter
patch = dc.get_example_patch().full(1)
# Mute first 0.5s (relative to start by default)
muted = patch.line_mute(time=(0, 0.5))
# Mute everything except middle section
kept = patch.line_mute(time=(0.2, -0.2), invert=True)
# 1D Mute with smoothed absolute units for time.
muted = patch.line_mute(time=(0.2, 0.8), smooth=0.02 * dc.units.s)
# Classic first break mute: mute early arrivals
# Line from (t=0, d=0) to (t=0.3, d=300) defines velocity=1000 m/s
muted = patch.line_mute(
time=(0, [0, 0.3]),
distance=(None, [0, 300]),
smooth=0.02,
)
# Mute late arrivals: from velocity line to end
muted = patch.line_mute(
time=([0, 0.3], None),
distance=([0, 300], 0),
)
# Mute wedge between two velocity lines
muted = patch.line_mute(
time=([0, 0.375], [0, 0.25]),
distance=([0, 300], [0, 300]),
)
# Mute wedge outside two velocity lines
muted = patch.line_mute(
time=([0, 0.375], [0, 0.25]),
distance=([0, 300], [0, 300]),
invert=True,
)
# Apply custom tapering
ones = patch.full(1.0)
envelope = ones.line_mute(
time=([0, 0.375], [0, 0.25]),
distance=([0, 300], [0, 300]),
)
# Knock down edges with rolling mean along the time dimension.
smooth = envelope.rolling(time=5, samples=True).mean()
# Then multiply the two patches.
result = patch * smoothline_mute
line_mute(
patch: Patch ,
smooth = None,
invert: bool = False,
relative: bool = True,
**kwargs ,
)-> ‘PatchType’
Mute (zero out) data in a region specified by one or more lines.
Each dimension accepts two boundary specifications that define the mute region. Boundaries can be scalar values or arrays of values.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch instance. |
| smooth |
Parameter controlling smoothing of the mute envelope. Defines the sigma Can be: - None: sharp mute - float (0.0-1.0): fraction of dimension range (e.g., 0.01 = 1%) which is applied independently to each dimension involved in the mute. - int: Indicates number of samples for each dimension. - Quantity with units, indicates values along a single dimension. Only applicable if a single dimension is specified. - dict: {dim: taper_value} for dimension-specific smooth values which can be any of the above. |
| invert |
If True, invert the taper such that the values outside the defined region are set to 0. |
| relative |
If True (default), values are relative to coordinate edges. Positive values are offsets from start, negative from end. |
| **kwargs |
Dimension specifications as (boundary_1, boundary_2) pairs. Each boundary can be: - Scalar: constant value (defines plane perpendicular to dimension) - Array/list: coordinates defining line/curve/surface - None or …: edge of coordinate (min or max) |
Examples
Note
By relative=True (the default) means values are offsets from coordinate edges. Use relative=False for absolute coordinate values.
Currently, mute doesn’t support more than 2 dimensions.
For more control over boundary smoothing, use a patch with one values then apply custom tapering/smoothing before multiplying with the original patch. See example section for more details.