$ VLBARUN - Amy Mioduszewski, NRAO - Oct 2 2014
$ Ver 1.0 : based heavily on VLBAPIPE
$---------------------------------------------------------------
$0000000011111111112222222222333333333344444444445555555555666666666677777777778
$2345678901234567890123456789012345678901234567890123456789012345678901234567890
$===============================================
$! Applies amplitude and phase calibration procs to VLBA data
$# RUN POPS VLBI UTILITY CALIBRATION IMAGING
$---------------------------------------------------------------
$; Copyright (C) 2014-2015
$; 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
$---------------------------------------------------------------
$===============================================================
PROCEDURE P_INIT
$
$ Define VLBAUTIL and variables for VLBA pipeline
$----------------------------------------------
docrt 1;dowa true
SCALAR P_DISK, P_SQ, P_NUM, P_VER, P_DOHTML, P_DOEMAIL, P_INVERS
SCALAR P_CLINT, P_ANTNUM, P_SOLINT, P_TINT, P_MIN, P_MAX, P_SEQ
SCALAR P_DOSTART, P_DOTIMER, P_NUMCAL, P_NUMREF, P_FREQUID, P_AP8
SCALAR P_ERROR, P_DEBUG, P_ROW, P_FACTOR, P_IFS, P_INSEQ, P_SI, P_IMSEQ
SCALAR P_LDFILE, P_ONDISK, P_INDI, P_OBSFQ, P_CHAN, P_NCHAN, P_DOPL
SCALAR P_PVER, P_IVER, P_I, P_FOUND, P_NUMANT, P_GU,P_DB,P_BP,P_NPL
ARRAY P_IMSIZE(2), P_PLCNT(20), P_CLCNT(10)
ARRAY P_CALSCANT(8), P_BADDISKS(10), P_NO_SLFCL(30)
STRING*2 P_REFANT, P_EXT, CHREFANT
STRING*4 P_TYP, P_MODE, P_INTERPOL
STRING*6 P_CLASS, P_INCL, P_IMCL
STRING*8 P_TASK
STRING*12 P_EXPNA, P_NA, P_INNA
STRING*16 P_CALSOURC(30), P_ATARGETS(30), P_PLABEL, P_SRC
STRING*48 P_DATAIN, P_DIR, P_EMAIL
STRING*66 P_LINE(2), P_OUTDIR
$ from input dialog:
P_DATAIN = DATAIN ;P_EXPNA = OUTNAME ;P_DISK = OUTDISK
P_INNA = INNAME ;P_INCL = INCLASS ;P_INSEQ = INSEQ
P_INDI = INDISK ;P_MODE = OPTYPE ;P_CLINT = CLINT
P_REFANT = CHREFANT ;P_CALSCANT = TIMERANG ;P_CALSOURC = CALSOUR
P_ATARGETS = SOURCES ;P_SOLINT = SOLINT ;P_IMSIZE = IMSIZE
P_FACTOR = FACTOR ;P_DOPL = DOPLOT ;P_DIR = OUTFILE
P_EMAIL = OUTTEXT ;P_BADDISKS = BADDISK ;P_INVERS = INVERS
$---
P_DOTIMER = 0 ;P_ERROR = 0 ;P_DOHTML = -1
P_LDFILE = -1 ;P_ONDISK = -1 ;P_DOEMAIL = -1
P_SEQ = 1 ;P_FOUND = -1 ;P_NUMANT = 0
P_INTERPOL = '2PT' ;P_OUTDIR = '' ;INVERS = 0
FOR I = 1 TO 10; P_CLCNT(I) = -1; END
$--- and set to defaults
tput vlbarun;vnum 35;vput vlbarun;task'vlbarun'
VBA_NFQI=0;VBA_SX=0;VBA_9050=0 $ must be 0 in VLBAUTIL, used in P_GETFQNUM
RETURN;finish
$===============================================
PROCEDURE P_RESTART
clrstat;inext'pl';j = maxtab(inext);if (j>0) then;invers -1;extdest;end
ine'bp';j = maxtab(inext);if (j>0) then;invers -1;extdest;end
ine'fg';j = maxtab(inext);if (j>1) then;for i=2:j;invers i;extdest;end;end
ine'cl';j = maxtab(inext);if (j>1) then;for i=2:j;invers i;extdest;end;end
ine'sn';j = maxtab(inext);if (j>0) then;invers -1;extdest;end
RETURN;finish
$===============================================
PROCEDURE P_RESET
p_restart
RETURN;finish
$===============================================
PROCEDURE P_ZAPALL
chkname;if (error<1) then;indisk p_disk;for j=1 to (1-1*error);zap;end;end
RETURN;finish
$===============================================
PROCEDURE P_ALLPLOT(P_MIN)
if(p_min=0)then;p_min=1;end;p_max=maxtab('PL');j=p_max-p_min+1
type char(j)!!' PLOT FILES TO SHOW ON TV:'!!char(p_min)!!' TO:'!!char(p_max)
if (j > 0) then; tvinit; for i=p_min:p_max;plver i
type 'plot #'!!char(i-p_min+1)!!'/'!!char(j)!!' -- TYPE A ZERO TO STOP'
grchan=0;grclear;runwait('tvpl');p_num=1;read p_num
if (p_num=0) then;i=p_max+1;end;end
else;type 'NOTHING TO PLOT - DONE';end
RETURN;finish
PROCEDURE P_INFO (P_TASK)
if (p_debug > 0) then
task p_task;type '*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*'
inp;type '*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*'; j = 1
type 'TYPE RETURN TO CONTINUE, ZERO TO STOP';read j
if (j = 0) then;type 'OK, STOPPING AT' p_task;p_error = 99;end
end;type p_task!!' RUNNING ..'
RETURN;finish
$===============================================
PROCEDURE P_GETSTOK
$ NOTE: sets stokes (default/undetermined -> stokes = '')
keyvalue 0;keystrng '';j = 0
while ( (j < 8) & (substr(keystrng,1,6) <> 'STOKES') )
j = j + 1;keyword 'ctype'!!char(j);gethead
if (substr(keystrng,1,6) = 'STOKES') then
keyword 'crval'!!char(j);gethead
if (keyvalue(1) = -1) then;stokes = 'RR'
else if (keyvalue(1) = -2) then;stokes = 'LL'
else if (keyvalue(1) = 1) then;stokes = 'I'
else;stokes = ' ';end;end;end;
end
end
RETURN;finish
$===============================================
PROCEDURE P_FQINFO
$ Sets the frequency information from the header
p_getstok;keyvalue 0;keystrng '';j = 0
while ((j < 8) & (substr(keystrng,1,4) <> 'FREQ'))
j = j + 1;keyword 'ctype'!!char(j);gethead
if (substr(keystrng,1,4) = 'FREQ') then
keyword 'crval'!!char(j);gethead;p_obsfq = keyvalue(1) $ obs frequency
keyword 'cdelt'!!char(j);gethead;p_chan = keyvalue(1) $ channel bandwidth
keyword 'naxis'!!char(j);gethead;p_nchan = keyvalue(1) $ number of channels
end
if (substr(keystrng,1,2) = 'IF') then
keyword 'naxis'!!char(j);gethead;p_ifs = keyvalue(1) $ number of IFs
end;
end
$ * * * * find freq -> sefd
$ * * * * find mode (typ) -> TBW (assume 2bit) and get #vis for ext=im - not bl
RETURN;finish
$===============================================
PROCEDURE P_SNPLOT (P_NA, P_SQ, P_EXT, P_VER, P_TYP, P_MIN, P_MAX, P_NUM)
type p_na
task'snplt';default;inname p_na;inclass p_class;inseq p_sq;indisk p_disk
inext p_ext;invers p_ver;pixrange p_min,p_max;nplots p_num;optype p_typ
if (p_typ = 'DDLY') then;p_getstok;end $ only one (first) stokes needed
$ p_info('snplt')
if (p_error = 0) then
dotv -1;plver = p_ver;runwait('snplt')
end;timerang p_calscant;
RETURN;finish
$===============================================
PROCEDURE P_POSSM(P_NA, P_SQ, P_GU,P_DB,P_BP,P_NPL,P_SI, P_SRC, P_AP8)
$----------------------------------------------
default 'possm'; inname p_na;inclass p_class;inseq p_sq;indisk p_disk
docal 1; gainuse=p_gu; doband=p_db; bpver=p_bp; nplots=p_npl; solint=p_si
source ''; source(1)=p_src; stokes 'half'; aparm(8)=p_ap8
if(p_ap8<2)then;baseline refant, 0;aparm(2)=1;aparm(5)=-180; aparm(6)=180;end
aparm(9)=1;runwait('possm')
return;finish
$===============================================
PROCEDURE P_VPLOT(P_NA, P_SQ,P_GU,P_DB,P_BP,P_NPL,P_SI, P_SRC)
$----------------------------------------------
default 'vplot'; inname p_na;inclass p_class;inseq p_sq;indisk p_disk
docal 1; gainuse=p_gu; doband=p_db; bpver=p_bp; nplots=p_npl; solint=p_si
source ''; source(1)=p_src; stokes 'half';nplots 8; echan=p_nchan; solint 1
baseline refant, 0; bparm 0, 2, 1, 0, 0,-180, 180; do3col 1;docal 1;
runwait('vplot')
return;finish
$===============================================
PROCEDURE P_KNTR(P_NA)
$----------------------------------------------
default 'imean'; inname p_na;inclass 'ICL001';indisk p_disk;
intype ''; inseq 0; chkname;
if(error<1) then; p_imcl='ICL001';p_imseq=1-error
else;
inclass='RCL001'; chkname;
if(error<1) then; p_imcl='RCL001';p_imseq=1-error
else;inclass='LCL001'; chkname;
if(error<1) then; p_imcl='LCL001';p_imseq=1-error;end;'
end;end
if(error<1) then
inclass=p_imcl;nboxes 50; docal -1; outtext ''; runwait('imean')
default 'kntr'; inname p_na;inclass p_imcl;inseq p_imseq;indisk p_disk
dogrey -1;dovect -1;clev=3*triangle(15);levs(1)=-1.414;levs(2)=-1;
tvchan=0; dodark -1;for p_i=3 to 30; levs(p_i)=2**((p_i-3)/2);end
runwait('kntr')
else
type 'Error making image plots, could not find image file'
end
return;finish
$===============================================
PROCEDURE P_HTMLPUT(P_LINE)
default system; sys2com(1)=p_line(1); sys2com(2)=p_line(2); syscom 'echo
sys2com(3)=' >>'; sys2com(4)=substr(p_outdir,1,length(p_outdir))!!'vlbarun.html
system; return; finish
$===============================================
PROCEDURE P_PLOTFILE(P_NA, P_IMCL,P_SQ,P_PVER, P_IVER, P_PLABEL)
default 'lwpla'; inname p_na;inclass p_imcl ;inseq p_sq;indisk p_disk
for p_i=p_pver to p_iver;
plver=p_i; outfile=p_dir!!substr(p_plabel,1,8)!!char(p_i)!!'.ps
runwait('lwpla'); default system; syscom 'convert
sys2com(1)= p_outdir!!substr(p_plabel,1,8)!!char(p_i)!!'.ps
sys2com(2)= p_outdir!!substr(p_plabel,1,8)!!char(p_i)!!'.gif
system
default system; syscom '\rm
sys2com(1)=p_outdir!!substr(p_plabel,1,8)!!char(p_i)!!'.ps
system
if(p_dohtml>0)then; p_line(2)='>"'
p_line(1)=' "
0) then;VBA_NFQI = VBA_NFQI + 1;end $ add one for S/X band
if (VBA_9050 > 0) then;VBA_NFQI = VBA_NFQI + 1;end $ add one for 90/50 band
RETURN;finish
$===============================================
PROCEDURE P_GETSUROW
$ NOTE: proc sets p_row
inext'su';invers 0;keyword'num row';getthead;p_row = keyvalue(1);
RETURN;finish
$===============================================
PROCEDURE P_EXIT
$ Restore values
vnum 35;vget vlbarun;dowait -1;vnum 0;
RETURN;finish
$===============================================
PROCEDURE P_GETUVF
$
$ Determine UV file class to work on
$ NOTE: proc sets P_CLASS
$----------------------------------------------
if(p_ondisk<>1) then
inname p_expna;inseq 1;indisk p_disk;intype 'uv';inclass 'fxpol';chkname
if (error = 0) then;p_class inclass $ dual polarization, one frequency
else;inclass 'fpol'!!char(p_frequid);chkname;
if (error = 0) then $ dual pols and multi freq with new outclass;del old
p_class inclass;inclass 'fq-'!!char(p_frequid);p_zapall;recat
else;inclass 'fq-'!!char(p_frequid);chkname;
if (error = 0) then;p_class inclass $ polarizations okay, multiple freqs
else;p_class 'uvdata';end;end $ polarizations okay, single frequency
end;inclass p_class
else
p_class=p_incl; p_expna=p_inna;p_seq=p_inseq; p_disk=p_indi
end
RETURN;finish
$===============================================
PROCEDURE P_WCHSCAN
p_i=1
while(p_found<0)
default bscan;inname p_expna;inclass p_class;inseq p_seq;indisk p_disk
docal 1; sources(1)= p_calsourc(p_i); runwait('bscan');invers=p_invers
if(chansel(3,1)=p_numant)then; p_found = p_i; end; p_i=p_i+1
end
if(p_found<0)then; p_error = 7
type 'CANNOT FIND GOOD CALIBRATOR SCAN WITH ALL ANTENNAS'
type 'PLEASE SET TIMERANG'
end
if(p_error=0)then;
if((chansel(1,1)-chansel(2,1))>0.0021) then
chansel(1,1)=chansel(2,1)-0.0021; end
p_calscant(1)=floor(chansel(1,1)); p_calscant(5)=floor(chansel(2,1))
p_calscant(2)=floor((chansel(1,1)-p_calscant(1))*24)
p_calscant(3)=floor((chansel(1,1)-(p_calscant(2)/24+p_calscant(1)))*1440)
p_calscant(4)=p_calscant(3)/1440+p_calscant(2)/24+p_calscant(1)
p_calscant(4)=floor((chansel(1,1)-p_calscant(4))*86400)
p_calscant(6)=floor((chansel(2,1)-p_calscant(5))*24)
p_calscant(7)=floor((chansel(2,1)-(p_calscant(6)/24+p_calscant(5)))*1440)
p_calscant(8)=p_calscant(7)/1440+p_calscant(6)/24+p_calscant(5)
p_calscant(8)=floor((chansel(2,1)-p_calscant(8))*86400)
end
finish
$===============================================
PROCEDURE P_PRECHECK
$
$ Prepare and check inputs for VLBA pipeline
$ NOTE: proc sets p_dotimer and p_dostart
$----------------------------------------------
$ check datain or inname
if (substr(p_datain,1,1) <> ' ')then; p_ldfile = 1; end
if (substr(p_inna,1,1) <> ' ' & p_inseq > 0) then; p_ondisk = 1; end
if (p_ondisk = 1 & substr(p_incl,1,1) <> ' ')then
p_ondisk = 1
else
p_ondisk = -1
end
if (p_ldfile = 1 & p_ondisk = 1) then
type 'SPECIFY DATAIN OR INNAME NOT BOTH'
p_error=1
end
if (p_ldfile < 0 & p_ondisk < 0) then
type 'DONT KNOW WHERE YOUR DATA IS: SPECIFY DATAIN OR INNAME'
p_error=1
end
$ check date file is pristine, only one CL table, no SN tables
$ and set the outnames etc because that is how the the script was
$ originally written
if (p_error=0 & p_ondisk = 1) then
if(maxtab('CL')>1) then; p_error=60; end
if(maxtab('SN')>0) then; p_error=60; end
if(p_error=60) then; type 'PARTIALLY CALIBRATED DATA - STOPPING'; end
end
$ check one freq id, does not check for S/X or 90/50
if (p_error=0 & p_ondisk = 1) then
INEXT = 'FQ'; INVERS = 1; KEYWORD = 'NUM ROW'; GETTHEAD
if(KEYVALUE(1)>1) then; p_error=70;
type 'MORE THAN ONE FREQID -- SEPARATE (RUN VLBAFIX) AND START AGAIN'
END;end
$ check outname, outdisk
if (substr(p_expna,1,1) = ' ' & substr(p_inna,1,1) <> ' ' ) then;
p_expna = p_inna;
else if (substr(p_expna,1,1) = ' ' & substr(p_inna,1,1) = ' ') then
type 'SPECIFY AN UNIQUE OUTNAME or INNAME'
p_error = 4;
end;end
if (p_disk = 0 & p_indi > 0) then;
p_disk = p_indi;
else if (p_disk = 0 & p_indi = 0) then
type 'SPECIFY AN OUTDISK or INDISK'
p_error = 4;
end; end
$ FUTURE check if outfile already exists - p_restart or bomb??
$ FUTURE check outdisk ?
$ check invers
if(p_invers=0) then; p_invers=1;end
$ spectral line data or continuum data to be expected?
if(p_mode = 'LINE') then; p_mode = 'SPEC'; end; p_fqinfo
if(p_mode = '' & p_nchan < 65) then; p_mode='CONT'; end
if(p_mode = '' & p_nchan >= 65) then; p_mode='SPEC'; end
if (p_error=0 & p_mode = 'SPEC') then $ apparently spectral line
type 'DOING SPECTRAL LINE PROCEDURE: NO PULSE CAL OR FREQUENCY AVERAGING'
else
if (p_error=0 & p_mode = 'CONT') then $ apparently continuum
type 'DOING CONTINUUM PROCEDURE: WITH PULSE CAL AND FREQUENCY AVERAGING'
else
if (p_error=0 & p_mode = 'PSEU') then $ pseudo continuum
type 'DOING PSEUDO CONTINUUM PROCEDURE: ';
type ' WITH PULSE CAL BUT -NO- FREQUENCY AVERAGING'
else if(p_mode <> 'SPEC' & p_mode <> 'CONT' & p_mode <> 'PSEU') then
type 'OBSERVATION MODE NOT KNOWN - FILL IN "OPTYPE" PROPERLY';p_error 1
end;end;end;end;
$ check if html directory and/or e-mail is wanted
if (length(p_email) > 0) then; p_doemail=1;end
if (p_doemail>0) then
p_email= 'X'!!p_email; substr(p_email,1,1)=' '; end
if (length(p_dir) > 0) then; p_dohtml=1; end
if (p_dohtml>0) then
if(substr(p_dir,length(p_dir),length(p_dir))<>':');then
if(substr(p_dir,length(p_dir),length(p_dir))<>'/');then
substr(p_dir,length(p_dir)+1,length(p_dir)+1)='/';end;end
p_outdir= p_outdir!!p_dir; substr(p_outdir,1,1)=' '
if(substr(p_outdir,length(p_outdir),length(p_outdir))=':') then
p_outdir= 'X$'!!p_dir; substr(p_outdir,1,1)=' ';
substr(p_outdir,length(p_outdir),length(p_outdir))='/';
else
p_outdir= 'X'!!p_dir; substr(p_outdir,1,1)=' '; end
if(length(p_dir)>37); then
type 'OUTPUT DIRECTORY LIMITED TO 37 CHARACTERS (including final /)'
type 'HINT: IF DESIRED OUTPUT DIRECTORY PATH LONGER THAN 31 CHAR'
type 'USE AN ENVIRONMENTALL VARIABLE AND DESIGNATE WITH A ":".'
type 'SEE EXPLAIN VLBARUN.'
p_error = 13;end
$check if convert command exists
default system; syscom 'which convert
system; if (error > 0) then
type 'ERROR: Cannot create plots for output html file because the
type 'ERROR: command convert does not exist on your computer.
type 'ERROR: Install convert or leave OUTFILE blank.
p_error=15; end
$check and create html file
if (p_error=0) then
default system; syscom 'ls
sys2com(1)=substr(p_outdir,1,length(p_outdir))!!'vlbarun.html
system; if (error < 0) then;
type 'ERROR: Output vlbarun.html file already exists.
p_error=14; else;
p_line(1)=' "
VLBARUN output
"
p_htmlput(p_line);p_line(1)=' "VLBARUN output for
p_line(2)=': '!!p_expna!!'.'!!p_incl!!'.'!!char(p_seq)!!'
"
p_htmlput(p_line); end
end; end
$ check reasonable clint -- very loose, default is 0.25
if(p_error=0) then;
if(p_clint=0) then; p_clint=0.25; type 'CLINT SET TO 0.25'; end
if(p_clint < 0) then;type 'CLINT < 0 UNVALID -- STOPPING';p_error=12;end
if((p_obsfq>10.e9) & (p_clint> 2)) then; p_error = 10
type 'CLINT IS TOO LARGE FOR YOUR FREQ, RESET CLINT AND START AGAIN'
else if((p_obsfq<10.e9) & (p_clint> 4)) then; p_error = 10
type 'CLINT IS TOO LARGE FOR YOUR FREQ, RESET CLINT AND START AGAIN'
end;end
clint = p_clint
$ check refant, FUTURE check if refant in array, get number of antennas
p_antnum = antnum(p_refant)
if(p_antnum = 0) then; type 'CHREFANT NOT SET, WILL TRY TO SET DEFAULT';end
if(p_antnum = 0) then; p_antnum=antnum('FD'); end
if(p_antnum = 0) then; p_antnum=antnum('PT'); end
if(p_antnum = 0) then; p_antnum=antnum('LA'); end
if(p_antnum = 0) then; p_antnum=antnum('KP'); end
if(p_antnum = 0) then; p_error=11;
type 'NO ANTENNA IN THE SOUTHWEST, PLEASE SET REFANT AND START AGAIN'
end
if(p_error<>11) then; type 'REFANT SET TO ANTENNA #', p_antnum
end
refant = p_antnum
inext 'an'; keyword 'num row'; getthead; p_numant = keyval(1)
$ check timerange and corresp scantime, if no timerang then auto-set
i = 1
while (i < 8) $ if timer(2) or above non-zero, timer is specified (not scan)
i = i + 1;if (p_calscant(i) > 0) then;p_dotimer = 1; p_found=1;end
end;
if ( (p_dotimer > 0) & (p_error = 0) ) then
type 'USING SPECIFIED TIMERANGE FOR VLBAPCOR OR VLBAMPCL'
i = p_calscant(5) - p_calscant(1)
i = p_calscant(6) - p_calscant(2) + 24 * i
i = p_calscant(7) - p_calscant(3) + 60 * i
if ( (p_calscant(8) - p_calscant(4) + 60 * i) < 1 ) then
type 'BUT NOW ENDING TIME PRECEEDS STARTING TIME - TRY AGAIN'
p_error = 6
end
else
if (p_calscant(1) = 0) then; p_dotimer=2
else;type 'USING SPECIFIED SCAN NUMBER INSTEAD OF TIMERANGE';end
end
$ check later if in data
p_numcal = 0;i = 0;
while (i < 30) $ count number of sources in calsour, do self-cal ?
i = i + 1
if (substr(p_calsourc(i),1,1) <> ' ') then
p_numcal = p_numcal + 1
if (substr(p_calsourc(i),1,1) = '-') then
j = length(p_calsourc(i))
p_calsourc(i) = substr(p_calsourc(i),2,j)
$ if (substr(p_calsourc(i),1,1) = '*') then
$ type 'SORRY HAVE TO EXIT: NO SELF CAL ALLOWED FOR CALSOUR = *'
$ p_error = 12
$ end;p_no_slfcl(i) = 0
$ else;p_no_slfcl(i) = 1
end;end;end;p_numref = 0;i = 0;
while (i < 30) $ count number of sources targeted (incl its Ph-Ref.)
i=i+1;if (substr(p_atargets(i),1,1)<>' ') then;p_numref=p_numref+1;end
end
if (p_numref = 0) then $ use calsour only (only strong sources, no Ph-Ref)
type 'NO PHASE-REF SCHEME SPECIFIED, ASSUMING ALL SOURCES ARE STRONG'
if (p_numcal = 0) then $ no sources specified !
$ type 'BUT NO CALIBRATOR SOURCES SPECIFIED ! TRY AGAIN'
type 'AT LEAST ONE CALSOURCE NEEDED - FOR P-CAL/BANDPASS CALIBRATION'
p_error = 8
else
if (substr(p_calsourc(2),1,1)='*') then
type 'WILL FRINGE FIT ALL SOURCES THAT ARE FOUND IN THE SU-TABLE'
$ p_no_slfcl = 1
else
type 'WILL FRINGE FIT ALL SOURCES IN CALSOUR, I.E. :'!!char(p_numcal)
end;end;end;
$ if sources, check if p_numref even (pairs), borrow p_num for loop
$ check later if in data, but here check if odd numbers are in calsource
if (substr(p_atargets(1),1,1) <> ' ') then
if (mod(p_numref,2) = 1) then $ odd number of sources
type 'ODD NUMBER OF SOURCES - SPECIFY PHAS-REF *PAIRS* !!'
p_error = 8
else $ check if odd numbered are in calsour, evens not in calsour
for i = 1 to p_numref by 2
j = length(p_atargets(i));p_num = 1
while ( (j < 17) & (substr(p_calsourc(p_num),1,1) <> ' ') )
if (substr(p_calsourc(p_num),1,j)=substr(p_atargets(i),1,j)) then
j = 17 $ found! stop the while loop
else;p_num = p_num + 1;end $ not found .. next
end
if (j <> 17) then $ source not found but should be there
type 'CALSOUR DOES NOT, BUT SHOULD, INCLUDE PH-REF. SOURCE :'!!p_atargets(i)
p_error 9
end;end;
for i = 2 to p_numref by 2
j = length(p_atargets(i));p_num = 1
while ( (j < 17) & (substr(p_calsourc(p_num),1,1) <> ' ') )
if (substr(p_calsourc(p_num),1,j)=substr(p_atargets(i),1,j)) then
j = 17 $ found! stop the while loop
else;p_num = p_num + 1;end $ not found .. next
end
if (j = 17) then $ source found but should not be there
type 'CALSOUR DOES, BUT SHOULD NOT, INCLUDE PH-REF. SOURCE :'!!p_atargets(i)
p_error 9
end;end
p_numref = p_numref / 2 $ # of pairs;can do because p_numref even
end
if ( (p_numref = 1) & (p_atargets(2) = '*') ) then
type 'PHASE-REFERENCING ALL NON-CALIBRATORS TO :'!!p_atargets(1)
end;end;
$ check solint FUTURE add check on other valid solints?
if (p_solint<0) then; type 'SOLINT<0 INVALID: STOPPING'; end
if (p_solint=0) then; p_solint=1;end
$ check map sizes for factor and imsize
if (p_factor < 1 & p_imsize(1) >= 0) then;p_factor = 1
type 'WILL NOT DO CALSOUR IMAGES SMALLER THAN 128 SQUARE; 128 IT IS'
else;if (p_factor > 64) then;p_factor = 64
type 'CALSOUR IMAGE REQUEST TOO BIG, WILL USE THE MAXIMUM OF 8192 SQUARE'
end;end;
if (substr(p_atargets(1),1,1) <> ' ' & p_imsize(1) >= 0) then
if ( (p_imsize(1) < 512) ! (p_imsize(2) < 512) ) then;p_imsize = 512
type 'WILL NOT DO SOURCES IMAGES SMALLER THAN 512 SQUARE; 512 IT IS'
else
if ( (p_imsize(1) > 8192) ! (p_imsize(2) > 8192) ) then;p_imsize = 8192
type 'SOURCE IMAGE REQUEST TOO BIG, WILL USE THE MAXIMUM OF 8192 SQUARE'
end;end;end;
$ include subarray , change into vlbafix ??
* if (p_debug > 0) then;type 'P_PRECHECK ERROR = '!!char(p_error);end
end
RETURN;finish
$===============================================
PROCEDURE P_LOAD
$
$ Load data and split freq-id's to prepare for VLBA pipeline
$ NOTE: proc sets VBA_NFQI
$----------------------------------------------
if (p_ldfile > 0) then $ start loading data
douvcomp=-1
type 'UNLESS DOTV > 0, YOU CAN GO HOME NOW; REST WILL BE AUTOMATIC'
type 'PROVIDED THAT ALL INPUTS ARE VALID SO I WONT BREAK'
p_info('vlbaload')
if (p_error = 0) then; vlbaload;recat;
type 'DONE WITH LOADING THE DATA'
$ check one freq id, does not check for S/X or 90/50
INEXT = 'FQ'; INVERS = 1; KEYWORD = 'NUM ROW'; GETTHEAD
if(KEYVALUE(1)>1) then; p_error=70;
type 'MORE THAN ONE FREQID - SEPARATE (RUN VLBAFIX) AND START AGAIN'
else
p_info('vlbafix');vlbafix
end;end;end;
RETURN;finish
$===============================================
PROCEDURE P_INSTCAL
$
$ Amplitude and instrumental phase calibration per freq-id
$ NOTE: proc sets VBA_PAIR
$----------------------------------------------
if (p_error = 0) then;p_getuvf $ find uvfile to work on
$tecor
p_info('vlbatecr')
if (p_error = 0 & p_obsfq<12.e9) then; go vlbatecr;
p_clcnt(1) = maxtab('cl'); end
$eops
p_info('vlbaeops');if (p_error = 0) then; go vlbaeops;
p_clcnt(6) = maxtab('cl');end
$cala
freqid 1;subarray 1 $ after vlbafix splitted into single freq/suba
p_info('vlbacala')
if (p_error = 0) then
go vlbacala;i = maxtab('sn');j = maxtab('cl');p_plcnt(1) = maxtab('pl')
if(p_dopl>1.5) then
p_snplot(p_expna, 1, 'sn', i-1, 'amp', 0,0, 8) $ #1
p_plcnt(3) = maxtab('pl');
if(p_dohtml>0)then;p_line(1)=' "SN table after ACCOR
p_line(2)='"'; p_htmlput(p_line);
p_plotfile(p_expna,p_class,1,p_plcnt(1)+1, p_plcnt(3),'ACCOR_SN'); end
p_snplot(p_expna, 1, 'cl', j-1, 'amp', 0,0, 8) $ #2
p_plcnt(4) = maxtab('pl');
if(p_dohtml>0)then;p_line(1)=' "CL table after ACCOR
p_line(2)='"'; p_htmlput(p_line);
p_plotfile(p_expna,p_class, 1,p_plcnt(3)+1, p_plcnt(4),'ACCOR_CL');end
p_snplot(p_expna, 1, 'sn', i, 'amp', 0, 0, 8) $ #2
p_plcnt(5) = maxtab('pl');
if(p_dohtml>0)then;p_line(1)=' "SN table after APCAL
p_line(2)='"'; p_htmlput(p_line);
p_plotfile(p_expna,p_class, 1,p_plcnt(4)+1, p_plcnt(5),'APCAL_SN');end
end
if (p_dopl>0.5) then
p_plcnt(5) = maxtab('pl') $ in case p_dopl=1
p_snplot(p_expna, 1, 'cl', j, 'amp', 0, 0, 8) $ #3
p_plcnt(6) = maxtab('pl');
if(p_dohtml>0)then;p_line(1)=' "CL table after APCAL
p_line(2)='"'; p_htmlput(p_line);
p_plotfile(p_expna,p_class, 1,p_plcnt(5)+1, p_plcnt(6),'APCAL_CL')
end;end
$ outseq p_frequid;outclass '';runwait('tasav')
p_clcnt(2) = j-1;p_clcnt(3) = j;p_info('vlbapang')
go vlbapang;j = maxtab('cl');p_clcnt(4) = j; p_plcnt(7) = maxtab('pl');
if (p_dotimer = 0)then; timerang = scantime(p_calscant(1));end
if (p_dotimer = 1)then;timerang = p_calscant;end
if (p_dotimer = 2)then;p_wchscan;timerang = p_calscant;end
calsour p_calsour(p_found),'';gainuse 0;docal 2;doban -1;opcode''
$if (maxtab('bp') > 0) then;bpver 0;doban 1;end
inext'fq';invers 1;keyword = 'no_if';getthead;
if (keyvalue(1) > 1) then $ if only 1 IF then no need to align IFs ..
refant=p_antnum;j = maxtab('pc') $ check for pc table
if ( (p_mode = 'SPEC') & (j > 0) ) then
type 'WEIRD: FOUND A PC TABLE IN MODE SPEC - WILL NOT USE IT ANYWAY'
end
if ((p_mode <> 'SPEC') & (j > 0) & (p_invers>-0.5)) then $ use pulse-cal tones
p_info('vlbapcor');if(p_error = 0) then;invers=p_invers;go vlbapcor;end
else $ spectral-line or pccor not wanted;do manual pcal
p_info('vlbampcl');if (p_error = 0) then;go vlbampcl;end
end;i = maxtab('sn');j = maxtab('cl');p_clcnt(5) = j;
aparm 0, 1, 0, 0, -180, 180, 0 0 3
if (p_dopl>0.5) then
p_possm(p_expna, p_sq, maxtab('cl'), -1, 0, 9, -1, calsour(1),0)
p_plcnt(8) = maxtab('pl')
if(p_dohtml>0)then;p_line(1)=' "Intrumental Phase Cals
p_line(2)='"'; p_htmlput(p_line);
p_plotfile(p_expna,p_class, 1,p_plcnt(7)+1, p_plcnt(8),'INSTRCAL')
end;end;end;end;end
p_plcnt(9) = maxtab('pl'); p_plcnt(11) = maxtab('pl');
RETURN;finish
$===============================================
PROCEDURE P_EXTRAS
$
$ Do some extras: BPASS (removed UVMLN)
$----------------------------------------------
$bpass
task 'bpass';calsour p_calsourc(1),'';solint -1;bpver 1;flux 0;timerang 0
antenna 0;bchan 1;echan 0;bpassprm 1 0 1 0 0 0 0 1 1 6 0;stokes''
gainuse=maxtab('cl');refant=p_antnum;p_info('bpass');
if (p_error = 0) then
vput bpass;runwait('bpass'); aparm 0 1 .5 1.3,-20 20 0 2 1 0
if (p_dopl>0) then
p_possm(p_expna, p_sq, maxtab('cl'), 1, 0, 6, 0, calsour(1), 2)
p_plcnt(12) = maxtab('pl');
if(p_dohtml>0)then;p_line(1)=' "Bandpass solutions
p_line(2)='"'; p_htmlput(p_line)
p_plotfile(inname,p_class, 1,p_plcnt(11)+1, p_plcnt(12),'BANDPASS')
end;end;end
RETURN;finish
$===============================================
PROCEDURE P_FRING
$----------------------------------------------
$ First do all clcals on calsources, then the pairs
if (substr(p_calsourc(2),1,1)='*') then
calsour '';sources '';p_getsurow;p_numcal = p_row $ do all sources
else
calsour p_calsourc;sources p_calsourc $ includes phase-refs, not targets
end
* search = 0 $ better make sure solutions exist
search = antnum('PT'),antnum('LA'),antnum('KP'),antnum('FD'),antnum('OV')
search(6)~antnum('NL'),antnum('BR'),antnum('NH'),antnum('SC'),antnum('MK')
bchan 0;interpol p_interpol;aparm(6) 1;aparm(9) 1;baddisk p_baddisks;
solint = p_solint;dparm(8) 0;refant=p_antnum;p_info('vlbafrng')
if (p_error = 0) then
go vlbafrng;gainuse=maxtab('cl');vput clcal $ -- for phase-ref
if ((p_numref>0)&(p_atargets(2)<>'*')) then $ sources not empty, nor all
for i = 1 to p_numref $ vlbafrng did all cals, now do the pairs
j = length(p_atargets(2*i));p_getsurow;keystrng''
while ((p_row>0)&(substr(p_atargets(2*i),1,j)<>substr(keystrng,1,j)))
inext'su';pixxy p_row 2 0;tabget
if (substr(p_atargets(2*i),1,j) = substr(keystrng,1,j)) then $ found
p_row = -1;p_error = 0
else;p_row = p_row - 1;p_error = 31;end
end;
if (p_error = 0) then $ source found;check for reference
j = length(p_atargets(2*i-1));p_getsurow;keystrng''
while ((p_row>0)&(substr(p_atargets(2*i-1),1,j)<>substr(keystrng,1,j)))
inext'su';pixxy p_row 2 0;tabget
if (substr(p_atargets(2*i-1),1,j)=substr(keystrng,1,j)) then $found
p_row = -1;p_error = 0
else;p_row = p_row - 1;p_error = 32;end
end;
if (p_error = 32) then
type 'TARGET IN UV DATA FILE, BUT REFERENCE NOT - CANNOT DO THIS !!'
end
else
type 'COULD NOT FIND TARGET IN UV DATA FILE - NOTHING TO REFERENCE'
$ keep p_error non-zero to avoid next clcal
end;
if (p_error = 0) then $ pair observed in this freq-ID
vget clcal;interpol p_interpol;sources p_atargets(2*i), ''
calsour p_atargets(2*i-1), '';p_info('clcal')
if (p_error = 0) then;runwait('clcal');vput clcal
type '**'!!calsour(1)!!' USED TO PHASE-REFERENCE :'!!source(1)!!'**'
end
else
type 'THUS :' p_atargets(2*i-1) p_atargets(2*i)
type ' AS PHASE REFERENCE PAIR SKIPPED - NOT AS PAIR IN UV DATA SET'
$ reset p_error to finish loop and program
p_error = 0
end;end;
else
if (p_atargets(2) = '*') then
vget clcal;interpol p_interpol;calsour p_atargets(1), ''
for i=1:p_numcal;sources(i)='-'!!p_calsourc(i);end $ not the cal's
p_info('clcal')
if (p_error = 0) then
runwait('clcal')
type '** ALL NON-CALIBRATORS PHASE-REFERENCED TO :'!!calsour(1)!!'**'
end;end;end;i = maxtab('sn');j = maxtab('cl'); p_clcnt(7) = j
if(p_dopl>1.5) then
p_snplot(inname, 1, 'sn', i, 'phas', -180, 180, 8) $ #4
p_snplot(inname, 1, 'sn', i, 'dela', 0, 0, 8) $ #4
p_snplot(inname, 1, 'sn', i, 'rate', 0, 0, 8) $ #4
p_snplot(inname, 1, 'sn', i, 'snr', 0, 0, 8) $ #4
p_plcnt(13) = maxtab('pl');
if(p_dohtml>0)then;
p_line(1)=' "Phase, delay, rate, snr in SN table after
p_line(2)=' FRING
"'; p_htmlput(p_line)
p_plotfile(p_expna,p_class,1,p_plcnt(12)+1, p_plcnt(13),'fring_sn');end
p_snplot(inname, 1, 'cl', j, 'amp', 0, 0, 8) $ #7
p_plcnt(14) = maxtab('pl');
if(p_dohtml>0)then;
p_line(1)=' "Amplitude in CL table after
p_line(2)=' FRING
"'; p_htmlput(p_line)
p_plotfile(p_expna,p_class,1,p_plcnt(13)+1, p_plcnt(14),'framp_cl');end
end
if(p_dopl>0.5)then
p_plcnt(14) = maxtab('pl') $ in case p_dopl=1
p_snplot(inname, 1, 'cl', j, 'phas', -180, 180, 8) $ #7
p_snplot(inname, 1, 'cl', j, 'dela', 0, 0, 8) $ #7
p_snplot(inname, 1, 'cl', j, 'rate', 0, 0, 8) $ #7
p_plcnt(15) = maxtab('pl');
if(p_dohtml>0 )then;
p_line(1)=' "Phase, delay, rate in CL table after FRING
p_line(2)='"'; p_htmlput(p_line)
p_plotfile(p_expna,p_class,1,p_plcnt(14)+1, p_plcnt(15),'fring_cl');end
for i=1 to p_numref by 2;
p_vplot(p_expna, p_sq,maxtab('cl'),1,0, 9, 0.5, p_atarget(i));end
p_plcnt(16) = maxtab('pl')
if(p_dohtml>0)then;
p_line(1)=' "Phases of phase calibrator(s) with last
p_line(2)=' CL table applied
"
p_htmlput(p_line);
p_plotfile(p_expna,p_class,1,p_plcnt(15)+1, p_plcnt(16),'phasecal')end
end;end
RETURN;finish
$===============================================
PROCEDURE P_SPLIT
$
$ Split data for this frequency ID
$----------------------------------------------
task 'split';outdisk indisk;sources'';doban 1;bpver=maxtab('bp');gainuse 0
douvcomp=-1; stokes=''
timerang 0;outseq p_frequid;outclass substr(p_expna,1,6);keyword'naxis3'
gethead;bchan 1;echan keyvalue(1);nchav 0
if (p_mode <> 'CONT') then $ pseudo cont or spectral line, no freq averaging
aparm 0;type char(echan)!!' CHANNELS KEPT UNAVERAGED IN SINGLE SOURCE DATA'
else $ continuum, grab all together
aparm 2 0;type char(echan)!!' CHANNELS AVERAGED IN SINGLE SOURCE DATA'
end;aparm(6)=1;p_info('split')
if (p_error=0) then;runwait('split');end;
RETURN;finish
$===============================================
PROCEDURE P_SETCELL (P_TYP)
$ NOTE: sets cellsize, bchan, echan and nchav for imagr
keyword'crval3';gethead;cellsize 2.25e6/keyv(1);bchan 1;echan 1;nchav 1
if (p_typ <> 'CONT') then $ spec cube or otf-avg channels
keyword'naxis3';gethead;echan = keyvalue(1);
if (p_typ = 'PSEU') then;nchav = keyvalue(1);else $ skip few channels
if (p_typ = 'SPEC') then;bchan = ceil(echan/10);echan = floor(echan*9/10)
if (bchan = 1) then;bchan = 2;end;else $ ie first channel usually empty
type 'CANNOT DETERMINE IMAGE PARAMETERS';p_error = 15;end;end
end;
RETURN;finish
$===============================================
PROCEDURE P_SCMAP(J)
task'imagr';imsize 128;nit 5000;flux 5e-4;sources'';timerang 0;docal -1
gainuse 0;outdisk 2;uvwtfn'na';imagrp(1) 25;imagrp(10) 1;doband -1;invers 0
dotv -1;inseq p_frequid;outn'';outseq p_frequid;outdisk p_disk
fldsize p_factor*128 p_factor*128 0;minpatch fldsize(1,1);intype'uv'
im2parm 10 6 9 0.5; nboxes 50
for i = j to p_numcal
if (substr(p_calsourc(2),1,1)='*') then
p_getuvf;inext'su';pixxy i 2 0;tabget;inname keystrng;inseq p_frequid
else;inname p_calsourc(i);end
inclass substr(p_expna,1,6);clrtemp;chkname
if (error < 1) then $ always continuum image of strong sources (if > 10 vis)
p_setcell('PSEU');timerang 0;keyword'gcount';gethead
if ( (keyvalue(1) > 10) & (p_error = 0) ) then
type 'CALIBRATOR :'!!inname!!' BEING IMAGED NOW';runwait('imagr')
if (p_dopl > 0.5) then; p_kntr(inname);end
p_plcnt(17) = maxtab('pl');
if(p_dohtml>0 & p_plcnt(17)>0) then;
if(i=1) then;p_line(1)=' "Images
p_line(2)='"'; p_htmlput(p_line);end
if(i<10) then
p_plotfile(inname,inclass,inseq,1, p_plcnt(17),'IMAGCAL'!!char(i))
else
p_plotfile(inname,inclass,inseq,1, p_plcnt(17),'IMACAL'!!char(i))
end;end
$ if (substr(p_calsourc(2),1,1)<>'*') then
$ if (p_no_slfcl(i) = 0) then
$ task'scmap';out2disk p_disk;nmaps 4;aparm 3 0;solmode'';docal -1
$ if (p_solint = -1) then;solint = p_solint
$ else;solint = p_solint;end;runwait('scmap')
$ inc'SWTCHD';chkname;end;end
end;clrtemp;end;end;clrtemp
for i = 1 to p_numcal
if (substr(p_calsourc(2),1,1)<>'*') then
inname p_calsourc(i);inc'SCMAP';p_zapall $$ inc'SWTCHD';p_zapall
inclass'IBM001';inseq 0;indisk p_disk;intype'ma';p_zapall
inclass'RBM001';p_zapall;inclass'LBM001';p_zapall
else
inname p_expna;inclass 'UVDATA';inseq 0;ine'su'
pixxy i 2 0;tabget;inname keystrng
inclass'IBM001';inseq 0;intype'ma';indisk p_disk;p_zapall
inclass'RBM001';p_zapall;inclass'LBM001';p_zapall
end;intype'uv';end;clrtemp;recat;clrtemp
RETURN;finish
$===============================================
PROCEDURE P_IMAGR
imsize 512;fldsize p_imsize(1) p_imsize(2) 0;outc'';stokes='';doband=-1
im2parm 10 6 9 0.5; nboxes 50
if (p_numref > 0) then
if (substr(p_atargets(2),1,1)='*') then
inname p_expna;inclass 'UVDATA';p_getsurow;p_numref=p_row-p_numcal;p_sq=1
end;
for i = 1 to p_numref
if (substr(p_atargets(2),1,1)='*') then
j = 0;inname p_expna;inclass 'UVDATA';inseq 1;inext'su'
while ((p_sq<=p_row)&(j<>17))
pixxy p_sq 2 0;tabget;p_num = 1;j = length(keystrng) $ max 12
while ( (j<17) & (p_num<=p_numcal) )
if (substr(p_calsourc(p_num),1,j)=substr(keystrng,1,j)) then
j = 17;p_sq = p_sq + 1 $ found, stop comparing, take next
else p_num = p_num + 1;end
end;if (j <> 17) then;inname keystrng;j = 17;p_sq = p_sq + 1;end;end
else;inname p_atargets(2*i);end
inseq p_frequid;outseq p_frequid;inclass substr(p_expna,1,6);chkname
if (error < 1) then
p_setcell(p_mode);timerang 0;keyword'gcount';gethead
if ( (keyvalue(1) > 10) & (p_error = 0) ) then
type 'TARGET :'!!inname!!' BEING IMAGED NOW';runwait('imagr');end
if (p_error = 0 & p_dopl > 0.5) then;
p_kntr(inname)
end;end;end;
p_plcnt(18) = maxtab('pl');
if(p_dohtml>0 & p_plcnt(18)>0) then;
p_plotfile(inname,inclass,inseq,1, p_plcnt(18),'IMAGRTAR'); end
for i = 1 to p_numref
inname p_atargets(2*i);inclass'IBM001';inseq 0;indisk outdisk;intype'ma'
p_zapall;inclass'RBM001';p_zapall;inclass'LBM001';p_zapall
end;recat;end;
RETURN;finish
$===============================================
PROCEDURE P_REPORT
$
$ Report on tables and plots made
$----------------------------------------------
if(p_dohtml>0) then
p_line(1)=' "Summary of the CL tables produced by VLBARUN:
p_line(2)='
"
p_htmlput(p_line); p_line(1)=' "CL#1: Input CL table
p_line(2)='
"'
p_htmlput(p_line);
if (p_clcnt(1) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(1))!!': Ionospheric correction added
p_htmlput(p_line);
end;if (p_clcnt(6) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(6))!!': EOP correction added
p_htmlput(p_line);
end;if (p_clcnt(2) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(2))!!': Sampler correction added
p_htmlput(p_line);
end;if (p_clcnt(3) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(3))!!': Gain amplitude correction added
p_htmlput(p_line);
end;if (p_clcnt(4) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(4))!!': Parallactic angle correction added
p_htmlput(p_line);
end;if (p_clcnt(5) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(5))!!': Intrumnetal Phase-cal correction added
p_htmlput(p_line);
end;if (p_clcnt(7) > 0) then
p_line(1)=' "CL#'!!char(p_clcnt(7))!!': Fringe fit added (final table)
p_htmlput(p_line);
end;end
type ' ';type 'SUMMARY OF THE CL-TABLES PRODUCED FOR THIS DATA:';type ' '
type 'CL-1 : INPUT CL TABLE'
if (p_clcnt(1) > 0) then
type 'CL-'!!char(p_clcnt(1))!!' : IONOSPHERIC CORRECTION ADDED'
end;if (p_clcnt(6) > 0) then
type 'CL-'!!char(p_clcnt(6))!!' : EOP CORRECTION ADDED'
end;if (p_clcnt(2) > 0) then
type 'CL-'!!char(p_clcnt(2))!!' : SAMPLER CORRECTIONS ADDED'
end;if (p_clcnt(3) > 0) then
type 'CL-'!!char(p_clcnt(3))!!' : GAIN CORRECTIONS ADDED'
end;if (p_clcnt(4) > 0) then
type 'CL-'!!char(p_clcnt(4))!!' : PARALLACTIC ANGLE CORRECTION ADDED'
end;if (p_clcnt(5) > 0) then
type 'CL-'!!char(p_clcnt(5))!!' : INSTRUMENTAL P-CAL ADDED'
end;if (p_clcnt(7) > 0) then
type 'CL-'!!char(p_clcnt(7))!!' : TOTAL CALIBRATION TABLE'
end; type ' '
if (p_dopl > 0.5) then $ report about plots made
for i=14:2 by -1;if (p_plcnt(i)=0) then;p_plcnt(i)=p_plcnt(i+1);end;end
type 'THESE PLOTS HAVE BEEN PRODUCED FOR THIS FREQUENCY-ID:'; type ' '
if (p_dopl > 1.5) then
type '1-'!!char(p_plcnt(3))!!' SAMPLER CORRECTIONS IN SN'
type char(p_plcnt(3)+1)!!'-'!!char(p_plcnt(4))!!' SAMPLER CORR. ADDED TO CL'
type char(p_plcnt(4)+1)!!'-'!!char(p_plcnt(5))!!' GAIN CORRECTIONS IN SN'
end;
type char(p_plcnt(5)+1)!!'-'!!char(p_plcnt(6))!!' GAIN CORR. ADDED TO CL'
if (VBA_NFQI > 1) then;
type char(p_plcnt(7)+1)!!'-'!!char(p_plcnt(8))!!' (MANUAL?) P-CAL'
end;
type char(p_plcnt(11)+1)!!'-'!!char(p_plcnt(12))!!' BANDPASS CORRECTIONS'
if (p_dopl > 1.5) then
type char(p_plcnt(12)+1)!!'-'!!char(p_plcnt(13))!!' FRINGE-FIT SOLUTIONS IN SN'
type char(p_plcnt(13)+1)!!'-'!!char(p_plcnt(14))!!' AMP IN FINAL CL TABLE''
end;
type char(p_plcnt(14)+1)!!'-'!!char(p_plcnt(15))!!' FINAL CL TABLE'
type char(p_plcnt(15)+1)!!'-'!!char(p_plcnt(16))!!' PHASES AFTER FINAL CAL'
type ' '
end
RETURN;finish
$===============================================
PROCEDURE VLBARUN
$
$ Do whole VLBA pipeline
$----------------------------------------------
* inputs vlbarun
type '============================================================='
p_init;p_precheck;
if (p_error = 0) then;p_load;end
type '-------------------------'
if (p_error = 0) then;p_instcal;end
if (p_error = 0) then;p_extras;end
if (p_error = 0) then;p_fring;end
$ new bandpass table and plots here
if (p_error = 0) then;p_split;end
if (p_error = 0 & p_imsize(1)>0) then;p_scmap(1);end
if (p_error = 0 & p_imsize(1)>0) then;p_imagr;end
if (p_error = 0) then;p_report;end
p_exit;
if (p_error = 0) then
if (p_dohtml>0) then
p_line(2)='';p_line(1)=' ""
p_htmlput(p_line)
if(p_doemail>0) then
default system; sysout '/tmp/p_tempmail
syscom= 'echo "VLBARUN is done, please review your plots at:
if(substr(p_dir,length(p_dir),length(p_dir))=':')then
sys2com(1)='"'; system; syscom 'echo "file://"
sys2com(1)=substr(p_outdir,2,length(p_outdir));sys2com(2) ='"vlbarun.html"
else
sys2com(1)= ' file://
sys2com(2)= substr(p_dir,1,length(p_dir))!!'vlbarun.html"
end
system; default system
syscom= 'cat /tmp/p_tempmail | mail -s "VLBARUN DONE"
sys2com(1)= p_email
system;sys2com = ''
syscom= '\rm /tmp/p_tempmail
system
end;end
if (p_doemail>0 & p_dohtml<0) then
default system
syscom= 'echo "VLBARUN is done."
sysout= '/tmp/p_tempmail
system; default system
syscom= 'cat /tmp/p_tempmail | mail -s "VLBARUN DONE"
sys2com(1)= p_email
system;sys2com = ''
syscom= '\rm /tmp/p_tempmail
system
end
type '';type 'USE P_ALLPLOT(X) TO PLOT FROM PL-VERSION X ON TV';type ''
type 'PROCEDURE DONE, THANK YOU FOR CHOOSING AIPS FOR YOUR BUSINESS'
else
$ send e-mail saying procedure has failed
if (p_doemail>0) then
default system
syscom= 'echo "VLBARUN failed, please review your inputs and try again."
sysout= '/tmp/p_tempmail
system; sysout =''
syscom= 'cat /tmp/p_tempmail | mail -s "VLBARUN FAILED"
sys2com(1)= p_email
system;sys2com = ''
syscom= '\rm /tmp/p_tempmail
system
end
type 'SOME ERROR OCCURRED - PLEASE REVIEW YOUR INPUTS AND TRY AGAIN'
type p_error
end;
type '=============================================================';
tget vlbarun
RETURN;finish
$===============================================
PROCEDURE PIPE
vlbarun
RETURN;finish
$===============================================
procedure setoutfile
outfile='mya:'!!inname!!'.'!!inclass!!'.'!!char(inseq);i=1
while ( i < length(outfile) )
if (substr(outfile,i,i) = ' ') then; substr(outfile,i,i) = '_';end;i=i+1
end
typ outfile
finish
$===============================================
P_DEBUG = 0 $ can set to true and back in the interactive AIPS window