• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisão99f0ffe970486f3d562b6e9829410d50017eb73c (tree)
Hora2008-11-05 03:47:58
Autoriselllo
Commiteriselllo

Mensagem de Log

This code plots a spherical harmonic and saves it as a file. NOT still clear how to get the png file without opening the applet. Find out more!

Mudança Sumário

Diff

diff -r 0e19d3affb6a -r 99f0ffe97048 Python-codes/mlab_example.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Python-codes/mlab_example.py Tue Nov 04 18:47:58 2008 +0000
@@ -0,0 +1,21 @@
1+#! /usr/bin/env python
2+
3+
4+from numpy import *
5+from enthought.mayavi import mlab
6+
7+# Create the data.
8+dphi, dtheta = pi/250.0, pi/250.0
9+[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
10+m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
11+r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7
12+x = r*sin(phi)*cos(theta)
13+y = r*cos(phi)
14+z = r*sin(phi)*sin(theta)
15+
16+# View it.
17+s = mlab.mesh(x, y, z)
18+
19+mlab.savefig("figure.png")
20+
21+mlab.show()