aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cone-vector.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/cone-vector.py b/contrib/cone-vector.py
index c099879..8d1877e 100644
--- a/contrib/cone-vector.py
+++ b/contrib/cone-vector.py
@@ -67,9 +67,13 @@ def random_vector_on_spherical_cap(axis, maximum_planar_angle):
x[-1] = cos(planar_angle)
return rotate_from_nth_canonical(x, axis)
-# Sample code exercising the above functions
-dim = 100
-maximum_planar_angle = pi/3
-axis = ones(dim)
-axis = axis/norm(axis)
-print(random_vector_on_spherical_cap(axis, maximum_planar_angle))
+def sample_code():
+ """Run some sample code testing the defined functions."""
+ dim = 100
+ maximum_planar_angle = pi/3
+ axis = ones(dim)
+ axis = axis/norm(axis)
+ print(random_vector_on_spherical_cap(axis, maximum_planar_angle))
+
+if __name__ == '__main__':
+ sample_code()