NASA香料tipbod spiceypy

时间:2018-03-18 20:46:48

标签: python astropy

尝试使用NASA示例获取行星,RA,DEC,PM的身体固定条件。 ftp://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/tipbod.html

TIPBOD用于将J2000惯性坐标中的位置变换为固定坐标中的状态。     TIPM = TIPBOD(' J2000',BODY,ET)

然后将位置(STATE的前三个元素)转换为bodyfixed坐标。什么是STATE?     BDPOS = MXVG(TIPM,POSTN)

我的代码:

Targ = 399 (Earth)
et = spice.str2et(indate)
TIPM = spice.tipbod( "J2000", Targ, et )  
BDPOS = spice.mxvg(TIPM, POSTN, BDPOS )

但什么是POSTN以及什么是BDPOS?

2 个答案:

答案 0 :(得分:1)

通过搜索相关函数here,您可以获得有关spiceypy函数输入的更多详细信息。

在您的特定情况下, override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "loginSuccessSugue"{ let spinner = self.showLoader(view: self.view) self.makeApiCall() } } 将是一个3x3 2D矩阵,它提供惯性框架中的对象与车身固定框架之间的转换。 TIPM函数所需的输入为here。在你的情况下,mxvg应该是一个包含3个值的列表(或numpy数组),给出你感兴趣的主体的x,y和z位置。POSTN将是{{BODPOS的输出。 1}},它将是矩阵mxvg乘以向量TIPM,因此将是一个包含三个值的向量:正文的变换的x,y和z位置。

我不完全确定你需要什么,但一个例子可能是:

POSTN

有可能完全在astropy中执行此操作,无论是使用预定义的框架还是按照您自己的定义,并使用ICRS对象的from astropy.time import Time from spiceypy import spiceypy as spice # create a time t = Time('2010-03-19 11:09:00', format='iso') # put in spice format - this may require a leap seconds kernel to be # downloaded, e.g. download https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls # and then load it with spice.furnsh('naif0012.tls') et = spice.str2et(t.iso) # get the transformation matrix - this may require a kernel to be # downloaded, e.g. download https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00010.tpc # and then load it with spice.furnsh('pck00010.tpc') target = 399 # Earth TIPM = spice.tipbod( "J2000", target, et ) # get the position that you want to convert from astropy.coordinates import Angle, ICRS ra = Angle('12:32:12.23', unit='hourangle') dec= Angle('-01:23:52.21', unit='deg') # make an ICRS object (you can also input a proper motion as a radial velocity or using 'pm_dec' and 'pm_ra_cosdec' keyword arguments) sc = ICRS(ra=ra, dec=dec) # get position in xyz xyz = sc.cartesian.xyz.value # perform conversion to body centred frame newpos = spice.mxvg(TIPM, xyz, 3, 3) # convert to latitude and longitude scnew = SkyCoord(x=newpos[0], y=newpos[1], z=newpos[2], representation_type='cartesian') # print out new RA and dec print(scnew.spherical.lon, scnew.spherical.lat) 方法。例如,您可以从ICRS转换为GCRS

答案 1 :(得分:0)

谢谢马特,看起来像tipbod和reclat的作品。告诉我,如果我错了,但数字看起来不错。

#Saturn Tilt Negative rotation
    Targ = 699
    TIPM = spice.tipbod( "J2000", Targ, et )   
    #Rotation
    Radius, Long, lat = spice.reclat(TIPM[0])
    fy = r2d * Long
    if fy < 0.0:
        fy = fy + 360.0 #if degrees/radians are negative, add 360
    #print 'X Longitude  = ' +str(fy)

    #Tilt
    Radius, Long, lat = spice.reclat(TIPM[1])
    fy = r2d * Long
    if fy < 0.0:
        fy = fy + 360.0
    #print 'Y Longitude = ' +str(fy)