; CALIB ;--------------------------------------------------------------- ;! determines antenna calibration: complex gain ;# TASK CALIBRATION AP UV ;----------------------------------------------------------------------- ;; Copyright (C) 1995-1997, 1999-2004 ;; 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 ;----------------------------------------------------------------------- CALIB LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC CALIB: Task to determine calibration for data. Input uv data. INNAME UV file name (name) INCLASS UV file name (class) INSEQ 0.0 9999.0 UV file name (seq. #) INDISK 0.0 9.0 UV file disk drive # Data selection (multisource): CALSOUR Calibrator sources QUAL -10.0 Calibrator qualifier -1=>all CALCODE Calibrator code ' '=>all SELBAND Bandwidth to select (kHz) SELFREQ Frequency to select (MHz) FREQID Freq. ID to select. TIMERANG Time range to use. BCHAN 0.0 2048.0 Lowest channel number 0=>all ECHAN 0.0 2048.0 Highest channel number ANTENNAS Antennas to select. 0=all DOFIT Subset of ANTENNAS list for which solns are desired. 0 => all in ANTENNAS, < 0 all but those in DOFIT ANTUSE Mean gain is calculated (CPARM(2)>0) using only the listed antennas. See explain. SUBARRAY 0.0 1000.0 Subarray, 0=>all UVRANGE Range of uv distance for full weight WTUV Weight outside UVRANGE 0=0. Cal. info for input: DOCALIB -1.0 2.0 If >0 calibrate data = 2 calibrate weights GAINUSE CL table to apply. DOPOL -1.0 10.0 If >0 correct polarization. BLVER BL table to apply. FLAGVER Flag table version DOBAND -1.0 10.0 If >0 apply bandpass cal. Method used depends on value of DOBAND (see HELP file). BPVER Bandpass table version SMOOTH Smoothing function. See HELP SMOOTH for details. CLEAN map. See HELP. IN2NAME Cleaned map name (name) IN2CLASS Cleaned map name (class) IN2SEQ 0.0 9999.0 Cleaned map name (seq. #) IN2DISK 0.0 9.0 Cleaned map disk unit # INVERS -1.0 46655.0 CC file version #. NCOMP # comps to use for model. 1 value per field FLUX Lowest CC component used. NMAPS 0.0 4096.0 No. Clean map files CMETHOD Modeling method: 'DFT','GRID',' ' CMODEL Model type: 'COMP','IMAG' SMODEL Source model, 1=flux,2=x,3=y See HELP SMODEL for models. Output uv data file. OUTNAME UV file name (name) OUTCLASS UV file name (class) OUTSEQ -1.0 9999.0 UV file name (seq. #) OUTDISK 0.0 9.0 UV file disk drive # Solution control adverbs: REFANT Reference antenna SOLINT Solution interval (min) SOLSUB Solution subinterval SOLMIN Min solution interval APARM General parameters 1=min. no. antennas 2 > 0 => data divided 3 > 0 => avg. RR,LL 5 > 0 => avg. IFs. 6=print level, 1=good, 2 closure, 3 SNR 7=SNR cutoff (0=>5) 8=max. ant. # (no AN) 9 > 0 => pass failed soln Phase-amplitude Parameters: SOLTYPE Soln type,' ','L1','GCON' SOLMODE Soln. mode: 'A&P','P','P!A', 'GCON' SOLCON Gain constraint factor. MINAMPER 0.0 Amplitude closure error regarded as excessive in % MINPHSER 0.0 Phase closure error regarded as excessive in degrees CPARM Phase-amp. parameters 1 = Min el for gain normalization (deg) 2 >0 => normalize gain 3 avg. amp. closure err 4 avg. ph. closure err 5 >0 => scalar average SNVER -1.0 46655.0 Output SN table, 0=>new table ANTWT Ant. weights (0=>1.0) GAINERR Std. Dev. of antenna gains. BADDISK Disk no. not to use for scratch files. ---------------------------------------------------------------- CALIB Task: This task determines the calibration to be applied to a uv data set given a model of the source(s). The output data will have the corrections applied for a single source input file; and a solution (SN) table will be left for a multi source data set. SN tables will be attached to the INPUT data file. Solutions are stored in solution (SN) tables. For multi-source data, any previously unapplied SN tables can be smoothed and applied to the specified CL table (multi-source data only). This calibration (CL) table can be applied to the data before determining the new calibration constants. Model images made with both values of IMAGR's DO3DIMAG option are handled correctly. Adverbs: INNAME.....Input UV file name (name). Standard defaults. INCLASS....Input UV file name (class). Standard defaults. INSEQ......Input UV file name (seq. #). 0 -> highest. INDISK.....Disk drive # of input UV file. 0 -> any. The following are used for multisource data files only: CALSOUR....List of sources for which calibration constants are to be determined, i.e. the calibrator sources. All ' ' = all sources; a "-" before a source name means all except ANY source named. You must specify one and only one CALSOUR if you want to apply a model using IN2NAME and IN2CLASS to a multi-source file. Otherwise, for such files, the program will quit if both IN2NAME and IN2CLASS are specified. Note: solutions for multiple sources can only be made if the sources are point sources at their assumed phase center and with the flux densities given in the source (SU) table. QUAL.......Only sources with a source qualifier number in the SU table matching QUAL will be used if QUAL is not -1. CALCODE....Calibrators may be selected on the basis of the calibrator code: ' ' => any calibrator code selected '* ' => any non blank code (cal. only) '-CAL' => blank codes only (no calibrators) anything else = calibrator code to select. NB: The CALCODE test is applied in addition to the other tests, i.e. CALSOUR and QUAL, in the selection of sources for which to determine solutions. SELBAND....Bandwidth of data to be selected. If more than one IF is present SELBAND is the width of the first IF required. Units = kHz, 0=> all SELFREQ....Frequency of data to be selected. If more than one IF is present SELFREQ is the frequency of the first IF required. Units = MHz, 0=> all FREQID.....Frequency identifier to select (you may determine which is applicable from the OPTYPE='SCAN' listing produced by LISTR. If either SELBAND or SELFREQ are set their values overide that of FREQID, however setting SELBAND and SELFREQ may result in an ambiguity, in which case the task will request that you use FREQID. The following may be used for all data files (except as noted): TIMERANG...Time range of the data to be used. In order: Start day, hour, min. sec, end day, hour, min. sec. Days relative to ref. date. BCHAN......First channel to use. 0=>all. ECHAN......Highest channel to use. 0=>all higher than BCHAN ANTENNAS...A list of the antennas to have solutions determined. If any number is negative then all antennas listed are NOT to be used to determine solutions and all others are. All 0 => use all. DOFIT......A list of the antennas for which solutions should be determined. Only those antennas listed in DOFIT will be solved for; all data selected via ANTENNAS will be used to form the solutions. If any antenna number in DOFIT is <= -1, then DOFIT is taken as the list of antennas for which no solution is desired; a solution is found for all antennas not in DOFIT. Note that the REFANT, if specified, will _not_ be solved for even if it appears in the DOFIT list. Selection via DOFIT can be disabled by setting DOFIT = 0 which defaults to solving for all antennas. ANTUSE.....A list of the antennas to be used in the calculation of the mean gain modulus (CPARM(2)>0). If any number is negative then all antennas listed are NOT to be used to determine the gain normalization and all others are. All 0 => use all. It can be useful to limit the antennas used for the gain normalization to those with good a priori calibration, especially when using VLBI-style calibration based on system temperatures and gains. This prevents the flux scale from being dragged up or down by poorly calibrated antennas including antennas subjected to bad weather. The normalization factor determined using the ANTUSE antennas is applied to all antennas. SUBARRAY...Subarray number to use. 0=>all. UVRANGE....The range of uv distance from the origin in kilowavelengths over which the data will have full weight; outside of this annulus in the uv plane the data will be down weighted by a factor of WTUV. WTUV.......The weighting factor for data outside of the uv range defined by UVRANGE. DOCALIB....If true (>0), calibrate the data using information in the specified Cal (CL) table for multi-source or SN table for single-source data. If > 1.5, also calibrate the weights (new for VLA, normal for VLBI). Applied before determining new solutions. GAINUSE....Version number of the CL table to apply to the data. 0 => highest. DOPOL......If > 0 then correct data for instrumental polarization as represented in the AN table. Only one subarray may be done at a time. This correction is only useful if PCAL has been run or feed polarization parameters have been otherwise obtained. See HELP DOPOL for available correction modes. BLVER......Version number of the baseline based calibration (BL) table to appply. <0 => apply no BL table, 0 => highest. FLAGVER....Specifies the version of the flagging table to be applied. 0 => highest numbered table. <0 => no flagging to be applied. DOBAND.....(multi-source) If true (>0) then correct the data for the shape of the antenna bandpasses using the BP table specified by BPVER. The correction has five modes: (a) if DOBAND=1 all entries for an antenna in the table are averaged together before correcting the data. (b) if DOBAND=2 the entry nearest in time (including solution weights) is used to correct the data. (c) if DOBAND=3 the table entries are interpolated in time (using solution weights) and the data are then corrected. (d) if DOBAND=4 the entry nearest in time (ignoring solution weights) is used to correct the data. (e) if DOBAND=5 the table entries are interpolated in time (ignoring solution weights) and the data are then corrected. BPVER......(multi-source) version of the BP table to be applied. 0 => highest. < 0 => no bandpass correction to be applied. SMOOTH.....Specifies the type of spectral smoothing to be applied to a uv database . The default is not to apply any smoothing. The elements of SMOOTH are as follows: SMOOTH(1) = type of smoothing to apply: 0 => no smoothing 1 => Hanning 2 => Gaussian 3 => Boxcar 4 => Sinc (i.e. sin(x)/x) SMOOTH(2) = the "diameter" of the function, i.e. width between first nulls of Hanning triangle and sinc function, FWHM of Gaussian, width of Boxcar. Defaults (if < 0.1) are 4, 2, 2 and 3 channels for SMOOTH(1) = 1 - 4. SMOOTH(3) = the diameter over which the convolving function has value - in channels. Defaults: 1, 3, 1, 4 times SMOOTH(2) used when input SMOOTH(3) < net SMOOTH(2). The following specify a CLEAN model to be used if a single source was specified in CALSOUR for multi-source files, or the data is a single-source file: IN2NAME....Cleaned map name (name). ' ' => not Clean model. For a single-source file the model determined by SMODEL is used instead of the CLEAN components if IN2NAME = ' ' or IN2CLASS = ' '. For a multi-source file a point source with flux given in the SU table is used instead of a CLEAN components if IN2NAME = ' ' or IN2CLASS = ' '. Note: a CLEAN image for only a single source may be given although it may be in a multi-source file. One and only one CALSOUR must be specified as well to apply a Clean-component model to a source in a multi-source file (even if the file actually contains only one source). For a multi-source file, the flux of the clean components selected for the model are summed and scaled to the source flux found in the SU table. If that flux is zero, no scaling is done. IN2CLASS...Cleaned map name (class). ' ' => not Clean model. IN2SEQ.....Cleaned map name (seq. #). 0 -> highest. IN2DISK....Disk drive # of cleaned map. 0 => any. INVERS.....CC file version #. 0=> highest numbered version NCOMP......Number of Clean components to use for the model, one value per field. If all values are zero, then all components in all fields are used. If any value is not zero, then abs(NCOMP(i)) (or fewer depending on FLUX and negativity) components are used for field i, even if NCOMP(i) is zero. If any of the NCOMP is less than 0, then components are only used in each field i up to abs(NCOMP(i)), FLUX, or the first negative whichever comes first. If abs(NCOMP(i)) is greater than the number of components in field i, the actual number is used. For example NCOMP = -1,0 says to use one component from field one unless it is negative or < FLUX and no components from any other field. This would usually not be desirable. NCOMP = -1000000 says to use all components from each field up to the first negative in that field. NCOMP = -200 100 23 0 300 5 says to use no more than 200 components from field 1, 100 from field 2, 23 from field 3, 300 from field 5, 5 from field 6 and none from any other field. Fewer are used if a negative is encountered or the components go below FLUX. FLUX.......Only components > FLUX in absolute value are used in the model. NMAPS......Number of image files to use for model. If more than one file is to be used, the NAME, CLASS, DISK and SEQ of the subsequent image files will be the same as the first file except that the LAST 3 or 4 characters of the CLASS will be an increasing sequence above that in IN2CLASS. Thus, if INCLASS='ICL005', classes 'ICL005' through 'ICLnnn' or 'ICnnnn', where nnn = 5 + NMAPS - 1 will be used. Old names (in which the 4'th character is not a number) are also supported: the last two characters are '01' through 'E7' for fields 2 through 512. In old names, the highest field number allowed is 512; in new names it is 4096. CMETHOD....This determines the method used to compute the model visibility values. 'DFT' uses the direct Fourier transform, this method is the most accurate. 'GRID' does a gridded-FFT interpolation model computation. ' ' allows the program to use the fastest method. NOTE: when using a model derived from data with difference uv sampling it is best to use 'DFT' CMODEL.....This indicates the type of input model; 'COMP' means that the input model consists of CLEAN components, 'IMAG' indicates that the input model consists of images. If CMODEL is ' ' clean components will be used if present and the image if not. Note: A normal CLEAN restored image is not a suitable model as it has been tapered by the restoring beam. A CLEANed image restored with a very small restoring beam is usable. CALIB will set a scaling factor to correct image units from JY/BEAM to JY/PIXEL for image models. If the source table contains a flux, then that flux will be used to scale the components model to obtain the stated total flux. This is needed since initial Cleans may not obtain the full flux even though they represent all the essentials of the source structure. SMODEL.....For a single source file the model described by SMODEL is used instead of a CLEAN components model if IN2NAME = ' ' and IN2CLASS = ' '. For a multi-source file a point source with flux from the SU table is used instead of the CLEAN components if IN2NAME = ' ' and IN2CLASS = ' '. If IN2NAME and IN2CLASS are specified, then SMODEL is required to be <= 0. If IN2NAME or IN2CLASS is blank, then, for single-source files, SMODEL(1) is required to be > 0. SMODEL(1) = flux density (Jy); 0 => no SMODEL. SMODEL(2) = X offset in sky (arcsec) SMODEL(3) = Y offset in sky (arcsec) SMODEL(4) = Model type: 0 => point model 1 => elliptical Gaussian and SMODEL(5) = major axis size (arcsec) SMODEL(6) = minor axis size (arcsec) SMODEL(7) = P. A. of major axis (degrees) 2 => uniform sphere and SMODEL(5) = radius (arcsec) The following specify the output file to be written if the input file is a single source file. OUTNAME....Output UV file name (name). Standard defaults. OUTCLASS...Output UV file name (class). Standard defaults. OUTSEQ.....Output UV file name (seq. #). 0 => highest unique OUTDISK....Disk drive # of output UV file. 0 => highest disk number with space The following control how the solutions are done, if you don't understand what a parameter means leave it 0 and you will probably get what you want. REFANT.....The desired reference antenna for phases. SOLINT.....The solution interval (min.) 0 => scan average for multisource, 0 => 10 s for single source amp-phase solns. (VLA) 0 => 10 min for delay-rate solutions (VLBA). SOLSUB.....The begin time for the next interval in advanced from the current one by SOLINT / SOLSUB where 1 <= SOLSUB <= 10. 0 -> 1. This is to produce solutions at sub-intervals of SOLINT based on SOLINT length of averaging. SOLMIN.....Minimum number of subintervals to be used in a solution. 0 -> SOLSUB. APARM......General control parameters. APARM(1)...Minimum number of antennas allowed for a solution. 0 => max (3, min (6, Numant/2)) APARM(2)...If > 0 then the input data has already been divided by a model; only solutions will be determined. APARM(3)...If > 0 then average RR, LL APARM(5)...If > 0 then make a combined solution for the IFs; if <= 0 then make separate solutions. APARM(6)...Print flag, 0=none, 1=time, closure error statistics, 2=individual closure failures, 3=some additional info including the antenna signal to noise ratio, 4=solutions, 5=data too. APARM(7)...The minimum allowed signal-to-noise ratio. 0 => 5 APARM(8)...If there is no antenna (AN) table with the input file then the maximum antenna number in the file should be entered in APARM(8). APARM(9)...When solutions fail or there is insufficient data and APARM(9) > 0 then (1,0) is written to the SN table. This will preserve the previous calibration but this option should be used with extreme care. Phase-amplitude parameters: SOLTYPE....Solution type: ' ' => normal least squares, 'L1 ' => L1 solution; a weighted sum of the moduli of the residuals is minimized. The computed gain solutions are less influenced by wild data points, but there is some loss of statistical efficiency. See [F.R. Schwab, VLA scientific Memo #136] for further details. 'GCON' => least squares which may include gain constraint. SOLMODE....Solution mode: 'A&P ' => amplitude and phase. 'P ' => phase only 'P!A ' => phase only (no amplitude information) 'GCON' => amplitude and phase with constraints on amplitude. This mode requires setting SOLTYPE='GCON', uses GAINERR and SOLCON may be used. ' ' => 'A&P ' for multisource (raw) data, => 'P ' for single source data. SOLCON.....Gain constraint factor; a value larger than 0 will increase the strength of the amplitude constraint in gain constrained solution with SOLMODE='GCON' MINAMPER...Amplitude closure error regarded as excessive in per cent. If APARM(6) > 0, summaries of the number of excessive errors by antenna are printed and, if APARM(6) > 1, up to 1000 of the individual failures are printed. 0 => do not check or report "excessive" closure errors of any sort. Note that amplitude closure errors are accumulated using logarithms so that gains of 0.5 and 2.0 are both errors of 100%. MINPHSER...Phase closure error regarded as excessive in degrees. If APARM(6) > 0, summaries of the number of excessive errors by antenna are printed and, if APARM(6) > 1, up to 1000 of the individual failures are printed. 0 => do not check or report "excessive" closure errors of any sort. CPARM......Phase-amplitude parameters. CPARM(1)...Minimum elevation in degrees for the solutions used to constrain the mean gain modulus. CPARM(2)...If > 0, constrain the mean gain modulus of the calibration applied to be unity. This is mostly used in self calibration. CPARM(3)...If > 0, the values of any amplitude closure errors whose average absolute percentage value exceeds CPARM(3) will be printed if APARM(6) > 0. CPARM(4)...If > 0, the values of any phase closure errors whose average absolute value exceeds CPARM(4) degrees will be printed if APARM(6) > 0.. CPARM(5)...If > 0 then the amplitudes will be scalar averaged before determining the solutions. SNVER......The version of the SN table to write the solutions to. If =0, a new SN table is generated. ANTWT......Antenna weights. These are additional weights to be applied to the data before doing the solutions, one per antenna. Use PRTAN to determine which antenna corresponds to each antenna number. 0 => 1.0 GAINERR....Estimates of the standard deviation of the modulus of the gains for each antenna. These are used ONLY if SOLMODE and SOLTYPE='GCON'. The solution will attempt to make the standard deviation of the modulus of the antenna gains match these values so accurate values are essential. BADDISK....Disk numbers on which scratch files are not to be placed. ---------------------------------------------------------------- CALIB: Task to determine antenna gains from calibrator data Documentor: A.H.Bridle Related Programs: CLCAL, LISTR, SPLIT, UVFLG This task is the central AIPS routine for calibrating multi- source uv data sets using observations of calibration sources that can either be assumed to be point sources or have well determined structures. CALIB determines antenna voltage gain solutions (amplitude and/or phase) from data for calibrator sources with well known flux densities, positions and structures. It is the equivalent of the VLA Dec-10 ANTSOL (with additional options) and of a combination of the AIPS routines ASCAL and VSCAL. Solutions determined by CALIB under control of the APARM, CPARM and DPARM parameters are written to the solution (SN) extension table of the input uv data set. Solution tables may be merged, smoothed and interpolated into calibration (CL) tables for multi-source uv data files using CLCAL. CALIB may also be run on files containing data for only one source, for self calibration. To run CALIB, you should specify at least: The input uv data file (INNAME, INCLASS, INSEQ, INDISK). The CALSOURces to be used for determining antenna gains, or leave CALSOUR blank and specify a CALCODE and/or qualifier. REFANT, the reference antenna for the solution (choose an antenna with good signal to noise that was present through as much of the observing as possible). The defaults are set so that running CALIB on a multi- source uv data file setting only these inputs will make a solution file for all IFs in the data over the entire time range using the highest-numbered flag file. All antennas will be calibrated for amplitude and phase, using data from the entire uv range. All antennas will be equally weighted. Point source models will be assumed for the calibration sources. The solution will be written to an SN table. Other useful options ==================== Use APARM(6)=3 to list the signal to noise ratio at each antenna solution. Solutions with signal to noise below 5:1 are probably not meaningful and will be discarded by the default setting of APARM(7). You may wish to apply more stringent criteria with APARM(7). Use SOLTYPE and SOLMODE='' to solve for both amplitude and phase solutions simultaneously with no constraints on amplitude, SOLTYPE and SOLMODE='GCON' for amplitude and phase with constraints set by GAINERR and SOLCON. Amplitude solutions for point source models in multisource files will be based on the flux densities entered for the sources in the source (SU) table extension of the data set using task SETJY. Use UVRANGE and WTUV to weight different uv ranges differently (or to restrict the solution to some uv range -- WTUV = 0 is read as zero weight). "CLEAN" COMPONENT MODELS ======================== CALIB does not restrict you to the use of point source models for your calibrators. Use IN2DISK, IN2NAME, IN2SEQ, INVERS, NCOMP and NMAPS to specify a CLEAN component model for the field or fields around a calibrator and specify that calibrator in SOURCE. CALIB will create an SN table for that calibrator alone. This SN table may then be merged with SN tables for other calibrators produced by other runs of CALIB, when the SN tables are smoothed and interpolated into a CL file by CLCAL. RESETTING YOUR CALIBRATION ========================== The first version of the CL table attached to your uv data set is protected from modification in CLCAL, so that you can easily "undo" all calibration steps that have taken place within AIPS. To reset your calibration, delete all CL tables with version numbers >1, and delete all SN tables.