deepof.utils.interpolate_outliers

deepof.utils.interpolate_outliers(experiment: DataFrame, likelihood: DataFrame, likelihood_tolerance: float, exclude: str = '', lag: int = 5, n_std: int = 3, mode: str = 'or', limit: int = 10) DataFrame

Mark all outliers in experiment and replaces them using a uni-variate linear interpolation approach.

Note that this approach only works for equally spaced data (constant camera acquisition rates).

Parameters:
  • experiment (pd.DataFrame) – Data frame with time series representing the x, y positions of every 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.

  • exclude (str) – Body part to exclude from the analysis (to concatenate with bpart alignment).

  • 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” both x and y have to be marked in order to call an outlier. If “or” (default), one is enough.

  • limit (int) – Maximum of consecutive outliers to interpolate. Defaults to 10.

Returns:

Interpolated version of experiment.

Return type:

interpolated_exp (pd.DataFrame)