def magnSatRing(JD, lon, lat): """Compute the apparent visual magnitude of Saturn's rings. Args: JD (float): Julian Day (days). lon (float): Geocentric ecliptical longitude of Saturn (rad). lat (float): Geocentric ecliptical latitude of Saturn (rad). Returns: float: magnSatRing: Apparent visual magnitude of the planet. References: - [Explanatory Supplement to the Astronomical Almanac 3rd Ed, Table 10.6, p.413 + errata](https://aa.usno.navy.mil/publications/docs/exp_supp.php) Note: - This is a simplified expression, which uses phi instead of Delta U. The mean absolute deviation from the full expression: is 0.014m, the maximum deviation found: 0.041m in 10^5 trials, over the last 5000 years. """ tJC = dt.jd2tjc(JD) # Time since 2000 in Julian centuries incl = 0.49 # Inclination of Saturn's rotation axis (rad) ascNod = 2.96 + 0.024 * tJC # Ascending node of Saturn's orbit (rad) sinB = np.sin(incl) * np.cos(lat) * np.sin(lon - ascNod) - np.cos( incl) * np.sin(lat) magnSatRing = -2.60 * abs(sinB) + 1.25 * (sinB)**2 return magnSatRing
def precessHip(jd, ra,dec): """Compute precession in equatorial coordinates from the Hipparcos equinox (J2000) to that of the specified JD. Arguments: jd (float): Julian day (days). ra (float): Right ascension (rad). dec (float): Declination (rad). Returns: tuple (float,float): tuple containing (raTarget, decTarget): - raNew (float): Right ascension for the target equinox (rad). - decNew (float): Declination for the target equinox (rad). """ tJC = dt.jd2tjc(jd) # Time in Julian centuries since J2000.0 tJC2 = tJC**2 tJC3 = tJC*tJC2 zeta = (2306.2181*tJC + 0.30188*tJC2 + 0.017998*tJC3)*as2r z = (2306.2181*tJC + 1.09468*tJC2 + 0.018203*tJC3)*as2r theta = (2004.3109*tJC - 0.42665*tJC2 - 0.041833*tJC3)*as2r raNew = (np.arctan2( np.sin(ra + zeta) * np.cos(dec), np.cos(ra + zeta) * m.cos(theta) * np.cos(dec) - m.sin(theta) * np.sin(dec) ) + z) % pi2 decNew = np.arcsin( np.cos(ra + zeta) * m.sin(theta) * np.cos(dec) + m.cos(theta) * np.sin(dec) ) return raNew,decNew
def properMotion(startJD,targetJD, ra,dec, pma,pmd): """Compute the proper motion from startJD to targetJD for the given positions and proper motions. Arguments: startJD (float): Julian day of the initial epoch (days). targetJD (float): Julian day of the target epoch (days). ra (float): Right ascension (numpy array, rad). dec (float): Declination (numpy array, rad). pma (float): Proper motion in right ascension (numpy array, rad/yr). pmd (float): Proper motion in declination (numpy array, rad/yr). Returns: tuple (float,float): tuple containing (raTarget, decTarget): - raTarget (float): Right ascension for the target epoch (rad). - decTarget (float): Declination for the target epoch (rad). """ dtYr = (targetJD - startJD)/365.25 raTarget = ra + pma*dtYr / np.cos(dec) decTarget = dec + pmd*dtYr return raTarget,decTarget
def par2horiz(ha,dec, phi): """Convert parallactic coordinates to horizontal. Arguments: ha (float): Hour angle (rad). dec (float): Declination (rad). phi (float): Geographical latitude (rad, N>0). Returns: tuple (float,float): tuple containing (az, alt): - az (float): Azimuth (rad, S=0). - alt (float): Altitude (rad). """ az = np.arctan2( np.sin(ha), np.cos(ha) * m.sin(phi) - np.tan(dec) * m.cos(phi) ) % pi2 alt = np.arcsin( np.sin(dec) * m.sin(phi) + np.cos(ha) * np.cos(dec) * m.cos(phi) ) return az,alt
def eq2ecl(ra,dec, eps): """ Convert equatorial coordinates to ecliptical. Arguments: ra (float): Right ascension (rad). dec (float): Declination (rad). eps (float): Obliquity of the ecliptic (rad). Returns: tuple (float,float): tuple containing (lon, lat): - lon (float): Ecliptical longitude (rad). - lat (float): Ecliptical latitude (rad). """ lon = np.arctan2( np.sin(ra) * m.cos(eps) + np.tan(dec) * m.sin(eps), np.cos(ra) ) % pi2 lat = np.arcsin( np.sin(dec) * m.cos(eps) - np.cos(dec) * m.sin(eps) * np.sin(ra) ) return lon,lat
def ecl2eq(lon,lat, eps): """Convert (geocentric) spherical ecliptical coordinates to spherical equatorial coordinates. Arguments: lon (float): Ecliptical longitude (rad). lat (float): Ecliptical latitude (rad). eps (float): Obliquity of the ecliptic (rad). Returns: tuple (float,float): tuple containing (ra, dec): - ra (float): Right ascension (rad). - dec (float): Declination (rad). References: - [Explanatory Supplement to the Astronomical Almanac 3rd Ed, Eq.14.43](https://aa.usno.navy.mil/publications/docs/exp_supp.php) """ ra = np.arctan2( np.sin(lon) * np.cos(eps) - np.tan(lat) * np.sin(eps), np.cos(lon) ) % pi2 dec = np.arcsin( np.sin(lat) * np.cos(eps) + np.cos(lat) * np.sin(eps) * np.sin(lon) ) return ra,dec