Esempio n. 1
0
 def midnight(self, utc, jd=False):
     try:
         if jd:
             return self._obs_.midnight(tm(utc)).jd
         else:
             return self._obs_.midnight(tm(utc)).datetime
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 2
0
File: ast.py Progetto: mshemuni/RSQM
 def now(self, utc=True):
     try:
         if utc:
             return tm(datetime.utcnow(), scale='utc')
         else:
             return tm(datetime.now())
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 3
0
 def midnight(self, utc, jd=False):
     self.logger.info(f"Returning midnight time")
     try:
         if jd:
             return self._obs_.midnight(tm(utc)).jd
         else:
             return self._obs_.midnight(tm(utc)).datetime
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 4
0
 def now(self, utc=True):
     self.logger.info(f"Getting now")
     try:
         if utc:
             return tm(datetime.utcnow(), scale='utc')
         else:
             return tm(datetime.now())
     except Exception as e:
         self.logger.error(e)
Esempio n. 5
0
 def jd_r(self, jd):
     """JD to Time calculator"""
     try:
         t = tm(jd, format='jd', scale='tai')
         return t.to_datetime()
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 6
0
        def jd2hjd(self, jd, ra, dec):
            obj = SkyCoord(ra, dec, unit=(U.hourangle, U.deg), frame='icrs')
            greenwich = EarthLocation.of_site('greenwich')
            jd = tm(jd, format="jd", location=greenwich)
            ltt_helio = jd.light_travel_time(obj, 'heliocentric')

            return jd + ltt_helio
Esempio n. 7
0
 def jd_r(self, jd):
     """Returns UTC from JD"""
     try:
         t = tm(jd, format='jd', scale='tai')
         return t.to_datetime()
     except Exception as e:
         self.logger.error(e)
Esempio n. 8
0
 def jd(self, utc):
     """JD calculator"""
     try:
         t = tm(utc, scale='utc')
         return t.jd
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 9
0
 def altaz(self, site, obj, utc):
     """Return AltAz for a given object and time for this site"""
     try:
         frame_of_site = AltAz(obstime=tm(utc), location=site)
         object_alt_az = obj.transform_to(frame_of_site)
         return object_alt_az
     except Exception as e:
         self.logger.error(e)
Esempio n. 10
0
 def jd_r(self, jd):
     """JD to Time calculator"""
     self.logger.info(f"Calculating date from {jd}")
     try:
         t = tm(jd, format='jd', scale='tai')
         return t.to_datetime()
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 11
0
        def jd2bjd(self, jd, ra, dec):
            obj = SkyCoord(ra, dec, unit=(U.hourangle, U.deg), frame='icrs')
            greenwich = EarthLocation.of_site('greenwich')
            self.logger.warning("JD: {}".format(jd))
            jd = tm(jd, format="jd", location=greenwich)
            ltt_bary = jd.light_travel_time(obj)

            return jd + ltt_bary
Esempio n. 12
0
 def jd(self, utc):
     """JD calculator"""
     self.logger.info(f"Calculating jd from {utc}")
     try:
         t = tm(utc, scale='utc')
         return t.jd
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 13
0
    def twilight_evening(self, utc, tp="ASTRONOMICAL", which="next", jd=False):
        try:
            which = self.__which_corrector__(which)
            if "CIVIL".startswith(tp.upper()):
                ret = self._obs_.twilight_evening_civil(tm(utc), which=which)
            elif "NAUTICAL".startswith(tp.upper()):
                ret = self._obs_.twilight_evening_nautical(tm(utc),
                                                           which=which)
            else:
                ret = self._obs_.twilight_evening_astronomical(tm(utc),
                                                               which=which)

            if jd:
                return ret.jd
            else:
                return ret.datetime
        except Exception as excpt:
            self.logger.log(excpt)
Esempio n. 14
0
 def jd(self, utc):
     """Calculates JD from UTC"""
     if utc is not None:
         try:
             ret = tm(utc, scale='utc')
             return ret.jd
         except Exception as e:
             self.logger.error(e)
     else:
         self.logger.warning("False Type: The value is not date")
Esempio n. 15
0
 def moon_set_time(self, utc, which="next", jd=False):
     try:
         which = self.__which_corrector__(which)
         moon_set = self._obs_.moon_set_time(tm(utc), which=which)
         if jd:
             return moon_set.jd
         else:
             return moon_set.datetime
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 16
0
 def sun_rise_time(self, utc, which="next", jd=False):
     try:
         which = self.__which_corrector__(which)
         sun_rise = self._obs_.sun_rise_time(tm(utc), which=which)
         if jd:
             return sun_rise.jd
         else:
             return sun_rise.datetime
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 17
0
 def sun_rise_time(self, utc, which="next", jd=False):
     self.logger.info(f"Calculating Sun Rise")
     try:
         which = self.__which_corrector__(which)
         sun_rise = self._obs_.sun_rise_time(tm(utc), which=which)
         if jd:
             return sun_rise.jd
         else:
             return sun_rise.datetime
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 18
0
 def moon_set_time(self, utc, which="next", jd=False):
     self.logger.info(f"Calculating Moon Set")
     try:
         which = self.__which_corrector__(which)
         moon_set = self._obs_.moon_set_time(tm(utc), which=which)
         if jd:
             return moon_set.jd
         else:
             return moon_set.datetime
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 19
0
File: ast.py Progetto: mshemuni/RSQM
 def create(self):
     try:
         return get_moon(tm(self._time_, scale='utc'))
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 20
0
 def create(self):
     self.logger.info(f"Creating Moon Object")
     try:
         return get_moon(tm(self._time_, scale='utc'))
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 21
0
 def update(self, time):
     self.logger.info(f"Updating Moon Object")
     try:
         return get_moon(tm(time, scale='utc'))
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 22
0
 def is_night(self, utc):
     self.logger.info(f"Checking if is night {utc}")
     try:
         return self._obs_.is_night(tm(utc))
     except Exception as excpt:
         self.logger.error(excpt)
Esempio n. 23
0
 def is_night(self, utc):
     try:
         return self._obs_.is_night(tm(utc))
     except Exception as excpt:
         self.logger.log(excpt)
Esempio n. 24
0
File: ast.py Progetto: mshemuni/RSQM
 def update(self, time):
     try:
         return get_moon(tm(time, scale='utc'))
     except Exception as excpt:
         self.logger.log(excpt)