Filters for outlier detection

In order to remove outliers from the resulting vector field, filters are used. The filter mainly used here differs from the Velocity Filter.

The filter initializes a mask of nan values in the velocity field. It filters by calculating a local residual and comparing it with a threshold.

filters.outlier_from_local_median(piv, treshold=2.0)[source]

Outlier detection algorithm for mask creation.

The calculated residual is compared to a threshold which produces a mask. The mask consists of nan values at the outlier positions. This mask can be interpolated to remove the outliers.

Parameters:
  • piv (object) – Piv Class Object
  • threshold (double) – threshold for identifying outliers
filters.get_normalized_residual(f, epsilon=0.1)[source]

Compute Residual for a Flow field

Implementation of a local median filter according to “J. Westerweel, F. Scarano, Universalo outlier detection for PIV data, Experiments in Fluids, 2005”

Parameters:
  • f – field
  • epsilon (double) – small tolerance value
Returns:

calculated residual for field

The outliers are afterwards interpolated.

filters.replace_outliers(piv)[source]

Replaces the detected outliers according to the mask

filters.replace_field(f, mask)[source]

Interpolates positions in field according to mask with a 2D cubic interpolator

After the replacement of the outliers a median filter is applied to remove sharp edges.

filters.median_filter(piv, size=2)[source]

Computes a median filter on u and v