$ VLBAMPHC
$---------------------------------------------------------------
$! Applies VLBARUN calibration to another phase-stopping center
$# RUN POPS VLBI UTILITY CALIBRATION IMAGING
$---------------------------------------------------------------
$; Copyright (C) 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 C_INIT
$
$ Define variables above and beyond VLBARUN
$ Assume all of VLBARUN is defined
docrt 1; dowa true
SCALAR C_DISK, C_SEQ, C_DOUVC
STRING*6 C_CLASS
STRING*12 C_NAME
$ 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
C_NAME = IN2NAME ; C_CLASS = IN2CLASS
C_SEQ = IN2SEQ ; C_DISK = IN2DISK
C_DOUVC = DOUVCOMP ; P_IMSIZE = IMSIZE
P_DOPL = DOPLOT ; P_DIR = OUTFILE
P_EMAIL = OUTTEXT ; P_BADDISKS = BADDISK
P_DOFLAG = DOFLAG ; P_DOCLIP = DOCLIP
$---
P_ERROR = 0; P_DOHTML = -1
if (p_imsize(1)=0) then; p_imsize=512; end
$--- save inputs 2 places
task 'VLBAMPHC'; tput; vnumber=36-getpopsn; vput
RETURN; FINISH
PROCEDURE C_HTMLPUT (P_LINE)
*---------------------------------------------------------------
* pipes contents of p_line to p_outdir file vlbamphc.html
*---------------------------------------------------------------
default system; sys2com = p_line, ' >>'; syscom 'echo
sys2com(4) = p_outdir; sys2com(5) = 'vlbamphc.html
system
RETURN; FINISH
PROC C_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; tvcolors; end
for p_i = p_pver to p_iver;
outfile = p_dir !! p_subst !! char(p_i) !! '.ps
plver=p_i; runwait('LWPLA')
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)=' " ' ') 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'; 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 VLBAMPHC 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)
* 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
$ 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
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)>63); then
type 'OUTPUT DIRECTORY LIMITED TO 37 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 VLBAMPHC. 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
default system; syscom 'which convert
p_cnvrt='convert
system; if (error > 0) then
* check if magick command exists
p_cnvrt='magick
syscom 'which magick
system; if (error > 0) then
type 'ERROR: Cannot create plots for output html
type 'files because the command convert or magick
type 'is not on your computer..
type 'Install convert/magick or leave OUTFILE blank
p_error=15
end
end
* check and create html file
if (p_error=0) then
default system
p_line(1) = ' "