; BPSMO
;---------------------------------------------------------------
;! Smooths or interpolates bandpass tables to regular times
;# Task SPECTRAL UV CALIBRATION
;-----------------------------------------------------------------------
;;  Copyright (C) 1996-1997, 2009
;;  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
;-----------------------------------------------------------------------
BPSMO     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BPSMO     Smooths/interpolates bandpass tables to regular times
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 #
BPVER                              Bandpass table version
BCHAN            -1.0     8192.0   Lowest normalization channel
                                      -1 = none, 0 = center 3/4
ECHAN             0.0     8192.0   Highest normalization channel
DOWEIGHT         -2.0        2.0   Use weights in smoothing?
APARM                              Control information:
                                   (1) function type
                                   (2) function diameter (hours)
                                   (3) function support (hours)
                                   (4) Output interval (hours)
                                   (5) >0 = vector normalization
----------------------------------------------------------------
BPSMO
Type:  Task
Use:   To create a new 'BP' extension file containing a bandpass
       correction solution for each antenna at each of a set of
       regularly spaced times or at the input times but with flagged
       solutions replaced by time-smoothed ones.  A variety of
       interpolation and smoothing options are provided.  The amplitude
       of the solutions may be forced to one over a range of channels
       with either scalar or vector averaging (or it may be allowed to
       float).
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.
  BPVER......Specifies the version of the BP table to be read as input.
             0 -> highest.  The output version is always highest + 1.
  BCHAN......Lowest channel of a range of channels used to determine
             the amplitude normalization.  0 => bchan = nchan/8 and
             echan = (7/8)*nchan (user ECHAN ignored).  < 0 => do no
             normalization
  ECHAN......Highest channel of a range of channels used to determine
             the amplitude normalization.  NO DEFAULT when BCHAN > 0.
  DOWEIGHT...> 0 => use the solution weights in the time smoothing; else
             ignore them.  If the solution weights are very variable,
             but the solutions have real variations with time, then it
             is best to ignore the weights.  If the weights are not
             greatly different, then using them improves the noise of the
             smoothed result.  DOWEIGHT = 2 or -2 causes the output
             weights to be computed by noise combinatorial methods,
             otherwise the data weights are interpolated.  If the
             solutions do not vary rapidly with time, then an averaged
             solution is more reliable and DOWEIGHT 2 would reflect
             that.  If they do vary with time, then the nearest neighbor
             gets less reliable (for estimating the BP at the present
             time) the further away it is in time.  DOWEIGHT -1 (or 1)
             is a partial compensation for this.
  APARM......Specifies the type of time smoothing to be applied to the
             bandpass table.
             APARM(1) = type of smoothing to apply:
                0 => Two-point (linear between nearest neighbors)
                1 => Hanning (linear)
                2 => Gaussian
                3 => Boxcar
                4 => Sinc (i.e. sin(x)/x)
             APARM(2) = the "diameter" of the function in hours, i.e.
                width between first nulls of Hanning triangle and sinc
                function, FWHM of Gaussian, width of Boxcar
                0 => 1 hour.
             APARM(3) = the diameter over which the smoothing function
                has value in hours.  Defaults: 1, 3, 1, 4 times APARM(2)
                used when input APARM(3) < net APARM(2).
             APARM(4) = increment between output bandpass solutions in
                hours.  0 -> 1 hour.
                < 0 => the output BP file has the same times as the
                input and has the same bandpasses, except that IFs or
                polarizations that were flagged are replaced with ones
                computed by smoothing using the other APARM parameters.
             APARM(5) = flag for type of normalization and smoothing.
                <= 0 => scalar averaging of amplitudes,
                 > 0 => vector averaging.
                In cases of decent S/N, use scalar.
----------------------------------------------------------------
