import dascore as dc
patch = dc.get_example_patch().full(1)
# Mute the first 0.5 s, or retain only the middle section.
muted = patch.line_mute(time=(0, 0.5))
kept = patch.line_mute(time=(0.2, -0.2), invert=True)
# Smooth boundaries with an explicit unit.
muted = patch.line_mute(time=(0.2, 0.8), smooth=0.02 * dc.units.s)
# Mute early arrivals above a 1,000 m/s line.
muted = patch.line_mute(
time=(0, [0, 0.3]),
distance=(None, [0, 300]),
smooth=0.02,
)
# Mute between two velocity lines, or invert to keep the wedge.
muted = patch.line_mute(
time=([0, 0.375], [0, 0.25]),
distance=([0, 300], [0, 300]),
)
kept = patch.line_mute(
time=([0, 0.375], [0, 0.25]),
distance=([0, 300], [0, 300]),
invert=True,
)line_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 length-2 sequences.
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 | Zero values outside rather than inside the region. |
| relative |
Interpret positive values from the coordinate start and negative values from its end; False uses absolute coordinate values. |
| **kwargs |
One or two dimensions mapped to boundary pairs. Each boundary is a scalar, a length-2 straight line (2D only), or None/ ... for thecoordinate edge. |
Examples
Note
At most two dimensions are supported, and 2D boundaries must be straight. For custom smoothing, apply the mute to an all-ones patch, smooth that envelope, then multiply it by the original patch.