summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-14 14:40:41 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-14 14:40:41 +0100
commit587a845289a4e29014f67d4c3379b2b4d6b1f102 (patch)
tree6a43e1ce25342d9707db2362c9577dd680845b1d
parent88c30209fe58d29d24d5bba3c137cd5e5def29c5 (diff)
print errors to stderr
-rwxr-xr-xsrc/python/example/alpha_complex_diagram_persistence_from_off_file_example.py3
-rwxr-xr-xsrc/python/example/alpha_rips_persistence_bottleneck_distance.py3
-rwxr-xr-xsrc/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py3
-rwxr-xr-xsrc/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py3
-rwxr-xr-xsrc/python/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py3
-rwxr-xr-xsrc/python/example/rips_complex_diagram_persistence_from_off_file_example.py3
-rwxr-xr-xsrc/python/example/tangential_complex_plain_homology_from_off_file_example.py3
-rw-r--r--src/python/gudhi/alpha_complex.pyx2
-rw-r--r--src/python/gudhi/cubical_complex.pyx9
-rw-r--r--src/python/gudhi/nerve_gic.pyx12
-rw-r--r--src/python/gudhi/off_reader.pyx4
-rw-r--r--src/python/gudhi/periodic_cubical_complex.pyx8
-rwxr-xr-xsrc/python/test/test_subsampling.py1
13 files changed, 37 insertions, 20 deletions
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 4079a469..6afaf533 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
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -64,6 +65,6 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/example/alpha_rips_persistence_bottleneck_distance.py b/src/python/example/alpha_rips_persistence_bottleneck_distance.py
index d5c33ec8..7b4aa3e7 100755
--- a/src/python/example/alpha_rips_persistence_bottleneck_distance.py
+++ b/src/python/example/alpha_rips_persistence_bottleneck_distance.py
@@ -3,6 +3,7 @@
import gudhi
import argparse
import math
+import sys
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
@@ -100,6 +101,6 @@ with open(args.file, "r") as f:
print(message)
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
index 4903667e..f61d692b 100755
--- a/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
+++ b/src/python/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -79,6 +80,6 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
index 339a8577..aaa03dad 100755
--- a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
+++ b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -78,6 +79,6 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/src/python/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
index c692e66f..97bfd49f 100755
--- a/src/python/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
+++ b/src/python/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -73,4 +74,4 @@ if is_file_perseus(args.file):
gudhi.plot_persistence_barcode(diag)
plot.show()
else:
- print(args.file, "is not a valid perseus style file")
+ print(args.file, "is not a valid perseus style file", file=sys.stderr)
diff --git a/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py b/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py
index c757aca7..5d8f057b 100755
--- a/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py
+++ b/src/python/example/rips_complex_diagram_persistence_from_off_file_example.py
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -68,6 +69,6 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/example/tangential_complex_plain_homology_from_off_file_example.py b/src/python/example/tangential_complex_plain_homology_from_off_file_example.py
index f0df2189..77ac2ea7 100755
--- a/src/python/example/tangential_complex_plain_homology_from_off_file_example.py
+++ b/src/python/example/tangential_complex_plain_homology_from_off_file_example.py
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plot
+import sys
import gudhi
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -60,6 +61,6 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file")
+ print(args.file, "is not a valid OFF file", file=sys.stderr)
f.close()
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index db11416c..4ff37437 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -7,12 +7,14 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification
+from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
from libc.stdint cimport intptr_t
+import sys
import os
from gudhi.simplex_tree cimport *
diff --git a/src/python/gudhi/cubical_complex.pyx b/src/python/gudhi/cubical_complex.pyx
index 92ff6411..28913a32 100644
--- a/src/python/gudhi/cubical_complex.pyx
+++ b/src/python/gudhi/cubical_complex.pyx
@@ -7,11 +7,13 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification
+from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
+import sys
import os
import numpy as np
@@ -87,10 +89,11 @@ cdef class CubicalComplex:
if os.path.isfile(perseus_file):
self.thisptr = new Bitmap_cubical_complex_base_interface(str.encode(perseus_file))
else:
- print("file " + perseus_file + " not found.")
+ print("file " + perseus_file + " not found.", file=sys.stderr)
else:
print("CubicalComplex can be constructed from dimensions and "
- "top_dimensional_cells or from a Perseus-style file name.")
+ "top_dimensional_cells or from a Perseus-style file name.",
+ file=sys.stderr)
def __dealloc__(self):
if self.thisptr != NULL:
@@ -199,5 +202,5 @@ cdef class CubicalComplex:
intervals_result = self.pcohptr.intervals_in_dimension(dimension)
else:
print("intervals_in_dim function requires persistence function"
- " to be launched first.")
+ " to be launched first.", file=sys.stderr)
return np.array(intervals_result)
diff --git a/src/python/gudhi/nerve_gic.pyx b/src/python/gudhi/nerve_gic.pyx
index 68c06432..5eb9be0d 100644
--- a/src/python/gudhi/nerve_gic.pyx
+++ b/src/python/gudhi/nerve_gic.pyx
@@ -7,11 +7,13 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification
+from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
+import sys
import os
from libc.stdint cimport intptr_t
@@ -182,7 +184,7 @@ cdef class CoverComplex:
if os.path.isfile(off_file):
return self.thisptr.read_point_cloud(str.encode(off_file))
else:
- print("file " + off_file + " not found.")
+ print("file " + off_file + " not found.", file=sys.stderr)
return False
def set_automatic_resolution(self):
@@ -214,7 +216,7 @@ cdef class CoverComplex:
if os.path.isfile(color_file_name):
self.thisptr.set_color_from_file(str.encode(color_file_name))
else:
- print("file " + color_file_name + " not found.")
+ print("file " + color_file_name + " not found.", file=sys.stderr)
def set_color_from_range(self, color):
"""Computes the function used to color the nodes of the simplicial
@@ -235,7 +237,7 @@ cdef class CoverComplex:
if os.path.isfile(cover_file_name):
self.thisptr.set_cover_from_file(str.encode(cover_file_name))
else:
- print("file " + cover_file_name + " not found.")
+ print("file " + cover_file_name + " not found.", file=sys.stderr)
def set_cover_from_function(self):
"""Creates a cover C from the preimages of the function f.
@@ -268,7 +270,7 @@ cdef class CoverComplex:
if os.path.isfile(func_file_name):
self.thisptr.set_function_from_file(str.encode(func_file_name))
else:
- print("file " + func_file_name + " not found.")
+ print("file " + func_file_name + " not found.", file=sys.stderr)
def set_function_from_range(self, function):
"""Creates the function f from a vector stored in memory.
@@ -309,7 +311,7 @@ cdef class CoverComplex:
if os.path.isfile(graph_file_name):
self.thisptr.set_graph_from_file(str.encode(graph_file_name))
else:
- print("file " + graph_file_name + " not found.")
+ print("file " + graph_file_name + " not found.", file=sys.stderr)
def set_graph_from_OFF(self):
"""Creates a graph G from the triangulation given by the input OFF
diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx
index 58f05db8..ef8f420a 100644
--- a/src/python/gudhi/off_reader.pyx
+++ b/src/python/gudhi/off_reader.pyx
@@ -7,9 +7,11 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification
+from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.string cimport string
+import sys
import os
__author__ = "Vincent Rouvreau"
@@ -32,6 +34,6 @@ def read_points_from_off_file(off_file=''):
if os.path.isfile(off_file):
return read_points_from_OFF_file(str.encode(off_file))
else:
- print("file " + off_file + " not found.")
+ print("file " + off_file + " not found.", file=sys.stderr)
return []
diff --git a/src/python/gudhi/periodic_cubical_complex.pyx b/src/python/gudhi/periodic_cubical_complex.pyx
index b5dece10..4ec06524 100644
--- a/src/python/gudhi/periodic_cubical_complex.pyx
+++ b/src/python/gudhi/periodic_cubical_complex.pyx
@@ -7,11 +7,13 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification
+from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
+import sys
import os
import numpy as np
@@ -95,12 +97,12 @@ cdef class PeriodicCubicalComplex:
if os.path.isfile(perseus_file):
self.thisptr = new Periodic_cubical_complex_base_interface(str.encode(perseus_file))
else:
- print("file " + perseus_file + " not found.")
+ print("file " + perseus_file + " not found.", file=sys.stderr)
else:
print("CubicalComplex can be constructed from dimensions, "
"top_dimensional_cells and periodic_dimensions, or from "
"top_dimensional_cells and periodic_dimensions or from "
- "a Perseus-style file name.")
+ "a Perseus-style file name.", file=sys.stderr)
def __dealloc__(self):
if self.thisptr != NULL:
@@ -209,5 +211,5 @@ cdef class PeriodicCubicalComplex:
intervals_result = self.pcohptr.intervals_in_dimension(dimension)
else:
print("intervals_in_dim function requires persistence function"
- " to be launched first.")
+ " to be launched first.", file=sys.stderr)
return np.array(intervals_result)
diff --git a/src/python/test/test_subsampling.py b/src/python/test/test_subsampling.py
index fe0985fa..31f64e32 100755
--- a/src/python/test/test_subsampling.py
+++ b/src/python/test/test_subsampling.py
@@ -120,7 +120,6 @@ def test_simple_pick_n_random_points():
# Go furter than point set on purpose
for iter in range(1, 10):
sub_set = gudhi.pick_n_random_points(points=point_set, nb_points=iter)
- print(5)
for sub in sub_set:
found = False
for point in point_set: