$ VLBARUN - Amy Mioduszewski, NRAO - Oct 2 2014 $ Ver 1.0 : based heavily on VLBAPIPE $--------------------------------------------------------------- $! Applies amplitude and phase calibration procs to VLBA data $# RUN POPS VLBI UTILITY CALIBRATION IMAGING $--------------------------------------------------------------- $; Copyright (C) 2014-2017, 2019-2023 $; 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 SCALAR P_INVERS, P_CLINT, P_ANTNUM, P_SOLINT, P_TINT, P_BR SCALAR P_MIN, P_MAX, P_SEQ, P_DOSTART, P_DOTIMER, P_NUMCAL SCALAR P_NUMREF, P_FREQUID, P_AP8, P_ERROR, P_DEBUG, P_ROW SCALAR P_FACTOR, P_IFS, P_INSEQ, P_SI, P_IMSEQ, P_LDFILE SCALAR 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 SCALAR P_BP, P_NPL, P_USERNO, P_CHKERR, P_DOAPLYD, P_DOFLAG SCALAR P_INTTIM, TYSMOLEV, P_SMOLEV, ELEVLIM, P_ELEV SCALAR SELFCAL, P_BPASS5, P_CHINC ARRAY P_IMSIZE(2), P_PLCNT(20), P_CLCNT(10), P_DOCLIP(2) ARRAY P_CALSCANT(8), P_BADDISKS(10), P_NO_SLFCL(30) ARRAY SMRATES(3) 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, P_SUBSTR, P_CNVRT, CALTASK, P_CTASK STRING*12 P_EXPNA, P_NA, P_INNA, P_DATE STRING*16 P_CALSOURC(30), P_ATARGETS(30), P_PLABEL, P_SRC STRING*48 P_DATAIN, P_DIR, P_EMAIL, P_INFI, P_INTEXT STRING*66 P_LINE(2), P_OUTDIR, P_SCR, P_OUTTMP $ 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_INFI = INFILE P_DOFLAG = DOFLAG ; P_INTEXT = INTEXT P_DOCLIP = DOCLIP ; P_SMOLEV = TYSMOLEV P_ELEV = ELEVLIM ; P_BPASS5 = BPASS5 P_CTASK = CALTASK ; P_CHINC = CHINC $--- and set to defaults if (smrates(1)>0) then; if (smrates(2)<=0) then; smrates(2)=smrates(1); end if (smrates(3)<=0) then; smrates(3) = 1000; end end tput vlbarun; vnumber= 36-getpopsn; vput vlbarun task 'VLBARUN' $--- 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 P_CHKERR = 1 ; P_LINE = '' ; P_DOAPLYD = -1 P_CLCNT = -1 ; P_PLCNT = -1 $ must be 0 in VLBAUTIL, used in P_GETFQNUM VBA_NFQI = 0; VBA_SX = 0; VBA_9050 = 0 IF ((p_ctask<>'CALIB') & (p_ctask<>'CALIBS')) then p_ctask = 'FRING'; end RETURN; FINISH PROCEDURE P_RESTART *--------------------------------------------------------------- * deletes all PL, BP, SN all but first CL tables *--------------------------------------------------------------- clrstat; inext 'PL'; j = maxtab(inext) if (j>0) then; invers = -1;extdest;end inext 'BP'; j = maxtab(inext); if (j>0) then; invers = -1;extdest;end inext 'FG'; j = maxtab(inext) if (j>1) then; print 'FG tables are not deleted end inext 'CL'; j = maxtab(inext); if (j>1) then;for i = 2:j; invers i; extdest; end; end inext 'TY'; j = maxtab(inext); if (j>1) then;for i = 2:j; invers i; extdest; end; end inext 'SN';j = maxtab(inext) if (j>0) then; invers = -1; extdest; end inext 'NS';j = maxtab(inext) if (j>0) then; invers = -1; extdest; end RETURN; FINISH PROCEDURE P_RESET *--------------------------------------------------------------- * call P_RESTART *--------------------------------------------------------------- p_restart RETURN; FINISH PROCEDURE P_ZAPALL *--------------------------------------------------------------- * deletes all catalog entries matching name parameters * uses adverbs INNAME, INCLASS, INSEQ, INTYPE, INDISK *--------------------------------------------------------------- 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) *--------------------------------------------------------------- * plots plot files P_MIN to max on the TV *--------------------------------------------------------------- p_min = max (1, p_min); p_max = maxtab('PL') j = p_max - p_min + 1 if (j>0) then; tvinit type char(j) !! ' plot files to show on TV: type 'Versions' !! char(p_min) !! ' TO:' !! char(p_max) for i = p_min:p_max; plver i type 'PLOT #'!!char(i-p_min+1)!!'/'!!char(j)!! type ' -- 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) print task name, inputs decide to continue * always print running message *--------------------------------------------------------------- if ((p_debug > 0) & (p_error=0)) then task p_task; type '*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*' inputs; type '*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*' tt = 1; type 'TYPE RETURN TO CONTINUE, ZERO TO STOP'; read tt if (tt = 0) then; p_error = 99 type 'OK, STOPPING AT' p_task; end end; if (p_error=0) then; type 'RUNNING_'!! p_task; end RETURN; FINISH PROCEDURE P_GSTOK *--------------------------------------------------------------- * NOTE: sets stokes (default/undetermined -> stokes = '') * does 'half' if possible *--------------------------------------------------------------- keyvalue 0; keystrng ''; j = 0; stokes = ' ' while ( (j < 8) & (substr(keystrng,1,6) <> 'STOKES') ) j = j + 1; keyword = 'CTYPE' !! char(j); gethead if (substr(keystrng,1,6) = 'STOKES') then keyword = 'NAXIS' !! char(j); gethead; p_i = keyvalue(1) keyword = 'CRVAL' !! char(j); gethead if (keyvalue(1) = -1) then; stokes = 'RR' if (p_i>1) then; stokes='HALF'; end; end if (keyvalue(1) = -2) then; stokes = 'LL'; end if (keyvalue(1) = -5) then; stokes = 'XX' if (p_i>1) then; stokes='HALF'; end; end if (keyvalue(1) = -6) then; stokes = 'YY'; end if (keyvalue(1) = 1) then; stokes = 'I'; end end end 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 Stokes & 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 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 PROC P_TVCOLR *--------------------------------------------------------------- * does TVCOLORS with default values *--------------------------------------------------------------- docolor = 1; plcolor=0 plcolor(1,1)~1,1,0, 0.063,1,0, 1,0.671,1, 0,1,1 plcolor(1,9)~1,1,0 RETURN,FINISH PROC P_SNPLOT (P_NA,P_SQ,P_EXT,P_VER,P_TYP,P_MIN,P_MAX,P_NUM) *--------------------------------------------------------------- * Runs SNPLT for catalog file p_na/p_class/p_sq on p_disk * extension p_ext, version p_ver pixrange p_min to p_max * p_num plots/page of parameter p_typ * plot files are made *--------------------------------------------------------------- if (p_error=0) then default 'SNPLT'; inname p_na; inclass p_class; inseq p_sq indisk p_disk; inext p_ext; invers p_ver; nplots p_num pixrange p_min,p_max; optype p_typ * only one (first) stokes needed for dispersive delay if (p_typ = 'DDLY') then; p_getstok; end p_info('SNPLT'); if (p_error = 0) then dotv -1; runwait ('SNPLT') end; timerang p_calscant $ reset altered adverb end RETURN; FINISH PROCEDURE P_UVPLOT (P_NA, P_CLASS, P_SQ) *--------------------------------------------------------------- * Runs UVPLT for catalog file p_na, p_class, p_seq *--------------------------------------------------------------- if (p_error=0) then default 'UVPLT'; inname = p_na; inclass = p_class inseq p_sq; p_gstok; p_info('UVPLT'); if (p_error = 0) then; nchav=4096; dotv=-1; factor=2.5; solint=0.5; bparm=11,0; bparm(10)=1; runwait ('UVPLT') bparm=0; bparm(10)=1; solint=1000; runwait ('UVPLT'); solint=0; factor=1; bparm=0; nchav=0; runwait ('UVPLT') end end RETURN; FINISH PROC P_POSSM (P_NA,P_SQ,P_GU,P_DB,P_BP,P_NPL,P_SI,P_SRC,P_AP8) *--------------------------------------------------------------- * Runs POSSM for catalog file p_na/p_class/p_sq gainuse p_gu * doband p_db, bpver p_bp, nplots n_npl, solint p_si * source p_src, aparm(8) p_ap8 *--------------------------------------------------------------- if (p_error=0) then default 'POSSM'; inname p_na; inclass p_class; inseq p_sq indisk p_disk; docalib 1; gainuse = p_gu; doband = p_db bpver = p_bp; nplots = p_npl; solint = p_si; aparm(9) = 1; source = p_src,''; p_gstok; aparm(8) = p_ap8 if (p_ap8<2) then; baseline refant, 0; aparm(2) = 1 aparm(5)=-180; aparm(6)=180; timerang=p_calscant; end p_info('POSSM'); if (p_error = 0) then dotv -1; runwait ('POSSM') end end RETURN; FINISH PROCEDURE P_VPLOT (P_NA, P_SQ,P_GU,P_DB,P_BP,P_NPL,P_SI, P_SRC) *--------------------------------------------------------------- * Runs VPLOT for catalog file p_na/p_class/p_sq gainuse p_gu * doband p_db, bpver p_bp, nplots n_npl, solint p_si * source p_src * Non-call adverbs: p_class, p_nchan, p_antnum, p_disk *--------------------------------------------------------------- if (p_error=0) then default 'VPLOT'; inname p_na; inclass p_class; inseq p_sq indisk p_disk; docalib 1; gainuse = p_gu; doband = p_db bpver = p_bp; nplots = p_npl; solint = p_si; p_gstok source = p_src,''; echan = p_nchan; baseline p_antnum, 0 bparm 0, 2, 1, 0, 0,-180, 180; do3col 1 p_info('VPLOT'); if (p_error = 0) then dotv -1; runwait ('VPLOT') end end RETURN; FINISH PROCEDURE P_KNTR (P_NA, P_IMCL, P_CHKERR) *--------------------------------------------------------------- * Runs KNTR: uses nameget to set p_imseq, uses IMEAN for CLEV * Inputs: p_na name, p_imcl class * Output: p_chkerr = seq number of file, < 0 => could not find *--------------------------------------------------------------- default 'IMEAN'; inname p_na; inclass 'ICL001'; intype 'MA' indisk = p_disk; nameget; if (error<1) then; p_imcl = 'ICL001'; p_imseq = inseq else; inclass = 'RCL001'; nameget if (error<1) then; p_imcl = 'RCL001'; p_imseq = inseq else; inclass='LCL001'; nameget if (error<1) then; p_imcl = 'LCL001'; p_imseq = inseq end end end inname p_na; inclass p_imcl; inseq p_imseq; indisk p_disk type 'P_KNTR', inname, inclass, inseq chkname; if (error<1) then nboxes 50; outtext ''; runwait('IMEAN'); nboxes 0 default 'KNTR';dogrey -1; dovect -1; clev = 3*triangle(15) levs = -1.414,-1; tvchan = 0; dodark -1; p_chkerr = -99 for p_i = 3 to 30; levs(p_i) = 2**((p_i-3)/2); end inname p_na; inclass p_imcl; inseq p_imseq; indisk p_disk keyword='naxis3'; gethead; zinc=keyvalue(1)/16 zinc = max(1,zinc); blc(3) = max(1,zinc/2) p_info('KNTR'); if (p_error = 0) then dotv -1; runwait ('KNTR'); p_chkerr = p_imseq; end else type 'ERROR MAKING IMAGE PLOTS, COULD NOT FIND IMAGE FILE' p_chkerr = -error end RETURN; FINISH PROCEDURE P_HTMLPUT (P_LINE) *--------------------------------------------------------------- * pipes contents of p_line to p_outdir file vlbarun.html *--------------------------------------------------------------- default system; sys2com = p_line, ' >>'; syscom 'echo sys2com(4) = p_outdir; sys2com(5) = 'vlbarun.html system RETURN; FINISH PROC P_PLOTFILE (P_NA,P_IMCL,P_SQ,P_BR,P_PVER,P_IVER,P_PLABEL) *--------------------------------------------------------------- * for catalog file p_na, p_imcl, p_sq and plot file versions * p_pver through p_iver makes PostScript files then gif files * with name p_outdir plus p_label and plot file number * P_BR controls whether the first plot is to the left or not * Non-call parameters: p_dir, p_outdir, p_disk, p_dohtml *--------------------------------------------------------------- STRING*10 P_SUBST SCALAR P_DOBR p_dobr = p_br; if (p_dobr=0) then; p_dobr=-1; end default 'LWPLA'; inname = p_na; inclass = p_imcl; inseq = p_sq; indisk=p_disk; p_subst = substr(p_plabel,1,10) docolor 1; plcolors 0; plcolors(1,10)~0.88 0.88 0.88 if (p_plabel='RFLAG') then; p_tvcolr; end for p_i = p_pver to p_iver; outfile = p_dir !! p_subst !! char(p_i) !! '.ps plver=p_i; runwait('LWPLA') if (p_cnvrt<>'') then default system; syscom p_cnvrt sys2com(1) = p_outtmp sys2com(2) = p_subst !! char(p_i) !! '.ps sys2com(3) = p_outdir sys2com(4) = p_subst !! char(p_i) !! '.gif system default system; syscom '\rm sys2com(1) = p_outtmp sys2com(2) = p_subst !! char(p_i) !! '.ps system if (p_dohtml>0) then; p_line(2)='>"' if (p_dobr) then p_line(1)=' "
0) then; VBA_NFQI = VBA_NFQI + 1; end if (VBA_9050 > 0) then; VBA_NFQI = VBA_NFQI + 1; end RETURN; FINISH PROCEDURE P_GETSUROW *--------------------------------------------------------------- * get number of sources in source table * output: p_row *--------------------------------------------------------------- inext 'SU'; invers 0; keyword'NUM ROW'; getthead; p_row = keyvalue(1); RETURN; FINISH PROCEDURE P_EXIT *--------------------------------------------------------------- * Restore initial values before exiting proc *--------------------------------------------------------------- vnumber = 36-getpopsn; vget vlbarun; dowait -1; vnumber 0 RETURN; FINISH PROCEDURE P_GETUVF *--------------------------------------------------------------- * Determine UV file class to work on * Inputs: p_ondisk (=1 -> known, else find) * p_expna, p_disk * proc sets p_class, inclass * also p_expna, p_seq, p_disk when =1 *--------------------------------------------------------------- if (p_ondisk<>1) then inname p_expna; inseq 0; indisk p_disk; intype 'UV'; inclass 'FXPOL'; nameget if (error = 0) then; p_class inclass $ dual polarization, one frequency else; inseq 0 inclass = 'FPOL' !! char(p_frequid); nameget; * dual pols and multi freq with new outclass if (error = 0) then p_class inclass; inclass 'FQ-'!!char(p_frequid); p_zapall; recat else; inseq=0 inclass 'FQ-'!!char(p_frequid); nameget; * polarizations okay, multiple freqs if (error = 0) then; p_class inclass * polarizations okay, single frequency else; p_class 'UVDATA' end end end inclass p_class; inseq 0; nameget; p_seq=inseq if (error) then; p_error = 33; end else p_class = p_incl; p_expna = p_inna; p_seq = p_inseq p_disk = p_indi end RETURN; FINISH PROCEDURE P_WCHSCAN *--------------------------------------------------------------- * Uses BSCAN task with file p_expna, p_incl, p_seq, p_disk * goes through p_numcal list of p_calsourc * Sets: p_calscant *--------------------------------------------------------------- print 'CALLING P_WCHSCAN' p_found = -1; p_i = 1 while ((p_found=-1) & (p_i<=p_numcal)) default BSCAN; inname p_expna; inclass p_incl inseq p_seq; indisk p_disk; docalib 1; invers = p_invers sources(1) = p_calsourc(p_i); runwait('BSCAN') * check return values if (chansel(3,1)=p_numant) then; p_found = p_i; else if(chansel(3,1)<>0) then type p_calsourc(p_i)!!':' p_scr = char(chansel(3,1))!!' OUT OF ' substr(p_scr, length(p_scr)+2, 66) = char(p_numant) type p_scr !! ' ANTENNAS FOUND' end; 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) x = chansel(1,1) - (p_calscant(2)/24+p_calscant(1)) p_calscant(3) = floor (x*1440) x = p_calscant(3)/1440 + p_calscant(2)/24 + p_calscant(1) p_calscant(4) = floor ((chansel(1,1)-x) *86400) p_calscant(6) = floor ((chansel(2,1)-p_calscant(5))*24) x = chansel(2,1) - (p_calscant(6)/24 + p_calscant(5)) p_calscant(7) = floor (x*1440) x = p_calscant(7)/1440 + p_calscant(6)/24 + p_calscant(5) p_calscant(8) = floor ((chansel(2,1)-x)*86400) 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) & (p_error=0)) then $ start loading data douvcomp = -1; doconcat = -1 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 - QUITTING' type 'SEPARATE FREQIDS (RUN VLBAFIX)' type 'RUN VLBARUN ON EACH SEPARATELY else p_info('VLBAFIX'); if (p_error = 0) then; vlbafix; end end; inname=outname; inclass='UVDATA'; inseq 1; indisk outdisk p_inna= inname; p_incl=inclass; p_inseq=inseq; p_indi=indisk end end RETURN; FINISH PROCEDURE P_PRECHECK *--------------------------------------------------------------- * Prepare and check inputs for VLBA pipeline * NOTE: proc sets p_dotimer and p_dostart *--------------------------------------------------------------- * clear messages default clrmsg; clrmsg * record inputs invers=p_invers; doprint=-9; inputs vlbarun if (length(p_dir) > 0) then; p_dohtml=1; x = length(p_dir) if (substr(p_dir,x,x)<>':') then if (substr(p_dir,x,x)<>'/') then substr(p_dir,x+1,x+1)='/'; end end default prtmsg; outprint=p_dir!!'messages.txt filezap outprint $ kill pre-existing one docrt=-3; prtmsg; clrmsg end invers=0; doprint=0 * 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 p_disk=p_indi 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 'NO DATA?: SPECIFY DATAIN OR INNAME' p_error=1 end $ check data 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 getitime; p_inttim = inttime 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'; type 'USE P_RESTART TO CLEAR THIS STATUS'; 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 - QUITTING' type 'SEPARATE FREQIDS (RUN VLBAFIX)' type 'RUN VLBARUN ON EACH SEPARATELY 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 p_load $ load file if needed keyword 'USERNO'; gethead; p_userno = keyval(1) $ FUTURE check if outfile already exists - p_restart or bomb?? $ FUTURE check outdisk ? * check invers (Pulse cal file) 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) then if (p_mode = 'SPEC') then type 'DOING SPECTRAL LINE PROCEDURE: ' type 'NO PULSE CAL OR FREQUENCY AVERAGING WILL BE DONE' else if (p_mode = 'CONT') then type 'DOING CONTINUUM PROCEDURE:' type 'WITH PULSE CAL AND FREQUENCY AVERAGING' else if (p_mode = 'PSEU') then type 'DOING PSEUDO CONTINUUM PROCEDURE: with'; if (p_invers>0) then type 'PULSE CAL BUT *NO* FREQUENCY AVERAGING' else type 'FRING BUT *NO* FREQUENCY AVERAGING' end else p_error = 1 type 'OBSERVATION MODE NOT KNOWN' type 'FILL IN "OPTYPE" PROPERLY' end end end end $ check if clcor for delzn is wanted if (length(p_infi)>0) then; p_doaplyd = 1; 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 x = length(p_dir) if (substr(p_dir,x,x)<>':') then if (substr(p_dir,x,x)<>'/') then substr(p_dir,x+1,x+1)='/'; end end if (length(p_dir)>35) then type 'OUTFILE IS TOO LONG, LIMIT IS 35 CHARACTERS' p_error = 13; end p_outdir= 'X' !! p_dir; substr(p_outdir,1,1)=' ' x = length (p_outdir) if (substr(p_outdir,x,x)=':') then p_outdir= 'X$'!!p_dir; substr(p_outdir,1,1)=' '; substr(p_outdir,length(p_outdir),length(p_outdir))='/'; end p_outtmp = p_outdir; format=1; getdate; format 0 p_date=substr(thedate,3,9)!!substr(thedate,11,14)!!'/' clrtemp p_outdir=p_outdir!!p_date if (length(p_outdir)>45); then type 'OUTPUT DIRECTORY LIMITED TO 35 CHARACTERS' type '(INCLUDING FINAL /) HINT: IF DESIRED OUTPUT' type 'DIRECTORY PATH LONGER THAN 31 CHAR USE AN type 'ENVIRONMENTAL VARIABLE AND DESIGNATE WITH A ":".' type 'SEE EXPLAIN VLBARUN. outdir ends up as type p_outdir p_error = 13;end if (p_error = 0) then default system; syscom 'mkdir sys2com(1) = p_outdir; system if (error > 0) then type 'CANNOT MAKE OUTPUT DIRECTORY FOR PLOTS P_error = 13; end end * check if convert command exists if ((p_dopl > 0) & (p_dopl < 0.5)) then p_cnvrt = ' ' else default system; syscom 'which convert p_cnvrt='convert system; if (error > 0) then * check if magick command exists type 'ERROR: Cannot create plots for output html type 'files because the command convert type 'is not on your computer.. type 'PostScript files will be saved, not in html p_cnvrt = '' end end * check and create html file if (p_error=0) then default system p_line(1) = ' "VLBARUN output p_line(2) = '
" p_htmlput(p_line) p_line(1) = ' "

