; SETJY
;---------------------------------------------------------------
;! Task to enter source info into source (SU) table.
;# TASK CALIBRATION
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1996, 2000
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
SETJY     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SETJY     Task to enter source info into source (SU) table.
INNAME                             Input image name (name)
INCLASS                            Input image name (class)
INSEQ             0.0     9999.0   Input image name (seq. #)
INDISK            0.0        9.0   Input image disk unit #
SOURCES                            Sources to modify.
QUAL            -10.0              Source qualifier -1=>all
BIF               0.0              Low IF # for flux density
EIF               0.0              High IF # for flux density
ZEROSP                             I,Q,U,V flux density (Jy)
OPTYPE                             '    ' => use other adverbs
                                   for required operation
                                   'CALC' => determine
                                   3C286/3C48/1934 fluxes from
                                   standard formulae
                                   'REJY' => reset source
                                   fluxes to zero.
                                   'REVL' => reset velocity
                                   to zero
                                   'RESE' => reset fluxes &
                                   velocities to zero.
CALCODE                            New calibrator code:
                                     '----' => change to blank
SYSVEL                             Velocity of source (km/s)
RESTFREQ                           Line rest frequency (Hz)
VELTYP                             Velocity type 'LSR,'HELIO'
VELDEF                             Velocity definition 'RADIO',
                                   'OPTICAL'
FREQID                             FQ table entry to use for
                                   velocity information and
                                   'CALC' option
APARM                              (1): Pixel to which SYSVEL
                                        refers ( 0=>1)
                                   (2): Only for 'CALC' option:
                                     <= 0 => use latest VLA
                                         values (1999.2) or,
                                         for 1934-638, the
                                         ATCA value of 30Jul94.
                                        1 => use Baars values
                                         or old ATCA/PKS values
                                         for 1934-638
                                        2 => use VLA 1995.2 values
                                         or, for 1934-638, the
                                         ATCA value of 30Jul94.
                                     >= 3 => use oldest VLA
                                         values (1990) or,
                                         for 1934-638, the
                                         ATCA value of 30Jul94.
----------------------------------------------------------------
SETJY
Task:  SETJY enters source information into the source (SU)
       table.
Adverbs:
  INNAME.....Input image name (name).       Standard defaults.
  INCLASS....Input image name (class).      Standard defaults.
  INSEQ......Input image name (seq. #).     0 => highest.
  INDISK.....Disk drive # of input image.   0 => any.
  SOURCES....The list of sources.  '*' = all; a "-" before a
             source name means all except ANY source named.
             All '  ' =>all.
  QUAL.......Only sources with a source qualifier number in the
             SU table matching QUAL will be modified if QUAL is
             not -1.
  BIF........The lowest IF number for which the given flux
             densities are valid. 0 => 1.
  EIF........The highest IF number for which the given flux
             densities are valid. 0 => all.
  ZEROSP.....The I, Q, U, and V flux densities in JY.  If
             ZEROSP(5) < 0.0 then the flux densities are not
             changed (i.e. only calibrator codes are changed).
             all 0 => no change.
  OPTYPE.....'   ' => use ZEROSP values for the source flux
                  densities and SYSVEL for source velocity.
             'CALC' => use the standard Baars et al formulae
                  and frequency information in the header to
                  determine the flux densities of the primary
                  calibrators 3C286, 3C48 and 3C147 (IAU style
                  names in B1950 or J2000 are also recognized
                  by SETJY).  Any selected sources with a
                  recognized name will have fluxes calculated.
                  Australia Telescope source 1934-638 is also
                  recognized (J2000 only but can start with P).
                  (see APARM(2) for polynomial selection).
             'REJY' => reset source flux densities to zero
                  for source(s) specified.
             'REVL' => reset velocity to zero for source(s)
                  specified.
             'RESE' => do both 'REJY' and 'REVL' operations.
  CALCODE....The 4 character calibrator code to be inserted.
             '    ' => no change, '----' => change to blank,
             '*' is not allowed.
             NOTE that CALCODE is not part of the source
             selection in SETJY as it is in other tasks.
  SYSVEL.....The velocity of the source (in km/s)
             per IF.
             0 => no change.  If 0 is desired use 1.0E-10.
  RESTFREQ...Rest frequency of line (Hz) per IF; the value used
             is the sum of RESTFREQ(1)+RESTFREQ(2).
             0=>no change
  VELTYP.....Velocity system ('LSR','HELIO'); ' '=> no change.
  VELDEF.....Definition of velocity, 'RADIO' or 'OPTICAL';
             ' ' = > no change.
  FREQID.....Frequency identifier to select (you may determine
             which is applicable from the OPTYPE='SCAN' listing
             produced by LISTR).  This is needed to set the
             frequency for flux computations in CALC OPTYPE.
             It is also needed to estimate the width of a line
             channel in km/s for calculation of velocity info.
             SET IT on CALC.
  APARM......(1) The frequency pixel (or channel) to which the
                 velocity refers. (0=>1)
                 The velocity stored in the 'SU' table will be
                 recalculated to refer to the reference pixel.
             (2): Only for 'CALC' option:
                  <= 0 => use latest VLA values (1999.2) or,
                          for 1934-638, the ATCA value of
                          30Jul94.
                     1 => use Baars values or old ATCA/PKS
                          values for 1934-638
                     2 => use mid-1990s VLA determined values
                          (1995.2) or, for 1934-638, the ATCA
                          value of 30Jul94.
                  >= 3 => use oldest VLA determined values
                          (1990) or, for 1934-638, the ATCA
                          value of 30Jul94.
----------------------------------------------------------------
SETJY: Enter Source Flux Density and Calcode into the SU Table.
       Other source parameters may also be entered.
RELATED PROGRAMS: CALIB

                           PURPOSE

 The flux density scale of radio interferometers is often determined by
observations of radio sources of known brightness.  For interferometer
observations, it is important that the standard sources used for this
purpose be relatively compact. This is often at odds however with the
requirement that the sources have very low variability over long
timescales.

 For calibration of observations with the VLA, the radio sources 3C48,
3C286 and 3C147 are often used.  In the southern hemisphere 1934-638
may also be used for this purpose.

 The standard reference for the flux density of bright radio sources
is the paper by Baars, Genzel, Pauliny-Toth, Witzel 1977, Astron.,
Astrop. volume 61, page 99.  The flux density of the standard sources
can be modelled as a polynomial expansion over frequency.  Polynomial
coefficients have also been derived independently by R. Perley and
G. Taylor as part of a long-term program to monitor the standard flux
density calibrators at the VLA. These flux densities have been tied to
3C295 as it is believed that the bulk of the emission from 3C295
should remain constant over a timsecale of thousands of years.

 SETJY will calculate the expected flux density of the standard
calibrators using either the Baars etal. coefficients or those derived
from the VLA observations in 1990, 1995.2, or 1999.2. This option is
selected by setting OPCODE to 'CALC'. The coefficient set to be used is
selected using APARM(2), with the default giving the 1999.2 values.

** NOTE 1: As of the end of 2000, there still is uncertainty in
the absolute VLA flux scale at 43 GHz, with the planets and NGC 7027
giving results that are discrepant by roughly 10%.  For further
information, consult the VLA Observational Status Summary, available
via the VLA web site at http://www.aoc.nrao.edu/vla.

** NOTE 2: It was discovered several years ago that the existing 1990 VLA
coefficients were rounded incorrectly in SETJY, introducing a positive
bias of approximately 0.5%, 0.9%, 1.2%, 1.4% and 2.0% at P, L, C, X
and U bands respectively for 3C286. The effect for other sources is
less significant. This error affected AIPS versions up to and
including 15JAN96. The 1990 coefficients implemented in subsequent
versions have been corrected to remove the rounding error.

 For more detailed information regarding the variability of the
standard flux density calibrators at the VLA the user is referred to
the VLA calibrator manual which is available on the WWW at
http://www.nrao.edu/doc/vla/html/calib.shtml.

 The source 1934-638 is the primary calibrator for the ATCA (Australia
Telescope Compact Array).  The flux density scale for 1934-638 was
re-determined by John Reynolds (jreynold@atnf.csiro.au, 30/jul/94) and
implemented in SETJY as the default on 30 August 1994.  Changes in the
flux density scale are significant at all frequencies.  The old scale
can be obtained with OPTYPE='CALC' by setting APARM(2)=1


Frequency          New - Old
  (MHz)               (%)
---------------------------------
408                 -1.9
843                 -3.5
1380                -7.9
1413                -8.1
1612                -9.3
1660                -9.5
1665                -9.5
2295               -11.4
2378               -11.5
4800                -7.9
4835                -7.8
4850                -7.8
8415                +8.5
8420                +8.5
8640                +9.8



 The SETJY output in the SU table can be viewed with the tasks
LISTR or PRTAB.
----------------------------------------------------------------

