Skip to main content

A Lean Persistent Homology Library for Python

Project description

DOI PyPI version Downloads Conda Version Conda Downloads

Build status codecov License: MIT

Ripser.py

Ripser.py is a lean persistent homology package for Python. Building on the blazing fast C++ Ripser package as the core computational engine, Ripser.py provides an intuitive interface for

  • computing persistence cohomology of sparse and dense data sets,
  • visualizing persistence diagrams,
  • computing lowerstar filtrations on images, and
  • computing representative cochains.

Additionally, through extensive testing and continuous integration, Ripser.py is easy to install on Mac, Linux, and Windows platforms.

To aid your use of the package, we've put together a large set of notebooks that demonstrate many of the features available. Complete documentation about the package can be found at ripser.scikit-tda.org.

Related Projects

If you're looking for the original C++ library, you can find it at Ripser/ripser.

If you're looking for a GPU-accelerated version of Ripser, you can find it at Ripser++

Setup

Ripser.py is available on all major platforms. All that is required is that you install the standard Python numerical computing libraries and Cython.

Dependencies:

  • Cython
  • numpy
  • scipy
  • scikit-learn
  • persim

Windows users: If you are using a Windows machine, you will also need to install MinGW on your system.

Mac users: Updating your Xcode and Xcode command line tools will probably fix any issues you have with installation.

Cython should be the only library required before installation. To install, type the following commands into your environment:

pip install cython
pip install ripser

If you are having trouble installing, please let us know!

Optional dependency

Ripser.py when compiled from source can have a steroid1 shot by replacing the standard unordered_map from the STL by one of the fastest implementation available: robin_hood. Benchmarking of Ripser.py using the robin_hood implementation showed speed-ups up to 30%.

To be able to use robin_hood instead of STL, you only need to clone the repository containing the implementation:

# Run this command at the root of the project
git clone https://github.com/martinus/robin-hood-hashing ripser/robinhood

1 The Python package is already compiled with robin_hood by default.

Usage

The interface is as simple as can be:

import numpy as np
from ripser import ripser
from persim import plot_diagrams

data = np.random.random((100,2))
diagrams = ripser(data)['dgms']
plot_diagrams(diagrams, show=True)

We also supply a Scikit-learn transformer style object if you would prefer to use that:

import numpy as np
from ripser import Rips

rips = Rips()
data = np.random.random((100,2))
diagrams = rips.fit_transform(data)
rips.plot(diagrams)
Ripser.py output persistence diagram

Contributions

We welcome all kinds of contributions! Please get in touch if you would like to help out. Everything from code to notebooks to examples and documentation are all equally valuable so please don't feel you can't contribute. To contribute please fork the project make your changes and submit a pull request. We will do our best to work through any issues with you and get your code merged into the main branch.

If you found a bug, have questions, or are just having trouble with the library, please open an issue in our issue tracker and we'll try to help resolve the concern.

License

Ripser.py is available under an MIT license! The core C++ code is derived from Ripser, which is also available under an MIT license and copyright to Ulrich Bauer. The modifications, Python code, and documentation is copyright to Christopher Tralie and Nathaniel Saul.

Citing

If you use this package, please site the JoSS paper found here DOI and the JACT paper about Ripser found here DOI:10.1007/s41468-021-00071-5.

You can use the following bibtex entries:

@article{ctralie2018ripser,
  doi = {10.21105/joss.00925},
  url = {https://doi.org/10.21105/joss.00925},
  year  = {2018},
  month = {Sep},
  publisher = {The Open Journal},
  volume = {3},
  number = {29},
  pages = {925},
  author = {Christopher Tralie and Nathaniel Saul and Rann Bar-On},
  title = {{Ripser.py}: A Lean Persistent Homology Library for Python},
  journal = {The Journal of Open Source Software}
}

@article{Bauer2021Ripser,
    AUTHOR = {Bauer, Ulrich},
     TITLE = {Ripser: efficient computation of {V}ietoris-{R}ips persistence
              barcodes},
   JOURNAL = {J. Appl. Comput. Topol.},
  FJOURNAL = {Journal of Applied and Computational Topology},
    VOLUME = {5},
      YEAR = {2021},
    NUMBER = {3},
     PAGES = {391--423},
      ISSN = {2367-1726},
   MRCLASS = {55N31 (55-04)},
  MRNUMBER = {4298669},
       DOI = {10.1007/s41468-021-00071-5},
       URL = {https://doi.org/10.1007/s41468-021-00071-5},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ripser-0.6.7.tar.gz (96.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ripser-0.6.7-cp312-cp312-win_amd64.whl (74.7 kB view details)

Uploaded CPython 3.12Windows x86-64

ripser-0.6.7-cp311-cp311-win_amd64.whl (74.2 kB view details)

Uploaded CPython 3.11Windows x86-64

ripser-0.6.7-cp310-cp310-win_amd64.whl (74.0 kB view details)

Uploaded CPython 3.10Windows x86-64

ripser-0.6.7-cp39-cp39-win_amd64.whl (74.0 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

Details for the file ripser-0.6.7.tar.gz.

File metadata

  • Download URL: ripser-0.6.7.tar.gz
  • Upload date:
  • Size: 96.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for ripser-0.6.7.tar.gz
Algorithm Hash digest
SHA256 52ec48d5b03a1fcb360fdc5657009e717107902574ae1931ba8a2869eaff6bc0
MD5 dcc3ed3b372198924ceceb8e00579ab5
BLAKE2b-256 4c9afb5cdb334a8745452e65def94350fcfb6254cc42dd460d53bb3e7f4c040b

See more details on using hashes here.

File details

Details for the file ripser-0.6.7-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ripser-0.6.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 74.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for ripser-0.6.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4177cd1469b98cdf4db11f7a915569ce86da2cd5dbe28d4bc25d8cedc8701c62
MD5 41eb729026dd3186f16bc813f6ca3925
BLAKE2b-256 d4461e75398feec729990dc68d1414acc03aa522fbaad187a6065734d55c4733

See more details on using hashes here.

File details

Details for the file ripser-0.6.7-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ripser-0.6.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for ripser-0.6.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 afbe61d7006f11f128bc0090516f957a18e4842804b80c5f6965ab77633cf3f0
MD5 02ad7d8a191a36f46dca2ff29f25d3ad
BLAKE2b-256 0c3e1adacb69459e6246a21b049f7dcc79867003ae95615a0a9b3ae7ab486fb9

See more details on using hashes here.

File details

Details for the file ripser-0.6.7-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ripser-0.6.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 74.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for ripser-0.6.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1fb3ce3d9f6f8d1d76a6f4e6174d3fc3a0bd284b1c6fa81e64cc32a24e92c05b
MD5 0e3d946ddaffc4cb52916d8951f3aa7f
BLAKE2b-256 e7c18ad4e0af1b8af671a3dbd25e38aff9c7c0ecff1e74b54d5682871007d11a

See more details on using hashes here.

File details

Details for the file ripser-0.6.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ripser-0.6.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 74.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.13

File hashes

Hashes for ripser-0.6.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e17d94a92356e8d79fef4190ba0ea7d33ce083c8f7a9ac4983b39b57ce5e139d
MD5 6d00d3106986ab67bff2c7efd377b8e4
BLAKE2b-256 7fdf1520c9ad2bfbcd67277acc1bb503d235644e67b26ac678fa493aea795f0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page