Module clustering

The function cluster_components() can create database of averaged compounds by clustering peak components and taking their average.

cluster_components()

mocca2.clustering.cluster_components.cluster_components(components: List[Component], are_same: Callable[[Component, Component], bool], weights: Callable[[Component], float] | ndarray[Any, dtype[_ScalarType_co]] | Sequence[float] | None = None) Dict[int, Compound]

Clusters similar components together and averages them to create compounds. The components are assigned compound IDs.

Parameters

components: List[Component]

Individual peak components

are_same: Callable[[Component, Component], bool]

Function that decides whether two components can be assigned to the same compound

weights: Callable[[Component], float] | NDArray | Sequence[float] | None = None

If weights are provided, they will be used to weight the individual components when creating compounds

Returns

List[Compound]

Compounds created from averages of clustered components