Skip to main content

Morse sequences, reference maps, Morse complexes, and Morse-based persistent homology

Project description

MorseFrames

CI Documentation Status PyPI License: MIT Python 3.10+

MorseFrames is an experimental C++ and Python library for working with Morse sequences, reference and coreference maps, Morse complexes, and Morse-based persistent homology.

Documentation is available at https://morseframes.readthedocs.io/en/latest/. New readers may want to start with the overview, quick start, and minimal examples. Please see CONTRIBUTING.md for development instructions and CITATION.cff for citation metadata.

The manuscript source for the Morse-frame persistence paper is kept outside this public software repository. When a public preprint or published version is available, the documentation will link to it.

The current codebase contains:

  • a header-only C++ core for filtered simplicial complexes;
  • several Morse sequence strategies, including saturated, F-Min, F-Max, same-level reduction, plateau-greedy, and flooding variants;
  • reference and coreference map construction;
  • Morse-reference and Morse-coreference persistence;
  • ordinary persistence for validation;
  • prime-field coefficients F_p in the Python interface;
  • a Python API with a pure-Python fallback and optional nanobind backend;
  • an experimental GUDHI-facing adapter for Simplex_tree;
  • tests, examples, and reproducible benchmark drivers.

Strategy terminology follows the paper: flooding strategies are filtration-monotone F-sequences, while f-max and f-min are global seed-and-expand F-sequence builders. All exposed strategies keep regular pairs inside one filtration level, so plateaus are handled without perturbing the filtration values.

The GUDHI adapter is included to make future upstream integration easier. It should be considered experimental, but the current native benchmark signal is encouraging: the optimized direct Simplex_tree path is near parity with GUDHI persistent cohomology on the tested flag complexes, and faster on the tested grid plateau complexes for the F-Min, F-Max, and same-level strategies. The generated tables in docs/native_gudhi_*_table.tex record the current numbers and the reproduction commands live in docs/benchmark_reproduction.md.

Build the C++ Tests

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

When the C++ GUDHI and Boost headers are available, CMake also builds optional GUDHI adapter tests, examples, and benchmarks. They can be supplied explicitly:

cmake -S . -B build \
  -DMORSEFRAMES_GUDHI_INCLUDE_DIR=/path/to/gudhi/include \
  -DMORSEFRAMES_BOOST_INCLUDE_DIR=/path/to/boost/include

To skip the optional GUDHI tools:

cmake -S . -B build -DMORSEFRAMES_BUILD_GUDHI_TOOLS=OFF

Python Quick Start

The current public alpha is available on PyPI:

python3 -m pip install "morseframes==0.1.0a2"
python3 -c "import morseframes as mf; print(mf.__version__, mf.cpp_backend_available())"

For development from a source checkout, install in editable mode with the test dependency as well. This uses scikit-build-core and nanobind to build the optional native backend:

python3 -m pip install -e ".[dev]"

Example:

import morseframes as mf

complex_ = mf.FilteredComplex.from_simplices([
    ([0], 0.0),
    ([1], 0.0),
    ([0, 1], 1.0),
])

sequence = mf.compute_morse_sequence(complex_, algorithm="f-max")
references = mf.compute_reference_map(complex_, sequence)
diagram = mf.compute_morse_persistence(complex_, sequence, references)

print(diagram.finite_barcode())
print(diagram.essential_barcode())

Prime-field coefficients are available by passing a prime modulus:

diagram = mf.compute_morse_persistence(complex_, algorithm="f-min", modulus=3)

Python Tests

MORSEFRAMES_DISABLE_CPP_BACKEND=1 python3 -m unittest discover -s python/tests -p "test_*.py"
python3 python/examples/quickstart.py

The pure-Python fallback can still be exercised directly from the source tree without building the native backend, or by disabling the backend explicitly:

PYTHONPATH=python python3 -c "import morseframes as mf; print(mf.cpp_backend_available())"
MORSEFRAMES_DISABLE_CPP_BACKEND=1 python3 -m unittest discover -s python/tests -p "test_*.py"

Documentation

Read the Docs is configured through .readthedocs.yaml. The public documentation is available at https://morseframes.readthedocs.io/.

