def get_demodulated_data_from_list(filelist,freq=10,supply_index=True,phase_offset=0):
    filelist.sort() #just in case
    dd=[]
    for f in filelist:
        #only use full size files
        stats=os.stat(f)
        if stats.st_size == 10752000:
            print f
            d=demod.demodulate_dat(f,freq,supply_index=True,phase_offset=phase_offset)
            #filename is start of data taking (I think) and we'll just add 1/samprate seconds per rev
            h=np.float64(f[-12:-10])
            m=np.float64(f[-10:-8])
            s=np.float64(f[-8:-6])
            t=h+m/60.+(s+(d['rev']-d['rev'][0])/samprate)/3600.
            d=recf.append_fields(d,'localtime',t)
            ut=np.mod(t+7.,24.)
            if len(f)>21:
                y=np.zeros(len(d),dtype=np.int)+np.int(f[-21:-17])
                mo=np.zeros(len(d),dtype=np.int)+np.int(f[-17:-15])
                dy=np.zeros(len(d),dtype=np.int)+np.int(f[-15:-13])
                ut=np.mod(t+7.,24.)
                utt=t+7.
                dy[utt>ut]=dy[utt>ut]+1
                d=recf.append_fields(d,['year','month','day'],[y,mo,dy])
            d=recf.append_fields(d,'ut',ut)
            dd.append(d)
    return np.concatenate(dd)
Esempio n. 2
0
def get_demodulated_data_from_list(filelist,freq=10,supply_index=True,phase_offset=0):
    filelist.sort() #just in case
    dd=[]
    for f in filelist:
        #only use full size files
        stats=os.stat(f)
        if stats.st_size == 10752000:
            print f
            d=demod.demodulate_dat(f,freq,supply_index=True,phase_offset=phase_offset)
            #filename is start of data taking (I think) and we'll just add 1/samprate seconds per rev
            h=np.float64(f[-12:-10])
            m=np.float64(f[-10:-8])
            s=np.float64(f[-8:-6])
            t=h+m/60.+(s+(d['rev']-d['rev'][0])/samprate)/3600.
            d=recf.append_fields(d,'localtime',t)
            ut=np.mod(t+7.,24.)
            if len(f)>21:
                y=np.zeros(len(d),dtype=np.int)+np.int(f[-21:-17])
                mo=np.zeros(len(d),dtype=np.int)+np.int(f[-17:-15])
                dy=np.zeros(len(d),dtype=np.int)+np.int(f[-15:-13])
                ut=np.mod(t+7.,24.)
                utt=t+7.
                dy[utt>ut]=dy[utt>ut]+1
                d=recf.append_fields(d,['year','month','day'],[y,mo,dy])
            d=recf.append_fields(d,'ut',ut)
            dd.append(d)
    return np.concatenate(dd)
Esempio n. 3
0
            zsky1[1][zsky1[0] == 50]) + np.sqrt(zsky3[1][zsky3[0] == 50]))
    epsilons[ch] = epsilon[0]

for ch in ['ch1', 'ch3', 'ch5']:
    calsecco[ch] = (tamb - tsky) / (np.mean(cal[ch].flatten()[secco]) /
                                    np.mean(cal[ch].flatten()[ssky2]))
calsecco['ch0'] = calsecco['ch1'] / bbgain['ch0']
calsecco['ch2'] = calsecco['ch3'] / bbgain['ch2']
calsecco['ch4'] = calsecco['ch5'] / bbgain['ch4']

#now get the other sky data
get_ipython().magic(u"cd 'c:/cofe/cofe_ground_fall_2012/data/20121113'")
fl = glob('*.dat')
dsky = []
for f in fl:
    dsky.append(demod.demodulate_dat(f, 10))

dsky = np.concatenate(dsky)

for ch in chans:
    zsky1t = cu.nps(dsky[ch]['T'][:5200], rotrate, minfreq=.1)
    zsky1q = cu.nps(dsky[ch]['Q'][:5200], rotrate, minfreq=.1)
    zsky1u = cu.nps(dsky[ch]['U'][:5200], rotrate, minfreq=.1)
    plt.figure(figsize=(12, 6))
    hold(True)
    plt.plot(zsky1t[0], np.sqrt(zsky1t[1]) * calsecco[ch] * 1000., label='T')
    plt.plot(zsky1q[0], np.sqrt(zsky1q[1]) * calsecco[ch] * 1000., label='Q')
    plt.plot(zsky1u[0], np.sqrt(zsky1u[1]) * calsecco[ch] * 1000., label='U')

    plt.title(
        'Sky test Nov 13, 2012 (Rough cal to 300K). 10 GHz COFE detector ' +
    zecco=cu.nps(cal[ch].flatten()[secco],samprate,minfreq=1)
    epsilon=np.sqrt((zfoam1[1][zfoam1[0]==50] + zfoam2[1][zfoam2[0]==50]))/(np.sqrt(zsky1[1][zsky1[0]==50]) + np.sqrt(zsky3[1][zsky3[0]==50]))
    epsilons[ch]=epsilon[0]

for ch in ['ch1','ch3','ch5']:
    calsecco[ch]=(tamb-tsky)/(np.mean(cal[ch].flatten()[secco])/np.mean(cal[ch].flatten()[ssky2]))
calsecco['ch0']=calsecco['ch1']/bbgain['ch0']
calsecco['ch2']=calsecco['ch3']/bbgain['ch2']
calsecco['ch4']=calsecco['ch5']/bbgain['ch4']

#now get the other sky data
get_ipython().magic(u"cd 'c:/cofe/cofe_ground_fall_2012/data/20121113'")
fl=glob('*.dat')
dsky=[]
for f in fl:
    dsky.append(demod.demodulate_dat(f,10))
    
dsky=np.concatenate(dsky)

for ch in chans:
    zsky1t=cu.nps(dsky[ch]['T'][:5200],rotrate,minfreq=.1)
    zsky1q=cu.nps(dsky[ch]['Q'][:5200],rotrate,minfreq=.1)
    zsky1u=cu.nps(dsky[ch]['U'][:5200],rotrate,minfreq=.1)
    plt.figure(figsize=(12,6))
    hold(True)
    plt.plot(zsky1t[0],np.sqrt(zsky1t[1])*calsecco[ch]*1000.,label='T')
    plt.plot(zsky1q[0],np.sqrt(zsky1q[1])*calsecco[ch]*1000.,label='Q')
    plt.plot(zsky1u[0],np.sqrt(zsky1u[1])*calsecco[ch]*1000.,label='U')
    
    plt.title('Sky test Nov 13, 2012 (Rough cal to 300K). 10 GHz COFE detector '+ch)
    plt.xlabel('Frequency, Hz')