detect_transient

detect_transient#

echopype.clean.detect_transient(ds: Dataset, method: str, params: dict) DataArray#

Dispatch transient-noise detection to a chosen method and return a boolean mask.

This dispatcher forwards ds and params to the selected implementation (e.g. "fielding", "matecho"). Any optional arguments omitted in params are filled by that method’s own defaults.

Parameters:
dsxr.Dataset

Acoustic dataset with Sv and required coordinates.

methodstr
Name of the detection method. Supported:
  • "fielding" → modified Fielding-style deep transient detector

  • "matecho" → Matecho-style column detector using local percentile

  • "ryan" → to be implemented TODO

paramsdict

Method-specific keyword arguments (see below). Omitted keys fall back to the method’s defaults.

Returns:
xr.DataArray

Boolean mask aligned to ds[var_name] (same dims and order), where True = VALID (keep) and False = transient noise. The name/attrs are set by the called method.

Raises:
ValueError

If method is not supported.

Examples

>>> from echopype.clean import detect_transient
>>> mask_fielding = detect_transient(
...     ds=ds_Sv_trimmed,
...     method="fielding",
...     params={
...         "var_name": "Sv",
...         "range_var": "depth",
...         "r0": 900,
...         "r1": 1000,
...         "n": 10,
...         "thr": (3, 1),
...         "roff": 20,
...         "jumps": 5,
...         "maxts": -35,
...         "start": 0,
...     },
... )

or

>>> from echopype.clean import detect_transient
>>> mask_matecho = detect_transient(
...     ds=ds_Sv,
...     method="matecho",
...     params={
...         "var_name": "Sv",
...         "range_var": "depth",
...         "bottom_var": None,
...         "start_depth": 700,
...         "window_meter": 300,
...         "window_ping": 50,
...         "percentile": 25,
...         "delta_db": 8,
...         "extend_ping": 0,
...         "min_window": 5,
...     },
... )