infopaths = {'SI': './redundantinfo_PSA32.txt'} oppath = './lst_v006_I_results/' calparpath = './lst_v007_results/' removedegen = 1 needrawcal = False #if true, (generally true for raw data) you need to take care of having raw calibration parameters in float32 binary format freq x nant rawpaths = {'xx': "testrawphasecalparrad_xx", 'yy': "testrawphasecalparrad_yy"} keep_binary_data = False ########Massage user parameters################ oppath += '/' ####read redundant info################ info = [omni.read_redundantinfo(infopaths[key]) for key in wantpols.keys()] #print info[0]['bl1dmatrix'] #exit(1) ####get some info from the first uvfile ################ uv = ap.miriad.UV(uvfiles[0]) nfreq = uv.nchan nant = uv['nants'] / 2 # 'nants' counting ant-pols, so divide 2 startfreq = uv['sfreq'] 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)
import struct import numpy as np import os, sys import datetime from optparse import OptionParser import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) import scipy as sp import scipy.sparse as sps import scipy.linalg as la import calibration_omni as omni correctinfo = omni.read_redundantinfo( '/home/ericy/omnical/redundant_info/redundantinfo_badant2_4_5_6_8_9_10badubl1_2_3_5_8_9.txt' ) calibrator = omni.RedundantCalibrator(32) calibrator.antennaLocationTolerance = .1 calibrator.badAntenna = [1, 3, 4, 5, 7, 8, 9] calibrator.badUBL = [0, 1, 2, 4, 7, 8] antlist = [[-1.82119623e-02, -1.17231687e-02, -1.65467362e-02], [3.98503466e+00, 9.63369375e-03, 2.37189551e-02], [7.98828128e+00, 3.09905563e-02, 6.39846464e-02], [1.19915279e+01, 5.23474188e-02, 1.04250338e-01], [-5.14142894e-01, 1.20011739e+02, 3.95129958e-02], [3.48910373e+00, 1.20033096e+02, 7.97786871e-02], [7.49235035e+00, 1.20054452e+02, 1.20044378e-01], [1.14955970e+01, 1.20075809e+02, 1.60310070e-01],
#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,
#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)
import aipy as ap import struct import numpy as np import os, sys import datetime from optparse import OptionParser import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore",category=DeprecationWarning) import scipy as sp import scipy.sparse as sps import scipy.linalg as la import calibration_omni as omni correctinfo = omni.read_redundantinfo('/home/ericy/omnical/redundant_info/redundantinfo_badant2_4_5_6_8_9_10badubl1_2_3_5_8_9.txt') calibrator = omni.RedundantCalibrator(32) calibrator.antennaLocationTolerance = .1 calibrator.badAntenna = [1,3,4,5,7,8,9] calibrator.badUBL = [0, 1, 2,4,7,8] antlist=[[ -1.82119623e-02, -1.17231687e-02 , -1.65467362e-02], [ 3.98503466e+00, 9.63369375e-03 , 2.37189551e-02], [ 7.98828128e+00, 3.09905563e-02 , 6.39846464e-02], [ 1.19915279e+01, 5.23474188e-02, 1.04250338e-01], [ -5.14142894e-01, 1.20011739e+02, 3.95129958e-02], [ 3.48910373e+00, 1.20033096e+02, 7.97786871e-02], [ 7.49235035e+00, 1.20054452e+02, 1.20044378e-01], [ 1.14955970e+01, 1.20075809e+02, 1.60310070e-01], [ -2.66177428e-01, 6.00000077e+01, 1.14831298e-02],
infopaths = {'SI':'./redundantinfo_PSA32.txt'} oppath = './lst_v006_I_results/' calparpath = './lst_v007_results/' removedegen = 1 needrawcal = False #if true, (generally true for raw data) you need to take care of having raw calibration parameters in float32 binary format freq x nant rawpaths = {'xx':"testrawphasecalparrad_xx", 'yy':"testrawphasecalparrad_yy"} keep_binary_data = False ########Massage user parameters################ oppath += '/' ####read redundant info################ info = [omni.read_redundantinfo(infopaths[key]) for key in wantpols.keys()] #print info[0]['bl1dmatrix'] #exit(1) ####get some info from the first uvfile ################ uv=ap.miriad.UV(uvfiles[0]) nfreq = uv.nchan; nant = uv['nants'] / 2 # 'nants' counting ant-pols, so divide 2 startfreq = uv['sfreq'] 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