$ Demo runfile for vlbi data rediction $ Jodrell Bank Imaging Scholl -- April 2000 $ Simon Garrington $ restore 0 $----------------------------------------------------------------------- $; Copyright (C) 1995 $; Associated Universities, Inc. Washington DC, USA. $; $; This program is free software; you can redistribute it and/or $; modify it under the terms of the GNU General Public License as $; published by the Free Software Foundation; either version 2 of $; the License, or (at your option) any later version. $; $; This program is distributed in the hope that it will be useful, $; but WITHOUT ANY WARRANTY; without even the implied warranty of $; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the $; GNU General Public License for more details. $; $; You should have received a copy of the GNU General Public $; License along with this program; if not, write to the Free $; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, $; MA 02139, USA. $; $; Correspondence concerning AIPS should be addressed as follows: $; Internet email: aipsmail@nrao.edu. $; Postal address: AIPS Project Office $; National Radio Astronomy Observatory $; 520 Edgemont Road $; Charlottesville, VA 22903-2475 USA $----------------------------------------------------------------------- *. Convert from CLBOX in pixels to CCBOX in arcsec. *. PROC BOX2CC array imcells(2) array imrefp(2) keyword = 'CDELT1' gethead imcells(1) = keyvalue(1) * keyword = 'CDELT2' gethead imcells(2) = keyvalue(1) * keyword = 'CRPIX1' gethead imrefp(1) = keyvalue(1) * keyword = 'CRPIX2' gethead imrefp(2) = keyvalue(1) * nccbox = nboxes for i = 1 to nccbox ccbox(1,i) = (clbox(1,i)-imrefp(1) ) * imcells(1) * 3600.0 ccbox(2,i) = (clbox(2,i)-imrefp(2) ) * imcells(2) * 3600.0 ccbox(3,i) = (clbox(3,i)-imrefp(1) ) * imcells(1) * 3600.0 ccbox(4,i) = (clbox(4,i)-imrefp(2) ) * imcells(2) * 3600.0 end finish docrt 120;dowait 1 msgkill true indi 1;outdi 1;in2di 1 inf 'WORK:VLBDEMO.UVDATA' outn 'vlbdemo';outcl 'uvdata';outseq 1;douvc 1;ncount 1 go fitld inf 'WORK:VLBDEMO.TASAV'; outcl 'tasav';go fitld proc TBREAK type 'Press return to continue read;ret;fin proc GOTASK read;type 'Press return to execute read; go return finish proc INPS read;type 'Press return to see INPUTS INP GOTASK read;return finish proc vlbdemo tbreak type 'This is VLBDEMO, a demonstration of calibration and imaging type 'Global 6cm VLBI data. type 'Here is a summary of what this demo will cover: type '1. Amplitude calibration using VLBA TY/GC tables and EVN ANTAB file type '2. Phase, delay and phase-rate calibration using FRING type '3. Mapping the phase calibrator source J1159 using HORUS and APCLN type '4. Self-calibration and further imaging of J1159 using CALIB and IMAGR type '5. Phase-referenced imaging of a weak target source. type ''; type 'The data have been pre-loaded into AIPS as the file VLBDEMO.UVDATA type 'Hit return to see the AIPS catalogue tbreak inn 'vlbdemo';incl 'uvdata';inseq 1;cata type 'Hit return to see the image header tbreak imh type 'The data were observed in dual polarization with 2 IFs type 'per polarization, each 8 MHz wide. type 'The NRAO correlator further subdivides this into 16 frequency channels type 'You can see a number of tables attached to the data file type 'HI - this is the AIPS History file type 'CL - these tables hold the calibration numbers. This one is blank type 'AT - this holds antenna calibration data type 'IM - this holds Interferometer Model data ... type 'CT - ... and the CALC-specific parameters for the model type 'MC - ... more correlator details type 'OB - Specifically for Orbiting antennas type 'GC - Antenna efficiencies vs elevation curves type 'TY - Antenna Tsys measured during the observations type 'WX - Weather measurements type 'PC - Phase-cal data extracted from 1 MHz comb injected in Rx type 'FQ - Frequency information type 'AN - Antenna information type 'SU - Source details type 'CQ - More detailed correlator-specific frequency information type 'We will only need to deal with a few of these tables! tbreak; type 'Just to get an overall view of the data we can use LISTR type 'to print a summary of the file' task 'listr';opty 'scan'; inps; type 'This experiment observed a number of faint target sources type 'FIRST048, FIRST031 selected from the VLA FIRST Survey type 'within a couple of degrees of the bright source J1159(+291) type 'which serves as the fringe-finder and phase reference source type 'The antennas nod between the target and the calibrator every type 'few minutes. tbreak; type 'The project used a global array of antennas - VLBA and the EVN type 'To list the antennas involved, use PRTAN task 'prtan' inps tbreak type 'A Global Array gives excellent uv-coverage, type '... which you can plot using UVPLT tvinit task 'uvplt'; bparm 6 7 2 0 dotv 1 bif 1;eif 1;stok 'll'; source 'J1159' '' bchan 8;echan 8 $inps type 'First we tackle the amplitude calibration. type 'For the VLBA antennas, this is very easy. The gain-curves type 'and Tsys measurements have already been attached to the data file type 'in the GC and TY tables. All we have to do is convert these type 'to an SN table using APCAL. The corrections are written to SN table 1. task 'APCAL' bif 1;eif 2 stok '';sour '';timer 0 tyver 1;gcver 1;snver 1 opc '';aparm 0;solint 0;bparm 0 inf ''; inps type 'We can plot these corrections using SNPL. task 'snpl' inext 'sn' sour '' timer 0 stok 'r' bif 1;eif 1; ante 0 ncount 6 xinc 1 opty 'amp';opc '' inps type 'You should notice several effects here. On the largest antenna, the type '100-m Effelsberg telescope, you can clearly see the Tsys rise on type 'the 2 Jy calibrator source. For all antennas, you can see the tsys type 'increase as the elevation is low, and for some telescopes you can type 'see transient effects, probably due to weather, causing inceases type 'in Tsys. tbreak type 'For the EVN antennas, one extra stage is necessary. type 'We need to read the GC and TY tables in from an external text file type 'using the task ANTAB. type 'The text file is produced from the logs written at each EVN antenna type 'and can be read from http://vlbeer.ira.bo.cnr.it/~evn/vlb_archive/ type 'in the directory jun99 as the file gg040.antab type 'If you like, you can fetch this file this now. type 'A little editing of the file is normally necessary. type 'In your login directory you should find type ' GG040.ORIG - the original file as copied from vlbeer type ' GG040.NEW - slightly edited version type 'The changes are not major type ' 1. antennas which did not participate were removed completely type ' 2. Effelsberg was removed since its calibration is covered by the VLBA type ' in this experiment. type ' 3. The INDEX lines were changed to L1 R1 L2 R2 - this is a 2-IF dual type ' polarization experiment. [This change should no longer be needed] type ' 4. The antenna names were all changes to match those seen in the type ' AIPS ANtenna table. type '' type 'You should inspect these files in another window ... tbreak type 'This file will now be used in ANTAB. It is specified as the type ' INFILE and the values are written to GC and TY tables 2. task 'antab' inf 'HOME:GG040.NEW' STOK '' tyver 2;gcver 2; inps tbreak; type 'Now we can use APCAL to convert these to an SN table, just as type 'we did for the VLBA antennas ... type 'Note that we specify GCVER and TYVER as 2 and write out type 'to SNVER 2. So the EVN and VLBA corrections are kept separate type 'for the time being. tbreak task 'apcal'; bif 1;eif 2 STOK '' tyver 2;gcver 2;snver 2;sour '';opc '';aparm 0;inf '' inps type 'Again, we can plot the corrections using SNPL ... task 'snpl' inext 'sn' inver 2 sour '' timer 0 stok 'r' bif 1;eif 1; ante 0 ncount 5 xinc 1 opty 'amp';opc '' inps type 'Now we assemble all these amplitude corrections into a CL table. type 'Most AIPS tasks can apply the corrections from a CL table on-the-fly type 'or the raw data can be multiplied by the corrections and written to type 'a new file using SPLIT. tbreak; type 'We use the task CLCAL, sepcifying SNVER 0, so that both SN tables type 'are read in (VLBA and EVN) and GAINVER 1;GAINUSE 2, so that the type 'input (blank) CL table 1 is multiplied by the corrections in SN 1 & 2 type 'and written to CL 2. tbreak task 'clcal' calso '';sour '' ante 0 interpol '';intparm 0 cutoff 0;smoty '';snver 0;gainver 1;gainuse 2 inps type 'Now that we have roughly calibrated the data amplitudes, type 'we can plot is out against time (VPLOT) or frequency (POSSM). type 'Data vs frequency first, for the first section of the data type 'involving the EVN, and we will just plot the baselines involving type 'Effelsberg (antenna #2) which will have the bext SNR. type 'The amplitude calibration is applied on on-the-fly by specifying type 'DOCALIB 1 and GAINUSE 0. type 'Note also the use of APARM(9) to stitch the 2 IFs together on type 'the plot and APARM(1) to do scalar averaging (since we have type 'not done any phase calibration yet. type 'The plots will average up every 2 min scan on J1159; just hit type 'A to see more, D when you have had enough. task 'possm' sour 'J1159' '' timer 0 15 0 0 0 16 0 0 stok 'LL' bif 1;eif 2 bchan 1;echan 0 ante 2 0;base 0 docal 1;gainuse 0 flagver -1;doband -1 smooth 0;shift 0;aparm 1 0 aparm(9) 1 codety '';polpl '';solint=-1;bparm 0;ncount 4 dotv 1 inps type 'You should have noticed the Jodrell data was poor on both IFs. type '(It is OK on the other polarization, though) and that there type 'are occasional problems at Noto, Onsala and Westerbork. tbreak type 'We can also look at the VLBA data ... timer 0 20 0 0 1 1 0 ante 1 0; inps type 'To edit out the various bad data, use IBLED. type 'This is just a demo - we will copy across a pre-prepared type 'flag table shortly! tvinit task 'ibled' clr2n;clr3n timer 0 stok 'RR' ante 2 15 0 docal 1 gainuse 0 bif 1;eif 1 bchan 1;echan 0 dparm 0 inps tbreak type 'Now we will copy across a FG table outn inn;outdi indi;outcl incl;outseq inseq inn 'vlbdemo';incl 'tasav';inseq 1; inext 'fg';inver 1;outver 1;ncount 1 keyw '';keyv 0;keystr '';go tacop inn outn;incl outcl;inseq 1; type '... and see how the data look with VPLOT task 'vplot' ante 0 base 0 solint 1 sour 'j1159' bif 1;eif 1 bchan 1;echan 0 xinc 1 docal 1;gainuse 0 flagver 1 opty '';aparm 0 bparm 0;ncount 6 dotv 1 inps tbreak type 'Now we are ready to fringe-fit the data. type 'Since these data have just 2 IFs and there is just one single type 'calibrator observed throughout the experiment, we can take a very type 'simple approach. type 'We simply run FRING solving separately for the 2 IFs. type 'We do not worry about multi-band delays; we do not even try type 'to apply any of the phase-cal corrections using the 1 MHz tone. type 'This approach takes care of all that simply and accurately. type 'The only complication is that since the VLBA antennas only type 'came on-source in the latter part of the run and continued type 'observing after the sources had set in Europe, we have type 'deal with the two arrays separately. type 'One simple way to do this is just to run FRING twice: type 'once for the EVN, up to 18:00 hrs, with Effelsberg as type 'the reference antenna, and then again from 18:00 onwards type 'specifying Pie Town as the reference antenna tbreak task 'fring' calso 'J1159' timer 0 0 0 0 0 18 0 0 refant 2 bchan 1;echan 0 ante 0 dofit 0 docal 1;gainuse 0 flagver 1 clr2n;clron search 0 solint 2 aparm 0;aparm(6) 1 dparm 1 1000 300 5,-1,0 snver 3 antwt 0 type 'Note the restrictions on the delay and rate search, to speed things type 'up. You get either guess these, or use FRING on a small TIMERANGE type 'to get an idea of the required range. To do the 2 IFs separately, type 'we just set aparm(5) = 0. type 'The phase, rate and delay solutions will be written as SN 3. inps tbreak type 'We can examine the solutions with SNPL type 'First the phase rates ... tget snpl sour 'J1159' '' opty 'rate'; inext 'sn';inver 3 ncount 5 timer 0 dotv 1 inps type 'And then the delays ... opty 'dela' inps type 'To save time we will copy the solutions from the type 'second run of FRING as SN table 4. tget tacop; inext 'sn';outver 4;inver 2 go tacop type 'We can plot these too. Delays ... tget snpl inver 4 opty 'dela';ncount 6 inps type ' ... and phase rates opty 'rate' inps type 'Now we combine these two sets of solutions into a CL type 'table so that they can be applied to the data type 'To make this simpler, we delete SN tables 1 and 2 type 'which contained amplitude information, then we can type 'just tell CLCAL to combine all the SN tables type 'So we set SNVER = 0 to use all SN tables and type 'we go from CL 2 (which contained the amplitude type 'corrections) to a new CL 3. inext 'sn';inver 1;extde inver 2;extde task 'clcal' calso 'j1159' timer 0;ante 0 opc '';interpol 'ambg' intparm 0 cutoff 0 snver 0 gainver 2 gainuse 3 refant 0 inps type 'Now we can check that this has flattenend that phase type 'across the band, between the 2 IFs and with time! tget possm ante 2 0 timer 0 15 0 0 0 16 0 stok 'rr' docal 1;gainuse 0 go tget vplot docal 1 gainuse 0 go type 'Now we can make an image of J1159+291, applying the phase calibration type 'The quickest way (honest!) is to use HORUS and APCLN. type 'HORUS produces a dirty map and beam; APCLN does the deconvolution type 'We use a 512 x 512 image with a cellsize of 0.4 mas. task 'horus' sour 'J1159' opty 'sum' bif 1;eif 2 bchan 1;echan 0 docal 1 gainuse 0 imsiz 512 cells 0.0004 uvwtfn 'na' stok '' inps type 'Have a look at the dirty image ... while we do the APCLN inty 'ma';inn 'J1159';incl 'imap';inseq 1; tvinit tvlod task 'apcln' inty 'ma';inn 'J1159';incl 'imap';inseq 1; in2di indi ;in2ty 'ma';in2n 'J1159';in2cl 'ibeam';in2seq 1; blc 0 gain 0.1 bmaj 0.0025 bmin 0.0025 niter 500 nbox 0;clbox 0 dotv -1 inps type 'And now the cleaned image ... incl 'icln';inseq 1;tvlod type ' ... also as a contour plot task 'cntr' blc 140;trc 360; clev 0;plev 1;levs -1,1,2 4 8 16 32 64 90 dotv 1 inps type 'While we have this image to hand, we will look at the type 'clean components. First we run CCMRG, just to squash them type 'to 1 CC per pixel then we print them to the screen with PRTCC. task 'ccmrg' inver 0;outver 0 inps task 'prtcc' docrt 1 outpri '' inver 0 xinc 1 inps type 'We can now improve on this image with self-calibration. type 'Having done the calibration across the frequency channels type 'we can average the data across the frequency channels type 'do reduce the size of the data set and make everything type 'run much faster. SPLIT applies all the calibration type 'and does the averaging. task 'split' inn 'vlbdemo';incl 'uvdata';inty 'uv';inseq 1 sour 'J1159' '' clron;outdi indi docal 1 gainuse 0 bif 1;eif 2;bchan 1;echan 0 flagver 1 douvc 1 aparm 2 0 inps type 'Plotting these data against uv-distance shows that the type 'amplitude calibration using the measured Tsys values type 'is poor for some antennas. We can correct this using type 'CALIB with a long solution interval and a simple model type 'of the source task 'uvplt' inn 'J1159';incl 'split';inseq 1;inty 'uv' aparm 0 bif 1;eif 1;stok 'rr';bchan 1;echan 0 docal -1 flagver 0 bparm 0 dotv 1 inps task 'calib' in2di indi ;in2ty 'ma';in2n 'J1159';in2cl 'icln';in2seq 1; calso '' bchan 1 echan 0 bif 1;eif 2 ante 0;dofit 0 docal -1 ncomp -100 clron;outdi indi solint 120 solty '';solmo 'a&p' snver 0 cparm 0 aparm 4 0; inps type 'We can check the solutions with SNPL.... task 'snpl' inext 'sn' stok 'r' opty 'amp';ncount 6 opc '' xinc 1 dotv 1 sour '' bif 1;eif 1 inps type 'And remake the map using IMAGR now task 'imagr' incl 'calib';inseq 0 docal -1 bif 1;eif 2 stok '' clr2n nfield 1;rashi 0;decshi 0 imsiz 256 cells 0.0004 uvwtfn 'na' robust 0 nbox 0 clbox 0 niter 1000 dotv 1 bmaj 0.0025;bmin 0.0025 inps type 'Use TVBOX to set some new windows on the cleaned image type 'and we will use BOX2CC and CCEDT to exclude from the model type 'all CCs which fall outside these boxes inty 'ma';inn 'J1159';incl 'icln';inseq 1; tvinit pixr -0.01,0.2 tvlod tvbox box2cc task 'ccedt' inver 0;outver 0;cparm 0 inps type 'Now we can re-do the CALIB with the improved map. type 'and a shorter solution interval. tget calib;solint 10;in2seq 0;ncomp 0 inps type 'And re-make the image ... tget imagr; nbox 0;clbox 0 inseq 0;go type 'Now set the boxes to exclude CCs again .. inty 'ma';inn 'J1159';incl 'icln';inseq 1; tvinit pixr -0.01,0.2 tvlod tvbox box2cc task 'ccedt' inver 0;outver 0;cparm 0 go type 'And re-do the CALIB with the improved map, this time with a type 'shorter solution interval again ... tget calib;in2seq 0;ncomp 0;solint 2 inps type 'And re-make the image ... tget imagr; nbox 0;clbox 0 inseq 0;go inty 'ma';inn 'J1159';incl 'icln';inseq 1; tvinit pixr -0.01,0.2 tvlod type 'That should do for imaging the phase calibrator ... type 'We should now repeat the calibration on the type 'original file so that we can apply these amplitude type 'corrections and any small phase difference due to the type 'structure of the phase calibrator source to our faint targets. tget calib aparm(7) 3 solint 0 inn 'vlbdemo';incl 'uvdata';inseq 0 docal 1 snver 5 bchan 1 echan 0 bif 1;eif 1 calso 'j1159' '' inps type 'And update a new CL table (4) with these corrections ... task 'clcal' calso 'j1159';sour ''; refant 0 snver 5 gainuse 4;gainver 3 interpol '';intparm 0;opc '';opty '' inps type 'Just check the final CL table ... task 'snpl' inext 'cl';inver 0;opty 'amp' sour '' timer 0 bif 1;eif 1 opc '' bcount 1 xinc 1 dotv 1 go type 'And finally, we can make a map of a faint target ... type 'We just use HORUS and APCLN as before ... tget horus inn 'vlbdemo';incl 'uvdata';inty 'uv';inseq 1 docal 1;gainuse 0 sour 'FIRST048' go tget apcln;inn 'FIRST048';in2n inn;nbox 0;inseq 0;in2seq 0 niter 500;go incl 'icln';inseq 0 tvinit tvlod ret;fin