VLBARUN output for: substr(p_line(1),27,66) = p_inna!!'.'!!p_incl!!'.' p_line(2)=char(p_seq)!!'

" p_htmlput(p_line) p_line(1)=' "

User number = p_line(2)=char(p_userno)!!'

" p_htmlput(p_line) p_line(1)=' "

Local time = format = 0; getdate p_line(2) = thedate !! '

" p_htmlput(p_line) p_line(1)=' "

Message log p_line(2)='

" p_htmlput(p_line) p_line(1)=' "See for the message log" p_htmlput(p_line) 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' type ' 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' type 'RESET CLINT AND START AGAIN' end end clint = p_clint end * check refant $ FUTURE check if refant in array, get number of antennas if (p_error=0) then; p_antnum = antnum (p_refant) if (p_antnum = 0) then; type 'REFANT not set, will try to set a 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' type 'PLEASE SET REFANT AND START AGAIN' end if (p_error<>11) then type 'REFANT SET TO ANTENNA #', p_antnum end refant = p_antnum end if (p_error=0) then; inext 'AN'; keyword 'NUM ROW'; getthead p_numant = keyval(1) * check timerange and corresp scantime * if no timerang then auto-set i = 1 * if timer(2) or above non-zero, timer is specified (not scan) while (i < 8) 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 MPCL' 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 '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 end * check later if in data * count number of sources in calsour, do self-cal ? p_numcal = 0; i = 0; while (i < 30); 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' $ type 'FOR CALSOUR = *' $ p_error = 12 $ end $ p_no_slfcl(i) = 0 $ else;p_no_slfcl(i) = 1 end end end * count number of sources targeted (incl its Ph-Ref.) p_numref = 0; i = 0; while (i < 30) ; i=i+1 if (substr(p_atargets(i),1,1)<>' ') then p_numref = p_numref+1; end end * use calsour only (only strong sources, no Ph-Ref) if (p_error=0) then; if (p_numref = 0) then type 'No phase-ref scheme specified type 'Assuming all sources are strong if (p_numcal = 0) then type 'AT LEAST ONE CALSOURCE NEEDED' type 'FOR P-CAL and BANDPASS CALIBRATION' p_error = 8 else if (substr(p_calsourc(2),1,1)='*') then if (p_ctask<>'CALIB') then type 'Will fringe fit all sources that are found else type 'Will CALIB all sources that are found end type 'in the SU table else if (p_ctask<>'CALIB') then type 'Will fringe fit all sources in CALSOUR else type 'Will CALIB all sources in CALSOUR end type '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 SOURCES - SPECIFY PHAS-REF *PAIRS* p_error = 8 * check if odd numbered are in calsour, evens not in calsour else for i = 1 to p_numref by 2 p_num = 0 for j = 1 to p_numcal if (p_atargets(i)=p_calsourc(j)) then; p_num = j; end end end if (p_num=0) then type 'CALSOUR DOES NOT, BUT SHOULD, INCLUDE type 'PHASE REF (CAL) SOURCE :'!! p_atargets(i) p_error 9 end for i = 2 to p_numref by 2 p_num = 0 for j = 1 to p_numcal if (p_atargets(i)=p_calsourc(j)) then; p_num = j; end end if (p_num<>0) then type 'CALSOUR DOES, BUT SHOULD NOT, INCLUDE' type 'PHase-REF (target) SOURCE:'!!p_atargets(i) p_error = 9 end end p_numref = p_numref / 2 $ # of pairs if ((p_numref = 1) & (p_atargets(2) = '*')) then type 'Phase-referencing all non-calibrators type 'to :' !! p_atargets(1) end end end * are sources in SU table? if (p_error=0) then; if (p_calsourc(2)<>'*') then jj = p_numcal else jj = 1; end; ii = 0 for i = 1 to jj; p_getsurow; keystrng = '' while ((p_row>0) & (p_calsour(i)<>keystrng)) inext'SU'; pixxy p_row 2 0; tabget if (p_calsour(i) = keystrng) then $ found p_row = -1; p_error = 0 else; p_row = p_row - 1; p_error = 31 end end if (p_error<>0) then p_scr = 'COULD NOT FIND' substr(p_scr,16,66) = p_calsour(i)!!' IN DATA FILE' type p_scr; ii = p_error end end p_error = ii end if ((p_error=0) & (p_numref>0) & (p_atargets(2)<>'*')) then; ii = 0; for i = 1 to p_numref; p_getsurow; keystrng = '' while ((p_row>0) & (p_atargets(2*i)<>keystrng)) inext'SU'; pixxy p_row 2 0; tabget if (p_atargets(2*i)=keystrng) then $ found p_row = -1; p_error = 0 else; p_row = p_row - 1; p_error = 32 end end if (p_error<>0) then p_scr = 'COULD NOT FIND' substr(p_scr,16,66) = p_atargets(2*i)!!' in DATA' type p_scr; ii = p_error end end p_error = ii end * check solint $ FUTURE add check on other valid solints? if (p_error=0) then; if (p_solint<0) then; type 'SOLINT<0 INVALID: STOPPING'; p_error = 10; 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' else if (p_factor > 64) then; p_factor = 64 type 'CALSOUR IMAGE REQUEST TOO BIG' type '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(1) = max (512, p_imsize(1)) p_imsize(2) = max (512, p_imsize(2)) type 'WILL NOT DO SOURCES IMAGES SMALLER THAN 512' else if ((p_imsize(1) > 8192) ! (p_imsize(2) > 8192)) then p_imsize(1) = min (8192, p_imsize(1)) p_imsize(2) = min (8192, p_imsize(2)) type 'SOURCE IMAGE REQUEST TOO BIG' type 'WILL USE THE MAXIMUM OF 8192 SQUARE' end end end $ include subarray , change into vlbafix ?? p_plcnt(1) = maxtab('PL') * Check there is a scan can be found if timer is left blank p_getuvf end if((p_error = 0) & (p_dotimer = 2)) then; p_wchscan; end if (p_debug > 0) then; type 'P_PRECHECK ERROR = '!!char(p_error);end end RETURN; FINISH PROCEDURE P_BPASS *--------------------------------------------------------------- * Do VLBABPSS (BPASS) *--------------------------------------------------------------- if (p_error=0) then task 'VLBABPSS'; calsour p_calsourc(1),''; solint -1 bpver 1; flux 0; timerang 0; antenna 0; refant = p_antnum calcode ''; in2na ''; in2cl ''; in2seq 0; invers 0 ncomp 0; nmaps 0; smodel 0; bpass5 = p_bpass5 p_info('VLBABPSS'); if (p_error = 0) then; vlbabpss; aparm 0 1 .5 1.3,-20 20 0 2 1 0 i = maxtab('SN');j = maxtab('CL') if (p_dopl>0) then p_plcnt(3) = maxtab('PL') p_possm(p_expna,p_seq, j, 1,0,6,0, calsour(1), 2) p_plcnt(4) = maxtab('PL'); j = p_plcnt(4); i = p_plcnt(3) if (p_dohtml>0) then p_line(1)=' "

