How to use the ephem.julian_date function in ephem

To help you get started, we’ve selected a few ephem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github patchvonbraun / simple_ra / simple_ra_utils.py View on Github external
def cur_sidereal(longitude,val):
    global doephem
    if doephem == False:
        return (("12:00:00","9999999999"))
    longstr = "%02d" % int(longitude)
    longstr = longstr + ":"
    longitude = abs(longitude)
    frac = longitude - int(longitude)
    frac *= 60
    mins = int(frac)
    longstr += "%02d" % mins
    longstr += ":00"
    x = ephem.Observer()
    x.date = ephem.now()
    x.long = longstr
    jdate = ephem.julian_date(x)
    tokens=str(x.sidereal_time()).split(":")
    hours=int(tokens[0])
    minutes=int(tokens[1])
    seconds=int(float(tokens[2]))
    sidt = "%02d:%02d:%02d" % (hours, minutes, seconds)
    return ((sidt,jdate))
github HERA-Team / aipy / antennas.py View on Github external
def set_jultime(self, t=None):
        """Set the current time to a Julian date."""
        if t is None: t = ephem.julian_date()
        self.set_ephemtime(juldate2ephem(t))
    def set_ephemtime(self, t=None):
github astroufsc / chimera / src / chimera / util / position.py View on Github external
def epochString(self):
        if self.epoch == Epoch.J2000:
            return "J2000.0"
        elif self.epoch == Epoch.B1950:
            return "B1950.0"
        else:
            return "J%.2f" % (2000.0 + (ephem.julian_date() - 2451545.0) / 365.25)
github GeoscienceAustralia / wagl / ULA3 / calculate_angles.py View on Github external
def calculate_julian_century(datetime):
    """
    
    """

    # Convert the scene timestamp to a julian date
    d = ephem.date(datetime)
    jdate = ephem.julian_date(d)

    # Get the J2000 epoch
    epoch = ephem.date((2000, 01, 01, 12.00))
    j2_epoch = ephem.julian_date(epoch)

    # Note:
    # This differes from online sources such as
    # http://www.pietro.org/astro_util_staticdemo/FDetailDateConversions.htm
    # http://en.wikipedia.org/wiki/Equinox_(celestial_coordinates)
    # which use:
    # 2000 + (jdate - epoch) / 365.25
    century = (jdate - j2_epoch) / 36525

    return century
github astroufsc / chimera / src / chimera / core / site.py View on Github external
def JD(self, t=None):
        if not t:
            t = self.ut()
        return ephem.julian_date(t)
github HERA-Team / aipy / src / phs.py View on Github external
def set_jultime(self, t=None):
        """Set current time as a Julian date."""
        if t is None: t = ephem.julian_date()
        self.set_ephemtime(juldate2ephem(t))
    def set_ephemtime(self, t=None):
github lofar-astron / RMextract / RMextract / PosTools.py View on Github external
reference_time = start_time * 86400.0 - TIME_OFFSET
        st = reference_time - timestep 
        et = end_time * 86400.0 +  timestep + TIME_OFFSET
        #print ("getting string",reference_time)
        str_start_time =  obtain_observation_year_month_day_hms(reference_time)
        timerange= [st, et]
      except:
        print ('no time range given')
        print ('exiting')
        return -1,-1,-1
    elif HAS_EPHEM:
      if time_in_sec:
        dublin_start = start_time / 86400.0 -15019.5
        dublin_end = end_time / 86400.0 -15019.5
        start_time = ephem.julian_date(ephem.Date(dublin_start)) - 2400000.5
        end_time = ephem.julian_date(ephem.Date(dublin_end)) - 2400000.5
      else:
        start_time = ephem.julian_date(ephem.Date(start_time)) - 2400000.5
        end_time = ephem.julian_date(ephem.Date(end_time)) - 2400000.5
      print ('ephem start and end time ', start_time, end_time)
      reference_time = start_time * 86400.0 - TIME_OFFSET
      st = reference_time - timestep 
      et = end_time * 86400.0 + timestep + TIME_OFFSET
      str_start_time =  obtain_observation_year_month_day_hms(reference_time)
      timerange= [st, et]
    else:
      print ('unable to get time range so exiting!')
      return -1,-1,-1
    return timerange,str_start_time,reference_time