The documentation can also be built locally:

python3 -m pip install -r docs/requirements.txt
sphinx-build -b html docs docs/_build/html
  • docs/python_api.md summarizes the public Python API.
  • docs/project_overview.rst explains the main objects and computation model.
  • docs/minimal_examples.rst gives small copy-paste examples.
  • docs/inspecting_morse_data.rst shows how to inspect sequences, maps, Morse complexes, and barcodes.
  • docs/strategies.md explains the Morse sequence strategies and terminology.
  • docs/python_prime_field_tutorial.md explains persistence over F_p.
  • docs/cpp_complex_view_api.md describes the C++ complex-view interface.
  • docs/gudhi_contribution_design_note.md summarizes the experimental GUDHI adapter.
  • docs/benchmark_reproduction.md explains how to regenerate benchmark tables.
  • Generated benchmark table fragments live in docs/*_table.tex; the scripts that regenerate them live in tools/.

Citation

If you use MorseFrames in academic work, please cite it using the metadata in CITATION.cff.

Contributing

Development and testing instructions are collected in CONTRIBUTING.md. Release notes are collected in CHANGELOG.md.

Development note

Parts of the implementation, tests, benchmarks, examples, and documentation were developed with assistance from OpenAI Codex. All mathematical choices, algorithmic design, validation, and released code were reviewed by the authors.

Status

This is research code. The public API is useful for experimentation, but names and interfaces may still change while the paper and GUDHI integration mature.

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

morseframes-0.1.0a2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

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

morseframes-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (240.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

morseframes-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl (229.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

morseframes-0.1.0a2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (241.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

morseframes-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl (230.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

morseframes-0.1.0a2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (242.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

morseframes-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl (230.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file morseframes-0.1.0a2.tar.gz.

File metadata

  • Download URL: morseframes-0.1.0a2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for morseframes-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 523cd07e289892f0fb8c1b125c966a35fa1ef73cb2cc2b73215bb05b74c6fc32
MD5 da57600ba00f00b37ab52273fda14eca
BLAKE2b-256 14addb47b918bfb6b7caec8c06336116467e3712417329da1e755e8462360c37

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2.tar.gz:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0057f17d1b2409929ca721ea44a5c24afc94730753635488ec18693083006276
MD5 32d3b6afedb06b173a88f38c0ebbbc4d
BLAKE2b-256 7ed34d134744b7acab48bd5323fab0e1e06bd4cfdefa42ea5adf87c2399519f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed8a793236e5fc08370dde550cc8fd84fa724e326c578a9cc8a95b0904b575b1
MD5 7949b238b23505d629e07f1ea09f0953
BLAKE2b-256 1cb2cc00e7239e0de66698581a3dedd24a0ba7d8cd5d4c71f5cf561ff26903e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68b64ebe3f6c14484391495b4c59d9c8e060a7ef5d13479234fdbde1ff108bfa
MD5 239cfbcd2689122ec5b3f875f06e43fc
BLAKE2b-256 2e1b98d48491311c838103fbf6c3bef5cde0b92e50b5ff6c7352f64e9a3baa42

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53ee873f730a40330852adb46679d6c1d20f0c583ff3da869765f2e02005dd67
MD5 22224acc8c3aebd66daaeb94fd755d7a
BLAKE2b-256 51b7759341c1f8b4f409389da9753af3cea1b2bc4103819df686aaa4569b1aed

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d46a403a02482c33d63342712b2247bca7f3286fceff98c145ac662263ec04b
MD5 ffeef62ffdd79967ec442682d1d3e727
BLAKE2b-256 cda9668de027f2c4b85e6af7f02f1abc7ce90c1ae01164e2ed96c293115ed30f

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file morseframes-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2d2155f520d9e435832b397cbbe703f1f3eec6d7d51d9da89bda0bc3e7eb30a
MD5 958d32c6102f955910b1d4f2e4f1a8c8
BLAKE2b-256 1f80b7381d686bd9aa8bba2db53293fba9761f2c593cb33227e1012c56daf3b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on lnajman/morseframes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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