As of Wed Jun 12 9:12:37 2024

TYSMO: Task which smooths/filters system temperature tables


INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK            0.0        9.0   Input UV file disk unit #
SOURCES                            Source list ' '=>all.
DOBTWEEN        -1.0         1.0   > 0 -> smooth all sources
                                   together; else separate them
SELBAND                            Bandwidth to select (kHz)
SELFREQ                            Frequency to select (MHz)
FREQID                             Freq. ID to select, 0=>all
BIF               0.0      100.0   Lowest IF number 0=>all
EIF               0.0      100.0   Highest IF number 0=>all
TIMERANG                           Time range to use.
ANTENNAS                           Antennas to correct.
SUBARRAY          0.0     9999.0   Subarray; 0 => all.
FLAGVER          -1.0              Apply flag table first?
                                   0 => highest, -1 => no
INEXT                              'TY' or 'SY' or choose
INVERS                             Input ?Y table; 0=>highest
OUTVERS                            Output ?Y table; 0=>new
APARM                              Range of allowed T's or P's
DOSCALE          -1.0        1.0   > 0 => MWF values are
                                      normalized by their median
CPARM                              Clip wrt median filter
SAMPTYPE                           Smoothing function
BPARM                              Smoothing parameters
CUTOFF            0.0              Cutoff for functional forms
DOBLANK                            Blanked value interpolation
BADDISK           0.0     9999.0   Disks to avoid for scratch


