Skip to main content

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

Project description

MorseFrames

CI Documentation Status 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 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.

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 Python package is installable in editable mode. This uses scikit-build-core and nanobind to build the optional native backend:

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

For development, install the test dependency as well:

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.

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.0a1.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.0a1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (235.0 kB view details)

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

morseframes-0.1.0a1-cp312-cp312-macosx_11_0_arm64.whl (225.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

morseframes-0.1.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (236.5 kB view details)

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

morseframes-0.1.0a1-cp311-cp311-macosx_11_0_arm64.whl (226.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

morseframes-0.1.0a1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (236.8 kB view details)

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

morseframes-0.1.0a1-cp310-cp310-macosx_11_0_arm64.whl (226.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: morseframes-0.1.0a1.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.0a1.tar.gz
Algorithm Hash digest
SHA256 c8172938f0952850d87b595d6cffcf02902e588a32e85bc566ed975b868bc88f
MD5 e9c299fe41a9a315f575ad728664c8c0
BLAKE2b-256 ffad7cab86f8de93e01043229025d811e5a3472343de6021631aec995eaa1f3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1.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.0a1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca4198cd4ac2668fb5d80224ef72e34cdb11fe731ada44c19da1c923a2376ae7
MD5 ad4511c1fc61a3ab36d173270fc49bb0
BLAKE2b-256 556d11a2fc501c8aa6b7fc3fedffa8ea60474072345305acdaac6c79b544e0bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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.0a1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e114ec0886a7efcf01191222f1d82ec5d6b7a66733d17551fc8ff2e7a61d1f2d
MD5 55312a0e4fe9195c7c99aaec750ddcc8
BLAKE2b-256 297422833353144a98efd7af1f05afa9a07f2804ce259885baf23633a7860f9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95da4e1a9b1f97a5a4f21f7094c890f1bf0b385b79a99cc265fdb8c28442ae67
MD5 f7a3c687aa010f21f16a93c838b2e17c
BLAKE2b-256 00a020377a07bc59e25026cfdf8078d3dd64cf433a53f1be77f159e4bd6d4964

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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.0a1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3400984b8d60d4d2210996c24875331261d5cc2539a9bf18a60ddf1bc63b7e3
MD5 f941ae12fa1bdd7de0f4d037f8b32b19
BLAKE2b-256 0ac0129fa1dbc455af947ec1963cd17213bbe5fe2978f6b513b35b6e325a5d78

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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.0a1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 87ab7dc9f23845915e1284faba51444030d63bc5e20c73966c6ed50e4ff06cde
MD5 1c6363c71ea589125a7592f54447e30e
BLAKE2b-256 e9fcc85020e60291c08966c1c86d9b95ee81a8e25183b4a4cdc127c4e7717282

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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.0a1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for morseframes-0.1.0a1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 986861c0685c66195eea52a2078b4c3a60eda01bb98105524c19727fe8ffbf37
MD5 7a5754089f7d21a8a8b189392ba32a9f
BLAKE2b-256 8aea733885af841af166a61eb34ef3f1520ebed54474d742f35e39f92f09dbb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for morseframes-0.1.0a1-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