mesa.ecospatial.calculate_MDI

mesa.ecospatial.calculate_MDI(spatial_data, scales, library_key, library_id, spatial_key, cluster_key, random_patch=False, plotfigs=False, savefigs=False, patch_kwargs={}, other_kwargs={})

Calculate the multiscale diversity index (MDI).

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_id (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.

  • 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 diversity value at each scale and MDI.

Return type:

pandas.DataFrame