def compute_paral_angles(header, latitude, ra_key, dec_key, lst_key, acqtime_key, date_key='DATE-OBS'): """Calculates the parallactic angle for a frame, taking coordinates and local sidereal time from fits-headers (frames taken in an alt-az telescope with the image rotator off). The coordinates in the header are assumed to be J2000 FK5 coordinates. The spherical trigonometry formula for calculating the parallactic angle is taken from Astronomical Algorithms (Meeus, 1998). Parameters ---------- header : dictionary Header of current frame. latitude : float Latitude of the observatory in degrees. The dictionaries in vip_hci/conf/param.py can be used like: latitude=LBT['latitude']. ra_key, dec_key, lst_key, acqtime_key, date_key : strings Keywords where the values are stored in the header. Returns ------- pa.value : float Parallactic angle in degrees for current header (frame). """ obs_epoch = Time(header[date_key], format='iso', scale='utc') # equatorial coordinates in J2000 ra = header[ra_key] dec = header[dec_key] coor = SkyCoord(ra=ra, dec=dec, unit=(hourangle,degree), frame=FK5, equinox='J2000.0') # recalculate for DATE-OBS (precession) coor_curr = coor.transform_to(FK5(equinox=obs_epoch)) # new ra and dec in radians ra_curr = coor_curr.ra dec_curr = coor_curr.dec lst_split = header[lst_key].split(':') lst = float(lst_split[0])+float(lst_split[1])/60+float(lst_split[2])/3600 exp_delay = (header[acqtime_key] * 0.5) / 3600 # solar to sidereal time exp_delay = exp_delay*1.0027 # hour angle in degrees hour_angle = (lst + exp_delay) * 15 - ra_curr.deg hour_angle = np.deg2rad(hour_angle) latitude = np.deg2rad(latitude) # PA formula from Astronomical Algorithms pa = -np.rad2deg(np.arctan2(-np.sin(hour_angle), np.cos(dec_curr) * \ np.tan(latitude) - np.sin(dec_curr) * np.cos(hour_angle))) #if dec_curr.value > latitude: pa = (pa.value + 360) % 360 return pa.value
def compute_paral_angles(header, latitude, ra_key, dec_key, lst_key, acqtime_key, date_key='DATE-OBS'): """Calculates the parallactic angle for a frame, taking coordinates and local sidereal time from fits-headers (frames taken in an alt-az telescope with the image rotator off). The coordinates in the header are assumed to be J2000 FK5 coordinates. The spherical trigonometry formula for calculating the parallactic angle is taken from Astronomical Algorithms (Meeus, 1998). Parameters ---------- header : dictionary Header of current frame. latitude : float Latitude of the observatory in degrees. The dictionaries in vip/conf/param.py can be used like: latitude=LBT['latitude']. ra_key, dec_key, lst_key, acqtime_key, date_key : strings Keywords where the values are stored in the header. Returns ------- pa.value : float Parallactic angle in degrees for current header (frame). """ obs_epoch = Time(header[date_key], format='iso', scale='utc') # equatorial coordinates in J2000 ra = header[ra_key] dec = header[dec_key] coor = SkyCoord(ra=ra, dec=dec, unit=(hourangle,degree), frame=FK5, equinox='J2000.0') # recalculate for DATE-OBS (precession) coor_curr = coor.transform_to(FK5(equinox=obs_epoch)) # new ra and dec in radians ra_curr = coor_curr.ra dec_curr = coor_curr.dec lst_split = header[lst_key].split(':') lst = float(lst_split[0])+float(lst_split[1])/60+float(lst_split[2])/3600 exp_delay = (header[acqtime_key] * 0.5) / 3600 # solar to sidereal time exp_delay = exp_delay*1.0027 # hour angle in degrees hour_angle = (lst + exp_delay) * 15 - ra_curr.deg hour_angle = np.deg2rad(hour_angle) latitude = np.deg2rad(latitude) # PA formula from Astronomical Algorithms pa = -np.rad2deg(np.arctan2(-np.sin(hour_angle), np.cos(dec_curr) * \ np.tan(latitude) - np.sin(dec_curr) * np.cos(hour_angle))) #if dec_curr.value > latitude: pa = (pa.value + 360) % 360 return pa.value
def skycoord_to_lmn(pos: SkyCoord, phasecentre: SkyCoord): """ Convert astropy sky coordinates into the l,m,n coordinate system relative to a phase centre. The l,m,n is a RHS coordinate system with * its origin on the sky sphere * m,n and the celestial north on the same plane * l,m a tangential plane of the sky sphere Note that this means that l increases east-wards """ # Determine relative sky position todc = pos.transform_to(phasecentre.skyoffset_frame()) dc = todc.represent_as(CartesianRepresentation) # Do coordinate transformation - astropy's relative coordinates do # not quite follow imaging conventions return dc.y.value, dc.z.value, dc.x.value - 1