f10=pyfits.open(flags10file,mode='update')
for ichan,chan in enumerate(chans10):
    flags=f10[chan].data['FLAGS']
    azname=chan_az_names[ichan]
    elname=chan_el_names[ichan]
    #take care of calibration sections first
    for i,cal in enumerate(cals):
        uttime=calstarts[i]
        calutstart=uttime[1]+uttime[2]/60. + uttime[3]/3600.
        uttime=calstops[i]
        calutstop=uttime[1]+uttime[2]/60. + uttime[3]/3600.
        if cal == 'cal6':
            calutstart=calutstart+24
            calutstop=calutstop+24
        badd=np.where((ut10 > (calutstart-1./60.)) & (ut10 < (calutstop+1./60.)))
        flags[badd]=util.raise_bit(flags[badd],bit=0)
    #now do the azimuth cut for relevant channels (satellite interference)
    azcut=chan_az_cuts_10[ichan]
    if (azcut != 0):
        azbad=np.where(np.abs(p10[1].data[azname] - 190.)<azcut)
        flags[azbad]=util.raise_bit(flags[azbad],bit=3)
    # now sun cut.
    sunbad=np.where((np.abs(p10[1].data[azname]-azsun) < suncut) & (np.abs(p10[1].data[elname]-elsun) < suncut))
    flags[sunbad]=util.raise_bit(flags[sunbad],bit=1)
    moonbad=np.where((np.abs(p10[1].data[azname]-azmoon) < mooncut) & (np.abs(p10[1].data[elname]-elmoon) < mooncut))
    flags[moonbad]=util.raise_bit(flags[moonbad],bit=2)
    f10.flush()
        
f10.flush()
d10.close()
p10.close()
Пример #2
0
for ichan, chan in enumerate(chans10):
    flags = f10[chan].data['FLAGS']
    azname = chan_az_names[ichan]
    elname = chan_el_names[ichan]
    #take care of calibration sections first
    for i, cal in enumerate(cals):
        uttime = calstarts[i]
        calutstart = uttime[1] + uttime[2] / 60. + uttime[3] / 3600.
        uttime = calstops[i]
        calutstop = uttime[1] + uttime[2] / 60. + uttime[3] / 3600.
        if cal == 'cal6':
            calutstart = calutstart + 24
            calutstop = calutstop + 24
        badd = np.where((ut10 > (calutstart - 1. / 60.))
                        & (ut10 < (calutstop + 1. / 60.)))
        flags[badd] = util.raise_bit(flags[badd], bit=0)
    #now do the azimuth cut for relevant channels (satellite interference)
    azcut = chan_az_cuts_10[ichan]
    if (azcut != 0):
        azbad = np.where(np.abs(p10[1].data[azname] - 190.) < azcut)
        flags[azbad] = util.raise_bit(flags[azbad], bit=3)
    # now sun cut.
    sunbad = np.where((np.abs(p10[1].data[azname] - azsun) < suncut)
                      & (np.abs(p10[1].data[elname] - elsun) < suncut))
    flags[sunbad] = util.raise_bit(flags[sunbad], bit=1)
    moonbad = np.where((np.abs(p10[1].data[azname] - azmoon) < mooncut)
                       & (np.abs(p10[1].data[elname] - elmoon) < mooncut))
    flags[moonbad] = util.raise_bit(flags[moonbad], bit=2)
    f10.flush()

f10.flush()
flags15file='v11_flags15ghz.fits'

# retrieve the start and stop times of the new bad data
baddatalistfile='c:/cofe/flight_data/baduts_for_flags_based_on_10Ghz_ch0.pkl'
baddata=open(baddatalistfile,'rb')
badstarts,badstops=cPickle.load(baddata)
baddata.close()

f10=pyfits.open(flags10file,mode='update')
ut10=f10['time'].data['ut']

for ichan,chan in enumerate(chans10):
    flags=f10[chan].data['FLAGS']
    for badutstart,badutstop in zip(badstarts,badstops):
        badd=np.where((ut10 > badutstart) & (ut10 < badutstop))
        flags[badd]=util.raise_bit(flags[badd],bit=4)
    f10.flush()
        
f10.flush()
f10.close()

f15=pyfits.open(flags15file,mode='update')
ut15=f15['time'].data['ut']
for ichan,chan in enumerate(chans15):
    flags=f15[chan].data['FLAGS']
    for badutstart,badutstop in zip(badstarts,badstops):
        badd=np.where((ut15 > badutstart) & (ut15 < badutstop))
        flags[badd]=util.raise_bit(flags[badd],bit=4)
    f15.flush()
        
f15.flush()
Пример #4
0
flags15file = 'v11_flags15ghz.fits'

# retrieve the start and stop times of the new bad data
baddatalistfile = 'c:/cofe/flight_data/baduts_for_flags_based_on_10Ghz_ch0.pkl'
baddata = open(baddatalistfile, 'rb')
badstarts, badstops = cPickle.load(baddata)
baddata.close()

f10 = pyfits.open(flags10file, mode='update')
ut10 = f10['time'].data['ut']

for ichan, chan in enumerate(chans10):
    flags = f10[chan].data['FLAGS']
    for badutstart, badutstop in zip(badstarts, badstops):
        badd = np.where((ut10 > badutstart) & (ut10 < badutstop))
        flags[badd] = util.raise_bit(flags[badd], bit=4)
    f10.flush()

f10.flush()
f10.close()

f15 = pyfits.open(flags15file, mode='update')
ut15 = f15['time'].data['ut']
for ichan, chan in enumerate(chans15):
    flags = f15[chan].data['FLAGS']
    for badutstart, badutstop in zip(badstarts, badstops):
        badd = np.where((ut15 > badutstart) & (ut15 < badutstop))
        flags[badd] = util.raise_bit(flags[badd], bit=4)
    f15.flush()

f15.flush()