summaryrefslogtreecommitdiff
path: root/src/cython/example
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-05-25 09:42:09 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-05-25 09:42:09 +0000
commita232e35a50e02fc479509e8fda45c16da5032740 (patch)
treeab06ab95d32d2a0974003ac885073085fc563e07 /src/cython/example
parentd101d16e7ebc4614389bbbf162133b27207f2cf4 (diff)
PEP8 conformity
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1195 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8d2e24e07694508853feb677e5fd2294a663a2d5
Diffstat (limited to 'src/cython/example')
-rwxr-xr-xsrc/cython/example/Alpha_complex_example.py38
-rwxr-xr-xsrc/cython/example/Mini_simplex_tree_example.py15
-rwxr-xr-xsrc/cython/example/Rips_complex_example.py10
-rwxr-xr-xsrc/cython/example/Simplex_tree_example.py27
4 files changed, 47 insertions, 43 deletions
diff --git a/src/cython/example/Alpha_complex_example.py b/src/cython/example/Alpha_complex_example.py
index cf5eed55..a724b0c4 100755
--- a/src/cython/example/Alpha_complex_example.py
+++ b/src/cython/example/Alpha_complex_example.py
@@ -2,44 +2,44 @@
import gudhi
-print("#######################################################################")
+print("#####################################################################")
print("AlphaComplex creation from points")
-alpha_complex = gudhi.AlphaComplex(points=[[0,0],[1,0],[0,1],[1,1]], max_alpha_square=60.0)
+alpha_complex = gudhi.AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
+ max_alpha_square=60.0)
-if alpha_complex.find([0,1]):
- print("[0,1] Found !!")
+if alpha_complex.find([0, 1]):
+ print("[0, 1] Found !!")
else:
- print("[0,1] Not found...")
+ print("[0, 1] Not found...")
if alpha_complex.find([4]):
- print("[4] Found !!")
+ print("[4] Found !!")
else:
- print("[4] Not found...")
+ print("[4] Not found...")
-if alpha_complex.insert([0,1,2], filtration=4.0):
- print("[0,1,2] Inserted !!")
+if alpha_complex.insert([0, 1, 2], filtration=4.0):
+ print("[0, 1, 2] Inserted !!")
else:
- print("[0,1,2] Not inserted...")
+ print("[0, 1, 2] Not inserted...")
-if alpha_complex.insert([0,1,4], filtration=4.0):
- print("[0,1,4] Inserted !!")
+if alpha_complex.insert([0, 1, 4], filtration=4.0):
+ print("[0, 1, 4] Inserted !!")
else:
- print("[0,1,4] Not inserted...")
+ print("[0, 1, 4] Not inserted...")
if alpha_complex.find([4]):
- print("[4] Found !!")
+ print("[4] Found !!")
else:
- print("[4] Not found...")
+ print("[4] Not found...")
print("dimension=", alpha_complex.dimension())
print("filtered_tree=", alpha_complex.get_filtered_tree())
print("star([0])=", alpha_complex.get_star_tree([0]))
-print("coface([0],1)=", alpha_complex.get_coface_tree([0], 1))
+print("coface([0], 1)=", alpha_complex.get_coface_tree([0], 1))
print("point[0]=", alpha_complex.get_point(0))
print("point[5]=", alpha_complex.get_point(5))
alpha_complex.initialize_filtration()
-print("persistence(2)=", alpha_complex.persistence(2))
-
-print("#######################################################################")
+print("persistence(2)=", alpha_complex.persistence(homology_coeff_field=2,
+ min_persistence=0))
diff --git a/src/cython/example/Mini_simplex_tree_example.py b/src/cython/example/Mini_simplex_tree_example.py
index 87407317..6cd5bf29 100755
--- a/src/cython/example/Mini_simplex_tree_example.py
+++ b/src/cython/example/Mini_simplex_tree_example.py
@@ -2,7 +2,7 @@
import gudhi
-print("#######################################################################")
+print("#####################################################################")
print("MiniSimplexTree creation from insertion")
""" Complex to build.
@@ -10,7 +10,8 @@ print("MiniSimplexTree creation from insertion")
o---o
/X\ /
o---o o
- 2 0 4 """
+ 2 0 4
+"""
triangle012 = [0, 1, 2]
edge03 = [0, 3]
@@ -23,7 +24,7 @@ mini_st.insert(edge13)
mini_st.insert(vertex4)
# FIXME: Remove this line
-mini_st.set_dimension(2);
+mini_st.set_dimension(2)
# initialize_filtration required before plain_homology
mini_st.initialize_filtration()
@@ -32,12 +33,12 @@ print("plain_homology(2)=", mini_st.plain_homology(2))
edge02 = [0, 2]
if mini_st.find(edge02):
- # Only coface is 012
- print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1))
+ # Only coface is 012
+ print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1))
if mini_st.get_coface_tree(triangle012, 1) == []:
- # Precondition: Check the simplex has no coface before removing it.
- mini_st.remove_maximal_simplex(triangle012)
+ # Precondition: Check the simplex has no coface before removing it.
+ mini_st.remove_maximal_simplex(triangle012)
# initialize_filtration required after removing
mini_st.initialize_filtration()
diff --git a/src/cython/example/Rips_complex_example.py b/src/cython/example/Rips_complex_example.py
index 4713b62b..6a39fc77 100755
--- a/src/cython/example/Rips_complex_example.py
+++ b/src/cython/example/Rips_complex_example.py
@@ -2,12 +2,14 @@
import gudhi
-print("#######################################################################")
+print("#####################################################################")
print("RipsComplex creation from points")
-rips = gudhi.RipsComplex(points=[[0,0],[1,0],[0,1],[1,1]],max_dimension=1,max_edge_length=42)
+rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
+ max_dimension=1, max_edge_length=42)
print("filtered_tree=", rips.get_filtered_tree())
print("star([0])=", rips.get_star_tree([0]))
-print("coface([0],1)=", rips.get_coface_tree([0], 1))
+print("coface([0], 1)=", rips.get_coface_tree([0], 1))
-print("persistence(2)=", rips.persistence(2))
+print("persistence(2)=", rips.persistence(homology_coeff_field=2,
+ min_persistence=0))
diff --git a/src/cython/example/Simplex_tree_example.py b/src/cython/example/Simplex_tree_example.py
index fa40fbe6..e8585d83 100755
--- a/src/cython/example/Simplex_tree_example.py
+++ b/src/cython/example/Simplex_tree_example.py
@@ -4,22 +4,22 @@ import gudhi
st = gudhi.SimplexTree()
-print("#######################################################################")
+print("#####################################################################")
print("SimplexTree creation from insertion")
-if st.insert([0,1]):
- print("Inserted !!")
+if st.insert([0, 1]):
+ print("Inserted !!")
else:
- print("Not inserted...")
+ print("Not inserted...")
-if st.find([0,1]):
- print("Found !!")
+if st.find([0, 1]):
+ print("Found !!")
else:
- print("Not found...")
+ print("Not found...")
-if st.insert([0,1,2], filtration=4.0):
- print("Inserted !!")
+if st.insert([0, 1, 2], filtration=4.0):
+ print("Inserted !!")
else:
- print("Not inserted...")
+ print("Not inserted...")
# FIXME: Remove this line
st.set_dimension(3)
@@ -28,8 +28,8 @@ print("dimension=", st.dimension())
st.set_filtration(4.0)
st.initialize_filtration()
print("filtration=", st.get_filtration())
-print("filtration[1,2]=", st.filtration([1,2]))
-print("filtration[4,2]=", st.filtration([4,2]))
+print("filtration[1, 2]=", st.filtration([1, 2]))
+print("filtration[4, 2]=", st.filtration([4, 2]))
print("num_simplices=", st.num_simplices())
print("num_vertices=", st.num_vertices())
@@ -38,4 +38,5 @@ print("skeleton_tree[2]=", st.get_skeleton_tree(2))
print("skeleton_tree[1]=", st.get_skeleton_tree(1))
print("skeleton_tree[0]=", st.get_skeleton_tree(0))
-print("persistence(2)=", st.persistence(2))
+print("persistence(2)=", st.persistence(homology_coeff_field=2,
+ min_persistence=0))