summaryrefslogtreecommitdiff
path: root/src/cython
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-08-23 07:39:42 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-08-23 07:39:42 +0000
commit1cb7aca35e97b3fe648060975ff8e11e8e3982da (patch)
tree82425d06b237e41dec4a5ef2662d8d1e65a5c73a /src/cython
parent11fde86ff4cc696c44567b6692aed4adb9c0e4d4 (diff)
Modification that should finalize persistence representation diagrams sython interface.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration@2621 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a4efe5b06b30c7765e16ba13f98aca39925fafe7
Diffstat (limited to 'src/cython')
-rw-r--r--src/cython/cython/persistence_representations_intervals.pyx2
-rwxr-xr-xsrc/cython/example/persistence_representations_diagrams_example.py2
-rwxr-xr-xsrc/cython/test/test_persistence_representations_intervals.py (renamed from src/cython/test/test_persistence_representations_diagrams.py)16
3 files changed, 10 insertions, 10 deletions
diff --git a/src/cython/cython/persistence_representations_intervals.pyx b/src/cython/cython/persistence_representations_intervals.pyx
index 887010e5..54ffc7e9 100644
--- a/src/cython/cython/persistence_representations_intervals.pyx
+++ b/src/cython/cython/persistence_representations_intervals.pyx
@@ -40,7 +40,7 @@ This is a promisse that there will be a class in this file with the following fu
According to Vincent, most of the tutorials in cython suggest to separate pre-declaration below with the definition of the method. Hovewer it seems to create problems, that is why we keep them both here.
"""
-cdef extern from "persistence_representations_intervals.h" namespace "Gudhi::Persistence_representations":
+cdef extern from "Persistence_intervals_interface.h" namespace "Gudhi::Persistence_representations":
cdef cppclass Persistence_intervals_interface "Gudhi::Persistence_representations::Persistence_intervals_interface":
Persistence_intervals_interface()
Persistence_intervals_interface(const char* , unsigned )
diff --git a/src/cython/example/persistence_representations_diagrams_example.py b/src/cython/example/persistence_representations_diagrams_example.py
index bcf17f5a..04651ba5 100755
--- a/src/cython/example/persistence_representations_diagrams_example.py
+++ b/src/cython/example/persistence_representations_diagrams_example.py
@@ -44,7 +44,7 @@ args = parser.parse_args()
print "Here are the parameters of the program: ",args.file," , " ,args.dimension
-p = gudhi.PersistenceDiagrams(None,args.dimension,args.file);
+p = gudhi.PersistenceIntervals(None,args.dimension,args.file);
min_max_ = p.get_x_range();
print "Birth-death range : ", min_max_
diff --git a/src/cython/test/test_persistence_representations_diagrams.py b/src/cython/test/test_persistence_representations_intervals.py
index 5be95a68..794cf49d 100755
--- a/src/cython/test/test_persistence_representations_diagrams.py
+++ b/src/cython/test/test_persistence_representations_intervals.py
@@ -29,41 +29,41 @@ __license__ = "GPL v3"
epsilon = 0.0000005;
def test_check_min_max_function():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
min_max_ = p.get_x_range()
assert fabs(min_max_[0] - 0.0290362) <= epsilon
assert fabs(min_max_[1] - 0.994537) <= epsilon
def test_check_length_of_dominant_intervals():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
dominant_ten_intervals_length = p.length_of_dominant_intervals(10)
dominant_intervals_length_ = [0.862625,0.800893,0.762061,0.756501,0.729367,0.718177,0.708395,0.702844,0.700468,0.622177]
assert dominant_ten_intervals_length == dominant_intervals_length_
def check_dominant_intervals():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram");
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram");
ten_dominant_intervals = p.dominant_intervals(10);
templ = [ (0.114718, 0.977343) , (0.133638, 0.93453) , (0.104599, 0.866659) , (0.149798, 0.906299), (0.247352, 0.976719) , (0.192675, 0.910852) , (0.191836, 0.900231) , (0.284998, 0.987842) , (0.294069, 0.994537), (0.267421, 0.889597)]
assert fabs(ten_dominant_intervals - templ) <= epsilon
def check_histogram_of_lengths():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
histogram = p.histogram_of_lengths(10);
template_histogram = [10,5,3,4,4,3,6,1,7,1,1]
assert fabs(histogram - template_histogram) <= epsilon
def check_cumulative_histograms_of_lengths():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
cumulative_histogram = p.cumulative_histogram_of_lengths(10)
template_cumulative_histogram = [10,15,18,22,26,29,35,36,43,44,45]
assert fabs(cumulative_histogram - template_cumulative_histogram) <= epsilon
def check_characteristic_function_of_diagram():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
min_max_ = p.get_x_range();
char_funct_diag = p.characteristic_function_of_diagram(min_max_[0], min_max_[1]);
template_char_funct_diag = [0.370665,0.84058,1.24649,1.3664,1.34032,1.31904,1.14076,0.991259,0.800714,0.0676303]
@@ -71,7 +71,7 @@ def check_characteristic_function_of_diagram():
def check_cumulative_characteristic_function_of_diagram():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
min_max_ = p.get_x_range()
cumul_char_funct_diag = p.cumulative_characteristic_function_of_diagram(min_max_.first, min_max_.second,None);
template_char_funct_diag_cumul = [0.370665,1.21125,2.45774,3.82414,5.16446,6.4835,7.62426,8.61552,9.41623,9.48386]
@@ -79,7 +79,7 @@ def check_cumulative_characteristic_function_of_diagram():
def check_compute_persistent_betti_numbers():
- p = gudhi.PersistenceDiagrams(None,None,"data/file_with_diagram")
+ p = gudhi.PersistenceIntervals(None,None,"data/file_with_diagram")
pbns = [(0.0290362, 1),(0.0307676, 2),(0.0366312, 3),(0.0544614, 4),(0.0920033, 5),(0.104599, 6),(0.114718, 7),(0.117379, 8),(0.123493, 9),(0.133638, 10)(0.137798, 9),(0.149798, 10),(0.155421, 11),(0.158443, 12)(0.176956, 13),(0.183234, 12),(0.191069, 13),(0.191333, 14),(0.191836, 15),(0.192675, 16),(0.208564, 17),(0.218425, 18),(0.219902, 17),(0.23233, 16),(0.234558, 17),(0.237166, 16),(0.247352, 17),(0.267421, 18),(0.268093, 19),(0.278734, 18),(0.284722, 19),(0.284998, 20),(0.294069, 21),(0.306293, 22),(0.322361, 21),(0.323152, 22),(0.371021, 23),(0.372395, 24),(0.387744, 25),(0.435537, 26),(0.462911, 25),(0.483569, 26),(0.489209, 25),(0.517115, 24),(0.522197, 23),(0.532665, 22),(0.545262, 23),(0.587227, 22),(0.593036, 23),(0.602647, 24),(0.605044, 25),(0.621962, 24),(0.629449, 23),(0.636719, 22),(0.64957, 21),(0.650781, 22),(0.654951, 23),(0.683489, 24),(0.687172, 23),(0.69703, 22),(0.701174, 21),(0.717623, 22),(0.722023, 21),(0.722298, 20),(0.725347, 19),(0.73071, 18),(0.758355, 17),(0.770913, 18),(0.790833, 17),(0.821211, 16),(0.849305, 17),(0.853669, 16),(0.866659, 15),(0.872896, 16),(0.889597, 15),(0.900231, 14),(0.903847, 13),(0.906299, 12),(0.910852, 11),(0.93453, 10),(0.944757, 9),(0.947812, 8),(0.959154, 7),(0.975654, 6),(0.976719, 5),(0.977343, 4),(0.980129, 3),(0.987842, 2),(0.990127, 1),(0.994537, 0)]
pbns_new = p.compute_persistent_betti_numbers();
assert fabs(pbns - pbns_new) <= epsilon