deepof.utils.mask_outliers

deepof.utils.mask_outliers(time_series: DataFrame, likelihood: DataFrame, likelihood_tolerance: float, lag: int, n_std: int, mode: str) DataFrame

Return a mask over the bivariate trajectory of a body part, identifying as True all detected outliers.

An outlier can be marked with one of two criteria: 1) the likelihood reported by DLC is below likelihood_tolerance, and/or 2) the deviation from a moving average model is greater than n_std.

Parameters:
  • time_series (pd.DataFrame) – Bi-variate time series representing the x, y positions of a single body part

  • likelihood (pd.DataFrame) – Data frame with likelihood data per body part as extracted from deeplabcut

  • likelihood_tolerance (float) – Minimum tolerated likelihood, below which an outlier is called

  • lag (int) – Size of the convolution window used to compute the moving average

  • n_std (int) – Number of standard deviations over the moving average to be considered an outlier

  • mode (str) – If “and” (default) both x and y have to be marked in order to call an outlier. If “or”, one is enough.

Returns

mask (pd.DataFrame): Bi-variate mask over time_series. True indicates an outlier.