circle_bundles.get_local_rips

circle_bundles.get_local_rips(data, U, p_values=None, to_view=None, *, maxdim=0, n_perm=500, random_state=None, **ripser_kwargs)[source]

Compute Ripser persistence separately on each fiber of a cover.

For each fiber (row of U), this function extracts the corresponding points from data (optionally subsampling them), then runs ripser on that fiber’s point cloud. The resulting persistence diagrams can be plotted with plot_local_rips().

Parameters:
  • data (ndarray) – Array of shape (n_points, d) containing the ambient data vectors.

  • U (ndarray) – Boolean indicator matrix of shape (n_fibers, n_points) indicating fiber membership (same convention as get_local_pca()).

  • p_values (ndarray | Sequence[float] | None) – Optional per-fiber sampling fractions in [0, 1] (same convention as get_local_pca()).

  • to_view (Sequence[int] | None) – Optional list of fiber indices to process. If None, processes all fibers.

  • maxdim (int) – Maximum homology dimension for Ripser. If maxdim < 0, returns None results for all fibers (useful as a quick “skip” switch).

  • n_perm (int) – Upper bound on the number of points passed to ripser per fiber. For each fiber, we set n_use = min(n_perm, m_fiber) and pass n_perm=n_use to ripser. (This leverages ripser’s internal subsampling/permutation behavior.)

  • random_state (int | None) – Seed used for the initial per-fiber subsampling (via p_values).

  • **ripser_kwargs – Additional keyword arguments forwarded directly to ripser(...).

Returns:

  • fiber_ids – The list of fiber indices processed.

  • idx_list – List of integer index arrays (points used in each fiber after subsampling).

  • rips_list – List of ripser result dicts, one per fiber, or None for fibers with fewer than 2 usable points.

Return type:

tuple[list[int], list[ndarray], list[dict | None]]

Notes

  • This function lazily imports ripser so importing this module does not require ripser unless you call it.

  • If you want exact control over which points go into each fiber computation, see get_dense_fiber_indices (currently not exported).