Task: This task edits and smooths a TY or SY table.  For TY tables,
      the antenna and system temperatures are clipped to be in
      reasonable ranges.  For SY tables, the Pdif (noise tube on -
      noise tube off) and Psum (Pon+Poff) columns and their ratio
      (Psum/Pdif/2*Tcal = Tsys) are clipped to be in reasonable
      ranges.  Then they are time smoothed.  Blanked values will be
      interpolated or not under control of DOBLANK.   In TY tables.
      for some telescopes, Tsys and Tant are what they are labled to
      be.  For the VLA, Tsys is the nominal sensitivity and Tant is
      some form of system temperature.  The SY table is an EVLA
      concept and contains Pdif, Psum, and PostGain columns.  At the
      synchronous detector, the measured power is Pon with the noise
      tube on and Poff with the noise tube off and PostGain is any
      gain that follows this detector.  Then Pdif = PostGain * (Pon -
      Poff) and Psum = PostGain * (Pon + poff).  The ratio, Psum/Pdif
      is twice the Tsys divided by the noise tube Tcal.

      Note that TYAPL with SY tables requires valid values for Pdif,
      Psum, and the post-detector gains.  If you are replacing flagged
      SY table values with smoothed values you should do this for all
      three data types whether your data are 3-bit or 8-bit.

      DOBTWEEN controls whether values from different sources are
      smoothed separately or together.  Unless all sources have
      similar strength and similar spill-over and the like, use
      DOBTWEEN <= 0.  This is especially important when the observing
      run includes observations of the Sun.  For solar data, you
      should also note that not all antennas have "solar cals".  Do
      not use Psys in smoothing and clipping since those antennas will
      be completely flagged due to the absence of a proper cal.

      For each IF, TYSMO reports the number of times that Psum <=
      Pdif as "improper SY records.  Then it uses 3 columns to report
      the number of samples flagged by the clip set by APARM, the
      number of samples flagged after the median-window filer set by
      CPARM, and the number of samples already flagged in the output
      of the MWF.  The last could arise is a significant number of
      consecutive samples have been clipped or flagged in some way
      prior to the MWF.  There are separate lines for Pdif, Psum,
      Psys, and Pgain.  Finally the number of SY table records changed
      by this flagging is reported.

  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.
  SOURCES....list of sources to process: '*' = all;
             a "-" before a source name means all except ANY source
  DOBTWEEN...> 0 => smooth all TY/SY values regardless of source.
             <= 0 => smooth only TY/SY values from the same source.
             Well-separated calibrators may have different spill-over
             and background temperatures, so one would not want to
             smooth them together.  This can be achieved via doing one
             source at a time, but DOBTWEEN allows one to do all
             sources at once - at least if the choice is a simple
             one.  If you do Pgain, you really must set DOBTWEEN = 0.
  FREQID.....Frequency identifier to select (you may determine which
             is applicable from the OPTYPE='SCAN' listing produced by
  BIF........First IF to process. 0=>all.
  EIF........Highest IF to process. 0=>all higher than BIF
  TIMERANG...Time range of the data to be used. In order:
             Start day, hour, min. sec, end day, hour, min. sec.
             Days relative to reference date.
  ANTENNAS...A list of the antennas to be modified.  If any number is
             negative then all antennas listed are NOT to be modified.
             All 0 => use all.
  SUBARRAY...The subarray to modify.  0 -> all.
  FLAGVER....< 0 => do NOT apply a flag table to the SY/TY table
             0   => apply the highest numbered FG table to the SY/TY
                    table INVERS as it is copied to OUTVERS
             > 0 => apply FG version FLAGVER to the SY/TY table INVERS
                    as is copied to OUTVERS
  INEXT......'SY' or 'TY' else select whichever is present and die if
             both are present.
  INVERS.....input version number of the TY/SY table to smooth.
             0 => Highest.
  OUTVERS....output version of TY/SY table to write.
             0 => create new table (recommended)
  APARM......Data can first be clipped on the actual values:
               (1) => min Tsys or Pdif            0 => zero
               (2) => min Tant or Psum            0 => zero
               (3) => min Psum/Pdif/2*Tcal = Tsys 0 => zero
               (4) => min Pgain                   0 => zero
               (6) => max Tsys or Pdif            0 => very large
               (7) => max Tant or Psum            0 => very large
               (8) => max Psum/Pdif/2*Tcal = Tsys 0 => very large
               (9) => max Pgain                   0 => very large
             Note - you will need very differnt values for clipping
             solar data and regular-source data.  Use SOURCES to limit
             each run on the SY table to the Sun or to normal
  DOSCALE....> 0 => the data in each scan is normalized by the median
                    of those data so that CPARM(6) - CPARM(9) are
                    relative numbers
             <= 0 => CPARM(6) - CPARM(9) are absolute numbers in the
                    appropriate data type.
  CPARM......Data can then be clipped by comparison with a median
             window filter.  The width of the Median window is
             specified in CPARM(1, 2, 3, or 4).  The maximum allowed
             deviation is given in CPARM(6, 7, 8, or 9).
             0 => all values are OK.
               (1) => smoothing time for Tsys or Pdif (minutes),
               (2) => smoothing time for Tant or Psum (minutes),
               (3) => smoothing time for Psum/Pdif/2*Tcal = Tsys (min)
               (4) => smoothing time for Pgain
               (6) => max deviation for Tsys or Pdif
               (7) => max deviation for Tant or Psum
               (8) => max deviation for Psum/Pdif/2*Tcal = Tsys
               (9) => max deviation for Pgain
  SAMPTYPE...The type of smoothing to follow clipping (if any)
                'BOX ' = boxcar smoothing (default)
                'MWF ' = Median window filter
                'GAUS' = Gaussian
                'EXP ' = Exponential
                'LINE' = Linear (1 - abs(t-t0)/sigma)
                '2PT ' = Two-point
                '2PTH' = Two-point + "Hanning"
  BPARM......Parameters for smoothing function: note that we cannot
             smooth Tsys in SY tables since that is the ratio of the
             two measured quantities.
             Function support full-width width in minutes
               (1) => support time for Tsys or Pdif,  (0 -> skip)
               (2) => support time for Tant or Psum,  (0 -> skip)
               (4) => support time for Pgain,         (0 -> skip)
             Added parameter (FWHM) for GAUS, EXP, LINE in minutes
               (6) => smoothing FWHM time for Tsys or Pdif,
               (7) => smoothing FWHM time for Tant or Psum,
               (9) => smoothing FWHM time for Pgain,
             In all cases, the substitution for blanked and good
             solutions is governed by DOBLANK (see below)
  CUTOFF.....Cutoff for GAUS, EXP, LINE.  The sum of the weighting
             function in the support region must exceed CUTOFF for the
             smoothed value to be regarded as valid.  Be careful, a
             value of 1.5 means that the sample itself must be good
             and the sum over other good samples in the support range
             must exceed 0.5.  < 1.e-6 => 1.e-6.
  DOBLANK....Blanked value interpolation:
             > 0: replace previously blanked values with smoothed
                  values, leave previously good values unchanged.
             = 0: replace previously blanked and previously good
                  values with smoothed values.
             < 0: replace previously good values with smoothed values,
                  leave previously blanked values blanked.
  BADDISK....A list of disks on which scratch files are not to be
             placed.  This will not affect the output file.