Bandpass solutions

p_line(2)='"'; p_htmlput(p_line) p_plotfile (inname,p_class,p_seq,1,i+1,j,'BANDPASS') end end end end RETURN; FINISH PROCEDURE P_UVFLG *--------------------------------------------------------------- * runs UVFLG to absorb INTEXT *--------------------------------------------------------------- print 'INTEXT =' !! p_intext !! 'not blank? default 'UVFLG'; inname=p_expna; inclass=p_class; inseq=p_seq; indisk=p_disk; intext=p_intext; outfgver=1 p_info('UVFLG'); if (p_error = 0) then runwait('UVFLG'); end RETURN; FINISH PROCEDURE P_TYSMO *--------------------------------------------------------------- * Runs TYSMO on the data set *--------------------------------------------------------------- if (p_smolev > 0) then default tysmo; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; dobtween=-1; flagver=0 inext 'ty'; invers=1; aparm(1)=p_smolev/20 aparm(6) = p_smolev; samptype='box'; bparm=15,0 cparm=10,0,0,0,0,p_smolev/10 p_info('TYSMO'); if (p_error=0) then runwait('TYSMO') end end RETURN; FINISH PROCEDURE P_ELEVFG *--------------------------------------------------------------- * Runs UVFLG for elevation *--------------------------------------------------------------- if (p_elev > 0) then default uvflg; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; aparm = 0, p_elev outfgver = maxtab('FG') p_info('UVFLG'); if (p_error=0) then runwait('UVFLG') end end RETURN; FINISH PROCEDURE P_CLIP *--------------------------------------------------------------- * runs CLIP on MS file *--------------------------------------------------------------- if (p_error=0) then default 'clip'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; docalib 1 if (p_doclip(1) > 0) then; doband=1; end aparm = abs(p_doclip(1)),abs(p_doclip(2)),0; aparm(9)=0.3 bparm = 1,0; p_info('CLIP'); if (p_error=0) then runwait('CLIP'); end end RETURN; FINISH PROCEDURE P_LISTR *--------------------------------------------------------------- * Put LISTR optype 'SCAN' in the output messages *--------------------------------------------------------------- if (p_dohtml>0) then default listr inname=p_expna; inclass=p_class; inseq=p_seq; indisk=p_disk; optype = 'SCAN'; docrt=-3; outprint=p_dir!!'messages.txt p_info('LISTR'); if (p_error = 0) then; go listr; 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; RETURN; end p_getuvf $ find uvfile to work on inname=p_expna; inclass=p_class; inseq p_seq; indisk=p_disk if (p_error<>0) then; RETURN; end if (tecrfile <> '-') then p_info('VLBATECR'); if (p_error = 0 & p_obsfq<12.e9) then; vlbatecr; p_clcnt(1) = maxtab('CL'); if (tecrfile=' ') then default system; syscom 'rm /tmp/jpl* system end end end if (p_error<>0) then; RETURN; end if (eopsfile <> '-') then p_info('VLBAEOPS'); if (p_error = 0) then; vlbaeops; p_clcnt(6) = maxtab('CL'); end end if (p_error = 0 & p_intext<>'') then; p_uvflg; end if (p_error = 0 & p_smolev > 0) then; p_tysmo; end if (p_error = 0 & p_elev > 0) then; p_elevfg; end * amplitude cal (Walker method) if (p_error=0) then p_info('VLBACCOR'); if (p_error=0) then vlbaccor; i = maxtab('SN');j = maxtab('CL') p_clcnt(2) = j if (p_dopl>1.5) then p_snplot(p_expna, p_seq, 'SN', i, 'AMP', 0,0, 8) if (p_error=0) then; p_plcnt(2) = maxtab('PL'); if (p_dohtml>0) then; p_line(1)=' "

