Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ docs:
rsync -a docs/html/ docs/
rm -rf docs/html

.PHONY: docs-execute
docs-execute:
# Running sphinx-build and forcing nbsphinx to execute all notebooks.
rm -rf docs
mkdir -p docs
sphinx-build -M html doc_source docs -D nbsphinx_execute=always
rsync -a docs/html/ docs/
rm -rf docs/html

install-editable:
@pip install -e .

Expand Down Expand Up @@ -41,6 +50,7 @@ help:
@echo " make format - Format code using black"
@echo " make install-editable - Install the package in editable mode for development"
@echo " make docs - Build the documentation in the docs/ folder"
@echo " make docs-execute - Build docs and execute all notebooks"
@echo " make release - Build the package for release"
@echo " make tests - Run the unit tests"
@echo " make install-requirements- Install all dependencies from requirements.txt"
Expand Down
22 changes: 11 additions & 11 deletions cereeberus/cereeberus/compute/computemapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ def __addedges(clusterpoints):
# Does the Mapper Algorithm in order
def computeMapper(pointcloud, lensfunction, cover, clusteralgorithm):
"""
Computes the mapper graph of an input function.
The point cloud should be given as a list of tuples or as a numpy array.
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.
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.
Computes the mapper graph of an input function.

The point cloud should be given as a list of tuples or as a numpy array.

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.

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.

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`).

Parameters:
Expand All @@ -138,12 +138,12 @@ def computeMapper(pointcloud, lensfunction, cover, clusteralgorithm):
Returns:
A `MapperGraph` object representing the mapper graph of the input data and lens function.
"""
lensfunctionoutput = __runlensfunction(lensfunction, pointcloud)

lensfunctionoutput = __runlensfunction(lensfunction, pointcloud)
coveringsets = __createcoveringsets(lensfunctionoutput, cover)
clusterpoints = __cluster(coveringsets, clusteralgorithm)
outputgraph = __addedges(clusterpoints)

return outputgraph


Expand Down
16 changes: 4 additions & 12 deletions cereeberus/cereeberus/compute/computereeb.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def computeReeb(K: LowerStar, verbose=False):
# A horizontal edge (both endpoints at the same height) must be processed
# within one batch so it properly merges its endpoints into a single Reeb node.
grouped = [
(filt, list(grp))
for filt, grp in _groupby(funcVals, key=lambda x: x[1])
(filt, list(grp)) for filt, grp in _groupby(funcVals, key=lambda x: x[1])
]

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

for group_idx, (filt, group_verts) in enumerate(grouped):
now_min = filt
now_max = (
grouped[group_idx + 1][0] if group_idx + 1 < len(grouped) else np.inf
)
now_max = grouped[group_idx + 1][0] if group_idx + 1 < len(grouped) else np.inf
vert_names = [v for v, _ in group_verts]

if verbose:
Expand Down Expand Up @@ -183,9 +180,7 @@ def _dedup(lst):
for e in edges_at_prev_level:
prev_comp = vert_to_component[e]
if any(
is_face(prev_simp, simp)
for simp in comp
for prev_simp in prev_comp
is_face(prev_simp, simp) for simp in comp for prev_simp in prev_comp
):
R.add_edge(e, nextNodeName)

Expand Down Expand Up @@ -227,11 +222,8 @@ def _dedup(lst):
for v in verts_at_level:
prev_comp = vert_to_component[v]
if any(
is_face(simp, prev_simp)
for simp in comp
for prev_simp in prev_comp
is_face(simp, prev_simp) for simp in comp for prev_simp in prev_comp
):
R.add_edge(v, e_name)

return R

Loading
Loading