source: fact/tools/pyscripts/simulation/simulation_helpers.py@ 14807

Last change on this file since 14807 was 14805, checked in by neise, 12 years ago
initial commit
  • Property svn:executable set to *
File size: 298 bytes
Line 
1import numpy as np
2
3def length( v ):
4 return np.sqrt(np.dot(v,v))
5
6def uv_to_dir( u,v):
7 dir = np.array([u, v, np.sqrt(1-u**2-v**2) ])
8 return dir
9
10def uv_to_theta_phi( u,v ):
11 x,y,z = uv_to_dir(u,v).tolist()
12 theta = np.arccos(z)
13 phi = np.arctan2(y,x)
14 return theta, phi
Note: See TracBrowser for help on using the repository browser.