SN table after ACCOR

p_line(2)='"'; p_htmlput(p_line); i = p_plcnt(1)+1; j = p_plcnt(2) p_plotfile(p_expna,p_class,p_seq,1,i,j,'ACCOR_SN') end end j = maxtab('CL') p_snplot(p_expna, p_seq, 'CL', j, 'AMP', 0,0, 8) if (p_error=0) then p_plcnt(3) = maxtab('PL'); i = p_plcnt(3); j = p_plcnt(2)+1 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,p_seq,1,j,i,'ACCOR_CL') end end end 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; timerang = p_calscant; end if (p_found > 0) then; calsour p_calsour(p_found),'' else; calsour = ' '; end gainuse 0; docalib 2; doband -1; opcode ''; inext'FQ' invers 1; keyword = 'NO_IF';getthead; * if only 1 IF then no need to align IFs if (keyvalue(1) > 1) then refant = p_antnum; j = maxtab('PC') if ((p_mode = 'SPEC') & (j > 0)) then type 'WEIRD: FOUND A PC TABLE IN MODE SPEC' type 'WILL NOT USE IT ANYWAY' end if ((p_mode<>'SPEC') & (j>0) & (p_invers>-0.5)) then p_info('VLBAPCOR'); if(p_error = 0) then invers=p_invers; vlbapcor; end * spectral-line or pccor not wanted;do manual pcal else p_info('VLBAMPCL'); if (p_error = 0) then 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) & (p_error=0)) then p_plcnt(19) = maxtab('PL') p_possm(p_expna,p_seq,j,-1,0,9,-1,calsour(1),0) p_plcnt(20) = maxtab('PL') if (p_dohtml>0) then; p_line(1)=' "

Instrumental Phase Cals

p_line(2)='"'; p_htmlput(p_line); i = p_plcnt(19)+1 j = p_plcnt(20) p_plotfile(p_expna,p_class,p_seq,1,i,j,'INSTRCAL') end end end if (p_doclip(1)<0) then; p_clip; end p_bpass; p_info('VLBAAMP'); if (p_error = 0) then vlbaamp; ii = maxtab('SN'); jj = maxtab('CL') p_clcnt(3) = jj; p_clcnt(8) = jj-1 if (p_dopl>1.5) then p_snplot(p_expna,p_seq,'SN',ii-1,'AMP', 0, 0, 8) if (p_error=0) then p_plcnt(5) = maxtab('PL'); if (p_dohtml>0) then p_line(1)=' "

SN table after ACSCL

p_line(2)='"'; p_htmlput(p_line); i = p_plcnt(4)+1; j = p_plcnt(5) p_plotfile(p_expna,p_class,p_seq,1,i,j,'ACSCL_SN') end end p_snplot (p_expna,p_seq,'SN',ii,'AMP',0,0,8) if (p_error=0) then p_plcnt(6) = maxtab('PL'); if (p_dohtml>0) then; p_line(1)=' "

SN table after APCAL

p_line(2)='"'; p_htmlput(p_line); i = p_plcnt(5)+1; j = p_plcnt(6) p_plotfile(p_expna,p_class,p_seq,1,i,j,'APCAL_SN') end end end end if ((p_dopl>0) & (p_error=0)) then p_plcnt(6) = maxtab('PL') $ in case p_dopl=1 p_snplot(p_expna, p_seq, 'CL', jj-1, 'AMP', 0, 0, 8) if (p_error=0) then p_plcnt(7) = maxtab('PL'); if (p_dohtml>0) then p_line(1) = ' "

CL table after ACSCL

p_line(2) = '"'; p_htmlput(p_line); i = p_plcnt(6)+1; j = p_plcnt(7) p_plotfile (p_expna,p_class,p_seq,1,i,j,'ACSCL_CL') end end p_snplot(p_expna, p_seq, 'CL', jj, 'AMP', 0, 0, 8) if (p_error=0) then p_plcnt(8) = maxtab('PL'); if (p_dohtml>0) then p_line(1) = ' "

CL table after APCAL

