viscid.calculator.cluster module¶
Functions for clustering clouds of neighboring points
-
viscid.calculator.cluster.
distance_to_clusters
(point, clusters, alt=())[source]¶ L2 distance between point and clusters
-
viscid.calculator.cluster.
find_clusters
(indx, indy, x, y, multiple=True, periodic=(False, False), diagonals=True)[source]¶ Cluster and average groups of neighboring points
- TODO: If absolutely necessary, could do some K-means clustering
- here by calling into scikit-learn.
Parameters: - indx (sequence) – list of x indices
- indy (sequence) – list of y indices
- x (sequence) – x coordinate array
- y (sequence) – y coordinate array
- multiple (bool) – If False, average all points as a single cluster
- periodic (sequence) – indicate whether that direction is periodic, and if so, whether the coordinate arrays are overlapped or not. Values can be True, False, or ‘+’. ‘+’ indicates that x[0] and x[-1] are not colocated, so assume they’re dx apart where dx = x[-1] - x[-2].
- diagonals (bool) – if true, then diagonal points are considered neighbors
Returns: 2xN for N clusters
Return type: ndarray