diff options
author | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
commit | 8c751c3929b1727c1e2e2781259ddaa39cfd8df3 (patch) | |
tree | 0e680ea9182032cc82a732230217980ada093ee9 /src/python/gudhi/subsampling.pyx | |
parent | a11db9cb0c8b35fa393c95d698754bb0c652b1d6 (diff) | |
parent | 9acc59fcc1d5001a212e7b9cd6f00a569a625882 (diff) |
Merge branch 'dfsg/latest' into debian/sid
Diffstat (limited to 'src/python/gudhi/subsampling.pyx')
-rw-r--r-- | src/python/gudhi/subsampling.pyx | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/python/gudhi/subsampling.pyx b/src/python/gudhi/subsampling.pyx index 1135c1fb..c501d16b 100644 --- a/src/python/gudhi/subsampling.pyx +++ b/src/python/gudhi/subsampling.pyx @@ -1,19 +1,18 @@ +# 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) 2016 Inria +# +# Modification(s): +# - YYYY/MM Author: Description of the modification + from cython cimport numeric from libcpp.vector cimport vector from libcpp.string cimport string from libcpp cimport bool import os -""" 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) 2016 Inria - - Modification(s): - - YYYY/MM Author: Description of the modification -""" - __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 Inria" __license__ = "GPL v3" @@ -44,19 +43,19 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi :param nb_points: Number of points of the subsample. :type nb_points: unsigned. :param starting_point: The iteration starts with the landmark `starting \ - point`,which is the index of the poit to start with. If not set, this \ - index is choosen randomly. + point`,which is the index of the point to start with. If not set, this \ + index is chosen randomly. :type starting_point: unsigned. :returns: The subsample point set. :rtype: vector[vector[double]] """ - if off_file is not '': + if off_file: if os.path.isfile(off_file): - if starting_point is '': - return subsampling_n_farthest_points_from_file(str.encode(off_file), + if starting_point == '': + return subsampling_n_farthest_points_from_file(off_file.encode('utf-8'), nb_points) else: - return subsampling_n_farthest_points_from_file(str.encode(off_file), + return subsampling_n_farthest_points_from_file(off_file.encode('utf-8'), nb_points, starting_point) else: @@ -65,7 +64,7 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi if points is None: # Empty points points=[] - if starting_point is '': + if starting_point == '': return subsampling_n_farthest_points(points, nb_points) else: return subsampling_n_farthest_points(points, nb_points, @@ -87,9 +86,9 @@ def pick_n_random_points(points=None, off_file='', nb_points=0): :returns: The subsample point set. :rtype: vector[vector[double]] """ - if off_file is not '': + if off_file: if os.path.isfile(off_file): - return subsampling_n_random_points_from_file(str.encode(off_file), + return subsampling_n_random_points_from_file(off_file.encode('utf-8'), nb_points) else: print("file " + off_file + " not found.") @@ -117,9 +116,9 @@ def sparsify_point_set(points=None, off_file='', min_squared_dist=0.0): :returns: The subsample point set. :rtype: vector[vector[double]] """ - if off_file is not '': + if off_file: if os.path.isfile(off_file): - return subsampling_sparsify_points_from_file(str.encode(off_file), + return subsampling_sparsify_points_from_file(off_file.encode('utf-8'), min_squared_dist) else: print("file " + off_file + " not found.") |