p_line(2) = '"'; p_htmlput(p_line); i = p_plcnt(7)+1; j = p_plcnt(8) p_plotfile(p_expna,p_class,p_seq,1,i,j,'APCAL_CL') end end end $ outseq p_frequid;outclass '';runwait('TASAV') p_info ('VLBAPANG'); if (p_error = 0) then vlbapang;clrtemp; j = maxtab('CL'); p_clcnt(4) = j; end end end p_plcnt(9) = maxtab('PL'); RETURN; FINISH PROCEDURE P_APPLYD *--------------------------------------------------------------- * adds DELZN corrections with CLCOR *--------------------------------------------------------------- source ''; stokes ''; timer 0; gainv = 0; gainu = 0 opcode 'ATMO'; clcorprm 0; infile = p_infi; p_info('CLCOR'); if (p_error = 0) then runwait('clcor') p_clcnt(9) = maxtab('CL') type 'CL #'!!char(p_clcnt(9)) !! ' adds DELZN corrections end return;finish PROC P_VLBAFRNG *--------------------------------------------------------------- * fringe fit a dataset using FRING and then apply the * corrections using CLCAL. * Input adverbs: * INNAME file name * INCLASS file class * INSEQ file sequence number * INDISK disk number * CALSOUR calibrator source * TIMERANG time range * BCHAN lowest channel * ECHAN highest channel * GAINUSE CL table to use * REFANT reference antenna * SEARCH prioritized reference antenna list * SOLINT solution interval * DPARM FRING DPARMS * SOURCES sources to calibrate in CLCAL * INTERPOL interpolation method to use * BADDISK bad disk *--------------------------------------------------------------- SCALAR VBA_OK, VBA_CL, VBA_NMS vba_nms = 0; vba_ok = 1; vnumber = 36-getpopsn; vput vlbafrng if (gainuse=0) then; gainuse = maxtab('cl'); end tput vlbafrng for i = 1 to 30 if (source(i)<>'') then vba_nms = vba_nms + 1 end end if (vba_ok>=0) then type 'run fring'; clrtemp default 'fring'; tget vlbafrng; task = 'fring' clrtemp if (search(1)<>0) then aparm(9) = 1; end clrtemp $ aparm(6) = 1 if (maxtab('bp')>0) then; doband = 1; bpver = maxtab('bp'); end chinc = min(p_chinc, 1); if (chinc<0) then chinc=findchin; end docalib 2; runwait('fring') chinc = p_chinc * SNSMO the result rates if ((smrates(1)) & (p_error=0)) then default 'snsmo'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; dobtween=-1 samptype='box'; bparm=0,0,smrates(1); smotype='vlbi' cparm=0; cparm(3)=smrates(2); cparm(8)=smrates(3); invers=maxtab('sn'); p_info('SNSMO'); if p_error = 0 then runwait('SNSMO'); end end if (p_error=0) then type 'RUN CLCAL'; default 'clcal'; tget vlbafrng task 'clcal'; vba_cl = maxtab('cl')+1 if ((interpol='self') ! (sources(1) = '')) then gainver gainuse; gainuse=vba_cl; snver=maxtab('SN') runwait('clcal') else $$$ manual self for i = 1 to vba_nms tget vlbafrng; task 'clcal'; gainver gainuse; gainuse vba_cl; calsour = source(i), '' source = source(i),''; snver = maxtab('SN') runwait('clcal') end end vba_clas = 'SN #' !! char(snver) type vba_clas!!' contains fringe solns for sources in calsour vba_clas = 'CL #' !! char(vba_cl) type vba_clas !! ' adds fringe solns for sources in sources vnumber=36-getpopsn; vget vlbafrng; tput vlbafrng; vnumber 0 end end return; finish PROCEDURE P_FRING *--------------------------------------------------------------- * Runs FRING on cal sourses, CLCAL on phase ref sources * First do all clcals on calsources, then the pairs *--------------------------------------------------------------- * all sources if (substr(p_calsourc(2),1,1)='*') then calsour ''; sources ''; p_getsurow; p_numcal = p_row * includes phase-refs, not targets else calsour p_calsourc; sources p_calsourc end * search = 0 $ better make sure solutions exist search = antnum('PT'),antnum('LA'),antnum('KP'),antnum('FD') search(5)~antnum('OV'), antnum('NL'), antnum('BR') search(8)~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 p_vlbafrng; gainuse = maxtab('CL') vnumber= 36-getpopsn; vput clcal $ -- for phase-ref * sources not empty, not all if ((p_numref>0) & (p_atargets(2)<>'*') & (p_error=0)) then * vlbafrng did all cals, now do the pairs * print messes with the for loop * this statement needed and the separation print 'Doing phase reference targets for i = 1 to p_numref * pair observed in this freq-ID vget clcal; interpol p_interpol; sources p_atargets(2*i), '' calsour p_atargets(2*i-1), '' if (p_error=0) then p_info('CLCAL'); if (p_error = 0) then runwait('CLCAL'); vput clcal end end end for i = 1 to p_numref sources p_atargets(2*i), '' calsour p_atargets(2*i-1), '' p_scr = '**' !! calsour(1) p_scr = p_scr !!': used to phase-reference : type p_scr !! source(1) !!'**' end end if ((p_atargets(2) = '*') & (p_error=0)) then vget clcal; interpol p_interpol calsour p_atargets(1), '' for i = 1:p_numcal; sources(i) = '-'!!p_calsourc(i); end p_info('CLCAL'); if (p_error = 0) then runwait('CLCAL') p_scr = '** ALL NON-CALIBRATORS PHASE-REFERENCED' type p_scr !! ' TO :'!!calsour(1)!!'**' end end ii = maxtab('SN'); jj = maxtab('CL'); p_clcnt(7) = jj if ((p_dopl>1.5) & (p_error=0)) then p_snplot(inname, p_seq, 'SN', ii, 'PHAS', -180, 180, 8) p_snplot(inname, p_seq, 'SN', ii, 'DELA', 0, 0, 8) p_snplot(inname, p_seq, 'SN', ii, 'RATE', 0, 0, 8) p_snplot(inname, p_seq, 'SN', ii, 'SNR', 0, 0, 8) if (p_error=0) then p_plcnt(10) = maxtab('PL'); if (p_dohtml>0) then; p_scr = ' "

Phase, delay, rate, snr in SN table p_line(1) = p_scr !! ' after p_line(2) =' FRING

"'; p_htmlput(p_line) i = p_plcnt(9)+1; j = p_plcnt(10) p_plotfile (p_expna,p_class,p_seq,1,i,j,'FRING_SN') end end p_snplot(inname, p_seq, 'CL', jj, 'AMP', 0, 0, 8) if (p_error=0) then p_plcnt(11) = maxtab('PL'); if (p_dohtml>0) then; p_line(1) = ' "

Amplitude in CL table after p_line(2) = ' FRING

"'; p_htmlput(p_line) i = p_plcnt(10)+1; j = p_plcnt(11) p_plotfile(p_expna,p_class,p_seq,1,i,j,'FRAMP_CL') end end end if ((p_dopl>0) & (p_error=0)) then p_plcnt(11) = maxtab('PL') $ in case p_dopl=1 p_snplot(inname, p_seq, 'CL', jj, 'PHAS', -180, 180, 8) p_snplot(inname, p_seq, 'CL', jj, 'DELA', 0, 0, 8) p_snplot(inname, p_seq, 'CL', jj, 'RATE', 0, 0, 8) if (p_error=0) then p_plcnt(12) = maxtab('PL'); if (p_dohtml>0 )then; p_scr = ' "

Phase, delay, rate in CL table p_line(1) = p_scr!!' after FRING

p_line(2) = '"'; p_htmlput(p_line) i = p_plcnt(11)+1; j = p_plcnt(12) p_plotfile (p_expna,p_class,p_seq,1,i,j,'FRING_CL') end end for i=1 to p_numref by 2; j = maxtab ('CL') p_vplot(p_expna,p_seq,j,1,0, 9, 0.5, p_atarget(i)) end if (p_error=0) then p_plcnt(13) = maxtab('PL') if (p_dohtml>0)then; p_line(1)=' "

Phases of phase calibrator(s) with p_line(2)=' last CL table applied

" p_htmlput(p_line); i = p_plcnt(12)+1; j = p_plcnt(13) p_plotfile (p_expna,p_class,p_seq,1,i,j,'PHASECAL') end end end end RETURN; FINISH PROCEDURE P_CALIB *--------------------------------------------------------------- * Runs CALIB on cal sourses, CLCAL on phase ref sources * First do all clcals on calsources, then the pairs *--------------------------------------------------------------- default calib; p_getuvf $ find uvfile to work on inname=p_expna; inclass=p_class; inseq p_seq; indisk=p_disk * all sources if (substr(p_calsourc(2),1,1)='*') then calsour ''; sources ''; p_getsurow; p_numcal = p_row * includes phase-refs, not targets else calsour p_calsourc; sources p_calsourc end docalib=1; doband=1; bchan 0; interpol p_interpol; aparm(6) 1; baddisk=p_baddisks; solint=p_solint; refant=p_antnum; solmode='p' p_info('CALIB'); if (p_error = 0) then runwait('CALIB'); gainuse = maxtab('CL') type 'RUN CLCAL'; default 'clcal'; tget calib task 'clcal'; vba_cl = maxtab('cl')+1 gainver maxtab('cl'); gainuse=vba_cl; snver=maxtab('SN') p_info('CLCAL'); if (p_error=0) then; runwait('clcal') vba_clas = 'SN #' !! char(snver) type vba_clas!!' contains CALIB solns vba_clas = 'CL #' !! char(vba_cl) type vba_clas !! ' adds CALIB solns ii = maxtab('SN'); jj = maxtab('CL'); p_clcnt(7) = jj end if ((p_dopl>1.5) & (p_error=0)) then p_snplot(inname, p_seq, 'SN', ii, 'PHAS', -180, 180, 8) if (p_error=0) then p_plcnt(10) = maxtab('PL'); if (p_dohtml>0) then; p_scr = ' "

Phase in SN table p_line(1) = p_scr !! ' after p_line(2) =' CALIB

"'; p_htmlput(p_line) i = p_plcnt(9)+1; j = p_plcnt(10) p_plotfile (p_expna,p_class,p_seq,1,i,j,'FRING_SN') end end p_snplot(inname, p_seq, 'CL', jj, 'AMP', 0, 0, 8) if (p_error=0) then p_plcnt(11) = maxtab('PL'); if (p_dohtml>0) then; p_line(1) = ' "

Amplitude in CL table after p_line(2) = ' CALIB

