triplclust_py API documentation¶
calculate_dnn(cloud)
builtin
¶
Calculate the characteristic length scale of the point cloud
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
ndarray
|
The point cloud |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The characteristic length scale |
smooth_pointcloud(cloud, dnn, neighborhood_radius=2.0)
builtin
¶
Smooth a point cloud which has already been sorted in z
Perform nearest neighbor smoothing on a pointcloud. If dnn is given, the neighborhood radius is calculated from that scale. If dnn is not given and neighborhood_radius is given, neighborhood_radius is used. If neither are given, dnn is calculated from the cloud. This last option should only be used if dnn is not going to be used in subsequent calculations (i.e. clustering).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
ndarray
|
The pointcloud to smooth |
required |
dnn
|
float | None
|
The characteristic length scale. The general recommendation is to give a dnn value. |
required |
neighborhood_radius
|
float
|
The maximum raidal distance between neighbors. The default value is 2.0. |
2.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
A new smoothed pointcloud |
split_clusters(point_cloud, labels, unqiue_labels, min_depth=25)
builtin
¶
Apply cluster splitting to results of triplet clustering
Triplclust has a tendency to over merge trajectories (due to colinearity near crossings). This post-processing algorithm aims to solve this by splitting the clusters based on a directed graph approach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smoothed_cloud
|
The sorted point cloud |
required | |
labels
|
ndarray
|
The labels generated by triplet_clustering |
required |
unique_labels
|
ndarray
|
The unique values in labels |
required |
min_depth
|
int
|
The minimum depth to use when splitting the graph. The default value is 25. |
25
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
The set of 1-D integer label arrays, where the first is the set of all point labels and the second is the unique label values. Note that these may be identical to the input labels/uniques if splitting did not result in any changes. |
triplet_clustering(smoothed_point_cloud, dnn, triplet_neighborhood_size=19, triplet_max_candidates=2, triplet_error_cutoff=0.03, cluster_scale=0.3, min_cluster_size=5, linkage='single', cluster_distance_threshold=None)
builtin
¶
Apply the triplclust algorithm to a smoothed point cloud
Cluster the points by the triplclust triplet metric
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smoothed_cloud
|
ndarray
|
The smoothed, sorted pointcloud |
required |
dnn
|
float | None
|
If dnn is not None, it is used to calculate the scale factor as cluster_scale * dnn. It is generally recommended to provide a dnn value. |
required |
triplet_neighborhood_size
|
int
|
The size of the triplet search neighborhood in points. The default value is 19. |
19
|
triplet_max_candidates
|
int
|
The maximum of triplet candidates to consider for a point. The default value is 2. |
2
|
triplet_error_cutoff
|
float
|
The error cutoff for evaluating triplet candidates. The default value is 0.03. |
0.03
|
cluster_scale
|
float
|
The scale factor used in the triplet distance metric. If dnn is not None, the scale factor is cluster_scale * dnn. The default value is 0.3. |
0.3
|
min_cluster_size
|
int
|
The minimum number of points required for a cluster to be valid. The default value is 5. |
5
|
linkage
|
str
|
The type of linkage to use in the agglometrive clustering. Valid values are "single", "complete", "average", and "median". The default value is "single". |
'single'
|
cluster_distance_threshold
|
float | None
|
The cluster distance used as a stopping criterion in the hierarchical clustering. If None, the appropriate threshold is calculated from the data. The default value is None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
A set of 1-D integer arrays, where the first is the set of cluster labels for each point in the point cloud and the second is the list of unique cluster labels. A label of -1 indicates that the point was not included in any valid cluster. |