Esempio n. 1
0
import numpy as np
import omnical.calibration_omni as omni
import matplotlib.pyplot as plt
import aipy as ap


paper_uvfiles = ['/data4/paper/2012EoR/psa_live/psa6266/zen.2456266.64714.uvcRREcAC']
omni_uvfiles = ["/data4/paper/2012EoR/psa_live/forlstbinning_omnical_2/zen.2456266.64714.uvcRREcACO"]
info=omni.read_redundantinfo('/data2/home/hz2ug/omnical/doc/redundantinfo_PSA64_ba19_37_50.bin')
nant = 64
wantpols = {}
wantpols['xx'] = ap.miriad.str2pol['xx']

papercal_data, _, _, _ = omni.importuvs(paper_uvfiles, np.concatenate([[[i,j] for i in range(j + 1)] for j in range(nant)]), wantpols, timingTolerance=100)
omnical_data, _, _, _ = omni.importuvs(omni_uvfiles, np.concatenate([[[i,j] for i in range(j + 1)] for j in range(nant)]), wantpols, timingTolerance=100)

omni.omniview(np.array([papercal_data[0,0,120], omnical_data[0,0,120]]), info)
Esempio n. 2
0
    #true_phase = np.angle([data_pack['true_corr'][:, info['subsetbl'][info['crossindex'][info['ublindex'][uu][0][2]]], :] for uu in range(info['nUBL'])]).transpose(2,1,0)
    R = calibrators[key].find_R(true_phase)

    #####store various useful quantities#########
    calpar = 10**(
        calibrators[key].rawCalpar[:, :, 3:3 + info['nAntenna']]) * np.exp(
            1.j * calibrators[key].rawCalpar[:, :, 3 + info['nAntenna']:3 +
                                             info['nAntenna'] * 2])
    cdata[p] = omni.apply_calpar(data[p], calpar,
                                 calibrators[key].totalVisibilityId)
    chisq = calibrators[key].rawCalpar[:, :, 2] / (
        len(info['crossindex']) - info['nUBL'] - info['nAntenna']) / (53.**2 /
                                                                      24200000)
    omni.omniview(
        np.array([
            data[p][np.argmax(casa_altaz[:, 0]), 0],
            cdata[p][np.argmax(casa_altaz[:, 0]), 0]
        ]), info)
    #######################save results###############################
    if keep_binary_calpar:
        print FILENAME + " MSG: saving calibration results on %s %s." % (
            dataano, key),
        sys.stdout.flush()
        #Zaki: catch these outputs and save them to wherever you like
        calibrators[key].rawCalpar.tofile(
            oppath + '/' + dataano + '_' + ano + "_%s_%i_%i_%i.omnical" %
            (key, calibrators[key].rawCalpar.shape[0], calibrators[key].
             rawCalpar.shape[1], calibrators[key].rawCalpar.shape[2]))
        #if removeadditive:
        #adds[key].tofile(oppath + '/' + dataano + '_' + ano + "_%s.omniadd"%key + str(removeadditiveperiod))
        #calibrators[key].get_calibrated_data(data[p])
Esempio n. 3
0
import numpy as np
import omnical.calibration_omni as omni
import matplotlib.pyplot as plt
import aipy as ap

paper_uvfiles = [
    '/data4/paper/2012EoR/psa_live/psa6266/zen.2456266.64714.uvcRREcAC'
]
omni_uvfiles = [
    "/data4/paper/2012EoR/psa_live/forlstbinning_omnical_2/zen.2456266.64714.uvcRREcACO"
]
info = omni.read_redundantinfo(
    '/data2/home/hz2ug/omnical/doc/redundantinfo_PSA64_ba19_37_50.bin')
nant = 64
wantpols = {}
wantpols['xx'] = ap.miriad.str2pol['xx']

papercal_data, _, _, _, rawflag = omni.importuvs(paper_uvfiles,
                                                 wantpols,
                                                 timingTolerance=100)
omnical_data, _, _, _, rawflag = omni.importuvs(omni_uvfiles,
                                                wantpols,
                                                timingTolerance=100)

