gating Module

Utility functions related to gating operations

flowutils.gating.points_in_ellipsoid(ellipsoid_covariance_matrix, ellipsoid_means, ellipsoid_distance_square, points)

Determines whether points in an array are inside an ellipsoid. Points on the edge are considered inclusive. True ellipsoids in n-dimensions are supported.

Parameters:
  • ellipsoid_covariance_matrix – Covariance matrix for the ellipsoid shape (NxN array)

  • ellipsoid_means – center point of the ellipsoid for n-dimensions

  • ellipsoid_distance_square – square of the Mahalanobis distance, controlling the size of the ellipsoid. The distance square parameter is conceptually similar to the number of standard deviations representing the boundary for an n-dimensional distribution of points.

  • points – NumPy array of data points to test for ellipsoid inclusion

Returns:

NumPy 1-D array of boolean values for each point. True is inside ellipsoid.

flowutils.gating.points_in_polygon(poly_vertices, points)

Determines whether points in an array are inside a polygon. Points on the edge of the polygon are considered inclusive. This function uses the winding number method and is robust to complex polygons with crossing boundaries, including the presence of ‘holes’ created by boundary crosses.

Parameters:
  • poly_vertices – Polygon vertices (NumPy array of 2-D points)

  • points – NumPy array of data points to test for polygon inclusion

Returns:

NumPy 1-D array of boolean values for each point. True is inside polygon.