; RMTFC
;---------------------------------------------------------------
;! Convolves rotation measure transfer function with various slab models.
;# TASK ANALYSIS
;-----------------------------------------------------------------------
;;  Copyright (C) 2020
;;  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
;-----------------------------------------------------------------------
RMTFC     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
RMTFC:  Task to convolve a TARS RMTF with various slab models
INTEXT
                                   Text file with RMTF
OPTYPE                             'BOX1' 'BOX2' 'GAUS' 'GAU2'
APARM                              Controls over model
                                   (1,2) X value range of box 1
                                   (3,4) X value range of box 2
                                   (1,2) center, FWHM of Gauss1
                                   (3,4) center, FWHM of Gauss2
OUTFILE
                                   output file name
----------------------------------------------------------------
RMTFC
Type: Task
Use:  RMTFC computes the convolution of the function contained in
      INTEXT with various "slab" models.  There is an assumption
      that this concerns rotation measure synthesis so the function
      in INTEXT is complex but the models are real.
Adverbs:
  INTEXT......Text file containing data from TARS for the RMTF.
  OPTYPE......Type of model:
              'BOX1'  single box using APARM(1,2)
              'BOX2'  two boxes using APARM(1,2), APARM(3,4)
                      note they can have zero width
              'GAUS'  one Gaussian using APARM(1,2)
              'GAU2'  two Gaussians using APARM(1,2), APARM(3,4)
  APARM.......(1,2) Range in RM values for the first or only box
              (3,4) Range in RM values for the second box
              (1,2) Center and FWHM in RM values for the first or
                    only Gaussina
              (3,4) Center and FWHM in RM values for the second
                    Gaussian
  OUTFILE.....Text file with convolution of model and RMTF.  If
              the file already exists, the output will be
              appended to it.  TARPL allows the selection of one
              or more of the models in OUTFILE for plotting.
----------------------------------------------------------------
RMTFC: Task to compute the convolution of an RMTF with a model
DOCUMENTOR:
RELATED PROGRAMS: FARS, TARS, TARPL

                           PURPOSE

     RMTFC generates a text file with the convolution of the RMTF
produced by TARS contained in INTEXT with a model controlled by
OPTYPE and APARM.  The input and output files have the format
used by TARS output.  Plot it with TARPL.

The text file can contain other comment cards starting with an
character not blank or a number so long as they do not start with
semi-colon, 3 blanks, and the letter K (';   K').

An example file (with ... being large numbers of skipped lines):

; RMTF
;   K        RM         10^6 RE       10^6 IM
    1     -2000.0     -10732.80      -3509.41
    2     -1990.0     -10675.10      -4387.22
    3     -1980.0     -11458.82      -5835.72
    4     -1970.0     -13273.08      -7360.74
    5     -1960.0     -16064.64      -8439.05
    6     -1950.0     -19550.80      -8626.45
    7     -1940.0     -23277.32      -7649.28
    8     -1930.0     -26709.80      -5461.85
    9     -1920.0     -29340.48      -2258.88
   10     -1910.0     -30789.77       1559.13
...
  196       -50.0     526493.73     644101.19
  197       -40.0     672820.55     582428.40
  198       -30.0     804620.36     480050.66
  199       -20.0     909367.19     342177.90
  200       -10.0     976751.67     178060.30
  201         0.0    1000000.00          0.00
  202        10.0     976751.67    -178060.30
  203        20.0     909367.19    -342177.90
  204        30.0     804620.36    -480050.66
  205        40.0     672820.55    -582428.40
  206        50.0     526493.73    -644101.19
...
  392      1910.0     -30789.77      -1559.13
  393      1920.0     -29340.48       2258.88
  394      1930.0     -26709.80       5461.85
  395      1940.0     -23277.32       7649.28
  396      1950.0     -19550.80       8626.45
  397      1960.0     -16064.64       8439.05
  398      1970.0     -13273.08       7360.74
  399      1980.0     -11458.82       5835.72
  400      1990.0     -10675.10       4387.22
  401      2000.0     -10732.80       3509.41
