コード例 #1
0
 def utc2obt(self, utc_string):
     # Utc to Ephemeris time (seconds past J2000)
     ephemeris_time = spiceypy.utc2et(utc_string)
     # Ephemeris time to Obt
     #return ephemeris_time
     obt_string = spiceypy.sce2s(self.solar_orbiter_naif_id, ephemeris_time)
     time_fields = re.search('\/(.*?):(\d*)', obt_string)
     group = time_fields.groups()
     try:
         return int(group[0]) + int(group[1]) / 65536.
     except Exception as e:
         #logger.warning(str(e))
         return 0
コード例 #2
0
def utc2scs_spice(tais, sc):
    res = {}
    try:
        scid = sp.bods2c(sc)
        for tai in tais:
            et = sp.unitim(tai, 'tai', 'et')
            obt = sp.sce2s(scid, et)
            utc = sp.et2utc(et, 'isoc', 3)

            res[utc] = obt
    except sp.stypes.SpiceyError as ex:
        raise GeometrySpiceError(ex.value)
    else:
        return res
コード例 #3
0
ファイル: manager.py プロジェクト: i4Ds/STIXCore
    def utc_to_scet(self, utc):
        """
        Convert UTC ISO format to SCET time strings.

        Parameters
        ----------
        utc : `str`
            UTC time string in ISO format e.g. '2019-10-24T13:06:46.682758'

        Returns
        -------
        `str`
            SCET time string
        """
        # Utc to Ephemeris time (seconds past J2000)
        ephemeris_time = spiceypy.utc2et(utc)
        # Ephemeris time to Obt
        return spiceypy.sce2s(SOLAR_ORBITER_ID, ephemeris_time)
コード例 #4
0
ファイル: manager.py プロジェクト: i4Ds/STIXCore
    def datetime_to_scet(self, adatetime):
        """
        Convert datetime to SCET.

        Parameters
        ----------
        adatetime : `datetime.datetime` or `astropy.time.Time`
            Time to convert to SCET

        Returns
        -------
        `str`
            SCET of datetime encoded as spacecraft clock string
        """
        if isinstance(adatetime, ApTime):
            adatetime = adatetime.to_datetime()
        et = spiceypy.datetime2et(adatetime)
        scet = spiceypy.sce2s(SOLAR_ORBITER_ID, et)
        return scet
コード例 #5
0
 def utc2scet(self, utc):
     # Utc to Ephemeris time (seconds past J2000)
     ephemeris_time = spiceypy.utc2et(utc)
     # Ephemeris time to Obt
     return spiceypy.sce2s(self.solar_orbiter_naif_id, ephemeris_time)
コード例 #6
0
 def toSCL(self, utc):
     '''Convert UTC to Spacecraft clock time'''
     if not self.loaded:
         self.load()
     return spice.sce2s(self.sc, spice.str2et(utc))
コード例 #7
0
 def utc2scet(self, utc):
     # Utc to Ephemeris time (seconds past J2000)
     ephemeris_time = spiceypy.utc2et(utc)
     # Ephemeris time to Obt
     return spiceypy.sce2s(-144, ephemeris_time)