* * CALCK - set of procedures to semi-automatically reduce polarization * calibration data for the VLA for dataset: * 09-18-2001 0830-1130 LST SMyers TESTT/AC524 program * * Version STM-10-12-01 for running on SANDROCK USER 1553 Disks 1 and 2 * Include VPol * THIS ASSUMES THE 31DEC01 VERSION OF AIPS OR LATER! * * NOTE: The session-specific variables are defined in procedure SETIT. * This script should be useable for any run if these are changed * appropriately. * * This script assumes the UV data and ICLN models are on Disk 1, and * Disk 2 is available for temporary map storage. * * Because the primary calibrator is 1331+305 (3C286) or 0137+331 (3C84) * which are resolved, a CC model is preferred. However, the following * procedure will sort of work with a point model by skipping step 2. * * Calibrators are broken into lists: * * abscal = primary flux and EVPA calibrator * polcal = polarization leakage calibrator(s) * * srclist = all calibrators except abscal * | * strongcal = bright calibrators from callist (shorter solutions) * phacal = normal calibrators from callist * weakcal = weak calbirators from callist (longer solution intervals) * * Steps to run, with data in SLOT I: * * 1. SETIT -- define the session specific variables (IMPORTANT!!!!) * * Before starting be sure to quack off the first 10 sec (to zap the * pointing scans and bad data at start), and examine the data in * TVFLG for obvious problems (use AMPL DIFF and PHA DIFF with 3.3sec * records). * * If you read in the data with 1min default CL entries: * Delete default CL 1 and run * REINDXR(I) -- INDXR with CPARM(3) 10/60 to make CL 1 with 10sec entries * * 2. CALGAIN(I) -- This will do gain and opacity calibration and * produce CL table 3 * * If you are starting with a previous calibration, reset this with * RESETIT(I) -- reset SU fluxes and clear SN and CL tables back to 2 * * Normally, at this point, you would split off the data for the cal * and map it in SCMAP or DIFMAP to produce a ICLN with CC=1. For * D-configuration (and probably C) a point model is sufficient. * * CALBASE(I) - fix baselines in CL2 * * 3. CALDATA(I) -- gain calibration, using the model, produces CL 3 and * CL 4 which is the one to be applied in following steps. You can * examine the output in file *.CALIB to check the process. * 4. LISTCAL(I) -- examine calibrators with LISTR OPTYP='MATX' * 5. CALPOL(I) -- runs PCAL and does a LISTR OPTYP='MATX' on cross-pols * for calibrator (RL and LR). * 6. Examine LISTR output files *.PCAL and *.POLC * 7. OUTPOL(I) -- runs IMAGR and then IMSTAT/IMVAL on the maps * 8. Examine LISTR output files *.TXT and produce summary by, for example * grep 'IF=' *.TXT * The lines at the end of the .TXT files contain the angles we want, * and can be extracted by * grep 'PHASE' *.TXT * * Remember, if you need to redo things, proc RESETIT(I) will reset to * the beginning, and to redo steps 5 or 7 just requires blasting the listr * output files. * Proc Setit * Procedure to define global pseudoverbs, arrays and strings * as well as to define the calibrator names and number for later use * scalar angle, angle1, angle2, polang1, polang2, corang1, corang2 scalar phdiff, flxtot1, flxtot2, fpol1, fpol2, spol1, spol2 * string*16 abscal, absnam, srccal, absnot, srclist(30) string*16 phacal(30), polcal(30), weacal(30), strongcal(30) string*12 absmod, predir string*6 iclass, bclass, uclass, qclass, vclass string*2 prefix string*1 fqband scalar opacity, abcell, absref, absang, numbox, calimode, sjparm scalar numcal, numsrcs, numweak, numstrong array absflx(2), absant(50), notant(50), absuvr(2), getant(50) array absbox(4), rmsbox(4) * * Set up some class suffixes for the appropriate version of AIPS * type 'Setting up for AIPS TST' iclass 'ICL001'; bclass 'IBM001'; uclass 'UCL001'; qclass 'QCL001'; vclass 'VCL001'; * * Calibrate weights (DOCALIB=2) * calimode 2; * * NOTE: These values are specific to this session * type 'Using setup values for DnC-config K-Band 09-18-2001 TESTT/AC524 run' * predir 'PWD:'; type 'PREDIR =',predir prefix 'CK'; type 'PREFIX =',prefix fqband 'K'; type 'FQBAND =',fqband abscal '1331+305'; type 'ABSCAL =',abscal; absnot ''; absnam '3C286'; type 'ABSNAM =',absnam absmod '3C286_AK'; type 'ABSMOD =',absmod absang 66; type 'ABSANG =',absang * setjy calc 1999.2 absflx 0; sjparm 0; type 'ABSFLX =',absflx * use recommended 0-185 klam and stations 28 and inward (7 per arm in B) absuvr 0 185; type 'ABSUVR =',absuvr absant 0 notant 0 type 'ABSANT =',absant * antennas for getjy, all stations getant 0 * absref 24; type 'ABSREF =',absref numbox 0; type 'NUMBOX =',numbox absbox 0, 0, 0, 0; type 'ABSBOX =',absbox rmsbox 32, 32, 96, 96; type 'RMSBOX =',absbox abcell 0.20; type 'ABCELL =',abcell * numsrcs 8; type 'NUMSRCS =',numsrcs srclist '0713+438','0854+201','0927+390','1146+399','1159+292','1229+020',''; srclist(7) '1256-057'; srclist(8) '1310+323'; numcal 4 phacal '0854+201','0927+390','1159+292','1310+323',''; type 'PHACAL =',phacal numstrong 2 strongcal '1229+020','1256-057',''; type 'STRONGCAL =',strongcal numweak 2 weacal '0713+438','1146+399',''; type 'WEACAL =',weacal polcal '0927+390',''; type 'POLCAL =',polcal srccal ' ' * use average opacity of 0.10 (from tip data) opacity 0.10; type 'OPACITY = ',opacity * Finish * * Proc Resetit(i) * Reset dataset I for redo-ing of all procedures * getn i task 'setjy' optyp 'rejy' source abscal,'' bif 1; eif 2; zerosp 0 freqid 1 go setjy; wait setjy * inext 'sn';inver -1;extd * inext 'cl';inver 0; extd * imh type 'There should now be no SN tables and 1 CL table' type 'May have to repeat EXTD if CL tables remain' * Finish * * Proc Reindxr(i) * Create new CL table with 10 sec entries * Run after deleting CL 1 * getn i task 'indxr' infile ''; prtlev 0 cparm 0, 0, 10/60, 0 go indxr; wait indxr imh type 'There should now be 1 CL table with 10sec entries' * Finish * * Proc Mapem * Specialized procedure to run IMAGR with stokes I,Q, and U * sets, and map them. * tget imagr for j=1 to 2; outn sour(1) bif j; eif j outseq (j+6) clr2n; in2di indi; outdi 2 niter 200 stokes 'i'; outcl iclass wait imagr; go imagr niter 200 stokes 'q'; outcl qclass wait imagr; go imagr stokes 'u'; outcl uclass wait imagr; go imagr stokes 'v'; outcl vclass wait imagr; go imagr end wait imagr * now make polc and pola maps for j=1 to 2; indi 2; in2di 2; outdi 2 innam outn blc 0; trc 0 inseq (j+6); outseq inseq incl qclass in2name innam in2seq inseq in2cl uclass opcode 'polc' outcl opcode aparm 0 blc 70 30; trc 140 94; tvlod; imstat bparm 0 0 1 bparm(1)=pixstd incl uclass blc 70 30; trc 140 94; tvlod; imstat bparm(2)=pixstd incl qclass; blc 0; trc 0 go comb; wait comb opcode 'pola' outcl opcode go comb; wait comb end type 'finished MAPEM' Finish * * * FIXKGAIN.001 - runfile to load gain curve procedure FIXKGAIN Proc FIXKGAIN(i,j) * Usage: FIXKGAIN( CATNO, CLVER ) * I = catalog number of file; J = version number of CL table to correct * Procedure to put in polynomial gain coefficients at K band * from Perley Oct 2/3 2000 run * Use Jul00 curves for AN 2,4,17 * Use Apr99 curves for AN 1 type 'Applying K band gain curves from Perley Oct00' type 'These gain curves are normalized to 1 at maximum' getn i gainver j opcode 'gain' source '' * From Apr99 ANTEN 1 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 0.945E+00, 0.173E-02, 0.235E-05, 0 go clcor ANTEN 1 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 0.929E+00, 0.252E-02, -0.372E-05, 0 wait clcor; go clcor ANTEN 1 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 0.949E+00, 0.125E-02, 0.117E-04, 0 wait clcor; go clcor ANTEN 1 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 0.935E+00, 0.217E-02, -0.687E-06, 0 wait clcor; go clcor * from Jul00 ANTEN 2 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0125e+00, -1.1818e-03, 2.7930e-05, 0; wait clcor; go clcor ANTEN 2 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0041e+00, -6.0815e-04, 2.2647e-05, 0; wait clcor; go clcor ANTEN 2 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0120e+00, -1.1286e-03, 2.6466e-05, 0; wait clcor; go clcor ANTEN 2 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0050e+00, -6.8980e-04, 2.3597e-05, 0; wait clcor; go clcor ANTEN 4 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1424e+00, -5.0021e-03, 4.3937e-05, 0; wait clcor; go clcor ANTEN 4 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1410e+00, -4.9293e-03, 4.3088e-05, 0; wait clcor; go clcor ANTEN 4 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.1345e+00, -4.7329e-03, 4.1622e-05, 0; wait clcor; go clcor ANTEN 4 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1370e+00, -4.7377e-03, 4.0947e-05, 0; wait clcor; go clcor ANTEN 17 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1611e+00, -7.3238e-03, 8.3241e-05, 0; wait clcor; go clcor ANTEN 17 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1623e+00, -7.3009e-03, 8.2090e-05, 0; wait clcor; go clcor ANTEN 17 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.1674e+00, -7.6287e-03, 8.6931e-05, 0; wait clcor; go clcor ANTEN 17 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1572e+00, -7.0336e-03, 7.8651e-05, 0; wait clcor; go clcor * from Oct00 ANTEN 3 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1029e+00, -4.0440e-03, 3.9726e-05, 0; wait clcor; go clcor ANTEN 3 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0960e+00, -3.4300e-03, 3.0647e-05, 0; wait clcor; go clcor ANTEN 5 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0330e+00, -1.8754e-03, 2.6676e-05, 0; wait clcor; go clcor ANTEN 5 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0474e+00, -2.1855e-03, 2.5178e-05, 0; wait clcor; go clcor ANTEN 6 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0318e+00, -1.5528e-03, 1.8934e-05, 0; wait clcor; go clcor ANTEN 6 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0289e+00, -1.4884e-03, 1.9179e-05, 0; wait clcor; go clcor ANTEN 7 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0965e+00, -3.5737e-03, 3.3097e-05, 0; wait clcor; go clcor ANTEN 7 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0997e+00, -3.5128e-03, 3.0954e-05, 0; wait clcor; go clcor ANTEN 8 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0727e+00, -2.8133e-03, 2.7222e-05, 0; wait clcor; go clcor ANTEN 8 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0784e+00, -2.9401e-03, 2.7570e-05, 0; wait clcor; go clcor ANTEN 9 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0536e+00, -2.7049e-03, 3.4140e-05, 0; wait clcor; go clcor ANTEN 9 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0567e+00, -2.0931e-03, 1.9306e-05, 0; wait clcor; go clcor ANTEN 10 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0623e+00, -2.2560e-03, 2.0436e-05, 0; wait clcor; go clcor ANTEN 10 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0755e+00, -2.5061e-03, 2.0800e-05, 0; wait clcor; go clcor ANTEN 11 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0043e+00, -6.7088e-04, 2.6305e-05, 0; wait clcor; go clcor ANTEN 11 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0053e+00, -7.6797e-04, 2.7908e-05, 0; wait clcor; go clcor ANTEN 12 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1716e+00, -5.3453e-03, 4.1633e-05, 0; wait clcor; go clcor ANTEN 12 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1694e+00, -5.3669e-03, 4.2497e-05, 0; wait clcor; go clcor ANTEN 13 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0936e+00, -3.2193e-03, 2.7696e-05, 0; wait clcor; go clcor ANTEN 13 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0847e+00, -2.3331e-03, 1.6066e-05, 0; wait clcor; go clcor ANTEN 14 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1122e+00, -4.8571e-03, 5.2550e-05, 0; wait clcor; go clcor ANTEN 14 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1154e+00, -4.2364e-03, 3.8885e-05, 0; wait clcor; go clcor ANTEN 15 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0139e+00, -1.2876e-03, 2.9909e-05, 0; wait clcor; go clcor ANTEN 15 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0265e+00, -1.9825e-03, 3.7134e-05, 0; wait clcor; go clcor ANTEN 16 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1384e+00, -4.8305e-03, 4.2151e-05, 0; wait clcor; go clcor ANTEN 16 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1345e+00, -4.8344e-03, 4.3439e-05, 0; wait clcor; go clcor ANTEN 18 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0020e+00, -4.2243e-04, 2.2346e-05, 0; wait clcor; go clcor ANTEN 18 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0167e+00, -1.5352e-03, 3.5280e-05, 0; wait clcor; go clcor ANTEN 19 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0267e+00, -1.8018e-03, 3.0398e-05, 0; wait clcor; go clcor ANTEN 19 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0336e+00, -2.0973e-03, 3.2714e-05, 0; wait clcor; go clcor ANTEN 20 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0611e+00, -2.9610e-03, 3.5875e-05, 0; wait clcor; go clcor ANTEN 20 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0778e+00, -3.8377e-03, 4.7341e-05, 0; wait clcor; go clcor ANTEN 21 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0051e+00, -7.8606e-04, 3.0023e-05, 0; wait clcor; go clcor ANTEN 21 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0026e+00, -5.4463e-04, 2.8863e-05, 0; wait clcor; go clcor ANTEN 22 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0827e+00, -3.5720e-03, 3.8554e-05, 0; wait clcor; go clcor ANTEN 22 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0843e+00, -3.2023e-03, 3.0402e-05, 0; wait clcor; go clcor ANTEN 23 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0128e+00, -9.4761e-04, 1.7548e-05, 0; wait clcor; go clcor ANTEN 23 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0171e+00, -1.1278e-03, 1.8630e-05, 0; wait clcor; go clcor ANTEN 24 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0006e+00, -2.0257e-04, 1.6185e-05, 0; wait clcor; go clcor ANTEN 24 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0052e+00, -6.4784e-04, 2.0346e-05, 0; wait clcor; go clcor ANTEN 25 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.1544e+00, -5.4939e-03, 4.8858e-05, 0; wait clcor; go clcor ANTEN 25 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.1562e+00, -4.9965e-03, 3.9952e-05, 0; wait clcor; go clcor ANTEN 26 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0139e+00, -5.9932e-04, 6.4450e-06, 0; wait clcor; go clcor ANTEN 26 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0349e+00, -1.1052e-03, 8.7611e-06, 0; wait clcor; go clcor ANTEN 27 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0721e+00, -3.2668e-03, 3.7017e-05, 0; wait clcor; go clcor ANTEN 27 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0814e+00, -3.1728e-03, 3.0912e-05, 0; wait clcor; go clcor ANTEN 28 0; STOKES = 'R'; BIF=1; EIF=1; CLCOR 1.0475e+00, -2.7296e-03, 3.9182e-05, 0; wait clcor; go clcor ANTEN 28 0; STOKES = 'L'; BIF=1; EIF=1; CLCOR 1.0679e+00, -3.7479e-03, 5.1684e-05, 0; wait clcor; go clcor ANTEN 3 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0952e+00, -3.6508e-03, 3.4987e-05, 0; wait clcor; go clcor ANTEN 3 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0932e+00, -3.4021e-03, 3.1058e-05, 0; wait clcor; go clcor ANTEN 5 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0349e+00, -1.8688e-03, 2.5018e-05, 0; wait clcor; go clcor ANTEN 5 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0506e+00, -2.5861e-03, 3.3034e-05, 0; wait clcor; go clcor ANTEN 6 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0366e+00, -1.8418e-03, 2.3148e-05, 0; wait clcor; go clcor ANTEN 6 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0439e+00, -2.1479e-03, 2.6297e-05, 0; wait clcor; go clcor ANTEN 7 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0885e+00, -3.0416e-03, 2.6144e-05, 0; wait clcor; go clcor ANTEN 7 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1021e+00, -3.6635e-03, 3.2859e-05, 0; wait clcor; go clcor ANTEN 8 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0733e+00, -2.7137e-03, 2.5111e-05, 0; wait clcor; go clcor ANTEN 8 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0660e+00, -2.7656e-03, 2.8964e-05, 0; wait clcor; go clcor ANTEN 9 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0603e+00, -2.8276e-03, 3.3123e-05, 0; wait clcor; go clcor ANTEN 9 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0537e+00, -2.3505e-03, 2.5734e-05, 0; wait clcor; go clcor ANTEN 10 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0680e+00, -2.5326e-03, 2.3597e-05, 0; wait clcor; go clcor ANTEN 10 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0780e+00, -2.7356e-03, 2.4000e-05, 0; wait clcor; go clcor ANTEN 11 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0038e+00, -6.1081e-04, 2.4738e-05, 0; wait clcor; go clcor ANTEN 11 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0013e+00, -3.2866e-04, 2.0822e-05, 0; wait clcor; go clcor ANTEN 12 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.1542e+00, -5.3897e-03, 4.7096e-05, 0; wait clcor; go clcor ANTEN 12 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1697e+00, -5.4965e-03, 4.4510e-05, 0; wait clcor; go clcor ANTEN 13 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0879e+00, -3.2536e-03, 3.0096e-05, 0; wait clcor; go clcor ANTEN 13 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0978e+00, -3.3543e-03, 2.8766e-05, 0; wait clcor; go clcor ANTEN 14 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0951e+00, -3.7295e-03, 3.6572e-05, 0; wait clcor; go clcor ANTEN 14 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1131e+00, -4.1461e-03, 3.7989e-05, 0; wait clcor; go clcor ANTEN 15 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0133e+00, -1.2565e-03, 2.9590e-05, 0; wait clcor; go clcor ANTEN 15 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0287e+00, -2.1583e-03, 4.0544e-05, 0; wait clcor; go clcor ANTEN 16 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.1290e+00, -4.4032e-03, 3.7566e-05, 0; wait clcor; go clcor ANTEN 16 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1271e+00, -3.8777e-03, 2.9574e-05, 0; wait clcor; go clcor ANTEN 18 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0054e+00, -7.9738e-04, 2.9468e-05, 0; wait clcor; go clcor ANTEN 18 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0096e+00, -1.0655e-03, 2.9427e-05, 0; wait clcor; go clcor ANTEN 19 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0332e+00, -1.8055e-03, 2.4575e-05, 0; wait clcor; go clcor ANTEN 19 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0231e+00, -1.5848e-03, 2.7182e-05, 0; wait clcor; go clcor ANTEN 20 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0640e+00, -3.1716e-03, 3.9316e-05, 0; wait clcor; go clcor ANTEN 20 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0821e+00, -3.9846e-03, 4.8341e-05, 0; wait clcor; go clcor ANTEN 21 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0012e+00, -3.5481e-04, 2.5592e-05, 0; wait clcor; go clcor ANTEN 21 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0030e+00, -5.9813e-04, 2.9392e-05, 0; wait clcor; go clcor ANTEN 22 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0808e+00, -3.0505e-03, 2.8788e-05, 0; wait clcor; go clcor ANTEN 22 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0867e+00, -3.1179e-03, 2.8031e-05, 0; wait clcor; go clcor ANTEN 23 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0123e+00, -9.3316e-04, 1.7641e-05, 0; wait clcor; go clcor ANTEN 23 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0124e+00, -8.4600e-04, 1.4434e-05, 0; wait clcor; go clcor ANTEN 24 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0018e+00, -3.4779e-04, 1.6832e-05, 0; wait clcor; go clcor ANTEN 24 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0010e+00, -2.3325e-04, 1.4299e-05, 0; wait clcor; go clcor ANTEN 25 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.1542e+00, -5.4723e-03, 4.8540e-05, 0; wait clcor; go clcor ANTEN 25 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.1595e+00, -5.2800e-03, 4.3689e-05, 0; wait clcor; go clcor ANTEN 26 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0098e+00, -4.8192e-04, 5.8991e-06, 0; wait clcor; go clcor ANTEN 26 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0286e+00, -1.2808e-03, 1.4320e-05, 0; wait clcor; go clcor ANTEN 27 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0767e+00, -3.0371e-03, 3.0066e-05, 0; wait clcor; go clcor ANTEN 27 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0740e+00, -3.0498e-03, 3.1410e-05, 0; wait clcor; go clcor ANTEN 28 0; STOKES = 'R'; BIF=2; EIF=2; CLCOR 1.0501e+00, -2.7363e-03, 3.7359e-05, 0; wait clcor; go clcor ANTEN 28 0; STOKES = 'L'; BIF=2; EIF=2; CLCOR 1.0636e+00, -3.3122e-03, 4.3150e-05, 0; wait clcor; go clcor wait clcor; * Finish * * Proc calgain(i) * * Specialized procedure to calibrate antennas for gain curve * * task 'tacop' getn i inext 'cl' outdi indi geto i inver 1 outver 2; ncount 1 keyword ''; keyval 0 go tacop; wait tacop * task 'clcor' if opacity>0.0 then opcode 'opac'; type ' Correcting for opacity: tau = ', opacity; clcor opacity,0; gainver 2; stokes ''; source ''; go clcor; wait clcor; end * if fqband='K' then fixkgain(i,2); end * type ' Completed CALGAIN ' * Finish * * Proc calbase(i) * * Apply baseline corrections to data * APPLY TO CL 2 * type 'Apply Baseline corrections, valid from Sep17 to Sep26' * * Already done in CALGAIN * task 'tacop' * indi 1; getn i * inext 'cl' * outdi indi * geto i * inver 1 * outver 2; ncount 1 * keyword ''; keyval 0 * go tacop; wait tacop * task 'clcor' indi 1; getn i opcode 'ANTP'; clcorprm 0; gainver 2; stokes ''; source ''; bif 0; eif 0; * * antenn 0, 0; clcor 0.0000,0.0000,0.0000,0,0,0,1; go clcor; wait clcor; antenn 1, 0; clcor -0.0082,0.0010,-0.0073,0,0,0,1; go clcor; wait clcor; antenn 2, 0; clcor 0.0000,0.0015,0.0000,0,0,0,1; go clcor; wait clcor; antenn 4, 0; clcor 0.0021,-0.0011,0.0000,0,0,0,1; go clcor; wait clcor; antenn 5, 0; clcor 0.0000,0.0000,-0.0055,0,0,0,1; go clcor; wait clcor; antenn 8, 0; clcor 0.0059,0.0000,0.0032,0,0,0,1; go clcor; wait clcor; antenn 9, 0; clcor 0.0023,-0.0008,-0.0040,0,0,0,1; go clcor; wait clcor; antenn 10, 0; clcor 0.0031,0.0000,0.0016,0,0,0,1; go clcor; wait clcor; antenn 11, 0; clcor -0.0036,-0.0006,-0.0010,0,0,0,1; go clcor; wait clcor; antenn 12, 0; clcor 0.0039,0.0000,0.0017,0,0,0,1; go clcor; wait clcor; antenn 13, 0; clcor 0.0000,0.0000,0.0032,0,0,0,1; go clcor; wait clcor; antenn 14, 0; clcor 0.0036,0.0000,0.0014,0,0,0,1; go clcor; wait clcor; antenn 16, 0; clcor -0.0081,-0.0015,-0.0030,0,0,0,1; go clcor; wait clcor; antenn 17, 0; clcor -0.0094,-0.0055,0.0183,0,0,0,1; go clcor; wait clcor; antenn 19, 0; clcor 0.0000,-0.0013,-0.0014,0,0,0,1; go clcor; wait clcor; antenn 20, 0; clcor -0.0030,0.0000,-0.0027,0,0,0,1; go clcor; wait clcor; antenn 21, 0; clcor 0.0031,-0.0010,0.0015,0,0,0,1; go clcor; wait clcor; antenn 22, 0; clcor 0.0037,-0.0011,0.0022,0,0,0,1; go clcor; wait clcor; antenn 23, 0; clcor -0.0086,-0.0010,-0.0020,0,0,0,1; go clcor; wait clcor; antenn 26, 0; clcor -0.0049,0.0000,0.0000,0,0,0,1; go clcor; wait clcor; antenn 28, 0; clcor 0.0000,-0.0009,-0.0018,0,0,0,1; go clcor; wait clcor; * type ' Completed baseline corrections with CLCOR ' * Finish * * Proc caldata(i) * * Specialized procedure to calibrate data, possibly with ICLN model. * First do short (typically 10s) phase solutions followed by longer * (~1min) full gain solutions. * clrtemp prtas ''; clrmsg * task 'setjy' indisk 1; getn i optyp '' aparm 0 if absflx(1) = 0.0 then optyp 'calc'; aparm(2) sjparm; end source abscal,'' bif 1; eif 1; zerosp absflx(1) 0 freqid 1 go setjy; wait setjy bif 2; eif 2; zerosp absflx(2) 0 freqid 1 go setjy; wait setjy * * First pass - phase-only * task 'calib' if absmod <> '' then in2n absmod; * Use CC 1 model attached to ABSMOD on Disk 1 type 'Phase calibration using Clean model - restricted data' in2cl iclass; in2seq 1; in2d 1; cmodel 'comp'; cmethod 'dft'; invers 1; flux 0; ncomp 0; nmaps 1; uvr 0; anten 0; basel anten else in2n ''; type 'Phase calibration using Point model - restricted data' in2cl ''; in2seq 0; in2d 0; cmodel ''; cmethod ''; invers 0; flux 0; ncomp 0; nmaps 0; smodel 0; uvr absuvr; anten absant; basel anten end calsour abscal,'' flagver 0; gainuse 0; docalib calimode; refant absref aparm 4 0 cparm 0 0 10 10 0 * * Main calibrator at 20 sec * solmode 'p'; solint 20/60 snver 1 go calib; wait calib * * Normal sources at 20 sec * calsour phacal uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'p'; solint 20/60 snver 1 go calib; wait calib * * Strong sources at 10 sec * if numstrong > 0 then calsour strongcal; calsour strongcal uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'p'; solint 10/60 snver 1 go calib; wait calib end * * Weaker sources at 30 sec * if numweak > 0 then calsour weacal; uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'p'; solint 30/60 snver 1 go calib; wait calib end * * Apply each source to itself * task 'clcal' type 'Applying Self Calibration for ',abscal source abscal,'' calsour source opcode ' ' interp 'simp' gainver 2 gainuse 3 go clcal; wait clcal * for i = 1 to numsrcs; srccal = srclist(i) type 'Applying Self Calibration for ',srccal task 'clcal' source srccal,'' calsour source opcode ' ' interp 'simp' gainver 2 gainuse 3 go clcal; wait clcal end * * Second pass - full gain (amplitude) solutions on longer timescales * task 'calib' if absmod <> '' then in2n absmod; * Use CC 1 model attached to ABSMOD on Disk 1 type 'Amplitude calibration using Clean model - restricted data' in2cl iclass; in2seq 1; in2d 1; cmodel 'comp'; cmethod 'dft'; invers 1; flux 0; ncomp 0; nmaps 1; uvr 0; anten 0; basel anten else in2n ''; type 'Amplitude calibration using Point model - very restricted data' in2cl ''; in2seq 0; in2d 0; cmodel ''; cmethod ''; invers 0; flux 0; ncomp 0; nmaps 0; smodel 0; uvr absuvr; anten absant; basel anten end calsour abscal,'' flagver 0; gainuse 0; docalib calimode refant absref aparm 4 0 cparm 0 0 10 10 0 * * One minute gain solutions * solmode 'a&p'; solint 1 snver 2 go calib; wait calib * * Normal calibrators 1m average * calsour phacal uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'a&p'; solint 1 snver 2 go calib; wait calib * * Strong calibrators with 30s solutions * if numstrong > 0 then calsour strongcal; uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'a&p'; solint 30/60 snver 2 go calib; wait calib end * * Weak calibrators scan average only * if numweak > 0 then calsour weacal; uvr 0 0; anten 0; basel 0 clr2n; invers 0; flux 0; ncomp 0; nmaps 0 solmode 'a&p'; solint 0 snver 2 go calib; wait calib end * * Get fluxes from amplitude solutions * task 'getjy' source srclist calsour abscal,'' anten getant bif 1; eif 2 go getjy anten 0 * * Apply each source to itself * task 'clcal' source abscal,'' if absmod <> '' then calsour source; type 'Applying Self Calibration for ',abscal opcode ' ' anten 0 interp 'simp' gainver 3 gainuse 4 go clcal; wait clcal else calsour source; type 'Applying Self Calibration for ',abscal opcode ' ' anten absant interp 'simp' gainver 3 gainuse 4 go clcal; wait clcal calsour absnot,'' type 'Applying External Calibration for ',abscal anten notant go clcal; wait clcal anten 0 end * for i = 1 to numsrcs; srccal = srclist(i) type 'Applying Self Calibration for ',srccal task 'clcal' source srccal,'' calsour source opcode ' ' anten 0 interp 'simp' gainver 3 gainuse 4 go clcal; wait clcal end * prtas '' outprint predir!!prefix!!'.CALIB' docrt -1 prtmsg docrt 1 * type ' Completed CALDATA ' * Finish * * Proc listcal(i) * * use LISTR 'GAIN' to output amplitude solutions * task 'listr' getn i sources '' optyp 'gain' inext 'sn';inver 2 docalib 1; gainuse 0; dopol -1 dparm 0 0 5 0 docrt -1 antenn 0; basel 0 * bif 1; eif 1; stokes 'r' outpr predir!!prefix!!'-1R.AMPL' go listr; wait listr * bif 1; eif 1; stokes 'l' outpr predir!!prefix!!'-1L.AMPL' go listr; wait listr * bif 2; eif 2; stokes 'r' outpr predir!!prefix!!'-2R.AMPL' go listr; wait listr * bif 2; eif 2; stokes 'l' outpr predir!!prefix!!'-2L.AMPL' go listr; wait listr * docrt 1; outpr ''; inext ''; inver 0 * * use LISTR 'MATX' to examine gain calibration * task 'listr' getn i sources '' stokes 'half' optyp 'matx' docalib 1; gainuse 0; dopol -1 dparm 5,0 docrt 1 * bif 1; eif 1; go listr; wait listr * bif 2; eif 2; go listr; wait listr * bif 1; eif 2; antenn 0; basel 0 * type ' Completed LISTCAL ' * Finish * * Proc calpol(i) clrtemp * indisk 1 getn i task 'pcal' calsour polcal bif 1; eif 2 docalib 1; gainuse 0 solint 2 refant absref anten 0 soltyp ''; bparm 0; cparm 0 prtas ''; clrmsg go pcal; wait pcal prtas 'pcal' outprint predir!!prefix!!'.PCAL' docrt -1 prtms docrt 1 * task 'listr' sour abscal,'' uvr absuvr; anten absant; basel anten docalib 1; gainuse 0 dopol 1 optyp 'matx' stokes 'polc' dparm 5 0 docrt -1 outprint predir!!prefix!!'-'!!absnam!!'.POLC' bif 1 go listr; wait listr bif 2 go listr; wait listr docrt 1 uvr 0 0; anten 0; basel anten; stokes ' '; optyp ' ' * clrtemp getn i task 'listr' sour srclist uvra 0 0 docalib 1; gainuse 0 dopol 1 optyp 'matx' stokes 'polc' dparm 5 0 docrt -1 outprint predir!!prefix!!'-ALLCAL.POLC' bif 1 go listr; wait listr bif 2 go listr; wait listr docrt 1 * type ' Completed CALPOL ' * Finish * * Proc outrms * * short proc to use IMSTAT for current image to output the off-source * statistics for I,Q,U images in IF 1 and 2 for the current source name * SOURCE(1). * * Expects BLC,TRC for off-source window stored in RMSBOX clrtemp inna source(1) blc rmsbox(1), rmsbox(2), 0; trc rmsbox(3), rmsbox(4), 0 * * IF 1 data, INSEQ=7 * inseq 7; type 'IF 1 Off-source image statistics for source '!!inna incl iclass; imstat; type inna!!' IF=1 I RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl qclass; imstat; type inna!!' IF=1 Q RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl uclass; imstat; type inna!!' IF=1 U RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl vclass; imstat; type inna!!' IF=1 V RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' * * IF 2 data, INSEQ=8 * inseq 8; type 'IF 2 Off-source image statistics for source '!!inna incl iclass; imstat; type inna!!' IF=2 I RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl qclass; imstat; type inna!!' IF=2 Q RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl uclass; imstat; type inna!!' IF=2 U RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' incl vclass; imstat; type inna!!' IF=2 V RMS: FLUX = '!!CHAR(pixstd*1000.0)!!' milliJy ' * Finish * * Proc setang (angle) * * Set vector angle into -180 to 180 deg range of validity * if angle < -180.0 then angle = angle + 360.0; end if angle > 180.0 then angle = angle - 360.0; end * Finish * * Proc outstat (angle1,angle2) * * short proc to use IMSTAT for current image to output the polarization * angles for IF 1 and 2 for the current source name SOURCE(1) * Should have already set BLC,TRC for window (or 0,0 for whole map) * * NOTE: Polarization angles output by COMB are 1/2 the R/L phase difference * and thus run from -90 to +90 degrees * clrtemp inna source(1); * * IF 1 data, INSEQ=7 * type 'IF 1 On-source image statistics for source '!!inna incl iclass; inseq 7; imstat; type inna!!' IF=1 I Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' type inna!!' IF=1 I Max: at ('!!CHAR(pixxy(1))!!','!!CHAR(pixxy(2))!!')' flxtot1 = pixval*1000.0 * incl qclass; imval; type inna!!' IF=1 Q Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl uclass; imval; type inna!!' IF=1 U Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl vclass; imval; type inna!!' IF=1 V Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl 'POLC'; imval; type inna!!' IF=1 P Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' fpol1 = pixval*1000.0 incl 'POLC N'; imval; type inna!!' IF=1 P Max: Noise = '!!CHAR(pixval*1000.0)!!' milliJy ' spol1 = pixval*1000.0 incl 'POLA'; imval; type inna!!' IF=1 P Max: Angle = '!!CHAR(pixval)!!' Deg ' angle1 = pixval incl 'POLA N'; imval; type inna!!' IF=1 P Max: Error = '!!CHAR(pixval)!!' Deg ' * type inna!!' IF=1 Poln Flux = '!!CHAR(fpol1)!!' +/- '!!CHAR(spol1)!!' mJy ' type inna!!' IF=1 Frac Poln = '!!CHAR(100.0*fpol1/flxtot1)!!' % ' * * IF 2 data, INSEQ=8 * inna source(1); type 'IF 2 On-source image statistics for source '!!inna incl iclass; inseq 8; imstat; type inna!!' IF=2 I Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' type inna!!' IF=2 I Max: at ('!!CHAR(pixxy(1))!!','!!CHAR(pixxy(2))!!')' flxtot2 = pixval*1000.0 * incl qclass; imval; type inna!!' IF=2 Q Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl uclass; imval; type inna!!' IF=2 U Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl vclass; imval; type inna!!' IF=2 V Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' incl 'POLC'; imval; type inna!!' IF=2 P Max: Flux = '!!CHAR(pixval*1000.0)!!' milliJy ' fpol2 = pixval*1000.0 incl 'POLC N'; imval; type inna!!' IF=2 P Max: Noise = '!!CHAR(pixval*1000.0)!!' milliJy ' spol2 = pixval*1000.0 incl 'POLA'; imval; type inna!!' IF=2 P Max: Angle = '!!CHAR(pixval)!!' Deg ' angle2 = pixval * incl 'POLA N'; imval; type inna!!' IF=2 P Max: Error = '!!CHAR(pixval)!!' Deg ' * type inna!!' IF=2 Poln Flux = '!!CHAR(fpol2)!!' +/- '!!CHAR(spol2)!!' mJy ' type inna!!' IF=2 Frac Poln = '!!CHAR(100.0*fpol2/flxtot2)!!' % ' * * Compute phase diff between IF 1 and 2 phdiff = 2.0*(angle1 - angle2); setang( phdiff ) type inna!!' IF=1-2 RL Phase Difference = '!!CHAR(phdiff)!!' Deg ' * Finish * * Proc outpol(i) * * Maps sources, calculates polarizations and angles and writes them out * clrtemp task 'imagr' indi 1 getn i docalib 1; gainuse 0; dopol 1 *** This has to change for different configs and bands imsize 256; cell abcell *** No need to clean the entire map either nbox numbox; clbox absbox, 0 *** uvwtfn ' ' cmethod ''; flagver 0; bchan 1; echan 0; subar 0; clr2n; nfield 1 bmaj 0; bmin 0; bpa 0; cparm 0 dotv false baddis 2 0 * * Do ABSCAL first to establish angle setting source abscal,'' * use restricted antennas and possibly uvrange uvra 0; anten 0; basel anten; cell abcell zerosp 0 outver 0 tput imagr mapem indi 2 prtas ''; clrmsg outrms blc absbox(1), absbox(2), 0; trc absbox(3), absbox(4), 0 outstat(angle1, angle2) * These angles are 1/2*RL phase diff * At X band the RL phase of ABSCAL is ABSANG deg corang1 = absang - 2.0*angle1; setang( corang1 ) corang2 = absang - 2.0*angle2; setang( corang2 ) * These correction factors are the instrumental R/L phase difference * correction factors ANGLE(TRUE) - ANGLE(OBS) * so we can just add these to the observed R/L angles for the sources type source(1)!!' IF=1 RL Phase Angle = '!!CHAR(absang)!!' Deg ' type source(1)!!' IF=2 RL Phase Angle = '!!CHAR(absang)!!' Deg ' type source(1)!!' IF=1 RL Phase Correction = '!!CHAR(corang1)!!' Deg ' type source(1)!!' IF=2 RL Phase Correction = '!!CHAR(corang2)!!' Deg ' outprint predir!!source(1)!!'-'!!prefix!!'.TXT' docrt -1; prtmsg; docrt 1; outprint '' for j=1 to 24; getn j; zap; end * * Loop over other calibrators * for i = 1 to numsrcs; * clrtemp tget imagr srccal = srclist(i) * type 'Imaging data from source ',srccal * source srccal,'' indi 1 uvra 0 0; anten 0; basel 0; cell abcell tput imagr mapem indi 2 prtas ''; clrmsg outrms blc absbox(1), absbox(2), 0; trc absbox(3), absbox(4), 0 outstat(angle1, angle2) polang1 = 2.0*angle1 + corang1; setang( polang1 ) polang2 = 2.0*angle2 + corang2; setang( polang2 ) type source(1)!!' IF=1 RL Phase Angle = '!!CHAR(polang1)!!' Deg ' type source(1)!!' IF=2 RL Phase Angle = '!!CHAR(polang2)!!' Deg ' outprint predir!!source(1)!!'-'!!prefix!!'.TXT' docrt -1; prtmsg; docrt 1; outprint '' for j=1 to 24; getn j; zap; end * end * type ' Completed Polarization Calibration Run ' type ' Results can be found in *'!!prefix!!'.TXT files ' * Finish