def stupidFast_RaDec2AltAz(ra, dec, lat, lon, mjd, lmst=None):
"""
Convert Ra,Dec to Altitude and Azimuth.
Coordinate transformation is killing performance. Just use simple equations to speed it up
and ignore abberation, precesion, nutation, nutrition, etc.
Parameters
----------
ra : array_like
RA, in radians.
dec : array_like
Dec, in radians. Must be same length as `ra`.
lat : float
Latitude of the observatory in radians.
lon : float
Longitude of the observatory in radians.
mjd : float
Modified Julian Date.
Returns
-------
alt : numpy.array
Altitude, same length as `ra` and `dec`. Radians.
az : numpy.array
Azimuth, same length as `ra` and `dec`. Radians.
"""
if lmst is None:
lmst, last = calcLmstLast(mjd, lon)
lmst = lmst/12.*np.pi # convert to rad
ha = lmst-ra
sindec = np.sin(dec)
sinlat = np.sin(lat)
coslat = np.cos(lat)
sinalt = sindec*sinlat+np.cos(dec)*coslat*np.cos(ha)
sinalt = inrange(sinalt)
alt = np.arcsin(sinalt)
cosaz = (sindec-np.sin(alt)*sinlat)/(np.cos(alt)*coslat)
cosaz = inrange(cosaz)
az = np.arccos(cosaz)
signflip = np.where(np.sin(ha) > 0)
az[signflip] = 2.*np.pi-az[signflip]
return alt, az
评论列表
文章目录