示例#1
0
def test_example_loading():
    currentdir = os.getcwd()
    os.chdir(kernelpath)
    spice.furnsh("ck/moc42_2010100_2010100_v01.bc")
    spice.furnsh("fk/lro_frames_2012255_v02.tf")
    spice.furnsh("fk/lro_dlre_frames_2010132_v04.tf")
    spice.furnsh("ick/lrodv_2010090_2010121_v01.bc")
    spice.furnsh("lsk/naif0010.tls")
    spice.furnsh('sclk/lro_clkcor_2010096_v00.tsc')
    spice.furnsh("spk/fdf29_2010100_2010101_n01.bsp")
    spice.furnsh('./planet_spk/de421.bsp')

    utc = dt.strptime('2010100 05', '%Y%j %H').isoformat()
    et = spice.utc2et(utc)
    t = spice.spkpos('sun', et, 'LRO_DLRE_SCT_REF', 'lt+s', 'lro')
    print(t)
    answer = ((-63972935.85033857, -55036272.7848299, 123524941.9877458),
              499.009424105693)
    for i, j in zip(t[0], answer[0]):
        assert_equals(round(i, 3), round(j, 3))
    os.chdir(currentdir)
示例#2
0
def test_example_loading():
    currentdir = os.getcwd()
    os.chdir(kernelpath)
    spice.furnsh("ck/moc42_2010100_2010100_v01.bc")
    spice.furnsh("fk/lro_frames_2012255_v02.tf")
    spice.furnsh("fk/lro_dlre_frames_2010132_v04.tf")
    spice.furnsh("ick/lrodv_2010090_2010121_v01.bc")
    spice.furnsh("lsk/naif0010.tls")
    spice.furnsh('sclk/lro_clkcor_2010096_v00.tsc')
    spice.furnsh("spk/fdf29_2010100_2010101_n01.bsp")
    spice.furnsh('./planet_spk/de421.bsp')

    utc = dt.strptime('2010100 05', '%Y%j %H').isoformat()
    et = spice.utc2et(utc)
    t = spice.spkpos('sun', et, 'LRO_DLRE_SCT_REF', 'lt+s', 'lro')
    print(t)
    answer = ((-63972935.85033857, -55036272.7848299, 123524941.9877458),
                499.009424105693)
    for i, j in zip(t[0], answer[0]):
        assert_equals(round(i, 3), round(j, 3))
    os.chdir(currentdir)
示例#3
0
modelFP = open(cfg['SERVERS'][server]['DOCROOT']+"/"+cfg['TYPES']['Coma']['CONFIG'])
Models = json.load(modelFP)
modelFP.close()

pathToExecutable = cfg['SERVERS'][server]['DOCROOT']+"/"+cfg['MODELS']+"/LoS/pyComa/bin"
#pathToExecutable = '/Users/ices/www-dev/htdocs/ICES/Models/LoS/pyComa/bin'
#pathToExecutable = '/Users/abieler/pyComa/bin'

if args.StringMeasurement == 'LOS':
    print 'LOS hybrid case...'
    #####################################################################
    # get position of s/c and pointing towards Earth from SPICE
    #####################################################################
    spice.furnsh(args.StringKernelMetaFile)
    Et = spice.str2et(args.StringUtcStartTime)
    rEarth, lightTime = spice.spkpos("EARTH", Et, "67P/C-G_CSO", "NONE", "ROSETTA")
    rRosetta, lightTime = spice.spkpos("ROSETTA", Et, "67P/C-G_CSO", "NONE", "CHURYUMOV-GERASIMENKO")
    rEarth = np.array(rEarth)
    rRosetta = np.array(rRosetta) * 1000  # transform km to m
    print 'Distance from comet: %.2e' % (np.sqrt(np.sum(rRosetta ** 2)))

    # p = normalized vector pointing from s/c to Earth in cso coordinates
    p = rEarth / np.sqrt(np.sum(rEarth**2))

    # rRay = position of rosetta s/c in cso coordinates
    rRay = np.array([value for value in rRosetta])

    ######################################################################
    # build line of sight ray xTravel, and extract x, y, z coordinates
    #######################################################################
    xTravel = np.array(createRay(rRay, p))
示例#4
0
currentdir = os.getcwd()
os.chdir(kernelpath)
spice.furnsh("fk/lro_frames_2012255_v02.tf")
spice.furnsh("fk/lro_dlre_frames_2010132_v04.tf")
spice.furnsh("ick/lrodv_2010090_2010121_v01.bc")
spice.furnsh("lsk/naif0010.tls")
spice.furnsh('sclk/lro_clkcor_2009182_v00.tsc')
spice.furnsh("spk/fdf29_2010100_2010101_n01.bsp")
spice.furnsh('./planet_spk/de421.bsp')
# spice.furnsh("ck/moc42_2010100_2010100_v01.bc")

time = dt(2009,6,24,0,1,8)

print("Testing for time ", time, '\nIn kernel-time: ', time.strftime("%Y%j"),
      'plus {0} hours.'.format(time.hour))
et = spice.utc2et(time.isoformat())

# ckernels = ['moc42_2010100_2010100_v01.bc', 'moc42_2010100_2010101_v01.bc',
            # 'moc42_2010100_2010101_v02.bc']
ckernels = ['moc42_2009174_2009175_v01.bc','moc42_2009175_2009176_v02.bc']

for ck in ckernels:
    spice.furnsh('ck/'+ck)
    print("Loading {0}".format(ck))
    t = spice.spkpos('sun', et, 'LRO_DLRE_SCT_REF', 'lt+s', 'lro')
    unitv = spice.vhat(t[0])
    print(t[0], "Zenith angle:", degrees(arccos(unitv[2])))
    spice.unload('ck/'+ck)

示例#5
0
if nPixelsY > 1:
    Dy = Ly / (nPixelsY - 1)
else:
    Dy = Ly


if iPointingCase == spice_:
    #################################################
    # get rosetta coordinates from spice
    #################################################
    spice.furnsh(StringKernelMetaFile)
    Et = spice.str2et(StringUtcStartTime)
    #R = spice.pxform("ROS_SPACECRAFT", "67P/C-G_CSO", Et)      # create rotation matrix R to go from instrument reference frame to CSO
    if ((iDim == 2) or (iDim == 1)):
        rRosetta, lightTime = spice.spkpos("ROSETTA", Et, "67P/C-G_CSO", "NONE", "CHURYUMOV-GERASIMENKO")        # s/c coordinates in CSO frame of reference
        R = spice.pxform(InstrumentFrame, "67P/C-G_CSO", Et)      # create rotation matrix R to go from instrument reference frame to CSO
    elif iDim == 3:
        print "iDim = 3"
        rRosetta, lightTime = spice.spkpos("ROSETTA", Et, "67P/C-G_CK", "NONE", "CHURYUMOV-GERASIMENKO")        # s/c coordinates in CSO frame of reference
        R = spice.pxform(InstrumentFrame, "67P/C-G_CK", Et)
        # do 3d stuff from here?
        rSun, lt = spice.spkpos("SUN", Et, "67P/C-G_CK", "NONE", "CHURYUMOV-GERASIMENKO")
        rSun = np.array(rSun)
        rSun = rSun / np.sqrt((rSun**2).sum())
        # quick and dirty fix --> andre  needs to define instrument object for all instruments!
        try:
            if instrument.name == 'sun':
                rRosetta = rSun * 150  # set distance from sun at 200 km because of domain size
                zhat = np.array([0,0,1])
                R = rotations.rotMat(zhat, -rSun)