def moon_dist(star_ra, star_dec, time_stamp): """ @brief: This function calculates projected distance from the Moon to a given object on the sky. @param star_ra: The right ascension of a star given in the format: HH:MM:SS. @param star_dec: The declination of a star given in the format: DD:MM:SS. """ song_site = ephem.Observer() song_site.lat = conf.lat_obs song_site.long = conf.long_obs song_site.elev = conf.elev_obs song_site.date = time_stamp moon = ephem.Moon() moon.compute(song_site) # star = ephem.readdb('star,f|A0,'+str(star_ra)+','+str(star_dec)+',2000') if len(str(star_ra).split(":")) == 1: star_ra = song_convert_coor.COOR_CONVERTER().convert_ra(star_ra) star_dec = song_convert_coor.COOR_CONVERTER().convert_dec(star_dec) star = ephem.FixedBody() star._ra = star_ra star._dec = star_dec star.compute(song_site) m_d = ephem.separation(star, moon) moon_d = float(str(m_d).split(":")[0]) return moon_d
def sun_dist(self, star_ra, star_dec): """ @brief: This function calculates projected distance from the Sun to a given object on the sky. @param star_ra: The right ascension of a star given in the format: HH:MM:SS. @param star_dec: The declination of a star given in the format: DD:MM:SS. """ song_site = ephem.Observer() song_site.lat = self.obs_lat song_site.long = self.obs_lon song_site.elev = self.obs_elev sun = ephem.Sun() sun.compute(song_site) # star = ephem.readdb('star,f|A0,'+str(star_ra)+','+str(star_dec)+',2000') if len(str(star_ra).split(":")) == 1: star_ra = song_convert_coor.COOR_CONVERTER().convert_ra(star_ra) star_dec = song_convert_coor.COOR_CONVERTER().convert_dec(star_dec) star = ephem.FixedBody() star._ra = star_ra star._dec = star_dec star.compute(song_site) sun_d = ephem.separation(star, sun) return sun_d
def star_rise_pre(self, star_ra, star_dec): """ @brief: This function calculates when the object with given coordinates was rising last time. @param star_ra: The right ascension of a star given in the format: HH:MM:SS. @param star_dec: The declination of a star given in the format: DD:MM:SS. """ song_site = ephem.Observer() song_site.lat = self.obs_lat song_site.long = self.obs_lon song_site.elev = self.obs_elev # star = ephem.readdb('star,f|A0,'+str(star_ra)+','+str(star_dec)+',2000') if len(str(star_ra).split(":")) == 1: star_ra = song_convert_coor.COOR_CONVERTER().convert_ra(star_ra) star_dec = song_convert_coor.COOR_CONVERTER().convert_dec(star_dec) star = ephem.FixedBody() star._ra = star_ra star._dec = star_dec star.compute(song_site) rise_star = song_site.previous_rising(star) return rise_star
def star_alt_at(self, star_ra='', star_dec='', time_stamp='', unit='s'): """ @brief: This function will calculate the altitude of an object with given coordinates at a given time seem from Teide. @param star_ra: The right ascension of a star given in the format: HH:MM:SS. @param star_dec: The declination of a star given in the format: DD:MM:SS. @param time_stamp: Time of when the altitude should be calculated in the format: YYYY-MM-DD hh:mm:ss """ song_site = ephem.Observer() song_site.lat = self.obs_lat song_site.long = self.obs_lon song_site.elev = self.obs_elev song_site.date = time_stamp # star = ephem.readdb('star,f|A0,'+str(star_ra)+','+str(star_dec)+',2000') if len(str(star_ra).split(":")) == 1: star_ra = song_convert_coor.COOR_CONVERTER().convert_ra(star_ra) star_dec = song_convert_coor.COOR_CONVERTER().convert_dec(star_dec) star = ephem.FixedBody() star._ra = star_ra star._dec = star_dec star.compute(song_site) alt_star = star.alt if unit == 's': # 's' for string return alt_star else: # return float value return float(str(alt_star).split(":")[0]) + float( str(alt_star).split(":")[1]) / 60. + float( str(alt_star).split(":")[2]) / 3600.
def star_az(self, star_ra, star_dec): """ @brief: This function will determine the azimuth of an object with given coordinates at a given time. @param star_ra: The right ascension of a star given in the format: HH:MM:SS. @param star_dec: The declination of a star given in the format: DD:MM:SS. """ song_site = ephem.Observer() song_site.lat = self.obs_lat song_site.long = self.obs_lon song_site.elev = self.obs_elev # star = ephem.readdb('star,f|A0,'+str(star_ra)+','+str(star_dec)+',2000') if len(str(star_ra).split(":")) == 1: star_ra = song_convert_coor.COOR_CONVERTER().convert_ra(star_ra) star_dec = song_convert_coor.COOR_CONVERTER().convert_dec(star_dec) star = ephem.FixedBody() star._ra = star_ra star._dec = star_dec star.compute(song_site) az_star = star.az return az_star