def updateaoprms(self, mjd, lapserate=0.0065, xpm=0.0, ypm=0.0): """ Pre-compute the set of apparent to observed place parameters. See http://star-www.rl.ac.uk/docs/sun67.htx/sun67ss8.html Parameters ---------- lapserate : float ta mere xpm : float polar motion coordinate x (radians) ypm : float polar motion coordinate y (radians) """ wavelength = (299792458.0 / 150.0e9) * 1e6 self.aoprms = slalib.sla_aoppa( mjd, self.ut1utc, self.lon, self.lat, self.height, xpm, ypm, self.temp, self.pressure, self.humidity, wavelength, lapserate, )
def hor2cel(coord, time, site, copy=True): coord = np.array(coord, copy=copy) trepr = time[len(time)/2] info = iers.lookup(trepr) ao = slalib.sla_aoppa(trepr, info.dUT, site.lon*utils.degree, site.lat*utils.degree, site.alt, info.pmx*utils.arcsec, info.pmy*utils.arcsec, site.T, site.P, site.hum, 299792.458/site.freq, site.lapse) am = slalib.sla_mappa(2000.0, trepr) # This involves a transpose operation, which is not optimal pyfsla.aomulti(time, coord.T, ao, am) return coord
def calculate_airmass_at_times(times, target, obs_latitude, obs_longitude, obs_height): """ Returns the airmass values at each of the times passed in for the given target Returns the airmass values for a target and observer specified at each time value in the input times list. This uses the speedier slalib aop quick function which caches the object lat/lon/height and refraction parameters. Args: times (list): A list of datetimes during which to calculate the airmass of the target target (dict): A dictionary of target details in the rise-set library format obs_latitude (Angle): The site/observer latitude within a rise-set Angle obs_longitude (Angle): The site/observer longitude within a rise-set Angle obs_height (float): The site/observer altitude in meters Returns: list: A list of airmass values that correspond to the input list of datetimes """ airmasses = [] aop_params = None # Assume standard atmosphere temp_k = 273.15 # local ambient temperature (K; std=273.15) pres_mb = 1013.25 # local atmospheric pressure (mb; std=1013.25D0) rel_humid = 0.3 # local relative humidity (in the range 0D0-1D0) wavelen = 0.55 # effective wavelength (in microns e.g. 0.55D0 (approx V band)) tlr = 0.0065 # tropospheric lapse rate (K per metre, e.g. 0.0065D0) # Assume no polar motion xp = yp = 0.0 # Assume UT1-UTC dut = 0.0 site = { 'longitude': obs_longitude, 'latitude': obs_latitude, 'altitude': obs_height } for time in times: mjd_utc = gregorian_to_ut_mjd(time) if aop_params is None: aop_params = sla.sla_aoppa(mjd_utc, dut, obs_longitude.in_radians(), obs_latitude.in_radians(), obs_height, xp, yp, temp_k, pres_mb, rel_humid, wavelen, tlr) else: aop_params = sla.sla_aoppat(mjd_utc, aop_params) # Convert datetime to MJD_TDB tdb = ut_mjd_to_tdb(mjd_utc) #not TDB but good enough # Convert catalog mean RA, Dec at J2000 to apparent of date if is_moving_object(target): ra_apparent, dec_apparent = elem_to_topocentric_apparent( time, target, site, target_to_jform(target)) else: ra_apparent, dec_apparent = mean_to_apparent(target, tdb) airmass = apparent_to_airmass(ra_apparent, dec_apparent, aop_params) airmasses.append(airmass) return airmasses