lib5c.algorithms.clustering.quasicontiguity module

Module for splitting clusters using a quasicontiguity heuristic.

lib5c.algorithms.clustering.quasicontiguity.split_cluster(cluster, distance_threshold=3, size_threshold=2)[source]

Identifies the subclusters of a cluster, as determined by quasicontiguity and a size threshold.

Parameters:
  • cluster (cluster) – The cluster to determine the subclusters of.
  • distance_threshold (float) – If two peaks are separated by a distance less than this threshold, they are considered “quasicontiguous”.
  • size_threshold (int) – If the size of a subcluster would be smaller than this threshold, that subcluster is not split from its parent.
Returns:

The subclusters of the query cluster.

Return type:

list of clusters

lib5c.algorithms.clustering.quasicontiguity.split_clusters(clusters, distance_threshold=3, size_threshold=2)[source]

Iteratively splits all clusters in a list by quasicontiguity (as determined by a distance and size threshold) and returns the resulting subclusters.

Parameters:
  • clusters (list of clusters) – The clusters to split.
  • distance_threshold (float) – If two peaks are separated by a distance less than this threshold, they are considered “quasicontiguous”.
  • size_threshold (int) – If the size of a subcluster would be smaller than this threshold, that subcluster is not split from its parent.
Returns:

The list of split clusters.

Return type:

list of clusters