Skip to content

Commit 33f0d08

Browse files
authored
Merge pull request #88 from MunchLab/drawing_improvements
Updating draw function, now has its own constrained layout generator rather than the old spring layout version.
2 parents cd31fdd + 8d650e8 commit 33f0d08

File tree

18 files changed

+760
-421
lines changed

18 files changed

+760
-421
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ docs:
1313
rsync -a docs/html/ docs/
1414
rm -rf docs/html
1515

16+
.PHONY: docs-execute
17+
docs-execute:
18+
# Running sphinx-build and forcing nbsphinx to execute all notebooks.
19+
rm -rf docs
20+
mkdir -p docs
21+
sphinx-build -M html doc_source docs -D nbsphinx_execute=always
22+
rsync -a docs/html/ docs/
23+
rm -rf docs/html
24+
1625
install-editable:
1726
@pip install -e .
1827

@@ -41,6 +50,7 @@ help:
4150
@echo " make format - Format code using black"
4251
@echo " make install-editable - Install the package in editable mode for development"
4352
@echo " make docs - Build the documentation in the docs/ folder"
53+
@echo " make docs-execute - Build docs and execute all notebooks"
4454
@echo " make release - Build the package for release"
4555
@echo " make tests - Run the unit tests"
4656
@echo " make install-requirements- Install all dependencies from requirements.txt"

cereeberus/cereeberus/compute/computemapper.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ def __addedges(clusterpoints):
119119
# Does the Mapper Algorithm in order
120120
def computeMapper(pointcloud, lensfunction, cover, clusteralgorithm):
121121
"""
122-
Computes the mapper graph of an input function.
123-
124-
The point cloud should be given as a list of tuples or as a numpy array.
125-
126-
The lens function should be given as either a list of numbers with the same length as the number of points; or as a callable function where :math:`f(point) = \text{value}` so long as the function can be determined from the coordinate values of the point.
127-
128-
The cover should be given as a list of intervals. This can be done, for example, using the 'cereeberus.cover' function in this module, which takes in a minimum, maximum, number of covers, and percentage of overlap to create a cover.
129-
122+
Computes the mapper graph of an input function.
123+
124+
The point cloud should be given as a list of tuples or as a numpy array.
125+
126+
The lens function should be given as either a list of numbers with the same length as the number of points; or as a callable function where :math:`f(point) = \text{value}` so long as the function can be determined from the coordinate values of the point.
127+
128+
The cover should be given as a list of intervals. This can be done, for example, using the 'cereeberus.cover' function in this module, which takes in a minimum, maximum, number of covers, and percentage of overlap to create a cover.
129+
130130
The clustering algorithm should be given as a callable that takes in a point cloud and outputs cluster labels (for example, `sklearn.cluster.DBSCAN(min_samples=2,eps=0.3).fit`).
131131
132132
Parameters:
@@ -138,12 +138,12 @@ def computeMapper(pointcloud, lensfunction, cover, clusteralgorithm):
138138
Returns:
139139
A `MapperGraph` object representing the mapper graph of the input data and lens function.
140140
"""
141-
142-
lensfunctionoutput = __runlensfunction(lensfunction, pointcloud)
141+
142+
lensfunctionoutput = __runlensfunction(lensfunction, pointcloud)
143143
coveringsets = __createcoveringsets(lensfunctionoutput, cover)
144144
clusterpoints = __cluster(coveringsets, clusteralgorithm)
145145
outputgraph = __addedges(clusterpoints)
146-
146+
147147
return outputgraph
148148

149149

cereeberus/cereeberus/compute/computereeb.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ def computeReeb(K: LowerStar, verbose=False):
7979
# A horizontal edge (both endpoints at the same height) must be processed
8080
# within one batch so it properly merges its endpoints into a single Reeb node.
8181
grouped = [
82-
(filt, list(grp))
83-
for filt, grp in _groupby(funcVals, key=lambda x: x[1])
82+
(filt, list(grp)) for filt, grp in _groupby(funcVals, key=lambda x: x[1])
8483
]
8584

8685
R = ReebGraph()
@@ -101,9 +100,7 @@ def _dedup(lst):
101100

102101
for group_idx, (filt, group_verts) in enumerate(grouped):
103102
now_min = filt
104-
now_max = (
105-
grouped[group_idx + 1][0] if group_idx + 1 < len(grouped) else np.inf
106-
)
103+
now_max = grouped[group_idx + 1][0] if group_idx + 1 < len(grouped) else np.inf
107104
vert_names = [v for v, _ in group_verts]
108105

109106
if verbose:
@@ -183,9 +180,7 @@ def _dedup(lst):
183180
for e in edges_at_prev_level:
184181
prev_comp = vert_to_component[e]
185182
if any(
186-
is_face(prev_simp, simp)
187-
for simp in comp
188-
for prev_simp in prev_comp
183+
is_face(prev_simp, simp) for simp in comp for prev_simp in prev_comp
189184
):
190185
R.add_edge(e, nextNodeName)
191186

@@ -227,11 +222,8 @@ def _dedup(lst):
227222
for v in verts_at_level:
228223
prev_comp = vert_to_component[v]
229224
if any(
230-
is_face(simp, prev_simp)
231-
for simp in comp
232-
for prev_simp in prev_comp
225+
is_face(simp, prev_simp) for simp in comp for prev_simp in prev_comp
233226
):
234227
R.add_edge(v, e_name)
235228

236229
return R
237-

0 commit comments

Comments
 (0)