tomodrgn.convergence.sketch_via_umap_local_maxima#

sketch_via_umap_local_maxima(outdir: str, plot_format: Literal['png', 'svg'], sketch_epoch: int, n_bins: int = 30, smooth: bool = True, smooth_width: int = 1, pruned_maxima: int = 12, radius: int = 5, final_maxima: int = 10) tuple[ndarray, str][source]#

Sketch one epoch’s latent space via local maxima finding to find dense neighborhoods of particles with similar embeddings as “well-supported” by the data

Parameters:
  • outdir – path to base directory to save outputs

  • plot_format – file format with which to save plots

  • sketch_epoch – epoch for which the (previously calculated) umap distribution will be sketched for local maxima

  • n_bins – the number of bins along UMAP1 and UMAP2 to discretize when finding local maxima

  • smooth – whether to smooth the 2D histogram (aids local maxima finding for particulaly continuous distributions)

  • smooth_width – scalar multiple of one-bin-width defining sigma for gaussian kernel smoothing

  • pruned_maxima – max number of local maxima above which pruning will be performed

  • radius – radius in number of bins below which points are considered poorly-separated and are candidates for pruning

  • final_maxima – the count of local maxima with the largest associated bin count that will be returned as candidate particles to the user

Returns:

binary mask of shape ((nptcls, n_local_maxima)) labeling all particles in the bin and neighboring 8 bins of a local maxima; a unique letter assigned to each local maxima