summaryrefslogtreecommitdiff
path: root/src/cython/example/functional_graph_induced_complex.py
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-06-26 16:59:58 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-06-26 16:59:58 +0200
commitfd47a2d926e78d3b83e79da3c959fb73809d09e4 (patch)
treed440223947ae58fa06d15c575f08023902bad898 /src/cython/example/functional_graph_induced_complex.py
parent2ffd579440e6f0158588f8fa905e2f1dc49a5158 (diff)
Format Python files with black
Diffstat (limited to 'src/cython/example/functional_graph_induced_complex.py')
-rwxr-xr-xsrc/cython/example/functional_graph_induced_complex.py46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/cython/example/functional_graph_induced_complex.py b/src/cython/example/functional_graph_induced_complex.py
index f87c6837..8b645040 100755
--- a/src/cython/example/functional_graph_induced_complex.py
+++ b/src/cython/example/functional_graph_induced_complex.py
@@ -17,25 +17,32 @@ __author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2018 Inria"
__license__ = "MIT"
-parser = argparse.ArgumentParser(description='Functional GIC '
- 'from points read in a OFF file.',
- epilog='Example: '
- 'example/functional_graph_induced_complex.py '
- '-o ../data/points/COIL_database/lucky_cat.off '
- '-f ../data/points/COIL_database/lucky_cat_PCA1'
- '- Constructs the functional GIC with the '
- 'points from the given OFF and function files.')
+parser = argparse.ArgumentParser(
+ description="Functional GIC " "from points read in a OFF file.",
+ epilog="Example: "
+ "example/functional_graph_induced_complex.py "
+ "-o ../data/points/COIL_database/lucky_cat.off "
+ "-f ../data/points/COIL_database/lucky_cat_PCA1"
+ "- Constructs the functional GIC with the "
+ "points from the given OFF and function files.",
+)
parser.add_argument("-o", "--off-file", type=str, required=True)
parser.add_argument("-f", "--function-file", type=str, required=True)
-parser.add_argument("-v", "--verbose", default=False, action='store_true' , help='Flag for program verbosity')
+parser.add_argument(
+ "-v",
+ "--verbose",
+ default=False,
+ action="store_true",
+ help="Flag for program verbosity",
+)
args = parser.parse_args()
nerve_complex = gudhi.CoverComplex()
nerve_complex.set_verbose(args.verbose)
-if (nerve_complex.read_point_cloud(args.off_file)):
- nerve_complex.set_type('GIC')
+if nerve_complex.read_point_cloud(args.off_file):
+ nerve_complex.set_type("GIC")
nerve_complex.set_color_from_file(args.function_file)
nerve_complex.set_function_from_file(args.function_file)
nerve_complex.set_graph_from_automatic_rips()
@@ -46,12 +53,17 @@ if (nerve_complex.read_point_cloud(args.off_file)):
nerve_complex.plot_dot()
simplex_tree = nerve_complex.create_simplex_tree()
nerve_complex.compute_PD()
- if (args.verbose):
- print('Iterator on functional GIC simplices')
- result_str = 'Functional GIC is of dimension ' + \
- repr(simplex_tree.dimension()) + ' - ' + \
- repr(simplex_tree.num_simplices()) + ' simplices - ' + \
- repr(simplex_tree.num_vertices()) + ' vertices.'
+ if args.verbose:
+ print("Iterator on functional GIC simplices")
+ result_str = (
+ "Functional GIC is of dimension "
+ + repr(simplex_tree.dimension())
+ + " - "
+ + repr(simplex_tree.num_simplices())
+ + " simplices - "
+ + repr(simplex_tree.num_vertices())
+ + " vertices."
+ )
print(result_str)
for filtered_value in simplex_tree.get_filtration():
print(filtered_value[0])