Ejemplo 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)
Ejemplo n.º 2
0
Archivo: ast.py Proyecto: 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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
Ejemplo 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)
Ejemplo 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)
Ejemplo 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")
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 19
0
Archivo: ast.py Proyecto: mshemuni/RSQM
 def create(self):
     try:
         return get_moon(tm(self._time_, scale='utc'))
     except Exception as excpt:
         self.logger.log(excpt)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 23
0
 def is_night(self, utc):
     try:
         return self._obs_.is_night(tm(utc))
     except Exception as excpt:
         self.logger.log(excpt)
Ejemplo n.º 24
0
Archivo: ast.py Proyecto: mshemuni/RSQM
 def update(self, time):
     try:
         return get_moon(tm(time, scale='utc'))
     except Exception as excpt:
         self.logger.log(excpt)