"'; p_htmlput(p_line) i = p_plcnt(10)+1; j = p_plcnt(11) p_plotfile(p_expna,p_class,p_seq,1,i,j,'FRAMP_CL') end end end if ((p_dopl>0) & (p_error=0)) then p_plcnt(11) = maxtab('PL') $ in case p_dopl=1 p_snplot(inname, p_seq, 'CL', jj, 'PHAS', -180, 180, 8) if (p_error=0) then p_plcnt(12) = maxtab('PL'); if (p_dohtml>0 )then; p_scr = ' "

Phase in CL table p_line(1) = p_scr!!' after FRING

p_line(2) = '"'; p_htmlput(p_line) i = p_plcnt(11)+1; j = p_plcnt(12) p_plotfile (p_expna,p_class,p_seq,1,i,j,'FRING_CL') end end for i=1 to p_numref by 2; if (p_error=0) then j = maxtab ('CL') p_vplot(p_expna,p_seq,j,1,0, 9, 0.5, p_atarget(i)) end end if (p_error=0) then p_plcnt(13) = maxtab('PL') if (p_dohtml>0)then; p_line(1)=' "

Phases of phase calibrator(s) with p_line(2)=' last CL table applied

" p_htmlput(p_line); i = p_plcnt(12)+1; j = p_plcnt(13) p_plotfile (p_expna,p_class,p_seq,1,i,j,'PHASECAL') end end end end RETURN; FINISH PROCEDURE P_RFLAG *--------------------------------------------------------------- * runs RFLAG on MS file one source at a time *--------------------------------------------------------------- STRING*1 P_CALS, P_TARGS SCALAR P_RFL default 'rflag'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; doband 1; docalib 1; p_gstok; dotv=-1; if (p_mode<>'SPEC') then avgchan 11; fparm=3,1,-1,-1,0,1; fparm(17)=0.3; j=12 else avgchan = 0; fparm=3,1,-1,0,0,1; fparm(17)=0.8; j = 4 end if (p_inttim>0) then; fparm(2)=p_inttim; end fparm(13) = max (100, p_doflag); fparm(18)=1 p_cals = substr(p_calsourc(2),1,1) p_targs = substr(p_atargets(2),1,1) if (p_dohtml>0) then p_line(1)=' "

RFLAG plots

p_line(2)='"'; p_htmlput(p_line); end * all sources in SU if ((p_cals='*') ! (p_targs='*')) then p_getsurow; inext='SU' for p_rfl = 1 to p_row pixxy = p_rfl, 2 0; tabget; source=keystrng,'' doplot = J; if (p_error = 0) then ii = maxtab('PL') + 1; type 'SOURCE :'!!source(1)!!' BEING RFLAGed NOW p_info('RFLAG'); if (p_error=0) then runwait('RFLAG'); doplot=-J; runwait('RFLAG') if ((p_dopl>0) & (p_dohtml>0)) then; jj = maxtab('PL'); p_plcnt(18)=jj p_plotfile (inname,inclass,inseq,1,ii,jj,'RFLAG') end end end end * one at a time else avgchan 11; fparm=3,1,-1,-1,0,1; fparm(17)=0.3; j=12 fparm(13) = max (100, p_doflag); fparm(18)=1 ii = maxtab('PL') + 1; for p_rfl = 1 to p_numcal source=p_calsourc(p_rfl),''; doplot=J if (p_error=0) then type 'SOURCE :'!!source(1)!!' BEING RFLAGed NOW p_info('RFLAG'); if (p_error=0) then runwait('RFLAG'); doplot=-J; runwait('RFLAG') end end end if (p_mode='SPEC') then avgchan = 0; fparm=3,1,-1,0,0,1; fparm(17)=0.8; j = 4 end fparm(13) = max (100, p_doflag); fparm(18)=1 if (p_numref > 0) then for p_rfl = 1 to p_numref source=p_atargets(2*p_rfl),''; doplot=J if (p_error=0) then type 'SOURCE :'!!source(1)!!' BEING RFLAGed NOW p_info('RFLAG'); if (p_error=0) then runwait('RFLAG'); doplot=-J; runwait('RFLAG') end end end end if ((p_dopl>0) & (p_dohtml>0) & (p_error=0)) then; jj = maxtab('PL'); p_plcnt(18)=jj p_plotfile (inname,inclass,inseq,1,ii,jj,'RFLAG') end end RETURN; FINISH PROCEDURE P_SPLIT *--------------------------------------------------------------- * Split data for this frequency ID *--------------------------------------------------------------- task 'SPLIT'; outdisk indisk; sources''; doband 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 * pseudo cont or spectral line, no freq averaging p_scr = 'VERAGED IN SINGLE SOURCE DATA' if (p_mode <> 'CONT') then aparm 0; type char(echan)!!' CHANNELS KEPT UNA' !! p_scr else $ continuum, grab all together aparm 2 0; type char(echan)!!' CHANNELS A' !! p_scr end aparm(6)=1; chinc=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 *--------------------------------------------------------------- SCALAR P_FRQ inext'FQ'; invers 1; p_frq = 0 keyword='NO_IF'; getthead; p_ifs=keyv(1) for x=1:p_ifs pixxy = 1,2,x; tabget; p_frq=max(p_frq,keyvalue(1)) end keyword'CRVAL3'; gethead; p_frq=p_frq+keyvalue(1) cellsize 2.25e6 / p_frq 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; bchan = ceil(echan/12); echan = echan+1-bchan; nchav = echan-bchan+1; chinc = nchav else $ skip few channels if (p_typ = 'SPEC') then bchan = ceil(echan/12); echan = echan+1-bchan; if (bchan = 1) then; bchan = 2; end else type 'CANNOT DETERMINE IMAGE PARAMETERS' p_error = 15 end end end; RETURN; FINISH PROCEDURE P_SCMAP(J) *--------------------------------------------------------------- * run IMAGR (NOT SCMAP) on calibrators *--------------------------------------------------------------- default 'IMAGR'; imsize 128*p_factor; niter 1500; flux 1e-4 uvwtfn'NA'; imagrp(10) 1; inseq p_frequid; outseq p_frequid outdisk p_disk; intype'UV'; stokes 'I'; im2parm 1,0 overlap 2 for i = 1 to p_numcal if (substr(p_calsourc(2),1,1)='*') then p_getuvf; inname=p_expna; inclass=p_class; inseq p_seq indisk=p_disk inext'SU';pixxy i 2 0; tabget; inname keystrng else; inname p_calsourc(i);end inclass substr(p_expna,1,6); INSEQ 0; clrtemp intype 'uv'; chkname; stokes 'I' * always continuum image of strong sources (if > 10 vis) if ((p_error=0) & (error < 1)) then p_setcell('PSEU'); timerang 0; keyword'GCOUNT'; gethead if ((keyvalue(1) > 10) & (p_error = 0)) then type 'CALIBRATOR :'!!inname!!' BEING IMAGED NOW' p_info('IMAGR'); if p_error = 0 then runwait('IMAGR'); end if ((p_dopl > 0) & (p_error=0)) then; p_uvplot(inname, inclass, inseq) imsize 128*p_factor; p_plcnt(14) = maxtab('PL'); p_kntr (inname,p_imcl,p_chkerr); inclass=p_imcl inseq = p_chkerr if (p_chkerr>0) then p_plcnt(15) = maxtab('PL');end end if (p_dohtml>0 & p_plcnt(14)>0 & p_error=0) then; if (i=1) then p_line(1)=' "

Final UVPLTs and Images

