Coverage for bilby/core/utils/conversion.py: 67%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-06 04:57 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-06 04:57 +0000
1import numpy as np
4def ra_dec_to_theta_phi(ra, dec, gmst):
5 """ Convert from RA and DEC to polar coordinates on celestial sphere
7 Parameters
8 ==========
9 ra: float
10 right ascension in radians
11 dec: float
12 declination in radians
13 gmst: float
14 Greenwich mean sidereal time of arrival of the signal in radians
16 Returns
17 =======
18 float: zenith angle in radians
19 float: azimuthal angle in radians
21 """
22 phi = ra - gmst
23 theta = np.pi / 2 - dec
24 return theta, phi
27def theta_phi_to_ra_dec(theta, phi, gmst):
28 ra = phi + gmst
29 dec = np.pi / 2 - theta
30 return ra, dec