aind_ephys_utils.ops.baseline module

Baseline correction operations.

aind_ephys_utils.ops.baseline.baseline(data: DataArray | ndarray | Sequence[object] | Sequence[Sequence[object]], *, window: Tuple[float, float], dim: str = 'time', mode: str = 'subtract', dims: Sequence[str] | None = None, coords: Dict[str, object] | None = None, return_type: str = 'auto') DataArray | object

Apply baseline correction over a window.

Parameters:
  • data – Input DataArray or NumPy-like data.

  • window – (tmin, tmax) baseline window.

  • dim – Dimension to baseline-correct.

  • mode – Baseline mode (“subtract”, “divide”, “zscore”).

  • dims – Optional dimension names used when data is a dense NumPy array.

  • coords – Optional coordinate mapping used when constructing a DataArray from dense NumPy input.

  • return_type – Output type policy: "auto", "xarray", or "numpy". "auto" mirrors the input style.

Returns:

Baseline-corrected data in the selected output representation.

Return type:

xr.DataArray or object