spatialleiden.search_resolution_spatial

spatialleiden.search_resolution_spatial(adata, n_clusters, *, start=0.4, step=0.1, n_iterations=15, **kwargs)

Search the resolution of the spatial layer to obtain n clusters using SpatialLeiden clustering.

The resolution of the latent space must be provided using kwargs. If you want to search both resolutions refer to spatialleiden.search_resolution().

Parameters:
  • adata (AnnData)

  • n_clusters (int) – Number of clusters.

  • start (float, optional) – Starting point for resolution.

  • step (float, optional) – Increment if cluster number is incorrect.

  • n_iterations (int, optional) – Maximum number of iterations before stopping. If correct number of clusters is obtained it will stop early.

  • kwargs – Other keyword arguments are passed to spatialleiden.spatialleiden().

Returns:

Target resolution for the topological space.

Return type:

float