示例#1
0
    # Moon Phase Calculations
    gobs = ephem.Observer()
    gobs.name = 'VLT'
    gobs.lat = rad(latitude)  # lat/long in decimal degrees
    gobs.long = rad(longitude)
    gobs.date = h[0].header['DATE-OBS'].replace('T', ' ')
    mephem = ephem.Moon()
    mephem.compute(gobs)
    Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd % 1), 1, 0.0)
    Mp = jplephem.barycentric_object_track("Moon", int(mjd), float(mjd % 1), 1,
                                           0.0)
    Sp = jplephem.barycentric_object_track("Sun", int(mjd), float(mjd % 1), 1,
                                           0.0)
    res = jplephem.object_doppler("Moon", int(mjd), mjd % 1, 1, 0.0)
    lunation, moon_state, moonsep, moonvel = GLOBALutils.get_lunar_props(
        ephem, gobs, Mcoo, Mp, Sp, res, ra, dec)
    refvel = bcvel_baryc + moonvel
    print '\t\tRadial Velocity of sacttered moonlight:', refvel

    sci_fits = dirout + fsim.split('/')[-1][:-4] + 'spec.pkl'
    sci_fits_simple = dirout + fsim.split('/')[-1][:-4] + 'spec.simple.pkl'
    P_fits = dirout + 'P_' + fsim.split('/')[-1][:-4] + 'spec.fits'

    if ( os.access(sci_fits,os.F_OK) == False ) or ( os.access(sci_fits_simple,os.F_OK) == False ) or \
       ( force_sci_extract ):
        print "\t\tNo previous extraction or extraction forced for science file", fsim, "extracting..."
        #"""
        print "\t\t\tweights for chip1..."
        P1 = GLOBALutils.obtain_P(data[:,:,0].T,c_all1,ext_aperture,ron1,gain1,NSigma_Marsh, S_Marsh, \
                                    N_Marsh, Marsh_alg, min_extract_cols1,max_extract_cols1, npools)
        print "\t\t\tweights for chip2..."
    res  = jplephem.pulse_delay(RA/15.0, DEC, int(scmjd), scmjd%1, 1, 0.0)   
    mbjd = scmjd + res['delay'][0] / (3600.0 * 24.0)

    gobs      = ephem.Observer()
    gobs.name = 'DUPONT'
    gobs.lat  = rad(latitude)  # lat/long in decimal degrees  
    gobs.long = rad(longitude)
    gobs.date = hd['UT-DATE'].replace('-','/') + ' ' + hd['UT-TIME']

    mephem = ephem.Moon()
    mephem.compute(gobs)
    Mcoo = jplephem.object_track("Moon", int(scmjd), float(scmjd%1), 1, 0.0)
    Mp   = jplephem.barycentric_object_track("Moon", int(scmjd), float(scmjd%1), 1, 0.0)
    Sp   = jplephem.barycentric_object_track("Sun", int(scmjd), float(scmjd%1), 1, 0.0)
    res  = jplephem.object_doppler("Moon", int(scmjd), scmjd%1, 1, 0.0)
    lunation,moon_state,moonsep2,moonvel = GLOBALutils.get_lunar_props(ephem,gobs,Mcoo,Mp,Sp,res,RA,DEC)
    refvel = bcvel_baryc + moonvel
    print '\t\tBarycentric velocity:',refvel

    i=0
    mind = 1000.0
    for t in thtimes:
        if abs(t-scmjd)<mind:
            mind  = abs(t-scmjd)
            index = i
        i+=1

    obj_S = pyfits.getdata(stpath)

    wavsol_pkl1 = thnames[index]
    pdict1      = pickle.load(open(wavsol_pkl1,'r'))