[SciPy-user] displaying spherical harmonics with different resolution...

fred fredmfp at gmail.com
Thu Jan 25 19:17:35 CST 2007


fred a écrit :

> Can someone try my short example, and tell if it looks right or wrong
> please ?
Ok, I rewrote my short example.
Can you tell me please if it looks good ?

Because the result is not "ugly" but not good.

#!/usr/bin/env mayavi2

import scipy
import scipy.special

from enthought.mayavi.tools import mlab

l = 1
m = 1

phi_deg_min, phi_deg_max, dphi_deg = 0, 180, 2
theta_deg_min, theta_deg_max, dtheta_deg = 0, 360, 2
phi_deg, theta_deg =
scipy.mgrid[phi_deg_min:phi_deg_max+dphi_deg:dphi_deg,
theta_deg_min:theta_deg_max+dtheta_deg:dtheta_deg]
phi, theta = phi_deg*scipy.pi/180, theta_deg*scipy.pi/180

a = scipy.special.sph_harm(m,l,theta,phi)
r = scipy.real(a)**2
x = r*scipy.cos(theta)*scipy.sin(phi)
y = r*scipy.sin(theta)*scipy.sin(phi)
z = r*scipy.cos(phi)
mlab.figure()
mlab.surf(x,y,z,r)

http://fredantispam.free.fr/foo.png

Cheers,

-- 
http://scipy.org/FredericPetit


More information about the SciPy-user mailing list