summaryrefslogtreecommitdiff
path: root/src/python/example
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2021-05-28 09:40:18 +0200
committerGitHub <noreply@github.com>2021-05-28 09:40:18 +0200
commit07b103c924ff57de1f5aea354186a5392bfc01e2 (patch)
treee91a3744e9e5e8b5dba3266342f18be1c6459dba /src/python/example
parent68d9c83247456d4a53b1fdd719564f0ea91fbc38 (diff)
parentad1145bc4ac224954055f9b9ad955c2a53ceb687 (diff)
Merge pull request #481 from Hind-M/generate_points_sphere_python
Add random points generator on sphere in python, with an example
Diffstat (limited to 'src/python/example')
-rw-r--r--src/python/example/alpha_complex_from_generated_points_on_sphere_example.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py b/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
new file mode 100644
index 00000000..267e6436
--- /dev/null
+++ b/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+from gudhi.datasets.generators import points
+from gudhi import AlphaComplex
+
+
+""" 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): Hind Montassif
+
+ Copyright (C) 2021 Inria
+
+ Modification(s):
+ - YYYY/MM Author: Description of the modification
+"""
+
+__author__ = "Hind Montassif"
+__copyright__ = "Copyright (C) 2021 Inria"
+__license__ = "MIT"
+
+print("#####################################################################")
+print("AlphaComplex creation from generated points on sphere")
+
+
+gen_points = points.sphere(n_samples = 50, ambient_dim = 2, radius = 1, sample = "random")
+
+# Create an alpha complex
+alpha_complex = AlphaComplex(points = gen_points)
+simplex_tree = alpha_complex.create_simplex_tree()
+
+result_str = 'Alpha complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \
+ repr(simplex_tree.num_simplices()) + ' simplices - ' + \
+ repr(simplex_tree.num_vertices()) + ' vertices.'
+print(result_str)
+