• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision377b57d9391bb098633c0661d001ff71b98f593e (tree)
l'heure2012-10-06 00:24:54
AuteurLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Message de Log

Now the code plots the random unit vectors on a sphere.
I also have to be careful about how to import and call the points3D module
from mlab. The syntax to import and call it has slightly changed wrt to my
older scripts with mayavi2.

Change Summary

Modification

diff -r 9cca36a1485e -r 377b57d9391b Python-codes/random_rotation_test.py
--- a/Python-codes/random_rotation_test.py Thu Oct 04 13:15:34 2012 +0200
+++ b/Python-codes/random_rotation_test.py Fri Oct 05 17:24:54 2012 +0200
@@ -5,6 +5,8 @@
55 import sys
66 import string
77 import scipy.linalg as sl
8+from mayavi import mlab
9+
810
911 def random_rot():
1012 theta=s.arccos(1.-2.*s.random.uniform(0.,1.,1)[0])-s.pi/2.
@@ -57,7 +59,9 @@
5759
5860 #############################################################
5961
60-N_rot=100
62+N_rot=4000
63+
64+visualisation=1
6165
6266 ini_cluster=s.arange(3).reshape((1,3))*1.
6367
@@ -83,6 +87,21 @@
8387
8488 n.savetxt("rotated_vectors.dat", rot_vec)
8589
86-#To do: visualize, as a 3D scatterplot in Mayavi, the points on a sphere.
90+if (visualisation==1):
91+
92+
93+ x=rot_vec[:,0]
94+ y=rot_vec[:,1]
95+ z=rot_vec[:,2]
96+
97+ mlab.clf()
98+ pts=mlab.points3d(x, y, z,color=(0,0,1), scale_factor=.02)
99+ pts2=mlab.points3d(0, 0, 0,color=(1,0,0), scale_factor=2.,\
100+ resolution=40)
101+ mlab.draw()
102+ mlab.show()
103+
104+
105+
87106
88107 print "So far so good"