mesa.ecospatial.calculate_MDI

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

Calculate the multiscale diversity index (MDI) for spatial data.

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

  • scales (Union[tuple, list]) – The scales at which the diversity index is to be calculated.

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

  • library_id (Union[tuple, list]) – The identifiers of the libraries involved in the analysis.

  • spatial_key (Union[str, List[str]]) – Key(s) used to access the spatial data from spatial_data.

  • cluster_key (str) – The key to access the cluster data which categorizes the spatial entities.

  • selecting_scale (bool, optional) – Specifies whether to run GDI at each scale to help decide the finest scale.

  • random_patch (bool, optional) – Specifies whether patches should be generated in a random manner. Default is False.

  • plotfigs (bool, optional) – Whether to plot figures during the analysis. Default is False.

  • savefigs (bool, optional) – Whether to save the generated figures to disk. Default is False.

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

  • other_kwargs (dict, optional) – Other keyword arguments that may influence the analysis. Defaults to an empty dictionary.

Returns:

A DataFrame containing the diversity value at each scale and the overall multiscale diversity index (MDI).

Return type:

pandas.DataFrame