LineMute

class of dascore.proc.mute
inherits from: dascore.proc.taper._Envelope, PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

LineMute(
    *args ,
    smooth: Any = None,
    invert: Any = False,
    relative: Any = True,
    **kwargs ,
)-> None

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 the
coordinate edge.

Examples

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,
)
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.

See Also

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the envelope of the region the lines bound.
kernel Return the data times the envelope.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
line_mute Mute (zero out) data in a region specified by one or more lines.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.