data = omni.omniview(
    np.array([papercal_data[0, 0, 120], omnical_data[0, 0, 120]]), info)

np.savez('/data2/home/zakiali/jeff_psa64/omniview.npz', data)
Esempio n. 4
0
    else:
        plt.close()

######################################################################
############## omniview uv ###################################
######################################################################

if plottype == 'uv':
    plotdata = omni.pick_slice_uvs(datafiles, pol, time, frequency)

    #try:
        #totalVisibilityId = info['totalVisibilityId']
    #except KeyError:
        #nant = int(np.ceil((len(plotdata)*2)**.5))
        #totalVisibilityId = np.concatenate([[[i,j] for i in range(j + 1)] for j in range(nant)])
    omni.omniview(plotdata, info, oppath = oppath, suppress= suppress)

if plottype == 'odf':
    with open(datafiles[0]+'/header.txt') as f:
        for l in f.readlines():
            if l.split()[0] == 'nChannels':
                nfreq = int(l.split()[1])
            elif l.split()[0] == 'nAntennas':
                nant = int(l.split()[1])
            #elif l.split()[0] == 'longitude':#odf header has bug that switched lat and lon
                #sa.lat = float(l.split()[1]) * PI/180.
            #elif l.split()[0] == 'latitude':
                #sa.lon = float(l.split()[1]) * PI/180.
            #elif l.split()[0] == 'startFreq':
                #startfreq = float(l.split()[1]) / 1000.
            #elif l.split()[0] == 'endFreq':
Esempio n. 5
0
        plt.plot(mod2p(phase[t1:t2].flatten()-np.angle(data_pack['true_corr'][0, info['subsetbl'][info['crossindex'][info['ublindex'][uu][0][2]]], t1:t2])))
        plt.title(info['ubl'][uu])
        plt.ylim([-np.pi,np.pi])
    plt.show()



    ###temporarily use true_corr as true_phase
    #true_phase = np.angle([data_pack['true_corr'][:, info['subsetbl'][info['crossindex'][info['ublindex'][uu][0][2]]], :] for uu in range(info['nUBL'])]).transpose(2,1,0)
    R = calibrators[key].find_R(true_phase)
    
    #####store various useful quantities#########
    calpar = 10**(calibrators[key].rawCalpar[:,:,3:3+info['nAntenna']])*np.exp(1.j*calibrators[key].rawCalpar[:,:,3+info['nAntenna']:3+info['nAntenna']*2])
    cdata[p] = omni.apply_calpar(data[p],calpar,calibrators[key].totalVisibilityId)
    chisq = calibrators[key].rawCalpar[:,:,2]/(len(info['crossindex']) - info['nUBL'] - info['nAntenna'])/(53.**2/24200000)
    omni.omniview(np.array([data[p][np.argmax(casa_altaz[:,0]),0],cdata[p][np.argmax(casa_altaz[:,0]),0]]), info)
    #######################save results###############################
    if keep_binary_calpar:
        print FILENAME + " MSG: saving calibration results on %s %s."%(dataano, key),
        sys.stdout.flush()
        #Zaki: catch these outputs and save them to wherever you like
        calibrators[key].rawCalpar.tofile(oppath + '/' + dataano + '_' + ano + "_%s_%i_%i_%i.omnical"%(key, calibrators[key].rawCalpar.shape[0], calibrators[key].rawCalpar.shape[1], calibrators[key].rawCalpar.shape[2]))
        #if removeadditive:
            #adds[key].tofile(oppath + '/' + dataano + '_' + ano + "_%s.omniadd"%key + str(removeadditiveperiod))
        #calibrators[key].get_calibrated_data(data[p])
        #calibrators[key].get_omnichisq()
        #calibrators[key].get_omnifit()
        print "Done"
        sys.stdout.flush()
    #calibrators[key].diagnose(data = data[p], additiveout = additiveout, healthbar = healthbar, ubl_healthbar = ubl_healthbar)
    ##print bad_ant_meter