Skip to content

Commit 112665d

Browse files
authored
Fix documentation (#74)
* Update readthedocs yml to new style * Update index.rst for landscape paths * Update notebook * Add all variable, remove unnec docstring * Revert index.rst change * Update conf.py settings for toc overlap * Update notebook * Update badges The travis CI build status badge wasn't working, so it was removed. Used new badge for downloads * Run ruff on landscape code, fix typo * Update notebook code, add new userguide notebook, add to ToC * Update notebook * Formatting tweaks to notebooks * Return axes, figure objects with landscape viz code. Update notebooks * More notebook tweaking * Add basic viz end-to-end test --------- Co-authored-by: Michael Catanzaro <[email protected]>
1 parent f58729c commit 112665d

16 files changed

+1332
-249
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[![PyPI version](https://badge.fury.io/py/persim.svg)](https://badge.fury.io/py/persim)
2-
[![Downloads](https://pypip.in/download/persim/badge.svg)](https://pypi.python.org/pypi/persim/)
2+
![PyPI - Downloads](https://img.shields.io/pypi/dm/persim)
33
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/persim.svg)](https://anaconda.org/conda-forge/persim)
44
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/persim.svg)](https://anaconda.org/conda-forge/persim)
5-
[![Build Status](https://travis-ci.org/scikit-tda/persim.svg?branch=master)](https://travis-ci.org/scikit-tda/persim)
65
[![codecov](https://codecov.io/gh/scikit-tda/persim/branch/master/graph/badge.svg)](https://codecov.io/gh/scikit-tda/persim)
76
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
87

docs/conf.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
# -*- coding: utf-8 -*-
22
import os
33
import sys
4-
sys.path.insert(0, os.path.abspath('.'))
5-
from persim import __version__
4+
5+
sys.path.insert(0, os.path.abspath("."))
66
from sktda_docs_config import *
77

8-
project = u'Persim'
9-
copyright = u'2019, Nathaniel Saul'
10-
author = u'Nathaniel Saul'
8+
from persim import __version__
9+
10+
project = "Persim"
11+
copyright = "2019, Nathaniel Saul"
12+
author = "Nathaniel Saul"
1113

1214
version = __version__
1315
release = __version__
1416

15-
html_theme_options.update({
16-
# Google Analytics info
17-
'ga_ua': 'UA-124965309-3',
18-
'ga_domain': '',
19-
'gh_url': 'scikit-tda/persim'
20-
})
17+
language = "en"
18+
19+
html_theme_options.update(
20+
{
21+
"collapse_naviation": False,
22+
# Google Analytics info
23+
"ga_ua": "UA-124965309-3",
24+
"ga_domain": "",
25+
"gh_url": "scikit-tda/persim",
26+
}
27+
)
2128

2229
html_short_title = project
23-
htmlhelp_basename = 'Persimdoc'
30+
htmlhelp_basename = "Persimdoc"
2431

25-
autodoc_default_options = {
26-
'members': True
27-
}
32+
autodoc_default_options = {"members": False, "maxdepth": 1}
2833

29-
autodoc_member_order = 'groupwise'
34+
autodoc_member_order = "groupwise"

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Documentation
3636

3737
notebooks/Persistence images
3838
notebooks/distances
39+
notebooks/Persistence landscapes
3940
reference/index
4041

4142

docs/notebooks/Differentiation with Persistence Landscapes.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"The experiment is to determine if persistent homology can distinguish between spheres of different dimensions. Here we restrict to differentiating $S^2$ from $S^3$. We will further restrict ourselves to persistent homology in degree one (but one can use all relevant homological degrees as well). A priori, we would not expect this to be an effective discriminator, since the ordinary first homology of both spheres is trivial. Note that this is a simplified version of the experiment from Bubenik and Dlotko's *A persistence landscapes toolbox for topological statistics* [1]. \n",
1919
"\n",
2020
"In detail: \n",
21+
"\n",
2122
"- Repeat the following `num_runs = 100` times:\n",
2223
" - Sample `num_pts = 100` points from the 2-sphere and the 3-sphere. We rescale the spheres so the average distance between the points on each sphere is approximately 1.\n",
2324
" - Compute the VR persistent homology (using `ripser`) and compute the associated landscapes. Store each of these landscapes.\n",
@@ -356,7 +357,7 @@
356357
],
357358
"metadata": {
358359
"kernelspec": {
359-
"display_name": "Python 3",
360+
"display_name": "Python 3 (ipykernel)",
360361
"language": "python",
361362
"name": "python3"
362363
},
@@ -370,7 +371,7 @@
370371
"name": "python",
371372
"nbconvert_exporter": "python",
372373
"pygments_lexer": "ipython3",
373-
"version": "3.9.1"
374+
"version": "3.12.0"
374375
}
375376
},
376377
"nbformat": 4,

docs/notebooks/Persistence Landscapes and Machine Learning.ipynb

Lines changed: 58 additions & 18 deletions
Large diffs are not rendered by default.

docs/notebooks/Persistence images.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@
494494
],
495495
"metadata": {
496496
"kernelspec": {
497-
"display_name": "persimenv",
497+
"display_name": "Python 3",
498498
"language": "python",
499-
"name": "persimenv"
499+
"name": "python3"
500500
},
501501
"language_info": {
502502
"codemirror_mode": {
@@ -508,7 +508,7 @@
508508
"name": "python",
509509
"nbconvert_exporter": "python",
510510
"pygments_lexer": "ipython3",
511-
"version": "3.7.9"
511+
"version": "3.9.1"
512512
}
513513
},
514514
"nbformat": 4,

docs/notebooks/Persistence landscapes.ipynb

Lines changed: 1012 additions & 0 deletions
Large diffs are not rendered by default.

persim/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
from .images import *
2-
from .sliced_wasserstein import *
1+
from ._version import __version__
32
from .bottleneck import *
4-
from .wasserstein import *
5-
from .heat import *
63
from .gromov_hausdorff import *
4+
from .heat import *
5+
from .images import *
6+
from .landscapes.approximate import PersLandscapeApprox
7+
from .landscapes.exact import PersLandscapeExact
8+
from .landscapes.transformer import PersistenceLandscaper
9+
from .sliced_wasserstein import *
710
from .visuals import *
11+
from .wasserstein import *
812

9-
from ._version import __version__
13+
__all__ = ["PersLandscapeApprox", "PersistenceLandscaper", "PersLandscapeExact"]

persim/landscapes/approximate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class are much faster compared to `PersLandscapeExact` in general.
8787
8888
ValueError: Start values of grids do not coincide
8989
90-
>>> from persim import snap_PL
91-
>>> [snapped_pla, snapped_wide_pl] = snap_PL([pla,wide_pl])
90+
>>> from persim import snap_pl
91+
>>> [snapped_pla, snapped_wide_pl] = snap_pl([pla,wide_pl])
9292
>>> print(snapped_pla, snapped_wide_pl)
9393
9494
Approximate persistence landscape in homological degree 0 on grid from -1 to 4 with 1000 steps Approximate persistence landscape in homological degree 0 on grid from -1 to 4 with 1000 steps
@@ -128,7 +128,6 @@ def __init__(
128128
values=np.array([]),
129129
compute: bool = True,
130130
) -> None:
131-
132131
super().__init__(dgms=dgms, hom_deg=hom_deg)
133132
if not dgms and values.size == 0:
134133
raise ValueError("dgms and values cannot both be emtpy")

persim/landscapes/auxiliary.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def union_crit_pairs(A, B):
4444
else:
4545
result_pairs.append(
4646
slope_to_pos_interp(
47-
sum_slopes(pos_to_slope_interp(a), pos_to_slope_interp(b),)
47+
sum_slopes(
48+
pos_to_slope_interp(a),
49+
pos_to_slope_interp(b),
50+
)
4851
)
4952
)
5053
return result_pairs
@@ -141,7 +144,7 @@ def ndsnap_regular(points, *grid_axes):
141144

142145
def _p_norm(p: float, critical_pairs: list = []):
143146
"""
144-
Compute `p` norm of interpolated piecewise linear function defined from list of
147+
Compute `p` norm of interpolated piecewise linear function defined from list of
145148
critical pairs.
146149
"""
147150
result = 0.0

0 commit comments

Comments
 (0)