source:
fact/tools/pyscripts/simulation/simulation_helpers.py
Last change on this file was 14805, checked in by , 12 years ago | |
---|---|
|
|
File size: 298 bytes |
Line | |
---|---|
1 | import numpy as np |
2 | |
3 | def length( v ): |
4 | return np.sqrt(np.dot(v,v)) |
5 | |
6 | def uv_to_dir( u,v): |
7 | dir = np.array([u, v, np.sqrt(1-u**2-v**2) ]) |
8 | return dir |
9 | |
10 | def 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.