aind_ephys_utils.ops.smooth module

Smoothing operations for binned or continuous signals.

aind_ephys_utils.ops.smooth.smooth(data: DataArray | ndarray | Sequence[object] | Sequence[Sequence[object]], *, dim: str = 'time', method: str = 'boxcar', sigma: float | None = None, window: float | None = None, boundary: str = 'reflect', dims: Sequence[str] | None = None, coords: Dict[str, object] | None = None, return_type: str = 'auto') DataArray | object

Smooth a signal along a dimension.

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

  • dim – Dimension to smooth (defaults to time).

  • method – Smoothing method (e.g. “boxcar”, “gaussian”).

  • sigma – Gaussian sigma in seconds (optional).

  • window – Window size in seconds (optional).

  • boundary – Boundary handling mode.

  • 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:

Smoothed data in the selected output representation.

Return type:

xr.DataArray or object