mesa.ecospatial.multiscale_diversity

mesa.ecospatial.multiscale_diversity(spatial_data: AnnData | DataFrame, scales: tuple | list, library_key: str, library_ids: tuple | list, spatial_key: str | List[str], cluster_key: str, mode='D', random_patch=False, plotfigs=False, savefigs=False, patch_kwargs={}, other_kwargs={})

Calculate the multiscale neighbourhood heterogeneity.

Parameters:
  • spatial_data (Union[ad.AnnData, pd.DataFrame]) – The spatial data to be used.

  • scales (Union[tuple, list]) – The scales to be used for the analysis.

  • library_key (str) – The key to access the library data.

  • library_ids (Union[tuple, list]) – The identifiers of the libraries.

  • spatial_key (Union[str, List[str]]) – The key or list of keys to access the spatial data.

  • cluster_key (str) – The key to access the cluster data.

  • mode (str, optional) – The mode of operation, default is ‘D’.

  • random_patch (bool, optional) – Whether to generate patches in a random manner. Defaults to False.

  • plotfigs (bool, optional) – Whether to plot the figures. Defaults to False.

  • savefigs (bool, optional) – Whether to save the figures. Defaults to False.

  • patch_kwargs (dict, optional) – Additional keyword arguments for the patch generation. Defaults to an empty dict.

  • other_kwargs (dict, optional) – Other keyword arguments. Defaults to an empty dict.

Returns:

A dataframe of results and a dataframe of slopes, respectively.

Return type:

pandas.DataFrame, pandas.DataFrame