Skip to content

cluster_dispersion

Compute the dispersion of a GeoDataFrame.

Parameters:

Name Type Description Default
gdf GeoDataFrame

The GeoDataFrame containing the cluster data.

required

Returns:

Name Type Description
float float

The standard distance of the cluster.

Source code in src/histolytics/spatial_clust/clust_metrics.py
def cluster_dispersion(gdf: gpd.GeoDataFrame) -> float:
    """Compute the dispersion of a GeoDataFrame.

    Parameters:
        gdf (gpd.GeoDataFrame):
            The GeoDataFrame containing the cluster data.

    Returns:
        float: The standard distance of the cluster.
    """
    xy = get_centroid_numpy(gdf)
    return std_distance(xy)