p_line(2)='"'; p_htmlput(p_line); end inclass substr(p_expna,1,6); inseq=0 if (i<10) then p_scr = 'UVPCAL0'!!char(i); ii=p_plcnt(14) p_plotfile (inname,inclass,inseq,1,1,ii,p_scr) if (p_plcnt(15)>0) then p_scr = 'IMACAL0'!!char(i); ii=p_plcnt(15) p_plotfile(inname,'ICL001',p_chkerr,0,1,ii,p_scr) end else inseq=0 p_scr = 'UVPCAL'!!char(i); ii=p_plcnt(14) p_plotfile (inname,inclass,inseq,1,1,ii,p_scr) if (p_plcnt(15)>0) then p_scr = 'IMACAL'!!char(i); ii=p_plcnt(15) p_plotfile(inname,'ICL001',p_chkerr,0,1,ii,p_scr) end end end end end end clrtemp; for i = 1 to p_numcal if (substr(p_calsourc(2),1,1)<>'*') then inname p_calsourc(i);inclass'SCMAP'; p_zapall inclass'IBM001'; inseq 0; indisk p_disk; intype'MA' p_zapall inclass'RBM001'; p_zapall; inclass'LBM001'; p_zapall else inseq 0; inext 'SU'; p_getuvf; inname=p_expna inclass=p_class; inseq p_seq; indisk=p_disk 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 RETURN; FINISH PROCEDURE P_IMAGR *--------------------------------------------------------------- * images phase ref targets *--------------------------------------------------------------- imsize p_imsize; outc''; doband=-1; im2parm 1,0; nbox 0 boxfile ''; oboxfi ''; outvers 0 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; p_getuvf; inname=p_expna inclass=p_class; inseq p_seq; indisk=p_disk 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 (p_calsourc(p_num)=keystrng) then j = 17; p_sq = p_sq + 1 $ found 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; intype 'uv' inclass substr(p_expna,1,6); chkname if ((p_error=0) & (error < 1)) then p_setcell(p_mode); timerang 0; keyword'GCOUNT' gethead; stokes 'I'; channel 0 if ((keyvalue(1) > 10) & (p_error = 0)) then type 'TARGET :'!!inname!!' BEING IMAGED NOW' if ((nchav<>1) ! (echan=1)) then p_info('IMAGR'); if p_error=0 then runwait('IMAGR'); end if ((p_error=0) & (p_dopl > 0)) then; p_uvplot (inname, inclass, inseq) imsize p_imsize; p_plcnt(16) = maxtab('PL'); p_kntr(inname, inclass,p_chkerr) inclass=p_imcl; inseq=p_chkerr if (p_chkerr>0) then; p_plcnt(17)=maxtab('PL'); end if (p_dohtml>0 & p_plcnt(16)>0) then; inclass substr(p_expna,1,6) if (i<10) then p_scr = 'UVPTAR0'!!char(i) j = p_plcnt(16); inseq 0 p_plotfile(inname,inclass,inseq,1,1,j,p_scr) if (p_plcnt(17)>0) then p_scr = 'IMATAR0'!!char(i) j = p_plcnt(17) p_plotfile(inname,'ICL001',p_chkerr,0,1,j,p_scr) end else p_scr = 'UVPTAR'!!char(i) j = p_plcnt(16); inseq 0 p_plotfile(inname,inclass,inseq,1,1,j,p_scr) if (p_plcnt(17)>0) then p_scr = 'IMATAR'!!char(i) j = p_plcnt(17) p_plotfile(inname,'ICL001',p_chkerr,0,1,j,p_scr) end end end end else if ((p_error=0) & (p_dopl > 0)) then p_uvplot (inname, inclass, inseq) imsize p_imsize; p_plcnt(16) = maxtab('PL'); if (p_dohtml>0 & p_plcnt(16)>0) then; inclass substr(p_expna,1,6) if (i<10) then p_scr = 'UVPTAR0'!!char(i) else p_scr = 'UVPTAR'!!char(i) end j=p_plcnt(16); inseq 0 p_plotfile(inname,inclass,inseq,1,1,j,p_scr) end end niter 1000; flux 1e-3; stokes='I'; bb = -1 for bif=1 to p_ifs inclass substr(p_expna,1,6) inseq 0; eif=bif; p_info('IMAGR'); if (p_error=0) then runwait('IMAGR'); end if ((p_error=0) & (p_dopl > 0)) then p_kntr(inname, inclass, p_chkerr) if (p_chkerr>0) then; p_plcnt(17)=maxtab('PL'); end if (p_dohtml>0 & p_plcnt(17)>0) then; if (i<10) then p_scr = 'IMATAR0'!!char(i) else p_scr = 'IMATAR'!!char(i) end p_scr = p_scr !! char(bif) j = p_plcnt(17) p_plotfile(inname,'ICL001',p_chkerr,bb,1,j,p_scr) end end end if (p_dopl>0) then inclass=p_imcl; inseq=p_chkerr; end end end end end inseq = 0; intype = 'MA'; indisk outdisk for i = 1 to p_numref inname p_atargets(2*i); inclass'?BM001'; p_zapall * inclass'RBM001'; p_zapall; inclass'LBM001';p_zapall end recat end RETURN; FINISH PROCEDURE P_SELFCAL *--------------------------------------------------------------- * runs IMAGR to image calibration sources * then runs FRING to slef-cal each cal source * then SNSMO to limit rates * finally CLCAL *--------------------------------------------------------------- default 'imagr'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; doband 1; docalib 1; imsize 128*p_factor; niter 1500; flux 1e-4 uvwtfn'NA'; imagrp(10) 1; outdisk p_disk; intype'UV'; stokes 'I'; im2parm 1,0; overlap 2 * image the cals for i = 1 to p_numcal if (substr(p_calsourc(2),1,1)='*') then p_getuvf; inname=p_expna inclass=p_class; inseq p_seq; indisk=p_disk inext'SU';pixxy i 2 0; tabget; srcname keystrng else; srcname p_calsourc(i);end p_setcell('PSEU'); outname = srcname type 'CALIBRATOR : '!!srcname!!' BEING IMAGED NOW' p_info('IMAGR'); if p_error = 0 then runwait('IMAGR'); end end * fringe the cals if (p_ctask='FRING') then; default 'fring'; search = antnum('PT'),antnum('LA'),antnum('KP') search(4)~antnum('FD'),antnum('OV'),antnum('NL') search(7)~antnum('BR'),antnum('NH'), antnum('SC') search(10)=antnum('MK'); aparm(9)=1 else; default 'calib'; solmode='p'; end inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; doband 1; docal 1; bchan 0; interpol p_interpol; aparm(6) 1; baddisk p_baddisks; solint = p_solint; dparm(8) 0; refant = p_antnum; snver = maxtab('sn')+1 nmaps 1; in2class 'icl001'; in2disk p_disk; chinc = min(p_chinc, 1); if (chinc<0) then chinc=findchin; end for i = 1 to p_numcal if (substr(p_calsourc(2),1,1)='*') then p_getuvf; inname=p_expna inclass=p_class; inseq p_seq; indisk=p_disk inext'SU';pixxy i 2 0; tabget; calsour keystrng,'' else; calsour p_calsourc(i),'';end in2name=calsour(1) if (p_ctask='FRING') then type 'CALIBRATOR : '!!in2name!!' BEING FRINGed NOW p_info('FRING'); if p_error = 0 then runwait('FRING'); end else type 'CALIBRATOR : '!!in2name!!' BEING CALIBed NOW p_info('CALIB'); if p_error = 0 then runwait('CALIB'); end end end; chinc = p_chinc * SNSMO the result rates if ((smrates(1)) & (p_ctask='FRING')) then default 'snsmo'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; dobtween=-1 samptype='box'; bparm=0,0,smrates(1); smotype='vlbi' cparm=0; cparm(3)=smrates(2); cparm(8)=smrates(3); invers=maxtab('sn'); p_info('SNSMO'); if p_error = 0 then runwait('SNSMO'); end end * CLCAL the cals default 'clcal'; inname=p_inna; inclass=p_incl; inseq=p_inseq; indisk=p_indi; interpol = p_interpol snver = maxtab('SN'); gainver=maxtab('CL'); gainuse=gainver+1 p_clcnt(10) = gainuse * all sources if (substr(p_calsourc(2),1,1)='*') then calsour ''; sources ''; p_getsurow; p_numcal = p_row * includes phase-refs, not targets else calsour p_calsourc; sources p_calsourc end tput vlbafrng; vba_nms=0 for i = 1 to 30 if (sources(i)<>'') then vba_nms = vba_nms + 1 end end if ((interpol='self') ! (sources(1) = '')) then p_info('CLCAL'); if p_error = 0 then runwait('CLCAL'); end else $$$ manual self for i = 1 to vba_nms tget vlbafrng; task 'clcal'; calsour = source(i), '' source = source(i),''; snver = maxtab('SN') p_info('CLCAL'); if p_error = 0 then runwait('CLCAL'); end end end * CLCAL the targets gainuse = maxtab('CL') vnumber= 36-getpopsn; vput clcal $ -- for phase-ref * sources not empty, not all if ((p_numref>0) & (p_atargets(2)<>'*')) then * vlbafrng did all cals, now do the pairs * print messes with the for loop * this statement needed and the separation print 'Doing phase reference targets for i = 1 to p_numref * 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 end end end 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 p_info('CLCAL'); if (p_error = 0) then runwait('CLCAL') p_scr = '** ALL NON-CALIBRATORS PHASE-REFERENCED' type p_scr !! ' TO :'!!calsour(1)!!'**' end 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 *--------------------------------------------------------------- p_line(2)=' VLBARUN:

