From fcd16066ed6ce571cbe484e6b423058d39cd1c36 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 9 Mar 2021 11:22:42 +0100 Subject: do not promote max_alpha_square use in examples --- src/python/CMakeLists.txt | 2 +- ...ex_diagram_persistence_from_off_file_example.py | 23 +++++++++++----------- .../example/alpha_complex_from_points_example.py | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/python') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 5c1402a6..e7988bcc 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -428,7 +428,7 @@ if(PYTHONINTERP_FOUND) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/example/alpha_complex_diagram_persistence_from_off_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 0.6) + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off) add_gudhi_py_test(test_alpha_complex) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) diff --git a/src/python/example/alpha_complex_diagram_persistence_from_off_file_example.py b/src/python/example/alpha_complex_diagram_persistence_from_off_file_example.py index 1e0273b3..fe03be31 100755 --- a/src/python/example/alpha_complex_diagram_persistence_from_off_file_example.py +++ b/src/python/example/alpha_complex_diagram_persistence_from_off_file_example.py @@ -25,12 +25,12 @@ parser = argparse.ArgumentParser( description="AlphaComplex creation from " "points read in a OFF file.", epilog="Example: " "example/alpha_complex_diagram_persistence_from_off_file_example.py " - "-f ../data/points/tore3D_300.off -a 0.6" + "-f ../data/points/tore3D_300.off" "- Constructs a alpha complex with the " "points from the given OFF file.", ) parser.add_argument("-f", "--file", type=str, required=True) -parser.add_argument("-a", "--max_alpha_square", type=float, default=0.5) +parser.add_argument("-a", "--max_alpha_square", type=float, required=False) parser.add_argument("-b", "--band", type=float, default=0.0) parser.add_argument( "--no-diagram", @@ -47,21 +47,20 @@ with open(args.file, "r") as f: print("##############################################################") print("AlphaComplex creation from points read in a OFF file") - message = "AlphaComplex with max_edge_length=" + repr(args.max_alpha_square) - print(message) - alpha_complex = gudhi.AlphaComplex(off_file=args.file) - simplex_tree = alpha_complex.create_simplex_tree( - max_alpha_square=args.max_alpha_square - ) + if args.max_alpha_square is not None: + print("with max_edge_length=", args.max_alpha_square) + simplex_tree = alpha_complex.create_simplex_tree( + max_alpha_square=args.max_alpha_square + ) + else: + simplex_tree = alpha_complex.create_simplex_tree() - message = "Number of simplices=" + repr(simplex_tree.num_simplices()) - print(message) + print("Number of simplices=", simplex_tree.num_simplices()) diag = simplex_tree.persistence() - print("betti_numbers()=") - print(simplex_tree.betti_numbers()) + print("betti_numbers()=", simplex_tree.betti_numbers()) if args.no_diagram == False: import matplotlib.pyplot as plot diff --git a/src/python/example/alpha_complex_from_points_example.py b/src/python/example/alpha_complex_from_points_example.py index 465632eb..5d5ca66a 100755 --- a/src/python/example/alpha_complex_from_points_example.py +++ b/src/python/example/alpha_complex_from_points_example.py @@ -19,7 +19,7 @@ __license__ = "MIT" print("#####################################################################") print("AlphaComplex creation from points") alpha_complex = AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]]) -simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=60.0) +simplex_tree = alpha_complex.create_simplex_tree() if simplex_tree.find([0, 1]): print("[0, 1] Found !!") -- cgit v1.2.3