VLA ANGST AIPS Reduction Recipe - Galactic HI case =================================================== Based on LITTLE THINGS AIPS Reduction of DDO47 recipe, B configuration. 1a) FILLM *** *** Reads the data into AIPS. *** *** Unlike before, we need to keep the FREQIDs separate so that *** we can later use CVEL or at least have the correct frequencies *** in the header. *** *** This may get tricky for D-configuration observations where *** we will have multiple galaxies in the same file. Because there *** are QUAL values, we'll have to read in by time range and *** append to FILLM. *** So first read the data in normally, figure out what *** TIMERANG you need to set to get JUST the data you want, *** and read them in that way. You'll have to set DOCONCAT=1 *** *** This has some non-transparent tricks associated with it that *** (I believe) has to do with the difference between how the VLA *** records scan times (at the end of the scan) and how FILLM *** records scan times (in the middle of the scan). *** *** In order to get all of the data, read in everything once with *** FILLM. Note the time ranges of data that you want. To adapt *** the timeranges printed by LISTR to the timeranges needed by *** FILLM, do the following: *** *** - the first half of the time range (timerang x x x x 0 0 0 0) *** will be just what you see in LISTR for the first scan. *** *** - the second half of the time range (timer 0 0 0 0 x x x x) *** will be the time you see in LISTR for the last scan PLUS *** FIVE SECONDS. *** *** DEFAULT FILLM INTAPE 1; NFILES 0; BAND ' '; QUAL -1; CALCODE ' '; VLAOBS ' '; VLAMODE ' '; REFDATE ' '; TIMERANG 0; BCHAN 1; ECHAN 0; OUTNAME ' '; DOUVCOMP -1; DOCONCAT -1; NCOUNT 0; DOACOR -1; CPARM 0; DPARM 0; BPARM -1, -1; IN2FILE ' '; OUTDISK 5; DOALL -1 $ restricts FILLM to the galaxy+calibrators of $ interest DOUVCOMP= -1 $ allow channel/IF-dependent weights DOWEIGHT 10 $ use memo 108 weights (i.e., put weights $ in 1/Jy^2) BPARM= -1,-1 $ avoid opacity & gain corrections CPARM 0 CPARM(7)= 0.1 $ assigns new FREQID if frequency changes by $ more than the max. Doppler shift between $ sources 180 degrees apart. Setting this $ to -1 forces all data to have same FREQID. CPARM(4)=25.1 $ for shadowing to work properly timerang 0 $ change this to the timerange bracketing the $ data you want. doconcat=-1 $ Change this to DOCONCAT=1 to add data to an $ existing file (after you read in the first $ timerange geto $ Only run this step if you have DOCONCAT=1. $ You can grab either the CH 0 or the LINE $ data; it doesn't matter. infile ':raw_ ***N.B. FILLM's channel 0 will ONLY be used for initial flagging. *** Run UVSRT/INDXR with cparm(3) = -1 on both line and ch0: 1b) UVSRT *** If you've concatenated files, you must run UVSRT on both the *** CH0 and LINE data: DEFAULT UVSRT INDISK 5 OUTDISK 5 SORT 'TB' OUTCLASS 'CH 0' outname '--' getn $ *.CH 0 DEFAULT UVSRT INDISK 5 OUTDISK 5 SORT 'TB' OUTCLASS 'LINE' outname '--' getn (+1) $ *.LINE 1c) INDXR *** *** Then run INDXR on both CH 0 and LINE to make a new NX table, *** but not a new CL table. *** DEFAULT INDXR INDISK 5 cparm(3) = -1 getn (+2) $ *.CH 0.2 DEFAULT INDXR INDISK 5 cparm(3) = -1 getn (+3) $ *.LINE.2 1d) LISTR/SCAN *** *** Make sure you have the correct data. *** *** If so, copy the output to here. If not, then start over. *** DEFAULT LISTR INDISK 5; INEXT ''; INVER 0; SOURCES ''; CALCODE ''; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; BIF 0; EIF 0; BCHAN 1; ECHAN 0; ANTENNAS 0; BASELINE 0; UVRANGE 0, 0; SUBARRAY 0; DOCALIB -1; GAINUSE 0; DOPOL -1; BLVER -1; FLAGVER 0; DOBAND -1; BPVER -1; SMOOTH 0; DPARM 0; DOACOR -1; FACTOR 0; BADDISK 0; OPTYPE 'scan' DOCRT 132 $ if you want a file: docrt -1 OUTPR '' $ and: $ outpr ':.listr getn (+2) $ *.CH 0.2 *** Make sure you copy your calibrator info from the online manual: ===> CALIBRATORS: Primary: 1331+305 = 3C286 0137+331 = 3C48 0542+498 = 3C147 Secondary: 1e) ZAP the old files getn ; zap getn (+1); zap recat 1f) FITTP *** *** Because you just put so much work into step 1a, feel free to *** save your data outside of aips in case of disk failures or *** unexpected loss of data. *** *** Really, you probably deserve a beer after just that. *** 2) UVCOP *** *** Discards the first and last channels *** If 127 channels total: bchan 5, echan 127-5 *** If 255 channels total: bchan 10, echan 255-10 *** *** We discard these EVIL CHANNELS because (1) they're pretty much *** useless; (2) they seem to confuse BPASS (which takes the *** solution from channel N as the initial guess for channel N+1) *** as some EVLA antennas have high spikes in the first few *** channels; (3) their noise characteristics are quite different *** from the rest of the channels, which can be confusing e.g. in *** clipping and imaging. *** DEFAULT UVCOP INDISK 5; OUTSEQ 0; OUTDISK 5; SELBAND -1; SELFREQ -1; FREQID -1; BIF 0; EIF 0; SOURCES ' '; QUAL -1; UVRANGE 0, 0; TIMERANG 0; ANTENNAS 0; BASELINE 0; SUBARRAY 0; FLAGVER 1; NCOUNT 0; OUTCLA 'LINCOP' $ new outclass to keep separate from other line data OUTDISK 5 $ more space on disk 5 UVCOPPRM 0 UVCOPPRM(4) 1 $ report progress bchan 10; $ bchan = 5 if 127 channels total echan 255-10; $ echan = 127-5 if 127 channels total getn (+1) $ *.LINE 3a) VLANT -> LINE *** *** *** Note: The NEW version of VLANT does NOT use FREQID so this will *** no longer be an issue. If you are still using an older version *** of VLANT, you will have to jump through these hoops. *** *** DEFAULT VLANT INDISK 5; getn (+1) $ *.LINE *** ----------------------------------------------------------- *** *** Note that VLANT can be run only for data observed from 1992 *** onwards. This is okay for VLA-ANGST because we're not using *** anything from before 1997 or something. *** *** As of 10oct08, VLANT only works on one FREQID at a time. This *** is where it starts to get tricky... *** *** We have to run VLANT multiple times for data with multiple *** FREQIDs. Unfortunately VLANT (1) produces a new CL table every *** time, and (2) updates the AN table positions every time as *** well. *** *** Michael Rupen would like to maintain the convention that CL/1 *** is the oritinal CL table and CL/2 has all the corrections that *** should have been applied on-line but weren't -- mainly antenna *** position corrections. For multiple FREQIDs therefore this *** recipe calls for deleting the intermediate CL tables created *** by VLANT, using the rather clumsy mechanism of TASAVing to a *** temporary file, deleting the original CL tables, and copying *** the latest one back from the TASAV'd data set. Blah. *** *** As for the AN table.. for now, this recipe resets the original *** AN table just before running VLANT the last itme. This means *** only one run of VLANT updates the AN entries, leading to a *** correct AN table as needed for (e.g.) UVFIX. *** *** Michael Rupen has emailed DAIP to see about fixing this. We'll *** see what Eric Greisen says. *** *** First, save the tables: DEFAULT TASAV OUTCLASS 'LINSAV' OUTDISK 2 outname '' getn (+1) $ *.LINE *** Second, set up VLANT: *** and run it for FREQIDs 1 through nfreq-1 (ie, 1 and 2) DEFAULT VLANT INDISK 5 getn (+2) $ *.LINCOP for i=1, 2; freqid i;go vlant;wait;end *** Then run VLANT for FREQIDs 1 through nfreq-1: (ie, 1 and 2) *** Reset AN table: getn (+2) $ *.LINCOP INEXT 'AN' ; INVER 0 ; EXTDES DEFAULT TACOP INDISK 2 OUTDISK 5 INEXT 'AN' getn $ *.LINSAV getona (+2) $*.LINCOP *** Then run VLANT for the last FREQID. DEFAULT VLANT INDISK 5 freqid = 3 $ or the last freqid. getn (+2) $ *.LINCOP *** TASAV to a temporary file DEFAULT TASAV OUTCLASS 'TMPSAV' INDISK 5 OUTDISK 5 getn (+2) $ *.LINCOP *** Delete all but the first CL table. (You should run this step *** 3 times. If it asks you to delete CL table 1, just say NO.) INDISK 5 INEXT 'CL'; INVER 0 getn (+2) $ *.LINCOP extdest extdest extdest *** Copy over the last CL table from the TMPSAV data set. DEFAULT TACOP INDISK 5; OUTDISK 5; INEXT 'CL'; INVER 0; NCOUNT 1 getn (+3) $ *.TMPSAV geto (+2) $ *.LINCOP *** Delete the temporary save. getn (+3); zap $ *.TMPSAV *** There is no way in hell we're going through this on the *** original CH 0 data. 3b) IF VLANT does not create a new CL table.. *** *** You will usually not have to run this step. It's just to keep *** the recipe uniform (ie, using CL table 2 from now on). *** DEFAULT TACOP INDISK 5; OUTDISK 5 INEXT 'CL'; INVER 1; NCOUNT 1; OUTVER 2 getn (+2) $ *.LINCOP geto (+2) $ *.LINCOP 4) PRTAN *** *** Print out the placement of antennas for choosing a refant. Copy *** the list to the reduction file for future reference. *** *** Choose a refant using the following algorithm: *** *** 1. must be present throughout the entire run. *** 2. should be on an "inner" pad, but NOT N1/E1/W1 (avoid *** shadowing) *** 3. NOT on the master pad (they're always weird) *** 4. NOT an EVLA antenna (can't trust 'em) *** 5. avoid the north arm in smaller configurations (shadowing) *** 6. NOT listed in any interesting way in the log file *** 7. preferably consistent with other recent runs *** 8. should be a fairly stable antenna (can't tell until *** TVFLG/CALIB of course...) *** *** REFANT => DEFAULT PRTAN INDISK 5 DOCRT 132 getn (+2) $ *.LINCOP 5) SETJY *** If we have more than one FREQID, we assume that the frequency *** offsets used are small, so that the flux densities of the *** flux calibrators are nearly the same for each FREQID. Typical *** frequency offsets are of order the bandwidth, +/- 3 MHz; at *** 1420 MHz, for a worst-case spectral index of -1, this leads to *** an error of 2*3 MHz / 1420 MHz = 0.4% -- not worth worrying *** about. So we use any FREQID which covers all primary flux *** calibrators. If flux calibrator A is observed only with FREQID *** 1, while flux calibrator B is observed only with FREQID 2, we *** would have to run SETJY twice. This should not be the case.. *** DEFAULT SETJY INDISK 5 OPTYPE 'CALC'; APARM 0,0 $ data taken after 1998 freqid 1 $ FREQID for A sources '','' $ primary (flux) calibrator A getn (+2) $ *.LINCOP *** If for some reason you observed the other calibrator with *** a different freqid, then: DEFAULT SETJY INDISK 5 OPTYPE 'CALC'; APARM 0,0 $ data taken after 1998 freqid 2 $ FREQID for B sources '','' $ primary (flux) calibrator B getn (+2) $ *.LINCOP 6) CALRD *** *** If you haven't loaded in calibrator models, might as well do it *** now. We will load these into disk 1 so it doesn't mess up getn *** numbers. *** *** These models are in J2000 coordinates. If your data are in *** B1950, change the model images to B1950 with EPOSWITCH. *** DEFAULT CALRD OUTDISK 1 object '3c286' band 'l' DEFAULT CALRD OUTDISK 1 object '3c48' band 'l' DEFAULT CALRD OUTDISK 1 object '3c147' band 'l' 7) PRTUV *** *** Use to find integration times on calibrators and source. *** DEFAULT PRTUV INDISK 5; SOURCES ''; CHANNEL 0; BIF 0; BPRINT 1; NPRINT 0; XINC 1; UVRANGE 0, 0; CPARM 0; DPARM 0; DOCRT 132; OUTPRINT ''; DOEBAR -1; cparm(9) = 103 $ Pick a baseline.. this is baseline 1(*100) + 3 getn (+2); $ *.LINCOP 8) TVFLG -> FG/1 *** *** We are no longer QUACKing because the NX table made by FILLM is *** incorrect. Plus, it doesn't flag the on-source antennas when *** not all antennas are on-source. We will have to chop off the *** raggedy edges this creates by hand using TVFLG. *** *** We will run TVFLG once on each calibrator, individually. Make *** sure the FREQID corresponds to the correct calibrator. *** *** Within TVFLG: *** *** - Set useful defaults: *** - SMOOTH = 1 to avoid averaging date before displays *** - SCAN = 20 to use a long time for AMP/PHS DIFF *** - FLAG ALL CHANNELS *** - FLAG STOKES FULL *** - SWITCH SOURCE FLAG to ONE-SOURCE to avoid accidentally *** flagging your galaxy. Sometimes you will WANT to flag *** your galaxy, however. *** *** - Be sure to inspect both polarizations *** *** We (ie Michael Rupen!) suggest the following steps: *** *** 1) Set the above defaults *** *** 2) Flag the first integration in every scan (manual QUACK) - *** this should be the first integration AFTER most antennas are *** on source, which is why we can't use the usual QUACK. *** *** 3) Inspect the following: *** - AMPLITUDE to check for missing records or antennas *** - AMP DIFF to check for variable gains *** - PHS DIFF to check for variable atmosphere/gains *** *** The flux calibrator will be observed at two offset *** frequencies and therefore we will run TVFLG once for each. DEFAULT TVFLG INDISK 5;DOCAT -1; IN2SEQ 0; IN2DISK 0; DOHIST -1; SOURCES ''; CALCODE ''; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; BIF 0; EIF 0; BCHAN 1; ECHAN 0; NCHAV 1; CHINC 1; ANTENNAS 0; BASELINE 0; UVRANGE 0, 0; SUBARRAY 0; DOCALIB -1; GAINUSE 2; DOPOL -1; BLVER -1; FLAGVER 1; OUTFGVER 1; DOBAND -1; BPVER -1; SMOOTH 0; dparm(3) = 1 $ Show baselines twice, treat all antennas the $ same. this shows baseline 27-1 as well as $ 1-27 dparm(6) = 10 $ set to calibrator's integ. time in seconds $ (use prtuv to get this) freqid 1 $ Make sure you run this for both the +/- source '' getn () $ *.CH 0 go tvflg freqid 2; go tvflg *** Your phase cal should have yet another freqid (probably 3) DEFAULT TVFLG INDISK 5;DOCAT -1; IN2SEQ 0; IN2DISK 0; DOHIST -1; SOURCES ''; CALCODE ''; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; BIF 0; EIF 0; BCHAN 1; ECHAN 0; NCHAV 1; CHINC 1; ANTENNAS 0; BASELINE 0; UVRANGE 0, 0; SUBARRAY 0; DOCALIB -1; GAINUSE 2; DOPOL -1; BLVER -1; FLAGVER 1; OUTFGVER 1; DOBAND -1; BPVER -1; SMOOTH 0; dparm(3) = 1 $ Show baselines twice, treat all antennas the $ same. this shows baseline 27-1 as well as $ 1-27 dparm(6) = 10 $ set to calibrator's integ. time in seconds $ (use prtuv to get this) freqid 3 $ make sure this matches the phase cal source '' getn () $ *.CH 0 9) UVFLG -> FG/1 *** *** Toss the EVLA-EVLA baselines, to avoid dealing with aliasing. *** *** IF you are using archival data with no EVLA antennas, DO NOT *** RUN THIS. Check that "print evla" != 0. *** DEFAULT UVFLG INDISK 5; INFILE ''; SOURCES ''; SUBARRAY 0; SELBAND -1; SELFREQ -1; FREQID 1; TIMERANG 0; BCHAN 1; ECHAN 0; BIF 0; EIF 0; ANTENNA=EVLA; BASELINE=EVLA; STOKES ''; OUTFGVER 1; APARM 0; OPCODE 'FLAG'; REASON 'EVLA'; DOHIST -1; getn () $ *.CH 0 10) TABED -> FG/1 *** *** Instead of TACOP, use TABED. This way we can guarantee that *** flags are applied to the correct freqid. Change the freqid *** column so that flags apply to ANY freqid. Phew. *** DEFAULT TABED INDISK 5; OUTDISK 5 OPTY 'REPL' $ replace entry INEXT 'FG' $ in flag table INVER 1 ; NCOUNT 1 ; OUTVER 1 APARM 0 APARM(1) 3 $ Changing column 3 = FREQID KEYVAL= -1,0 $ ...to FREQID= -1 getn () $ *.CH 0 getona (+2) $ *.LINCOP 11) BPASS *** *** Here's where things start to get ugly. In Socorro, we *** discovered an issue with the obs2script/Executor putting *** us on the edge of the LO bandwidth, so we are going to see *** the filter response in our positively-offset bandpass for *** the flux calibrator. This means we probably cannot use the *** positive offset at all.. the negative offset should be okay. *** *** The overall plan for multiple FREQIDs is as follows. *** This assumes that FREQIDs 1 and 2 refer to the offset bandpass *** calibrator, and FREQID 3 refers to that of the galaxy and *** phase calibrator. *** *** 1) Run BPASS once for FREQID=1 (-> BP/1) and once for *** FREQID=2 (-> BP/2) *** *** 2) Check both BP tables with POSSM. They should look *** virtually identical (but probably won't). *** a) If they do appear identical, we concatenate them: *** - write out both tables [TBOUT] *** - concatenate the two [vi/emacs] *** - read them back in [TBIN] as BP/3 *** b) IF they do NOT appear identical, there is Something *** Wrong. The case we've come across involves the use *** of a front-end filter combined with the use of *** unexpected LOs (see Adrienne's note), so that one *** FREQID was observed through the edge of the filter. *** The resulting bandpasses show a strong slope in the *** amplitude gains for most VLA antennas. So far we've *** seen this only for central frequencies around *** 1423 MHz. In this case, simply copy the "good" BP *** table to BP/3 using TACOP. *** 5) Modify BP/3 to refer to FREQID 3 [TABED] *** *** It is a VERY good idea to use POSSM carefully throughout to be *** sure you're doing what you think you're doing. *** First, run BPASS on FREQID 1 DEFAULT BPASS INDISK 5 DOCAL 1 ; GAINUSE 2 $ apply VLANT changes. Probably irrelevant. FLAGVER 1 $ apply initial flags QUAL -1 SOLINT 0 $ one solution per scan MINAMPER 7 ; MINPHSER 7 $ report closures > 7%/7d SMOOTH 0 $ no smoothing SOLTYPE '' ; WEIGHTIT 0 $ L1, L1R, etc. seem _less_ stable -- weird BPASSPRM 0 BPASSPRM(5) 0 $ derive "channel 0" on a record-by-record basis $ more biased than averaging first, but avoids $ some subtle pitfalls (see EXPLAIN file) BPASSPRM(2) 1 $ some closure info is printed BPASSPRM(6) 2 $ print avg. closure errors > 2% BPASSPRM(7) 2 $ print avg. closure errors > 2d ICHANSEL 0 $ derive channel 0 from inner 3/4 of the band refant $ Change this to your refant freqid 1 $ 1st offset FREQID calsour '','' $ Select bandpass calibrators getn (+2) $ *.LINCOP go bpass *** Now run it on FREQID 2 to make BP/2 freqid 2; bpver 2; go bpass *** Use POSSM to compare results DEFAULT POSSM INDISK 5 FLAGVER 1 APARM 0, 1, 0.7, 1.3, -180, 180, 0, 2, 0, 0 SOLINT -1 NPLOTS 9 BPARM 0 DOTV 1 source '0137+331','0542+498','1331+305','' getn (+2) $ *.LINCOP freqid 1; bpver 1; grch 1; go possm $ then hit D freqid 2; bpver 2; grch 2; go possm $ do they match?? *** IF they appear identical, concatenate them to form BP/3: *** Write the two tables to disk: DEFAULT TBOUT INDISK 5 DOCRT 500 getn (+2) $ *.LINCOP inext 'bp'; inver 1; outfile ':bp1.out go tbout inext 'bp'; inver 2; outfile ':bp2.out go tbout *** OUTSIDE OF AIPS: Concatenate the two tables. cd cat bp1.out bp2.out > bp3.out emacs bp3.out - change NAXIS2 to be equal to the *sum* of NAXIS2 in the two tables - delete from first ***END*PASS*** through ***BEGIN*PASS***, inclusive. *** Read the new concatenated table in as BP/3 DEFAULT TBIN INDISK 5 infile ':bp3.out geto (+2) $ *.LINCOP *** IF they are not identical, pick the one that best matches the *** behavior of the phase calibrator (possibly by doing a quick *** BPASS on the phase calibrator and comparing the results), *** and copy that BP table to BP/3 DEFAULT TACOP INDISK 5; OUTDISK 5 INEXT 'BP' OUTVER 3 NCOUNT 1; inver 1 $ set this to the "good" BP table. getn (+2) $ *.LINCOP *** Now the two recipes match up. *** TABED BP/3 to set FREQID=-1 (so we can use the same BP table *** for everyone) --> makes BP/4 DEFAULT TABED INDISK 5; OUTDISK 5 OPTYPE 'REPL' INEXT 'BP' INVER 3; OUTVER 4 APARM 0 APARM(1) = 8 $ changing column 8 = FREQID KEYVAL = -1,0 $ ... which we change to FREQID=-1 getn (+2) $ *.LINCOP 12a) POSSM *** *** CHECK the final BP table on the phase calibrator by plotting *** the BP table itself. *** DEFAULT POSSM INDISK 5; QUAL -1; CALCODE ''; SELBAND -1; SELFREQ -1; FREQID 1; UVRANG 0, 0; TIMERANG 0; STOKES ''; BIF 0; EIF 0; BCHAN 1;ECHAN 0; SUBARRAY 0; ANTENNAS 0; BASELINE 0; DOCALIB -1; GAINUSE 2; DOPOL -1; BLVER -1; DOBAND -1; BPVER 1; SMOOTH 0; SHIFT 0, 0; CODETYPE ''; POLPLOT ''; BPARM 0; OUTFILE ''; LTYPE 3; FACTOR 0; XYRATIO 0; BADDISK 0; GRCHAN 0; FLAGVER 1 APARM 0, 1, 0.7, 1.3, -180, 180, 0, 2, 0, 0 $ Plot BP SOURCE '0137+331','0542+498','1331+305','' $ POSSM doesn't work with $ source '' for some $ reason! SOLINT -1 $ Separate plots for each scan NPLOTS 9 $ 9 plots per page BPARM 0 DOTV 1 FREQID -1; BPVER 4; getn (+2) $ *.LINCOP tvinit 12b) POSSM *** *** Check bandpass solutions by applying BP table to the secondary *** calibrator and plot individual baselines. *** *** I'm not sure what we're looking for but we'll keep it in the recipe. DEFAULT POSSM INDISK 5; QUAL -1; CALCODE ''; SELBAND -1; SELFREQ -1; FREQID 1; UVRANG 0, 0; TIMERANG 0; STOKES ''; BIF 0; EIF 0; BCHAN 1;ECHAN 0; SUBARRAY 0; ANTENNAS 0; BASELINE 0; DOCALIB -1; GAINUSE 2; DOPOL -1; BLVER -1; DOBAND -1; BPVER 1; SMOOTH 0; SHIFT 0, 0; CODETYPE ''; POLPLOT ''; BPARM 0; OUTFILE ''; LTYPE 3; FACTOR 0; XYRATIO 0; BADDISK 0; GRCHAN 0; FLAGVER 1 APARM 0 $ Plot data SOLINT -1 $ Separate plots for each scan NPLOTS 9 $ 9 plots per page APARM 0 APARM(1) 1 $ vector average DOCAL 1 ; GAINUSE 2 ; DOBAND 1 $ average all BP entries DOTV 1 FREQID 3; BPVER 4; source='','' $ Secondary (phase) calibrator getn (+2) $ *.LINCOP 12c) POSSM *** *** Apply BP table to secondary calibrator and vector-average all *** data. *** *** Your secondary calibrator should be quite flat in both *** amplitude and phase as a function of frequency, with no slope. *** If some channels are off, note which ones those are and keep an *** eye out for interference or other bad data. *** If there are large errors consider running BPASS on the *** secondary calibrator and using that to correct the galaxy. Note *** that this will be somewhat painful since AIPS does not allow *** incremental BP tables -- unlike SN or CL tables. Sigh. *** *** *** Also note whether or not you see effects from Galactic HI. *** It can be either in emission or absorption. *** You should flag these channels using UVFLG. DEFAULT POSSM INDISK 5; QUAL -1; CALCODE ''; SELBAND -1; SELFREQ -1; FREQID 1; UVRANG 0, 0; TIMERANG 0; STOKES ''; BIF 0; EIF 0; BCHAN 1;ECHAN 0; SUBARRAY 0; ANTENNAS 0; BASELINE 0; DOCALIB -1; GAINUSE 2; DOPOL -1; BLVER -1; DOBAND -1; BPVER 1; SMOOTH 0; SHIFT 0, 0; CODETYPE ''; POLPLOT ''; BPARM 0; OUTFILE ''; LTYPE 3; FACTOR 0; XYRATIO 0; BADDISK 0; GRCHAN 0; FLAGVER 1 APARM 0 $ Plot data SOLINT 0 $ average all time NPLOTS 0 $ average all baselines APARM 0 APARM(1) 1 $ vector average DOCAL 1 ; GAINUSE 2 ; DOBAND 1 $ average all BP entries DOTV 1 FREQID 3; BPVER 4 $ for multi-FREQID data sets source='','' $ Secondary (phase) calibrator getn (+2) $ *.LINCOP tvinit 13) UVFLG *** *** If you see effects of Galactic HI in your phase *** calibrator after applying the bandpass solutions, then *** flag those channels in the LINCOP data for JUST your *** phase calibrator. *** DEFAULT UVFLG INDISK 5; OUTFGVER 1 OPCODE 'FLAG' bchan echan sources '','' 14) AVSPC *** *** Make a new channel 0 with AVSPC because the one created *** by FILLM is messsed up. *** *** We will use the NEWCH0 files for (1) further flagging, and *** (2) time-dependent gain calibration. *** *** AVSPC must be run once for each FREQID (unfortunately *** FREQID=-1 purports to work but creates an empty data set.) *** This entails some nasty bookkeeping for data sets with *** multiple FREQIDs. Here I assume we have three FREQIDs. If *** BPASS checks above show that one FREQID is useless, you *** should ignore that one entirely in all subsequent processing. *** However, in order to keep the recipe uniform, we will create *** an AVSPCed file for it. *** (1) FREQID=1 -> NEWCH0.1 (cat. no. +3) DEFAULT AVSPC INDISK 5; SOURCES ''; QUAL -1; CALCODE ''; STOKES ''; TIMERANG 0; SELBAND -1; SELFREQ -1; FREQID -1; SUBARRAY 0; BIF 0; EIF 0; DOPOL -1; BLVER -1; BPVER 1; SMOOTH 0; DOACOR -1; OUTNAME ''; OUTCLASS ''; OUTSEQ 0; OUTDISK 5; ICHANSEL 0; AVOPTION ''; CHANNEL 0; DOBAND 1; BPVER 4 $ do bandpass calibration with $ bp table 4 DOCALIB -1; GAINUSE 0; FLAGVER -1 $ do NOT apply flags. OUTCL 'NEWCH0' FREQID 1 $ first freqid. blech. getn (+2) $ *.LINCOP *** (2) FREQID=2 -> NEWCH0.2 (cat. no. +4) DEFAULT AVSPC INDISK 5; SOURCES ''; QUAL -1; CALCODE ''; STOKES ''; TIMERANG 0; SELBAND -1; SELFREQ -1; FREQID -1; SUBARRAY 0; BIF 0; EIF 0; DOPOL -1; BLVER -1; BPVER 1; SMOOTH 0; DOACOR -1; OUTNAME ''; OUTCLASS ''; OUTSEQ 0; OUTDISK 5; ICHANSEL 0; AVOPTION ''; CHANNEL 0; DOBAND 1; BPVER 4 $ do bandpass calibration with $ bp table 4 DOCALIB -1; GAINUSE 0; FLAGVER -1 $ do NOT apply flags. OUTCL 'NEWCH0' FREQID 2 $ second freqid. blech. getn (+2) $ *.LINCOP *** (3) FREQID=3 -> NEWCH0.3 (cat. no. +5) DEFAULT AVSPC INDISK 5; SOURCES ''; QUAL -1; CALCODE ''; STOKES ''; TIMERANG 0; SELBAND -1; SELFREQ -1; FREQID -1; SUBARRAY 0; BIF 0; EIF 0; DOPOL -1; BLVER -1; BPVER 1; SMOOTH 0; DOACOR -1; OUTNAME ''; OUTCLASS ''; OUTSEQ 0; OUTDISK 5; ICHANSEL 0; AVOPTION ''; CHANNEL 0; DOBAND 1; BPVER 4 $ do bandpass calibration with $ bp table 1 DOCALIB -1; GAINUSE 0; FLAGVER -1 $ do NOT apply flags. OUTCL 'NEWCH0' FREQID 3 $ third freqid. blech. getn (+2) $ *.LINCOP *** It is a very good idea to run LISTR/SCAN to make sure AVSPC *** did what you thought it should do. I'm not sure how to *** completely check.. the number of visibilities WILL NOT *** MATCH even if you think it should (I believe) because FILLM's *** NX table is incorrect. 15) TABED: LINCOP FG/1 -> NEWCH0.? FG/1 *** *** We use TABED to set FREQID = -1 (apply to all FREQIDs) in the *** FG table, since AVSPC will change all FREQIDs to 1 in the *** NEWCH0 data sets. Again, this is important only for the *** galactic HI case, but shows up in both recipes for consistency. *** *** Make sure you run this for ALL DEFAULT TABED INDISK 5; OUTDISK 5 OPTY 'repl' $ Replace entries INEXT 'fg' $ in flag table INVER 1 ; OUTVER 1 APARM 0 APARM(1) 3 $ Changing column 3 = FREQID KEYVAL= -1,0 $ ...to FREQID= -1 getn (+2) $ *.LINCOP geto (+3) $ *.NEWCH0.1 go tabed geto (+4); go tabed $ *.NEWCH0.2 geto (+5); go tabed $ *.NEWCH0.3 16a) CALIB -> flux *** *** With the multi-FREQID data, CALIBs for a given source must be *** run for all NEWCH0.? in which that source appears. It's most *** likely easiest to check with LISTR/SCAN.) *** *** It most likely follows this format: *** flux cal in NEWCH0.1 and NEWCH0.2 *** phase cal in NEWCH0.3 *** Remember to ignore the NEWCH0.1/2 that corresponds to the "bad" *** BPASS!! *** *** Remember that you may have to precess the data using EPOSWITCH *** if your data are in 1950 coordinates! *** *** We are not using SOLTYPE 'L1R' because it messed up the data in *** BPASS. We use L1 with WEIGHTIT 1 to give a true L1 *** minimization, says Michael Rupen. Eric Greisen also does not *** recommend using anything with an 'R' in it. *** *** flux cal: make sure you run this on any necessary FREQIDs: *** likely 1 and/or 2. DEFAULT CALIB INDISK 5; QUAL -1; CALCODE ''; SELBAND -1; SELFREQ -1; FREQID -1; TIMERANG 0; BCHAN 1; ECHAN 0; ANTENNAS 0; DOFIT 0; ANTUSE 0; SUBARRAY 0; UVRANGE 0; WTUV 0;DOPOL -1; BLVER -1; FLAGVER 1; DOBAND -1; BPVER -1; SMOOTH 0; IN2NAME''; IN2CLASS ''; IN2SEQ 0; IN2DISK 1; INVERS 0; NCOMP 0; FLUX 0; NMAPS 0; CMETHOD 'DFT'; CMODEL ''; SMODEL 0; OUTNAME ''; OUTCLASS ''; OUTSEQ 0; OUTDISK 0; SOLSUB 0; SOLMIN 0;DOFLAG 0; SOLCON 0; SNVER 1; ANTWT 0; GAINERR 0; BADDISK 0; NMAP 1 ; NCOMP 1e6,0 ; INVER 1 ; CMETHOD 'DFT' DOCAL 1 ; GAINUSE 2 SOLINT 0 APARM 4,0,0,0,0,2; $ min 4 antennas; print closures SOLTYPE 'L1'; SOLMODE 'A&P'; $ not L1R WEIGHTIT 1 $ true L1 minimization MINAMPER 10; MINPHSER 10 $ complain if >10%/10d off CPARM 0,0,10,10,1 $ complain if avg > 10%/10d off SNVER 1 freqid 1 $ calsour '','' $ flux density calibrator #1 get2n $ use your model from CALRD refant $ Change this to your refant getn (+3) $ *.NEWCH0.1 go calib freqid 2; getn (+4); go calib $ *.NEWCH0.2 *** Now for the phase calibrator. This is probably FREQID 3 16b) CALIB -> phase calibrator *** *** Check UV restrictions for secondary calibrators carefully. *** *** If they HAVE restrictions, you may have to change WTUV to 0.01 *** CALIB finds crazy solutions. (This considers data outside of *** the allowed UVRANGE with a weight of 1%.) *** *** Again, make sure it's the correct FREQID. *** DEFAULT CALIB INDISK 5; QUAL -1; CALCODE ''; SELBAND -1; SELFREQ -1; FREQID -1; TIMERANG 0; BCHAN 1; ECHAN 0; ANTENNAS 0; DOFIT 0; ANTUSE 0; SUBARRAY 0; UVRANGE 0; WTUV 0;DOPOL -1; BLVER -1; FLAGVER 1; DOBAND -1; BPVER -1; SMOOTH 0; IN2NAME''; IN2CLASS ''; IN2SEQ 0; IN2DISK 0; INVERS 0; NCOMP 0; FLUX 0; NMAPS 0; CMETHOD 'DFT'; CMODEL ''; SMODEL 0; OUTNAME ''; OUTCLASS ''; OUTSEQ 0; OUTDISK 0; SOLSUB 0; SOLMIN 0;DOFLAG 0; SOLCON 0; SNVER 1; ANTWT 0; GAINERR 0; BADDISK 0; NMAP 1 ; NCOMP 1e6,0 ; INVER 1 ; CMETHOD 'DFT' DOCAL 1 ; GAINUSE 2 SOLINT 0 APARM 4,0,0,0,0,2; $ min 4 antennas; print closures SOLTYPE 'L1'; SOLMODE 'A&P'; $ not L1R WEIGHTIT 1 $ true L1 minimization MINAMPER 10; MINPHSER 10 $ complain if >10%/10d off CPARM 0,0,10,10,1 $ complain if avg > 10%/10d off SNVER 1 UVRANGE 0, 0 $ if this is not 0 and you get crazy $ solutions... WTUV 0.0 $ ...then set this to 0.01 and see. freqid 3 $ probably freqid 3 calsour '','' $ phase density calibrator #1 refant $ Change this to your refant getn (+5) $ *.NEWCH0.3 *** *** If you need to re-run CALIB (ie, you've flagged more data), then *** delete your SN tables with extdest: *** *** default extdest; inext 'sn'; invers -1; getn (+?); extdest *** 17) TABED all SN tables to NEWCH0.1 --> SN/2,3 *** *** This step is only required if we have more than one FREQID *** (and NEWCH0). We copy everything to NEWCH0.1 to match the *** single FREQID case. *** *** Only copy from NEWCH0.2/FREQID 2 if it's the GOOD BPASS. *** DEFAULT TABED INDISK 5; OUTDISK 5 OPTY 'repl' INEXT 'sn' INVER 1 ; OUTVER 0 APARM 0 APARM(1) 6 $ Changing column 6 = FREQID KEYVAL= -1,0 $ ...which we change to FREQID= -1 getn (+4) $ *.NEWCH0.2 or NEWCH0.3 getona (+3) $ *.NEWCH0.1 *** Also copy from FREQID 3/NEWCH0.3. DEFAULT TABED INDISK 5; OUTDISK 5 OPTY 'repl' INEXT 'sn' INVER 1 ; OUTVER 0 APARM 0 APARM(1) 6 $ Changing column 6 = FREQID KEYVAL= -1,0 $ ...which we change to FREQID= -1 getn (+5) $ *.NEWCH0.3 getona (+3) $ *.NEWCH0.1 18) GETJY *** *** Find flux density of secondary calibrator, and set SN *** table amplitude gains to reflect a common flux density *** scale. *** *** We will have to run this only on NEWCH0.1, because we have *** copied the SN tables there already. DEFAULT GETJY INDISK 5 FREQID -1 $ any freqid (we have edited SN tables) SNVER 0 $ use all SN tables sources '','' calsour '','' getn (+3) $ *.NEWCH0.1 *** Copy the output here: 19a) CLCAL/MERG *** *** This merges all SN tables into SN/4. It does not change CL *** tables at all. *** DEFAULT CLCAL INDISK 5 OPCODE 'MERG' $ merge SN tables for ease of plotting refant getn (+3) $ *.NEWCH0.1 19b) TACOP *** *** If you have bad BPASS solutions for one FREQID (probably FREQID *** 2) then you should copy the merged SN table created by CLCAL *** to SN/4 for uniformity of the recipe. *** DEFAULT TACOP INDISK 5; OUTDISK 5 INEXT 'SN' INVERS 3 OUTVER 4 getn (+3) $ *.NEWCH0.1 geto (+3) $ *.NEWCH0.1 20a) SNPLT - phase *** *** Check the phases from CALIB with SNPLT. *** *** Look for phase jumps or spikes, and flag necessary data. *** - for a spike, flag the data surrounding the spike as well as *** that calibrator scan. *** - for a jump, ONLY flag the data in between the jump (no *** calibrators) *** DEFAULT SNPLT; INDISK 5; INEXT 'SN'; INVERS 0; SOURCES ''; QUAL -1; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; SUBARRAY 0; BIF 0; EIF 0; ANTENNAS 0; PIXRANGE 0; NPLOTS 4; XINC 1; OPTYPE 'PHAS'; OPCODE 'ALSI'; DO3COL 1; BCOUNT 1; XAXIS 0; SYMBOL 5; FACTOR 2; CUTOFF 0; LTYPE 3; DOTV 1; GRCHAN 0; getn (+3); $ *.NEWCH0.1 20b) SNPLT -> amplitude/gains *** *** Check the gains from CALIB with SNPLT. *** *** Look for jumps or spikes, and flag necessary data. *** - for a spike, flag the data surrounding the spike as well as *** that calibrator scan. *** - for a jump, ONLY flag the data in between the jump (no *** calibrators) *** *** We have seen a couple cases where the first phase cal scan has *** a significantly diffrent amplitude gain for the EVLA *** antennas. The reason is not clear but the raw data do show this *** effect, so CALIB is doing the right thing. This area warrants *** further tests, to learn whether we should simply flag the EVLA *** antennas on the first phase calibrator scan. *** DEFAULT SNPLT; INDISK 5; INEXT 'SN'; INVERS 0; SOURCES ''; QUAL -1; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; SUBARRAY 0; BIF 0; EIF 0; ANTENNAS 0; PIXRANGE 0; NPLOTS 4; XINC 1; OPTYPE 'AMP'; OPCODE 'ALSI'; DO3COL 1; BCOUNT 1; XAXIS 0; SYMBOL 5; FACTOR 2; CUTOFF 0; LTYPE 3; DOTV 1; GRCHAN 0; getn (+3); $ *.NEWCH0.1 *** *** Now we have a loop. If calibration is not good, do some flagging. *** *** a) tvflg as before *** b) uvplt *** - amp vs. time (bparm 11, 1) - check for outliers *** - single antenna or baseline? *** - for loops through antennas: *** for i=1:28; antenna i; go uvplt; wait; end *** - real vs. imaginary (bparm 9,10) *** - check for arcs. *** - uv distance vs. weight (bparm 0, 13) *** - this will be done in ANBPL anyway. *** *** *** A gain range of 1/2 - 2 times the average is okay. EVLA gains can *** have a larger range. *** *** If you have to flag, delete your old SN tables and rerun *** CALIB. When you are satisfied, move on. You will have to delete *** tables from all NEWCH0.?. *** 21a) SNPLT -> phase, plot file DEFAULT SNPLT; INDISK 5; INEXT 'SN'; INVERS 0; SOURCES ''; QUAL -1; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; SUBARRAY 0; BIF 0; EIF 0; ANTENNAS 0; PIXRANGE 0; NPLOTS 4; XINC 1; OPTYPE 'PHAS'; OPCODE 'ALSI'; DO3COL 1; BCOUNT 1; XAXIS 0; SYMBOL 5; FACTOR 2; CUTOFF 0; LTYPE 3; DOTV -1; GRCHAN 0; getn (+3); $ *.NEWCH0.1 21b) SNPLT -> amp, plot file DEFAULT SNPLT; INDISK 5; INEXT 'SN'; INVERS 0; SOURCES ''; QUAL -1; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; SUBARRAY 0; BIF 0; EIF 0; ANTENNAS 0; PIXRANGE 0; NPLOTS 4; XINC 1; OPTYPE 'AMP'; OPCODE 'ALSI'; DO3COL 1; BCOUNT 1; XAXIS 0; SYMBOL 5; FACTOR 2; CUTOFF 0; LTYPE 3; DOTV 1; GRCHAN 0; getn (+3); $ *.NEWCH0.1 21c) LISTR -> check amp/phases in non-plot form *** *** I've never found anything here that I don't see in the SNPLT *** but it may be your personal preference to run this.. *** DEFAULT LISTR; INDISK 5; OPTYPE 'GAIN'; INEXT 'SN'; INVER 1; SOURCES ''; CALCODE ''; TIMERANG 0; STOKES ''; SELBAND -1; SELFREQ -1; FREQID 1; BIF 0; EIF 0; BCHAN 1; ECHAN 0; ANTENNAS 0; BASELINE 0; UVRANGE 0, 0; SUBARRAY 0; DOCALIB -1; GAINUSE 1; DOPOL -1; BLVER -1; FLAGVER 1; DOBAND -1; BPVER -1; SMOOTH 0; DPARM 5, 0; DOACOR -1; FACTOR 0; DOCRT 132; OUTPRINT ''; BADDISK 0; getn (+3); $ *.NEWCH0.1 22a) LWPLA -> save SNPLT phase plots. DEFAULT LWPLA; INDISK 5; ASPMM 0; LPEN 3; RGBGAMMA 0; FUNCTYPE ''; DPARM 0; COPIES 1; DODARK 1; OFMFILE ''; DOCOLOR 0; PLCOLORS 0; plver 1 $ this should always be one but. invers 7 $ this might change. make sure you get the right $ plots. outfile 'snplt-phase-.ps'; getn (+3); $ *.NEWCH0.1 22b) LWPLA -> save SNPLT amp plots. DEFAULT LWPLA; INDISK 5; ASPMM 0; LPEN 3; RGBGAMMA 0; FUNCTYPE ''; DPARM 0; COPIES 1; DODARK 1; OFMFILE ''; DOCOLOR 0; PLCOLORS 0; plver 8 $ this might change to be 7 invers 14 $ this might change to 12 outfile 'snplt-amp-.ps'; getn (+3); $ *.NEWCH0.1 *** *** These will be output to the /tmp directory, so: *** mv /tmp/SNPLT*.PS ***/scr3/jottangst/reduction_vla-angst/red/ *** 23) TACOP *** *** Copy the new SN table to the other NEWCH0 files. *** DEFAULT TACOP INDISK 5; OUTDISK 5 INEXT 'SN' INVERS 4 getn (+3) $ *.NEWCH0.1 geto (+4) $ *.NEWCH0.2 go tacop geto (+5) $ *.NEWCH0.3 23a) CLCAL -> flux cal *** *** For multi-FREQID data this becomes rather complicated, since *** we need a new CL table for every NEWCH0 file, to allow *** detailed checks and second-order flagging. *** *** Note that there is no need to work around any phase jumps, *** since the intervening data are flagged. *** Remember that you only care about the "good" BP version. DEFAULT CLCAL INDISK 5; GETN 4; SOUCODE '';QUAL -1; CALCODE ''; TIMERANG 0; SUBARRAY 0; ANTENNAS 0; SELBAND -1; SELFREQ -1; FREQID -1; OPCODE 'CALI'; CUTOFF 0; SAMPTYPE ''; BPARM 0; ICUT 0.1; DOBLANK 0; SMOTYPE ''; INVERS 0; BADDISK 0; INTERPOL 'SELF' GAINVER 2 ; GAINUSE 3 DOBTWEEN -1 $ Don't interpolate for different sources SNVER 4 sources '','' $ your flux calibrator calsour = sour refant $ Change this to your refant getn (+3) $ *.NEWCH0.1 23b) CLCAL -> phase cal *** *** *** The phase calibrator and galaxy will be CLCAL'd using SIMP *** interpolation. *** *** If your data use +/- frequency switching for the phase *** calibrator (none of ours, but some archival sets), you should *** use BPARM with SAMPTYPE='BOX' to select a smoothing time which *** covers both frequency settings. LISTR/SCAN on LINCOP will help *** you choose this; normally something like 12 minutes should be *** okay. *** DEFAULT CLCAL INDISK 5; GETN 4; SOUCODE '';QUAL -1; CALCODE ''; TIMERANG 0; SUBARRAY 0; ANTENNAS 0; SELBAND -1; SELFREQ -1; FREQID 1; OPCODE 'CALI'; SAMPTYPE ''; BPARM 0; ICUT 0.1; DOBLANK 0; SMOTYPE ''; SNVER 1; INVERS 0; BADDISK 0; INTERPOL 'SIMP' SAMPTYPE '' $ Change to 'BOX' if +/- freq switching BPARM 0 $ change to 12 (?) if +/- freq switching GAINVER 2 ; GAINUSE 3 DOBTWEEN -1 $ Don't interpolate entries for different $ sources CUTOFF 120 $ Don't extrapolate/interpolate beyond 120 $ minutes SNVER 2 sources '',''; calsour '',''; refant ; getn (+5); $ *.NEWCH0.3 (This should have phase/galaxy data.) 24) ANBPL *** *** Plot the data weights as a function of time. Data with *** extremely high weights (a factor of ~5x or more higher than *** normal) should be flagged. Use UVFLG to eliminate these *** weights. *** *** You will need to run ANBPL on any NEWCH0.? that is usable. *** DEFAULT ANBPL DOCALIB 1;GAINUSE 3 FLAGVER 1 BPARM 2,17,0 $ Plot antenna-based weight vs. time NPLOTS 9; DOTV 1 DOCRT 132 $ Print as well as plotting weights -- useful for $ finding exact times of bad weights $ Note you can also use outprint to send to a file. OPCODE 'alsi' $ Plot all IFs together DO3COL 1 $ ...using different colors getn (+3) $ *.NEWCH0.1 $ Must do this separately for every NEWCH0 file go anbpl tvinit; getn (+5); go anbpl $ *.NEWCH0.3 25a) TVFLG -> flux cal *** *** Run TVFLG on the calibrators, which should now have constant *** amplitude and 0 phase. *** DEFAULT TVFLG CALCODE '*' $ calibrators only DOCAT -1 $ avoid saving temporary files DOHIST -1 $ avoid creation of history entries DOCALIB 1 ; GAINUSE 3 $ apply the new CL table FLAGVER 1;OUTFGVER 1 $ keep all flags in FG/1 DPARM 0 dparm(3) 1 $ show baselines twice, to treat all antennas identically -- $ this displays baseline 27-1 as well as 1-27 dparm(6)=10 $ time resolution: should be set to the calibrators' $ integration time, in seconds source '','' getn (+3) $ *.NEWCH0.1 or maybe NEWCH0.2 if that's good. 25b) TABED *** Copy the flag table to the NEWCH0.? data. *** *** You will probably only have to copy it to NEWCH0.3. *** DEFAULT TABED OPTY 'REPL' INEXT 'FG' ; INVER 2 ; NCOUNT 1 ; OUTVER 2 APARM 0 APARM(1) 3 $ Changing column 3 = FREQID KEYVAL =-1,0 $ ...to FREQID= -1 getn (+3) $ *.NEWCH0.1 getona (+5) $ *.NEWCH0.3 25c) TVFLG -> phase cal *** *** Run TVFLG on the calibrators, which should now have constant *** amplitude and 0 phase. *** DEFAULT TVFLG CALCODE '*' $ calibrators only DOCAT -1 $ avoid saving temporary files DOHIST -1 $ avoid creation of history entries DOCALIB 1 ; GAINUSE 3 $ apply the new CL table FLAGVER 2;OUTFGVER 2 $ keep all flags in FG/2 DPARM 0 dparm(3) 1 $ show baselines twice, to treat all antennas identically -- $ this displays baseline 27-1 as well as 1-27 dparm(6)=10 $ time resolution: should be set to the calibrators' $ integration time, in seconds source '','' getn (+5) $ *.NEWCH0.3 26) TVFLG on the galaxy! *** *** This is our first run of flagging on the galaxy. *** *** - Check the first scan carefully - often the system isn't *** "organized" on this first scan. *** - Online flagging isn't as reliable as in the old days, so *** there are plenty of hot pixels and hiccups. *** - We are NOT quacking, because of issues discussed above. *** *** This assumes that the galaxy is FREQID 3. *** *** Within TVFLG, set these useful defaults: *** - SMOOTH = 1 *** - SCAN = 20 *** - FLAG ALL CHANNELS *** - FLAG STOKES FULL *** - SWITCH SOURCE FLAG *** *** We suggest the following steps: *** *** 1) Set the above defaults *** 2) Flag first integration in every scan (manual QUACK) *** 3) Check AMPLITUDE (for missing data), AMP DIFF. PHS DIFF may *** occasionally be useful bu tit's likely to be mostly random *** unless you have a strong continuum source near your galaxy. DEFAULT TVFLG CALCODE '-CAL' $ non-calibrators only DOCAT -1 $ avoid saving temporary files DOHIST -1 $ avoid creation of history entries DOCALIB 1 ; GAINUSE 3 $ apply the new CL table FLAGVER 2;OUTFGVER 2 $ or flagver 3 ; outfgver 3 if you had to TACOP $ the FG table from another file DPARM 0 DPARM(3) 1 $ show baselines twice, to treat all antennas identically -- $ this displays baseline 27-1 as well as 1-27 DPARM(6)=30 $ time resolution: should be set to the sources' $ integration time, in seconds getn (+5) $ *.NEWCH0.3 file with the galaxy data ============================================================= =============== Calibration Checks on Calibrators =========== ============================================================= 27) UVPLT *** *** Check the amp & phase vs. uvdistance for all calibrators. *** *** Amplitudes should match the results of SETJY/GETJY. *** If there are obvious outliers which are not expected due to *** source structure, go back and flag those (and possibly re-CALIB.) *** DEFAULT UVPLT DOCAL 1; GAINUSE 3 FLAGVER 1 $ set this to the latest FG version -- may be >1 if $ there are multiple NEWCH0s (FREQIDs). DOTV 1 DO3COL 1 BPARM 0 $ Amp vs. uv-distance getn (+3) $*.NEWCH0.1 $ do this for each NEWCH0 file go uvplt tvinit; bparm 0,2; go uvplt $ phase vs. uv-distance 28) IMAGR [optional] *** *** If you want to see something other than UV points, you can *** image your calibrators now!! It's kind of fun. *** *** This is an optional step to check for striping or other *** calibration errors. *** *** In addition, the CLEANed flux density should roughly match *** SETJY/GETJY. *** DEFAULT IMAGR DOCALIB 1; GAINUSE 3 $ apply latest calibration FLAGVER 1 $ apply latest flags -- set this to the $ highest-numbered FG table OUTNAME 'junk' $ some obviously cruddy name IMSIZE 1024 NITER 1000 NBOX 1 ; CLBOX -1,5,512,513 $ calibrator should be in the center MINPA 121 UVWTFN ''; ROBUST 0.5 DOTV 1 sources '','' $ calibrator to image cellsize 0 $ 1 for B configuration $ 4 for C configuration $ 16 for D configuration getn (+3) $ *.NEWCH0 -> make sure you're using the $ file containing your calibrator. 29) UVPLT *** *** Check the amp vs. uv-distance for the galaxy. *** *** If there are obvious outliers which are not expected due to *** source structure or RFI (e.g., mostly on short spacings), go *** back and flag those. Note any obvious short-spacing horrors, *** which may be due to solar or terrestrial RFI. *** *** You may see the galaxy emission start to show up under the *** continuum if it's bright enough. *** *** Check for striping or other calibration errors. *** DEFAULT UVPLT DOCAL 1 ; GAINUSE 3 $ Apply calibration FLAGVER 1 $ set this to the latest FG version DOTV 1 DO3COL 1 BPARM 0 $ amp vs. uv-distance sources '','' getn (+5) $ *.NEWCH0.3 -> should contain your galaxy 30) TASAV *** *** Save the tables because we should be done calibrating. you *** don't want to lose that work. Put it on a different disk. I *** arbitrarily chose 2 for saved files. *** DEFAULT TASAV OUTCLASS 'ch0sav' OUTDISK 2 outname '-1MidTa' $ loop over NEWCH0.? files: getn (+3); go tasav getn (+4); go tasav getn (+5); go tasav 31a) TABED - FG table *** *** Use TABED to ensure FREQID=-1 for all tables. *** DEFAULT TABED OPTY 'REPL' IENXT 'FG' APARM 0 APARM(1) 3 $ Changing column 3 = FREQID KEYVAL= -1,0 $ ...which we change to FREQID= -1 INVER 3 $ if multiple FREQIDs: set this to max. flag table number OUTVER 2 getn (+5)$ *.NEWCH0.3 $ if multiple FREQIDs: $ set this to file you flagged $ on most recently (usually the file $ with the galaxy in it) getona (+2) $ *.LINCOP 31b) TABED - SN table *** *** TABED the SN table to LINCOP to ensure that FREQID -1 *** (again, more important for multifrequency galactic HI *** observations. *** DEFAULT TABED OPTY 'repl' INEXT 'sn' APARM 0 APARM(1) 6 $ Changing column 6 = FREQID KEYVAL= -1,0 $ ...which we change to FREQID= -1 INVER 1 $ if single FREQID OUTVER 0 getn (+3) $ *.NEWCH0.1 (merged SN table) getona (+2) $ *.LINCOP 32a) CLCAL on LINCOP *** *** We run CLCAL on LINCOP again to avoid confusion with the *** multiple freqid case. *** *** We should already have dealt with phase jumps. *** *** The primary calibrator will use SELF while the phase calibrator *** and galaxy will use SIMP. *** *** I believe that SELF allows you to use the phases throughout the *** scan (instead of an average) to figure out the correction.. *** DEFAULT CLCAL INDISK 5; GETN 4; SOUCODE '';QUAL -1; CALCODE ''; TIMERANG 0; SUBARRAY 0; ANTENNAS 0; SELBAND -1; SELFREQ -1; FREQID -1; OPCODE 'CALI'; CUTOFF 0; SAMPTYPE ''; BPARM 0; ICUT 0.1; DOBLANK 0; SMOTYPE ''; INVERS 0; BADDISK 0; INTERPOL 'SELF' GAINVER 2 ; GAINUSE 3 DOBTWEEN-1 $ Don't interpolate entries for different sources SNVER 1 freqid 1; $ freqid of your flux cal sources '','' $ your flux calibrator calsour = sour refant $ Change this to your refant getn (+2) $ *.LINCOP *** Run this again if you have a flux cal in other freqid's (ie, *** if your bad bpass results were in freqid 1.) 32b) CLCAL -> phase calibrator, galaxy *** *** *** The phase calibrator and galaxy will be CLCAL'd using SIMP *** interpolation. *** *** If your data use +/- frequency switching for the phase *** calibrator (none of ours, but some archival sets), you should *** use BPARM with SAMPTYPE='BOX' to select a smoothing time which *** covers both frequency settings. LISTR/SCAN on LINCOP will help *** you choose this; normally something like 12 minutes should be *** okay. *** *** CLCAL will complain that it's appending solutions to CL table *** 3, but I think this is okay. DEFAULT CLCAL INDISK 5; GETN 4; SOUCODE '';QUAL -1; CALCODE ''; TIMERANG 0; SUBARRAY 0; ANTENNAS 0; SELBAND -1; SELFREQ -1; FREQID 1; OPCODE 'CALI'; SAMPTYPE ''; BPARM 0; ICUT 0.1; DOBLANK 0; SMOTYPE ''; SNVER 1; INVERS 0; BADDISK 0; INTERPOL 'SIMP' SAMPTYPE '' $ Change to 'BOX' if +/- freq switching BPARM 0 $ change to 12 (?) if +/- freq switching GAINVER 2 ; GAINUSE 3 DOBTWEEN -1 $ Don't interpolate entries for different $ sources CUTOFF 120 $ Don't extrapolate/interpolate beyond 120 $ minutes SNVER 4 freqid 3; $ or whatever the freqid of your galax is sources '',''; calsour '',''; refant ; getn (+2); $ *.LINCOP 33) UVPLT on LINCOP *** *** Check the amplitude and phase for all calibrators. Amplitude *** should match the results of SETJY/GETJY, and phase should be *** zero, apart from known source structure. *** If there are obvious, unexpected outliers, go back and flag *** those and possibly re-run various tasks. *** DEFAULT UVPLT DOCAL 1; GAINVER 3 $ apply calibration DOBAND 1; BPVER 4 $ apply bandpass FREQID 1 FLAGVER 2 $ use just TABEDed flag table SMOOTH 7, 117 $ boxcar average over all channels DOTV 1 DO3COL 1 BPARM 0 $ amp vs. uv-distance CALCODE '*' $ all calibrators smooth 7, 235 $ boxcar average over all channels $ use smooth 7,117 if you started with 127 $ channels. getn (+2) $ *.LINCOP *** *** Also plot phase. *** DEFAULT UVPLT DOCAL 1; GAINVER 3 $ apply calibration DOBAND 1; BPVER 4 $ apply bandpass FREQID 1 FLAGVER 2 $ use just TABEDed flag table SMOOTH 7, 117 $ boxcar average over all channels DOTV 1 DO3COL 1 BPARM 0 ,2 $ phase vs. uv-distance CALCODE '*' $ all calibrators smooth 7, 235 $ boxcar average over all channels $ use smooth 7,117 if you started with 127 $ channels. getn (+2) $ *.LINCOP 34) POSSM *** *** Check vector average of all data for each calibrator. *** *** Amplitude should match the results of SETJY/GETJY; phase should *** be flat and consistent with zero (corresponding to a point *** source at the origin), apart from known source structure and *** possibly HI absorption (from our galaxy?) *** DEFAULT POSSM DOCAL 1 ; GAINUSE 3 $ apply calibration DOBAND 1; BPVER 4 $ apply bandpass FREQID 1 FLAGVER 2 $ should be the latest FG table APARM 0 $ Plot data SOLINT 0 $ average all time NPLOTS 0 $ average all baselines APARM 0 APARM(1) 1 $ vector average DOTV 1 source='','' $ Secondary (phase) calibrator uvrange= 0,0 $ should be set to eliminate known source structure, $ as in CALIB getn (+2) $ *.LINCOP tvinit 35) IMAGR on LINCOP *** *** You shouldn't see obvious calibratione errors or *** striping. CLEANed flux density should roughly match *** SETJY/GETJY. If you DO have evil stuff, UVLSF (continuum *** subtration) will likely take care of it, so don't get too *** worked up. *** DEFAULT IMAGR DOCAL 1 ; GAINUSE 3 $ apply latest calibration DOBAND 1; BPVER 4 $ for single-FREQID data sets FLAGVER 2 $ should be the latest FG table OUTNAME 'junk' $ some obviously cruddy name IMSIZE 1024 NITER 200 $ reasonable for a point source NBOX 1 ; CLBOX -1,5,512,513 $ calibrator should be in the center MINPA 121 $ ??? UVWTFN ''; ROBUST 0.5 DOTV -1 $ so you can go eat lunch cellsize 0 $ 1 for B configuration $ 3.5 for C configuration $ 14 for D configuration source '','' $ run for each calibrator. getn (+2) $ *.LINCOP ============================================================= =============== Calibration Checks on Sources =============== ============================================================= 36) UVPLT on LINCOP *** *** Check the amp vs. uv-distance for the galaxy. If there are *** obvious outliers which are not expected due to source structure *** or RFI (ie, not mostly on short spacings), go back and flag *** those. Note any obvious short-spacing horrors, which may be due *** to solar or terrestrial RFI. *** DEFAULT UVPLT DOCAL 1 ; GAINUSE 3 DOBAND 1; BPVER 4 $ for single-FREQID data sets FLAGVER 2 $ should be the latest FG table DOTV 1 DO3COL 1 BPARM 0 $ amp vs. uv-distance smooth 7, 235 $ boxcar average over all channels -- use $ smooth 7, 117 if you started with 127 channels source '','' getn (+2) $ *.LINCOP *** *** Also run this, even though I'm not sure what the phases are *** supposed to be.. not zero or else your galaxy is a single point. *** DEFAULT UVPLT DOCAL 1 ; GAINUSE 3 DOBAND 1; BPVER 4 $ for single-FREQID data sets FLAGVER 2 $ should be the latest FG table DOTV 1 DO3COL 1 BPARM 0,2 $ phase vs. uv-distance smooth 7, 235 $ boxcar average over all channels -- use $ smooth 7, 117 if you started with 127 $ channels source '','' getn (+2) $ *.LINCOP 37) POSSM *** *** Check vector average of all data for the galaxy. You SHOULD see *** your HI line. *** DEFAULT POSSM DOCAL 1 ; GAINUSE 3 DOBAND 1; BPVER 4 $ for -FREQID data sets FLAGVER 2 $ should be the latest FG table APARM 0 $ Plot data SOLINT 0 $ average all time NPLOTS 0 $ average all baselines APARM 0 APARM(1) 1 $ vector average DOTV 1 source='','' getn (+2) $ *.LINCOP 38) IMAGR *** *** You shouldn't see any calibration errors or striping. you *** should, however, see of order 100 mJy of continuum sources in ** the field, as well as some indication of your galaxy. The latter *** may be quite confusing for B configuration, which resolves out *** most of the structure. Don't fret until you've combined all the *** array configurations. *** DEFAULT IMAGR DOCAL 1 ; GAINUSE 3 DOBAND 1; BPVER 4 $ for single-FREQID data sets FLAGVER 2 $ should be the latest FG table OUTNAME 'junk' $ some obviously cruddy name IMSIZE 1024 NITER 1000 $ a light clean, just to see what we've $ got. niter 0 would be ok too, esp. if $ you IMLIN afterwards NBOX 0 ; CLBOX 0 MINPA 121 UVWTFN ''; ROBUST 0.5 DOTV -1 $ so you can go eat lunch cellsize 0 $ 1 for B configuration $ 3.5 for C configuration $ 14 for D configuration source '','' getn (+2) $ *.LINCOP 39) TASAV -> EndTaB.LINSAV *** *** Save your tables on a different disk in case of disk failure. *** DEFAULT TASAV OUTCLA 'linsav' OUTDI 2 $ Ideally set this to a different disk from indisk, $ in case of disk crashes outname '-EndTa getn (+2) $ *.LINCOP 40) FITTP *** *** create: ---uv-calib-newch0.?.fits *** ---uv-calib-lincop.fits *** ---beginTasav.fits *** ---midTasav.fits $ one per freqid *** ---endTasav.fits 41) DRINK *** *** Celebrate your victory with an appropriate beverage! We *** recommend something with bananas. For example, a recipe for *** banana daiquiris can be found in the AIPS Cookbook. In the *** case of Galactic HI, please double the amount of alcohol in *** your celebratory drink. ***