mesa.ecospatial.calculate_diversity_index
- mesa.ecospatial.calculate_diversity_index(spatial_data: AnnData | DataFrame, library_key: str, library_id: str, spatial_key: str | List[str], patches: list, cluster_key: str, metric: str, return_comp=False)
Calculate the heterogeneity index for a set of patches.
- Parameters:
spatial_data (Union[ad.AnnData, pd.DataFrame]) – The spatial data to be used.
library_key (str) – The key to access the library data.
library_id (str) – The identifier of the library.
spatial_key (Union[str, List[str]]) – The key or list of keys to access the spatial data.
patches (list) – The list of patches to be analyzed.
cluster_key (str) – The key to access the cluster data.
metric (str) – The metric to be used for the heterogeneity index calculation.
return_comp (bool, optional) – If True, return a comprehensive object with additional details beyond the heterogeneity indices. Defaults to False.
- Returns:
A series of heterogeneity indices, or if return_comp is True, a more comprehensive object with additional details.
- Return type:
pandas.Series