chalc 3.1.3__tar.gz → 4.0.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {chalc-3.1.3 → chalc-4.0.0.dev1}/CMakeLists.txt +3 -3
- {chalc-3.1.3 → chalc-4.0.0.dev1}/PKG-INFO +1 -1
- chalc-4.0.0.dev1/build_docs.sh +5 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/docs/Makefile +8 -2
- chalc-4.0.0.dev1/docs/README.md +11 -0
- chalc-4.0.0.dev1/docs/requirements.txt +15 -0
- chalc-4.0.0.dev1/docs/source/API.rst +7 -0
- chalc-4.0.0.dev1/docs/source/conf.py +101 -0
- {chalc-3.1.3/docs → chalc-4.0.0.dev1/docs/source}/example.ipynb +2 -2
- {chalc-3.1.3/docs → chalc-4.0.0.dev1/docs/source}/index.rst +1 -2
- {chalc-3.1.3/docs → chalc-4.0.0.dev1/docs/source}/installation.rst +17 -3
- {chalc-3.1.3 → chalc-4.0.0.dev1}/pyproject.toml +2 -2
- chalc-4.0.0.dev1/src/chalc/__init__.py +28 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/chromatic.pyi +10 -12
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/chromatic_py.cxx +0 -3
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/filtration.pyi +9 -9
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/plotting.py +10 -12
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/sixpack.py +21 -19
- chalc-3.1.3/build_docs.sh +0 -9
- chalc-3.1.3/build_stubs.sh +0 -4
- chalc-3.1.3/docs/API.rst +0 -17
- chalc-3.1.3/docs/conf.py +0 -117
- chalc-3.1.3/docs/exts/autosummary_customise.py +0 -119
- chalc-3.1.3/docs/requirements.txt +0 -12
- chalc-3.1.3/docs/stubgen.py +0 -11
- chalc-3.1.3/docs/templates/autosummary/base.rst +0 -5
- chalc-3.1.3/docs/templates/autosummary/class.rst +0 -72
- chalc-3.1.3/docs/templates/autosummary/function.rst +0 -5
- chalc-3.1.3/docs/templates/autosummary/method.rst +0 -5
- chalc-3.1.3/docs/templates/autosummary/module.rst +0 -83
- chalc-3.1.3/src/chalc/__init__.py +0 -24
- {chalc-3.1.3 → chalc-4.0.0.dev1}/.clang-format +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/.gitignore +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/.gitmodules +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/COPYING +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/README.md +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/docs/make.bat +0 -0
- {chalc-3.1.3/docs → chalc-4.0.0.dev1/docs/source}/license.rst +0 -0
- {chalc-3.1.3/docs → chalc-4.0.0.dev1/docs/source}/references.bib +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/docs/static/css/custom.css +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/.clang-format +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/.git +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/.gitignore +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/CMakeLists.txt +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/CMakePresets.json +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/COPYING +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/README.md +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/cmb.hpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/example.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/degenerate_case.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/gmpzf_input.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/paper_example_1.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/paper_example_2.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/test_utils.hpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/triangle_2d.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/tests/triangle_3d.cpp +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/ConstrainedMiniball/vcpkg.json +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/_utils.py +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/chromatic/chromatic.cxx +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/chromatic/chromatic.h +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/common.h +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/filtration/filtration.cxx +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/filtration/filtration.h +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/filtration_py.cxx +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/src/chalc/py.typed +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/tests/test_chalc.py +0 -0
- {chalc-3.1.3 → chalc-4.0.0.dev1}/vcpkg.json +0 -0
|
@@ -9,9 +9,9 @@ if (NOT DEFINED ENV{NO_USE_VCPKG})
|
|
|
9
9
|
message(STATUS "CI build detected.")
|
|
10
10
|
set(VCPKG_INSTALLATION_ROOT ${CMAKE_CURRENT_LIST_DIR}/vcpkg)
|
|
11
11
|
message(STATUS "Setting VCPKG_INSTALLATION_ROOT to ${CMAKE_CURRENT_LIST_DIR}/vcpkg")
|
|
12
|
-
elseif (DEFINED ENV{
|
|
13
|
-
set(VCPKG_INSTALLATION_ROOT $ENV{
|
|
14
|
-
message(STATUS "VCPKG_INSTALLATION_ROOT is $
|
|
12
|
+
elseif (DEFINED ENV{VCPKG_ROOT})
|
|
13
|
+
set(VCPKG_INSTALLATION_ROOT $ENV{VCPKG_ROOT})
|
|
14
|
+
message(STATUS "VCPKG_INSTALLATION_ROOT is ${VCPKG_INSTALLATION_ROOT}")
|
|
15
15
|
else()
|
|
16
16
|
# get the vcpkg commit id from vcpkg.json
|
|
17
17
|
file(READ ${CMAKE_CURRENT_LIST_DIR}/vcpkg.json VCPKG_JSON_STRING)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chalc
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0.dev1
|
|
4
4
|
Summary: Persistent homology of chromatic Delaunay filtrations
|
|
5
5
|
Keywords: topological data analysis,TDA,chromatic Delaunay,computational geometry,computational topology,persistent homology
|
|
6
6
|
Author-Email: Abhinav Natarajan <natarajan@maths.ox.ac.uk>
|
|
@@ -12,9 +12,15 @@ BUILDDIR = build
|
|
|
12
12
|
help:
|
|
13
13
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
stubs:
|
|
16
|
+
@echo "Generating stubs for chalc.chromatic"
|
|
17
|
+
@python -m pybind11_stubgen chalc.chromatic --numpy-array-use-type-var --output-dir ../src
|
|
18
|
+
@echo "Generating stubs for chalc.filtration"
|
|
19
|
+
@python -m pybind11_stubgen chalc.filtration --numpy-array-use-type-var --output-dir ../src
|
|
20
|
+
|
|
21
|
+
.PHONY: help Makefile stubs
|
|
16
22
|
|
|
17
23
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
24
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
-
%: Makefile
|
|
25
|
+
%: Makefile stubs
|
|
20
26
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Chalc Documentation Source Directory
|
|
2
|
+
|
|
3
|
+
To build the documentation, first make sure that ``chalc`` is installed and available to the Python interpreter. Then run the following commands from the root directory of the repository.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install -r requirements.txt
|
|
7
|
+
make html
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This will build the documentation into the folder ``docs/build`` with root ``index.html``.
|
|
11
|
+
In order to avoid polluting your global Python package tree, it is a good idea to install ``chalc`` and run the ``pip install ..`` command above in a virtual environment.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Dependencies for the documentation build
|
|
2
|
+
pybind11-stubgen ~= 2.5.1 # generate stubs from binary modules
|
|
3
|
+
sphinx ~= 8.0.0 # documentation generator
|
|
4
|
+
sphinx-autoapi ~= 3.3.1 # automatically generate the API documentation
|
|
5
|
+
furo ~= 2024.8.6 # sphinx theme
|
|
6
|
+
nbsphinx ~= 0.9.3 # support for jupyter notebooks
|
|
7
|
+
sphinx_design ~= 0.6.0 # for the grid layout in the installation page
|
|
8
|
+
sphinx_toolbox ~= 3.5.0 # sidebar and github links
|
|
9
|
+
|
|
10
|
+
# Dependencies to run the example notebook
|
|
11
|
+
numpy ~= 2.0.0
|
|
12
|
+
matplotlib ~= 3.8.4
|
|
13
|
+
IPython ~= 8.15.0
|
|
14
|
+
ipykernel ~= 6.25.2
|
|
15
|
+
ipympl ~= 0.9.3
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from packaging.version import parse
|
|
5
|
+
|
|
6
|
+
# Configuration file for the Sphinx documentation builder.
|
|
7
|
+
#
|
|
8
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
9
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
10
|
+
|
|
11
|
+
# -- Project information -----------------------------------------------------
|
|
12
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
13
|
+
|
|
14
|
+
# If extensions (or modules to document with autodoc) are in another directory,
|
|
15
|
+
# add these directories to sys.path here.
|
|
16
|
+
docs_path = list(Path(__file__).parents)[1]
|
|
17
|
+
project_root_dir = docs_path.parent
|
|
18
|
+
|
|
19
|
+
copyright = "2023, Abhinav Natarajan"
|
|
20
|
+
author = "Abhinav Natarajan"
|
|
21
|
+
|
|
22
|
+
# Get the name and release from pyproject.toml
|
|
23
|
+
from tomllib import loads
|
|
24
|
+
|
|
25
|
+
with open(project_root_dir / "pyproject.toml") as f:
|
|
26
|
+
proj_props = loads(f.read())["project"]
|
|
27
|
+
|
|
28
|
+
project = proj_props["name"]
|
|
29
|
+
release = ".".join(map(str, parse(proj_props["version"]).release))
|
|
30
|
+
|
|
31
|
+
# -- General configuration ---------------------------------------------------
|
|
32
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
33
|
+
|
|
34
|
+
maximum_signature_line_length = 160
|
|
35
|
+
toc_object_entries_show_parents = "hide"
|
|
36
|
+
add_module_names = False
|
|
37
|
+
master_doc = "index"
|
|
38
|
+
# templates_path = ['templates']
|
|
39
|
+
exclude_patterns = [
|
|
40
|
+
"_build",
|
|
41
|
+
"templates",
|
|
42
|
+
"exts",
|
|
43
|
+
"static",
|
|
44
|
+
# "example.ipynb",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
extensions = [
|
|
48
|
+
"sphinx.ext.autosectionlabel",
|
|
49
|
+
"sphinx.ext.napoleon",
|
|
50
|
+
"autoapi.extension",
|
|
51
|
+
"sphinx.ext.intersphinx",
|
|
52
|
+
"nbsphinx",
|
|
53
|
+
"sphinx_design",
|
|
54
|
+
"sphinx_toolbox.sidebar_links",
|
|
55
|
+
"sphinx_toolbox.github",
|
|
56
|
+
"sphinx.ext.githubpages",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
# autosectionlabel options
|
|
60
|
+
autosectionlabel_prefix_document = True
|
|
61
|
+
|
|
62
|
+
# napoleon options
|
|
63
|
+
napolean_include_init_with_doc = True
|
|
64
|
+
napoleon_attr_annotations = True
|
|
65
|
+
|
|
66
|
+
# autoapi options
|
|
67
|
+
autoapi_dirs = ["../../src"]
|
|
68
|
+
autoapi_options = [
|
|
69
|
+
"members",
|
|
70
|
+
"show-module-summary",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
# intersphinx options
|
|
74
|
+
intersphinx_mapping = {
|
|
75
|
+
"python": ("https://docs.python.org/3/", None),
|
|
76
|
+
"numpy": ("https://numpy.org/doc/stable", None),
|
|
77
|
+
"matplotlib": ("https://matplotlib.org/stable", None),
|
|
78
|
+
"h5py": ("https://docs.h5py.org/en/stable/", None),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# nbsphinx options
|
|
82
|
+
nbsphinx_execute = "always"
|
|
83
|
+
os.environ["PYDEVD_DISABLE_FILE_VALIDATION"] = "1"
|
|
84
|
+
|
|
85
|
+
# toolbox.github options
|
|
86
|
+
github_username = "abhinavnatarajan"
|
|
87
|
+
github_repository = "chalc"
|
|
88
|
+
|
|
89
|
+
# -- Options for HTML output -------------------------------------------------
|
|
90
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
91
|
+
|
|
92
|
+
html_static_path = ["../static"]
|
|
93
|
+
html_css_files = ["css/custom.css"]
|
|
94
|
+
|
|
95
|
+
html_theme = "furo"
|
|
96
|
+
html_theme_options = {
|
|
97
|
+
"source_repository": "https://github.com/abhinavnatarajan/chalc",
|
|
98
|
+
"source_branch": "master",
|
|
99
|
+
"source_directory": "docs/",
|
|
100
|
+
"top_of_page_button": "edit",
|
|
101
|
+
}
|
|
@@ -19132,8 +19132,8 @@
|
|
|
19132
19132
|
"# using the previously computed filtration\n",
|
|
19133
19133
|
"dgms_alpha = ch.sixpack.from_filtration(K, dom=[0])\n",
|
|
19134
19134
|
"# or directly from the point cloud\n",
|
|
19135
|
-
"dgms_delcech = ch.sixpack.compute(points, colours, dom=[0], method=\"
|
|
19136
|
-
"dgms_delrips = ch.sixpack.compute(points, colours, dom=[0], method=\"
|
|
19135
|
+
"dgms_delcech = ch.sixpack.compute(points, colours, dom=[0], method=\"delcech\")\n",
|
|
19136
|
+
"dgms_delrips = ch.sixpack.compute(points, colours, dom=[0], method=\"delrips\")"
|
|
19137
19137
|
]
|
|
19138
19138
|
},
|
|
19139
19139
|
{
|
|
@@ -20,13 +20,12 @@ Documentation index
|
|
|
20
20
|
installation
|
|
21
21
|
example
|
|
22
22
|
API
|
|
23
|
+
license
|
|
23
24
|
|
|
24
25
|
.. sidebar-links::
|
|
25
26
|
:github:
|
|
26
27
|
:pypi: chalc
|
|
27
28
|
|
|
28
|
-
license
|
|
29
|
-
|
|
30
29
|
Citing this Software
|
|
31
30
|
--------------------
|
|
32
31
|
If you want to use chalc in your work, please use the following citation:
|
|
@@ -43,7 +43,7 @@ Clone the git repository.
|
|
|
43
43
|
$ git clone https://github.com/abhinavnatarajan/chalc
|
|
44
44
|
$ cd chalc
|
|
45
45
|
|
|
46
|
-
If you have vcpkg installed on your system, make sure that the environment variable ``
|
|
46
|
+
If you have vcpkg installed on your system, make sure that the environment variable ``VCPKG_ROOT`` is set and points to the base directory where vcpkg is installed.
|
|
47
47
|
|
|
48
48
|
.. tab-set::
|
|
49
49
|
|
|
@@ -52,14 +52,14 @@ If you have vcpkg installed on your system, make sure that the environment varia
|
|
|
52
52
|
|
|
53
53
|
.. code-block:: bash
|
|
54
54
|
|
|
55
|
-
$ export
|
|
55
|
+
$ export VCPKG_ROOT=/path/to/vcpkg/dir
|
|
56
56
|
|
|
57
57
|
.. tab-item:: Powershell
|
|
58
58
|
:sync: powershell
|
|
59
59
|
|
|
60
60
|
.. code-block:: powershell
|
|
61
61
|
|
|
62
|
-
> $Env:
|
|
62
|
+
> $Env:VCPKG_ROOT = 'C:\path\to\vcpkg\dir'
|
|
63
63
|
|
|
64
64
|
If you do not have vcpkg installed, the build process will automatically download vcpkg into a temporary directory and fetch the required dependencies.
|
|
65
65
|
|
|
@@ -88,3 +88,17 @@ Build the package wheel using ``pip wheel`` and install the compiled binary.
|
|
|
88
88
|
|
|
89
89
|
$ pip wheel . -w outputdir
|
|
90
90
|
$ pip install outputdir/<name_of_generated_wheel>.whl
|
|
91
|
+
|
|
92
|
+
Building the Documentation
|
|
93
|
+
--------------------------
|
|
94
|
+
|
|
95
|
+
To build the documentation, first make sure that ``chalc`` is installed and available to the Python interpreter. Then run the following commands from the root directory of the repository.
|
|
96
|
+
|
|
97
|
+
.. code-block:: console
|
|
98
|
+
|
|
99
|
+
$ cd docs
|
|
100
|
+
$ pip install -r requirements.txt
|
|
101
|
+
$ make html
|
|
102
|
+
|
|
103
|
+
This will build the documentation into the folder ``docs/build`` with root ``index.html``.
|
|
104
|
+
In order to avoid polluting your global Python package tree, it is a good idea to install ``chalc`` and run the ``pip install ..`` command above in a virtual environment.
|
|
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chalc"
|
|
7
|
-
version = "
|
|
7
|
+
version = "4.0.0-dev1"
|
|
8
8
|
authors = [{ name = "Abhinav Natarajan", email = "natarajan@maths.ox.ac.uk" }]
|
|
9
9
|
description = "Persistent homology of chromatic Delaunay filtrations"
|
|
10
10
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
@@ -57,7 +57,7 @@ experimental = true
|
|
|
57
57
|
archs = ["auto64"]
|
|
58
58
|
skip = ["pp*", "*-musllinux_*"]
|
|
59
59
|
test-command = "pytest {package}/tests"
|
|
60
|
-
test-requires = ["pytest
|
|
60
|
+
test-requires = ["pytest~=8.2.2"]
|
|
61
61
|
build-verbosity = 2
|
|
62
62
|
|
|
63
63
|
[tool.cibuildwheel.linux]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Chalc is a package to compute the persistent homology of chromatic complexes of points clouds in Euclidean space.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import platform
|
|
8
|
+
|
|
9
|
+
from . import filtration
|
|
10
|
+
|
|
11
|
+
if platform.system() == "Windows":
|
|
12
|
+
# need to load up the GMP and MPFR DLLs
|
|
13
|
+
import os as _os
|
|
14
|
+
from importlib.metadata import files as _files
|
|
15
|
+
|
|
16
|
+
_bindir = (
|
|
17
|
+
[x for x in _files("chalc") if len(x.parent.parts) > 0 and x.parent.parts[-1] == "bin"][0]
|
|
18
|
+
.locate()
|
|
19
|
+
.parent
|
|
20
|
+
)
|
|
21
|
+
with _os.add_dll_directory(_bindir):
|
|
22
|
+
from . import chromatic
|
|
23
|
+
else:
|
|
24
|
+
from . import chromatic
|
|
25
|
+
|
|
26
|
+
from . import plotting, sixpack
|
|
27
|
+
|
|
28
|
+
__all__ = ["chromatic", "filtration", "sixpack", "plotting"]
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"""
|
|
2
2
|
|
|
3
3
|
Module containing geometry routines to compute chromatic Delaunay filtrations.
|
|
4
|
-
|
|
5
|
-
Attributes:
|
|
6
|
-
MaxColoursChromatic (int): Maximum number of colours that can be handled by the methods in this module.
|
|
7
4
|
|
|
8
5
|
"""
|
|
9
6
|
from __future__ import annotations
|
|
10
7
|
import chalc.filtration
|
|
11
8
|
import numpy
|
|
12
|
-
import pybind11_stubgen.typing_ext
|
|
13
9
|
import typing
|
|
14
10
|
__all__ = ['MaxColoursChromatic', 'alpha', 'delaunay', 'delcech', 'delrips']
|
|
11
|
+
M = typing.TypeVar("M", bound=int)
|
|
12
|
+
N = typing.TypeVar("N", bound=int)
|
|
15
13
|
@typing.overload
|
|
16
|
-
def alpha(x:
|
|
14
|
+
def alpha(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: numpy.ndarray[tuple[M, typing.Literal[1]], numpy.dtype[numpy.int32]]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
17
15
|
...
|
|
18
16
|
@typing.overload
|
|
19
|
-
def alpha(x:
|
|
17
|
+
def alpha(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: list[int]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
20
18
|
"""
|
|
21
19
|
Computes the chromatic alpha filtration of a coloured point cloud.
|
|
22
20
|
|
|
@@ -37,10 +35,10 @@ def alpha(x: typing.Annotated[numpy.ndarray, numpy.float64, pybind11_stubgen.typ
|
|
|
37
35
|
:func:`delrips`, :func:`delcech`
|
|
38
36
|
"""
|
|
39
37
|
@typing.overload
|
|
40
|
-
def delaunay(x:
|
|
38
|
+
def delaunay(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: numpy.ndarray[tuple[M, typing.Literal[1]], numpy.dtype[numpy.int32]]) -> chalc.filtration.FilteredComplex:
|
|
41
39
|
...
|
|
42
40
|
@typing.overload
|
|
43
|
-
def delaunay(x:
|
|
41
|
+
def delaunay(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: list[int]) -> chalc.filtration.FilteredComplex:
|
|
44
42
|
"""
|
|
45
43
|
Returns the chromatic Delaunay triangulation of a coloured point cloud in Euclidean space.
|
|
46
44
|
|
|
@@ -55,10 +53,10 @@ def delaunay(x: typing.Annotated[numpy.ndarray, numpy.float64, pybind11_stubgen.
|
|
|
55
53
|
The Delaunay triangulation.
|
|
56
54
|
"""
|
|
57
55
|
@typing.overload
|
|
58
|
-
def delcech(x:
|
|
56
|
+
def delcech(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: numpy.ndarray[tuple[M, typing.Literal[1]], numpy.dtype[numpy.int32]]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
59
57
|
...
|
|
60
58
|
@typing.overload
|
|
61
|
-
def delcech(x:
|
|
59
|
+
def delcech(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: list[int]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
62
60
|
"""
|
|
63
61
|
Returns the chromatic Delaunay--Čech filtration of a coloured point cloud.
|
|
64
62
|
|
|
@@ -79,10 +77,10 @@ def delcech(x: typing.Annotated[numpy.ndarray, numpy.float64, pybind11_stubgen.t
|
|
|
79
77
|
:func:`alpha`, :func:`delrips`
|
|
80
78
|
"""
|
|
81
79
|
@typing.overload
|
|
82
|
-
def delrips(x:
|
|
80
|
+
def delrips(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: numpy.ndarray[tuple[M, typing.Literal[1]], numpy.dtype[numpy.int32]]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
83
81
|
...
|
|
84
82
|
@typing.overload
|
|
85
|
-
def delrips(x:
|
|
83
|
+
def delrips(x: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float64]], colours: list[int]) -> tuple[chalc.filtration.FilteredComplex, bool]:
|
|
86
84
|
"""
|
|
87
85
|
Computes the chromatic Delaunay--Rips filtration of a coloured point cloud.
|
|
88
86
|
|
|
@@ -13,9 +13,6 @@ PYBIND11_MODULE(chromatic, m) {
|
|
|
13
13
|
m.doc() =
|
|
14
14
|
R"docstring(
|
|
15
15
|
Module containing geometry routines to compute chromatic Delaunay filtrations.
|
|
16
|
-
|
|
17
|
-
Attributes:
|
|
18
|
-
MaxColoursChromatic (int): Maximum number of colours that can be handled by the methods in this module.
|
|
19
16
|
)docstring";
|
|
20
17
|
m.attr("MaxColoursChromatic") = py::int_(MAX_NUM_COLOURS);
|
|
21
18
|
m.def(
|
|
@@ -68,12 +68,12 @@ class FilteredComplex:
|
|
|
68
68
|
Serialised representation of the simplicial complex in a format suitable for persistent homology computations.
|
|
69
69
|
|
|
70
70
|
:return:
|
|
71
|
-
A list `x` of simplices in the simplicial complex ordered by dimension followed by filtration time. Each simplex :math
|
|
71
|
+
A list `x` of simplices in the simplicial complex ordered by dimension followed by filtration time. Each simplex :math:`\\sigma` is represented by a tuple containing the following items.
|
|
72
72
|
|
|
73
|
-
1. A list containing the indices in `x` of the facets of :math
|
|
74
|
-
2. The lexicographic key of :math
|
|
75
|
-
3. The filtration time of :math
|
|
76
|
-
4. The colour bitmask of :math
|
|
73
|
+
1. A list containing the indices in `x` of the facets of :math:`\\sigma`, sorted in ascending order.
|
|
74
|
+
2. The lexicographic key of :math:`\\sigma` in the simplicial complex.
|
|
75
|
+
3. The filtration time of :math:`\\sigma`.
|
|
76
|
+
4. The colour bitmask of :math:`\\sigma`.
|
|
77
77
|
"""
|
|
78
78
|
@property
|
|
79
79
|
def dimension(self) -> int:
|
|
@@ -83,7 +83,7 @@ class FilteredComplex:
|
|
|
83
83
|
@property
|
|
84
84
|
def max_dimension(self) -> int:
|
|
85
85
|
"""
|
|
86
|
-
Maximum dimension of simplex that this complex can store.
|
|
86
|
+
Maximum dimension of simplex that this complex can store. \\
|
|
87
87
|
Set during initialisation.
|
|
88
88
|
"""
|
|
89
89
|
@property
|
|
@@ -99,7 +99,7 @@ class FilteredComplex:
|
|
|
99
99
|
@property
|
|
100
100
|
def num_vertices(self) -> int:
|
|
101
101
|
"""
|
|
102
|
-
Number of vertices in the simplicial complex.
|
|
102
|
+
Number of vertices in the simplicial complex. \\
|
|
103
103
|
Set during initialisation.
|
|
104
104
|
"""
|
|
105
105
|
@property
|
|
@@ -128,7 +128,7 @@ class Simplex:
|
|
|
128
128
|
@property
|
|
129
129
|
def colours(self) -> int:
|
|
130
130
|
"""
|
|
131
|
-
Bitmask of colours in the simplex, where the rightmost bit represents the smallest colour index. More precisely, :math
|
|
131
|
+
Bitmask of colours in the simplex, where the rightmost bit represents the smallest colour index. More precisely, :math:`\\mathrm{bitmask} = \\sum_{c \\in \\mathrm{colours}(\\sigma)} 2^c`. For example, a simplex having vertices of colours 0 and 1 has a colour bitmask of 3.
|
|
132
132
|
"""
|
|
133
133
|
@property
|
|
134
134
|
def dimension(self) -> int:
|
|
@@ -151,7 +151,7 @@ class Simplex:
|
|
|
151
151
|
@property
|
|
152
152
|
def label(self) -> int:
|
|
153
153
|
"""
|
|
154
|
-
Label of the simplex in its parent filtered complex. A :math:`k`-simplex :math
|
|
154
|
+
Label of the simplex in its parent filtered complex. A :math:`k`-simplex :math:`\\sigma` is labelled by the lexicographic index of :math:`\\sigma` with respect to its vertex labels sorted in ascending order, counting all possible sorted subsequences of :math:`(0, ..., N-1)` of length :math:`k`.
|
|
155
155
|
"""
|
|
156
156
|
@property
|
|
157
157
|
def vertices(self) -> list[int]:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
"""Plotting and visualisation utilities."""
|
|
2
|
+
|
|
1
3
|
from __future__ import annotations
|
|
2
4
|
|
|
3
5
|
from collections.abc import Collection, Sequence
|
|
4
6
|
from itertools import product
|
|
5
|
-
from typing import
|
|
7
|
+
from typing import Literal
|
|
6
8
|
|
|
7
9
|
import matplotlib.animation as animation
|
|
8
10
|
import matplotlib.pyplot as plt
|
|
@@ -14,7 +16,6 @@ from pandas import DataFrame
|
|
|
14
16
|
|
|
15
17
|
from chalc.filtration import FilteredComplex
|
|
16
18
|
|
|
17
|
-
from ._utils import interpolate_docstring
|
|
18
19
|
from .sixpack import (
|
|
19
20
|
DiagramEnsemble,
|
|
20
21
|
_bitmask_to_colours,
|
|
@@ -25,15 +26,13 @@ from .sixpack import (
|
|
|
25
26
|
|
|
26
27
|
plt.rcParams["animation.html"] = "jshtml"
|
|
27
28
|
|
|
28
|
-
__doc__ = "Plotting and visualisation utilities."
|
|
29
|
-
|
|
30
29
|
|
|
31
30
|
def plot_sixpack(
|
|
32
31
|
dgms: DiagramEnsemble,
|
|
33
32
|
truncation: float | None = None,
|
|
34
33
|
max_diagram_dimension: int | None = None,
|
|
35
34
|
tolerance: float = 0,
|
|
36
|
-
) -> tuple[Figure,
|
|
35
|
+
) -> tuple[Figure, np.ndarray[tuple[int, ...], np.dtype[Axes]]]:
|
|
37
36
|
"""
|
|
38
37
|
Plots the 6-pack of persistence diagrams returned by :func:`compute <.sixpack.compute>`.
|
|
39
38
|
|
|
@@ -100,10 +99,9 @@ def plot_sixpack(
|
|
|
100
99
|
return fig, axes
|
|
101
100
|
|
|
102
101
|
|
|
103
|
-
@interpolate_docstring()
|
|
104
102
|
def plot_diagram(
|
|
105
103
|
dgms: DiagramEnsemble,
|
|
106
|
-
diagram_name:
|
|
104
|
+
diagram_name: Literal["ker", "cok", "dom", "cod", "im", "rel"],
|
|
107
105
|
truncation: float | None = None,
|
|
108
106
|
max_diagram_dimension: int | None = None,
|
|
109
107
|
ax: Axes | None = None,
|
|
@@ -114,7 +112,7 @@ def plot_diagram(
|
|
|
114
112
|
|
|
115
113
|
Args:
|
|
116
114
|
dgms : The 6-pack of persistence diagrams.
|
|
117
|
-
diagram_name : One of
|
|
115
|
+
diagram_name : One of ``'ker'``, ``'cok'``, ``'dom'``, ``'cod'``, ``'im'``, or ``'rel'``.
|
|
118
116
|
truncation : The maximum entrance time for which the diagrams are plotted. A sensible default will be calculated if not provided.
|
|
119
117
|
max_diagram_dimension : The maximum homological dimension for which to plot points. If not provided, all dimensions will be included in the plots.
|
|
120
118
|
ax : A matplotlib axes object. If provided then the diagram will be plotted on the given axes.
|
|
@@ -223,16 +221,16 @@ def _plot_diagram(
|
|
|
223
221
|
|
|
224
222
|
def draw_filtration(
|
|
225
223
|
K: FilteredComplex,
|
|
226
|
-
points:
|
|
224
|
+
points: np.ndarray[tuple[Literal[2], int], np.dtype[np.float64]],
|
|
227
225
|
time: float,
|
|
228
226
|
include_colours: Collection[int] | None = None,
|
|
229
227
|
ax: Axes | None = None,
|
|
230
228
|
) -> Axes:
|
|
231
229
|
"""
|
|
232
|
-
Visualise a filtration at given time, optionally including only certain colours.
|
|
230
|
+
Visualise a 2D filtration at given time, optionally including only certain colours.
|
|
233
231
|
|
|
234
232
|
Args:
|
|
235
|
-
K : A filtered complex.
|
|
233
|
+
K : A filtered 2-dimensional simplicial complex.
|
|
236
234
|
points : The vertices of ``K`` as a :math:`2\\times N` numpy matrix.
|
|
237
235
|
time : Filtration times for which to draw simplices.
|
|
238
236
|
include_colours : Optional collection of colours to include. If not specified then all colours will be drawn.
|
|
@@ -313,7 +311,7 @@ def draw_filtration(
|
|
|
313
311
|
|
|
314
312
|
def animate_filtration(
|
|
315
313
|
K: FilteredComplex,
|
|
316
|
-
points:
|
|
314
|
+
points: np.ndarray[tuple[Literal[2], int], np.dtype[np.float64]],
|
|
317
315
|
filtration_times: Sequence[float],
|
|
318
316
|
animation_length: float,
|
|
319
317
|
) -> animation.FuncAnimation:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
"""Routines for computing 6-packs of persistence diagrams."""
|
|
2
|
+
|
|
1
3
|
from __future__ import annotations
|
|
2
4
|
|
|
3
5
|
from collections.abc import Collection, Sequence
|
|
4
6
|
from dataclasses import dataclass, field, fields
|
|
5
|
-
from typing import
|
|
7
|
+
from typing import Callable, ClassVar, Literal, overload
|
|
6
8
|
|
|
7
9
|
import numpy as np
|
|
8
10
|
from h5py import Dataset, Group
|
|
@@ -11,9 +13,6 @@ from phimaker import compute_ensemble
|
|
|
11
13
|
from chalc.chromatic import alpha, delcech, delrips
|
|
12
14
|
from chalc.filtration import FilteredComplex
|
|
13
15
|
|
|
14
|
-
from ._utils import interpolate_docstring
|
|
15
|
-
|
|
16
|
-
__doc__ = "Routines for computing 6-packs of persistence diagrams."
|
|
17
16
|
__all__ = [
|
|
18
17
|
"from_filtration",
|
|
19
18
|
"compute",
|
|
@@ -24,9 +23,9 @@ __all__ = [
|
|
|
24
23
|
]
|
|
25
24
|
|
|
26
25
|
ChromaticMethod = {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
26
|
+
"alpha": alpha,
|
|
27
|
+
"delcech": delcech,
|
|
28
|
+
"delrips": delrips,
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
BdMatType = list[tuple[bool, int, list[int]]]
|
|
@@ -92,7 +91,6 @@ def _get_diagrams(
|
|
|
92
91
|
return dgms.threshold(tolerance)
|
|
93
92
|
|
|
94
93
|
|
|
95
|
-
@interpolate_docstring()
|
|
96
94
|
def from_filtration(
|
|
97
95
|
K: FilteredComplex,
|
|
98
96
|
dom: Collection[int] | int | None = None,
|
|
@@ -155,13 +153,12 @@ def from_filtration(
|
|
|
155
153
|
return _get_diagrams(K, check_in_domain, max_diagram_dimension, tolerance)
|
|
156
154
|
|
|
157
155
|
|
|
158
|
-
@interpolate_docstring()
|
|
159
156
|
def compute(
|
|
160
|
-
x:
|
|
157
|
+
x: np.ndarray[tuple[int, int], np.dtype[np.float64]],
|
|
161
158
|
colours: Sequence[int],
|
|
162
159
|
dom: Collection[int] | int | None = None,
|
|
163
160
|
k: int | None = None,
|
|
164
|
-
method:
|
|
161
|
+
method: Literal["alpha", "delcech", "delrips"] = "alpha",
|
|
165
162
|
max_diagram_dimension: int | None = None,
|
|
166
163
|
tolerance: float = 0,
|
|
167
164
|
) -> DiagramEnsemble:
|
|
@@ -175,7 +172,7 @@ def compute(
|
|
|
175
172
|
colours : Sequence of integers describing the colours of the points.
|
|
176
173
|
dom : Integer or collection of integers describing the colours of the points in the domain (the subcomplex :math:`L`).
|
|
177
174
|
k : If not ``None``, then the domain is taken to be the :math:`k`-chromatic subcomplex of :math:`K`, i.e., the subcomplex of simplices having at most :math:`k` colours.
|
|
178
|
-
method : Filtration used to construct the chromatic complex. Must be one of
|
|
175
|
+
method : Filtration used to construct the chromatic complex. Must be one of ``'alpha'``, ``'delcech'``, or ``'delrips'``.
|
|
179
176
|
max_diagram_dimension : Maximum homological dimension for which the persistence diagrams are computed. By default diagrams of all dimensions are computed.
|
|
180
177
|
tolerance : Retain only points with persistence strictly greater than this value.
|
|
181
178
|
|
|
@@ -248,7 +245,9 @@ class SimplexPairings:
|
|
|
248
245
|
|
|
249
246
|
@classmethod
|
|
250
247
|
def _from_matrices(
|
|
251
|
-
cls,
|
|
248
|
+
cls,
|
|
249
|
+
p: np.ndarray[tuple[int, int], np.dtype[np.int64]],
|
|
250
|
+
u: np.ndarray[tuple[int, int], np.dtype[np.int64]],
|
|
252
251
|
) -> SimplexPairings:
|
|
253
252
|
if p.shape[1] != 2:
|
|
254
253
|
raise ValueError(f"p must be a (m, 2) matrix, but received a matrix of size {p.shape}")
|
|
@@ -256,7 +255,7 @@ class SimplexPairings:
|
|
|
256
255
|
unpaired = list(u)
|
|
257
256
|
return cls(paired, unpaired)
|
|
258
257
|
|
|
259
|
-
def paired_as_matrix(self) ->
|
|
258
|
+
def paired_as_matrix(self) -> np.ndarray[tuple[int, int], np.dtype[np.int64]]:
|
|
260
259
|
return np.concatenate(list(self.paired)).reshape((-1, 2))
|
|
261
260
|
|
|
262
261
|
def __eq__(self, other) -> bool:
|
|
@@ -315,20 +314,23 @@ class DiagramEnsemble:
|
|
|
315
314
|
return self
|
|
316
315
|
|
|
317
316
|
@overload
|
|
318
|
-
def get(
|
|
317
|
+
def get(
|
|
318
|
+
self, diagram_name: Literal["ker", "cok", "dom", "cod", "im", "rel"], dim: int
|
|
319
|
+
) -> np.ndarray[tuple[int, int], np.dtype[np.float64]]: ...
|
|
319
320
|
|
|
320
321
|
@overload
|
|
321
322
|
def get(
|
|
322
|
-
self,
|
|
323
|
-
|
|
323
|
+
self,
|
|
324
|
+
diagram_name: Literal["ker", "cok", "dom", "cod", "im", "rel"],
|
|
325
|
+
dim: list[int] | None = None,
|
|
326
|
+
) -> list[np.ndarray[tuple[int, int], np.dtype[np.float64]]]: ...
|
|
324
327
|
|
|
325
|
-
@interpolate_docstring({"diagram_names": diagram_names})
|
|
326
328
|
def get(self, diagram_name, dim=None):
|
|
327
329
|
"""
|
|
328
330
|
Get a specific diagram as a matrix of birth and death times.
|
|
329
331
|
|
|
330
332
|
Args:
|
|
331
|
-
diagram_name : One of
|
|
333
|
+
diagram_name : One of ``'ker'``, ``'cok'``, ``'dom'``, ``'cod'``, ``'im'``, or ``'rel'``.
|
|
332
334
|
dim : Dimension(s) of the diagram desired. If a list is provided then a list of matrices is returned, with the order of matrices respecting the order of entries of `dim`. If `dim` is not provided then the returned matrix will contain persistent features from all homological dimensions from zero to ``max(self.dimensions)``.
|
|
333
335
|
|
|
334
336
|
Returns:
|
chalc-3.1.3/build_docs.sh
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# python docs/stubgen.py chalc --output-dir docs/stubs
|
|
4
|
-
source build_stubs.sh
|
|
5
|
-
shopt -s extglob
|
|
6
|
-
mkdir -p docs/stubs/chalc/
|
|
7
|
-
cp -rf src/chalc/!(__init__)*.py?(i) docs/stubs/chalc/
|
|
8
|
-
for f in docs/stubs/chalc/*.pyi; do mv -- "$f" "${f%.pyi}.py"; done
|
|
9
|
-
sphinx-build -E -b html docs docs/_build
|
chalc-3.1.3/build_stubs.sh
DELETED