lib5c.algorithms.clustering.adjacency module¶
Module for assembling or merging clusters using a simple adjacency heuristic.
-
lib5c.algorithms.clustering.adjacency.
make_clusters
(peaks)[source]¶ Clusters peaks by adjacency.
- Parameters
peaks (list of peaks) – The peaks to cluster.
- Returns
The clustered peaks.
- Return type
list of clusters
-
lib5c.algorithms.clustering.adjacency.
merge_to_which
(clusters)[source]¶ Determines which other cluster, if any, the first cluster in a list of clusters should be merged into.
- Parameters
clusters (list of clusters) – The list of clusters to consider. Ideally, this list should be sorted in ascending order of cluster size.
- Returns
The index of the cluster that the first cluster should be merged into. If the cluster should not be merged, the value will be -1.
- Return type
int
Notes
Under the adjacency heuristic, the condition for merging two clusters is that they must contain peaks that are immediately adjacent to each other in 2-D space.