" p_htmlput(p_line) p_line(1)=' "CL#1: Input CL table p_line(2)='
" p_htmlput(p_line); p_line(2) = ' correction added
" if (p_clcnt(1) > 0) then p_line(1) =' "CL#'!!char(p_clcnt(1))!!': Ionospheric p_htmlput(p_line); end if (p_clcnt(6) > 0) then p_line(1)=' "CL#'!!char(p_clcnt(6))!!': EOP p_htmlput(p_line); end if (p_clcnt(2) > 0) then p_line(1)=' "CL#'!!char(p_clcnt(2))!!': Sampler p_htmlput(p_line); end; if (p_clcnt(5) > 0) then p_line(1)=' "CL#'!!char(p_clcnt(5))!!': Instr Phase-cal p_htmlput(p_line); end;if (p_clcnt(8) > 0) then p_scr = char(p_clcnt(8)) p_line(1)=' "CL#'!!p_scr!!': Post-BPASS sampler p_htmlput(p_line); end if (p_clcnt(3) > 0) then p_line(1)=' "CL#'!!char(p_clcnt(3))!!': Gain amplitude p_htmlput(p_line); end if (p_clcnt(4) > 0) then p_scr = char(p_clcnt(4)) p_line(1)=' "CL#'!!p_scr!!': Parallactic angle p_htmlput(p_line); end if (p_clcnt(9) > 0) then p_line(1)=' "CL#'!!char(p_clcnt(9))!!': DELZN p_htmlput(p_line); end if (p_clcnt(10) > 0) then if (p_clcnt(7) > 0) then if (p_ctask<>'CALIB') then p_line(1) = ' "CL#'!!char(p_clcnt(7))!!': Fringe fit else p_line(1) = ' "CL#'!!char(p_clcnt(7))!!': CALIB end p_line(2) = ' added
" p_htmlput(p_line); end if (p_ctask<>'FRING') then p_line(1) = ' "CL#'!!char(p_clcnt(10))!!': CALIB else p_line(1) = ' "CL#'!!char(p_clcnt(10))!!': Fringe fit end p_line(2) = ' self-cal added (final table)
" p_htmlput(p_line); else if (p_clcnt(7) > 0) then if (p_ctask<>'CALIB') then p_line(1) = ' "CL#'!!char(p_clcnt(7))!!': Fringe fit else p_line(1) = ' "CL#'!!char(p_clcnt(7))!!': CALIB end p_line(2) = ' added (final table)
" p_htmlput(p_line); end 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 p_scr = char(p_clcnt(1)) type 'CL-'!!p_scr!!' : Ionospheric correction added end if (p_clcnt(6) > 0) then p_scr = char(p_clcnt(6)) type 'CL-'!!p_scr!!' : EOP correction added end if (p_clcnt(2) > 0) then p_scr = char(p_clcnt(2)) type 'CL-'!!p_scr!!' : Sampler corrections added end if (p_clcnt(5) > 0) then p_scr = char(p_clcnt(5)) type 'CL-'!!p_scr!!' : Instr. Phase-cal added end if (p_clcnt(8) > 0) then p_scr = char(p_clcnt(8)) type 'CL-'!!p_scr!!' : Post-BPASS sampler cor added end if (p_clcnt(3) > 0) then p_scr = char(p_clcnt(3)) type 'CL-'!!p_scr!!' : Gain corrections added end if (p_clcnt(4) > 0) then p_scr = char(p_clcnt(4)) type 'CL-'!!p_scr!!' : Parallactic angle correction added end if (p_clcnt(9) > 0) then p_scr = char(p_clcnt(9)) type 'CL-'!!p_scr!!' : DELZN corrections added end if (p_clcnt(10) > 0) then if (p_clcnt(7) > 0) then p_scr = char(p_clcnt(7)) if (p_ctask<>'CALIB') then type 'CL-'!!p_scr!!' : Fringe fit added else type 'CL-'!!p_scr!!' : CALIB solution added end end p_scr = char(p_clcnt(10)) if (p_ctask<>'FRING') then type 'CL-'!!p_scr!!' : Fringe self-cal added - final CL table else type 'CL-'!!p_scr!!' : CALIB self-cal added - final CL table end else if (p_clcnt(7) > 0) then p_scr = char(p_clcnt(7)) if (p_ctask<>'CALIB') then type 'CL-'!!p_scr!!' : Fringe fit added - final CL table else type 'CL-'!!p_scr!!' : CALIB added - final CL table end end end; type ' ' if (p_dopl > 0) then $ report about plots made type 'Plots have been produced for this frequency-ID: type ' ' if (p_dopl > 1.5) then p_scr = char(p_plcnt(1)+1)!!'-'!!char(p_plcnt(2)) type p_scr!!' Sampler corrections in SN p_scr = char(p_plcnt(2)+1)!!'-'!!char(p_plcnt(19)) type p_scr !!' Sampler corrections added to CL end p_scr = char(p_plcnt(19)+1)!!'-'!!char(p_plcnt(20)) type p_scr!!' (Manual?) P-cal p_scr = char(p_plcnt(3)+1)!!'-'!!char(p_plcnt(4)) type p_scr!!' Bandpass corrections if (p_dopl > 1.5) then p_scr = char(p_plcnt(4)+1)!!'-'!!char(p_plcnt(5)) type p_scr!!' post-BPASS sampler corr in SN p_scr = char(p_plcnt(5)+1)!!'-'!!char(p_plcnt(6)) type p_scr!!' Gain corrections in SN end p_scr = char(p_plcnt(6)+1)!!'-'!!char(p_plcnt(7)) type p_scr!!' Post-BPASS samp corr in CL p_scr = char(p_plcnt(7)+1)!!'-'!!char(p_plcnt(8)) type p_scr!!' Gain correction added to CL if (p_dopl > 1.5) then p_scr = char(p_plcnt(9)+1)!!'-'!!char(p_plcnt(10)) if (p_ctask<>'CALIB') then type p_scr!!' Fringe-fit solutions in SN else type p_scr!!' CALIB solutions in SN end p_scr = char(p_plcnt(10)+1)!!'-'!!char(p_plcnt(11)) type p_scr!!' Amp in final CL table end p_scr = char(p_plcnt(11)+1)!!'-'!!char(p_plcnt(12)) type p_scr!!' Final CL table p_scr = char(p_plcnt(12)+1)!!'-'!!char(p_plcnt(13)) type p_scr!!' Phases after final cal if (p_doflag>0) then p_scr = char(p_plcnt(13)+1)!!'-'!!char(p_plcnt(18)) type p_scr!!' RFLAG before and after plots end type ' ' end RETURN; FINISH PROCEDURE VLBARUN *--------------------------------------------------------------- $ $ Do whole VLBA pipeline *--------------------------------------------------------------- * inputs vlbarun type '======================================================= p_init; p_precheck; type '-------------------------' if (p_error = 0) then; p_listr; end if (p_error = 0) then; p_instcal; end if (p_error = 0 & p_doaplyd > 0) then; p_applyd; end if (p_error = 0 & p_doclip(1) > 0) then; p_clip; end if (p_error = 0) then; if (p_ctask='CALIB') then; p_calib; else; p_fring; end end if (p_error = 0 & p_doflag > 0) then; p_rflag; end if (p_error = 0 & selfcal > 0) then; p_selfcal; end if (p_error = 0) then; p_split; end if (p_error = 0 & p_factor>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 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 "From: sys2com(1) = p_email ; sys2com(2) = '"'; system; syscom 'echo "To: sys2com(1) = p_email; system; syscom 'echo "Subject: sys2com(1) = ' VLBARUN DONE : sys2com(2) = 'X'!!p_expna!!'.'!!p_incl!!'.' sys2com(2) = sys2com(2)!!char(p_seq)!!'"' substr(sys2com(2),1,1) = ' ' ; system; syscom 'echo "X-Mailer: AIPS VLBARUN report" sys2com = ''; system syscom= 'echo "VLBARUN is done, please review your sys2com(1) = ' plots at jj = length(p_dir) if (substr(p_dir,jj,jj)=':') then sys2com(2)='"'; system syscom 'echo "file://" sys2com(1)=substr(p_outdir,2,length(p_outdir)) sys2com(2) ='"vlbarun.html" else sys2com(1)= ' plots at file:// sys2com(2)= substr(p_dir,1,jj)!!p_date sys2com(3)= 'vlbarun.html" end system; default system syscom= 'cat /tmp/p_tempmail | sendmail -f daip@nrao.edu sys2com(1) = p_email; system; sys2com = '' syscom= '\rm /tmp/p_tempmail system end * print messages default prtmsg; outprint=p_dir!!'messages.txt docrt=-3; prtmsg; default system; syscom='mv sys2com(1) = p_outtmp!!'messages.txt sys2com(2) = p_outdir system end if (p_doemail>0 & p_dohtml<0) then default system; sysout= '/tmp/p_tempmail syscom 'echo "From: sys2com(1) = p_email ; sys2com(2) = '"'; system; syscom 'echo "To: sys2com(1) = p_email; system; syscom 'echo "Subject: sys2com(1) = ' VLBARUN done : sys2com(2) = 'X'!!p_expna!!'.'!!p_incl!!'.' sys2com(2) = sys2com(2)!!char(p_seq)!!'"' substr(sys2com(2),1,1) = ' ' ; system; syscom 'echo "X-Mailer: AIPS VLBARUN report" sys2com = ''; system syscom = 'echo " sys2com(1) = 'VLBARUN finished okay but sys2com(2) = ' " system syscom = 'echo " sys2com(1) = 'OUTFILE not set so there is no html system syscom 'echo " " sys2com = ' ' system; sysout='' syscom= 'cat /tmp/p_tempmail | sendmail -f daip@nrao.edu 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 '' p_scr = 'PROCEDURE DONE, THANK YOU FOR CHOOSING' type p_scr!!' AIPS FOR YOUR BUSINESS' * send e-mail saying procedure has failed else if (p_doemail>0) then default system; sysout= '/tmp/p_tempmail syscom 'echo "From: sys2com(1) = p_email ; sys2com(2) = '"'; system; syscom 'echo "To: sys2com(1) = p_email; system; syscom 'echo "Subject: sys2com(1) = ' VLBARUN FAILED : sys2com(2) = 'X'!!p_expna!!'.'!!p_incl!!'.' sys2com(2) = sys2com(2)!!char(p_seq)!!'"' substr(sys2com(2),1,1) = ' ' ; system; syscom 'echo "X-Mailer: AIPS VLBARUN error report" sys2com = ''; system syscom = 'echo " sys2com(1) = 'Error # '!! char(p_error) !!' occurred sys2com(2) = ' " system syscom = 'echo " sys2com(1) = 'Please review your inputs and try again system syscom 'echo " " sys2com = ' ' system; sysout='' syscom= 'cat /tmp/p_tempmail | sendmail -f daip@nrao.edu sys2com(1) = p_email system;sys2com = '' syscom= '\rm /tmp/p_tempmail system end type 'ERROR #'!! char(p_error) !!' OCCURRED' type 'PLEASE REVIEW YOUR INPUTS AND TRY AGAIN' end; type '======================================================= tget vlbarun; p_exit RETURN; FINISH $=============================================== PROCEDURE PIPE *--------------------------------------------------------------- * does vlbarun *--------------------------------------------------------------- vlbarun RETURN;finish *--------------------------------------------------------------- * revision EWG November 19, 2020 4:00 pm P_DEBUG = 0 $ can be set to true in the interactive AIPS window