summaryrefslogtreecommitdiff
path: root/src/python/gudhi/reader_utils.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/gudhi/reader_utils.pyx')
-rw-r--r--src/python/gudhi/reader_utils.pyx33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/python/gudhi/reader_utils.pyx b/src/python/gudhi/reader_utils.pyx
index 147fae71..d6033b86 100644
--- a/src/python/gudhi/reader_utils.pyx
+++ b/src/python/gudhi/reader_utils.pyx
@@ -1,3 +1,12 @@
+# 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.
+# Author(s): Vincent Rouvreau
+#
+# Copyright (C) 2017 Inria
+#
+# Modification(s):
+# - YYYY/MM Author: Description of the modification
+
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.string cimport string
@@ -7,16 +16,6 @@ from libcpp.pair cimport pair
from os import path
from numpy import array as np_array
-""" 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.
- Author(s): Vincent Rouvreau
-
- Copyright (C) 2017 Inria
-
- Modification(s):
- - YYYY/MM Author: Description of the modification
-"""
-
__author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2017 Inria"
__license__ = "MIT"
@@ -37,9 +36,9 @@ def read_lower_triangular_matrix_from_csv_file(csv_file='', separator=';'):
:returns: The lower triangular matrix.
:rtype: vector[vector[double]]
"""
- if csv_file is not '':
+ if csv_file:
if path.isfile(csv_file):
- return read_matrix_from_csv_file(str.encode(csv_file), ord(separator[0]))
+ return read_matrix_from_csv_file(csv_file.encode('utf-8'), ord(separator[0]))
print("file " + csv_file + " not set or not found.")
return []
@@ -56,9 +55,9 @@ def read_persistence_intervals_grouped_by_dimension(persistence_file=''):
:returns: The persistence pairs grouped by dimension.
:rtype: map[int, vector[pair[double, double]]]
"""
- if persistence_file is not '':
+ if persistence_file:
if path.isfile(persistence_file):
- return read_pers_intervals_grouped_by_dimension(str.encode(persistence_file))
+ return read_pers_intervals_grouped_by_dimension(persistence_file.encode('utf-8'))
print("file " + persistence_file + " not set or not found.")
return []
@@ -79,9 +78,9 @@ def read_persistence_intervals_in_dimension(persistence_file='', only_this_dim=-
:returns: The persistence intervals.
:rtype: numpy array of dimension 2
"""
- if persistence_file is not '':
+ if persistence_file:
if path.isfile(persistence_file):
- return np_array(read_pers_intervals_in_dimension(str.encode(
- persistence_file), only_this_dim))
+ return np_array(read_pers_intervals_in_dimension(persistence_file.encode(
+ 'utf-8'), only_this_dim))
print("file " + persistence_file + " not set or not found.")
return []