コード例 #1
0
ファイル: apply_omnical.py プロジェクト: hungiyang/omnical
###read raw phase calibration prameters over frequencyfor each antenna, 203 by 32 in radiants; this part can be replaced################
if needrawcal:
    rawcalpar = np.asarray([
        np.fromfile(rawpaths[key], dtype="complex64").reshape(nfreq, nant)
        for key in wantpols.keys()
    ])
    rawcorrection = np.zeros(
        (len(wantpols), nfreq, nant * (nant + 1) / 2),
        dtype='complex64') + 1  #to be dividing the data;  data/calpar = model
    for p in range(len(wantpols)):
        for i, bl in zip(range(len(info[p]['subsetbl'])), info[p]['subsetbl']):
            a1, a2 = info[p]['bl2d'][i]
            rawcorrection[p, :, bl] = np.conj(
                rawcalpar[p, :, a1]) * rawcalpar[p, :, a2]

###reorder and dump the binary data from miriad################
if not os.path.exists(oppath):
    os.makedirs(oppath)

#####apply calpar and create new uv##################################
calparfilenames = [
    calparpath + 'miriadextract_' + pol + '_' + calparano + '.omnical'
    for p, pol in zip(range(len(wantpols)), wantpols.keys())
]
print FILENAME + " MSG: Applying", calparfilenames,
sys.stdout.flush()
omni.apply_omnical_uvs(uvfiles, calparfilenames, info, wantpols, oppath, ano)

print "Done!"
コード例 #2
0
#calibrators = [omni.RedundantCalibrator(nant, info = infopaths[key]) for key in wantpols.keys()]
calibrators = [RedundantCalibrator_PAPER(aa) for key in wantpols.keys()]
for calibrator, key in zip(calibrators, wantpols.keys()):
	#calibrator.compute_redundantinfo(badAntenna = badAntenna, badUBL = badUBL, antennaLocationTolerance = 1)
	#calibrator.write_redundantinfo(infoPath = oppath + 'redundantinfo_' + ano + '_' + key + '.txt', overwrite = True)
	#calibrator.read_redundantinfo(infopaths[p])
	calibrator.dataPath = oppath + 'data_' + ano + '_' + key
	calibrator.tmpDataPath = calibrator.dataPath
	if removeadditive:
		calibrator.calparPath = oppath + 'data_' + ano + '_' + key + '_add' + str(removeadditiveperiod) + '.omnical'
	else:
		calibrator.calparPath = oppath + 'data_' + ano + '_' + key + '.omnical'





calparfilenames = [calibrator.calparPath for calibrator in calibrators]
additivefilenames = [calibrator.dataPath + '.omniadd%d'%removeadditiveperiod for calibrator in calibrators]
info = omni.read_redundantinfo('results/redundantinfo_PSA64_ba19_37_50.txt')
info = [info, info]



####make uv################
print FILENAME + " MSG: starting uv creation."
print calparfilenames
print additivefilenames
omni.apply_omnical_uvs(uvfiles, calparfilenames, calibrators[0].totalVisibilityId, info, wantpols, opuvpath, '', additivefilenames = additivefilenames, nTotalAntenna = None, overwrite = False)

コード例 #3
0
    calibrator.dataPath = oppath + 'data_' + ano + '_' + key
    calibrator.tmpDataPath = calibrator.dataPath
    if removeadditive:
        calibrator.calparPath = oppath + 'data_' + ano + '_' + key + '_add' + str(
            removeadditiveperiod) + '.omnical'
    else:
        calibrator.calparPath = oppath + 'data_' + ano + '_' + key + '.omnical'

calparfilenames = [calibrator.calparPath for calibrator in calibrators]
additivefilenames = [
    calibrator.dataPath + '.omniadd%d' % removeadditiveperiod
    for calibrator in calibrators
]
info = omni.read_redundantinfo('results/redundantinfo_PSA64_ba19_37_50.txt')
info = [info, info]

####make uv################
print FILENAME + " MSG: starting uv creation."
print calparfilenames
print additivefilenames
omni.apply_omnical_uvs(uvfiles,
                       calparfilenames,
                       calibrators[0].totalVisibilityId,
                       info,
                       wantpols,
                       opuvpath,
                       '',
                       additivefilenames=additivefilenames,
                       nTotalAntenna=None,
                       overwrite=False)
コード例 #4
0
ファイル: apply_omnical.py プロジェクト: JIANSHULI/omnical
dfreq = uv['sdf']
del(uv)

###read raw phase calibration prameters over frequencyfor each antenna, 203 by 32 in radiants; this part can be replaced################
if needrawcal:
	rawcalpar = np.asarray([np.fromfile(rawpaths[key], dtype="complex64").reshape(nfreq, nant) for key in wantpols.keys()])
	rawcorrection = np.zeros((len(wantpols), nfreq, nant*(nant+1)/2), dtype='complex64') + 1#to be dividing the data;  data/calpar = model
	for p in range(len(wantpols)):
		for i, bl in zip(range(len(info[p]['subsetbl'])), info[p]['subsetbl']):
			a1, a2 = info[p]['bl2d'][i]
			rawcorrection[p, :, bl] = np.conj(rawcalpar[p, :,a1]) *  rawcalpar[p, :,a2]



###reorder and dump the binary data from miriad################
if not os.path.exists(oppath):
	os.makedirs(oppath)



#####apply calpar and create new uv##################################
calparfilenames = [calparpath + 'miriadextract_' + pol + '_' + calparano + '.omnical' for p, pol in zip(range(len(wantpols)), wantpols.keys())]
print FILENAME + " MSG: Applying", calparfilenames,
sys.stdout.flush()
omni.apply_omnical_uvs(uvfiles, calparfilenames, info, wantpols, oppath, ano)

print "Done!"