NAME:
    p6model
 PURPOSE: (one line)
    Generate synthetic PSF images for the HST WFPC Planetary Camera, Chip 6.
 DESCRIPTION:
    A generated PSF is added to the output array.  If the array is not
 defined, it is created with dimensions 800 by 800.  Successive calls
 will add objects (PSF's) to the array.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    p6model, xsrc, ysrc, inten, date, filter, bmvnum, back, image
 INPUTS:
    xsrc, ysrc : Position of the PSF in the output array.
    inten      : Intensity of PSF relative to TinyTim output PSF
    date       : Date of observation (YYMMDD format).
    filter     : Filter name in the form Fxxx(W,LP,M,N).
    bmvnum     : B-V list value (TinyTim V6.2 values):
                1           O5      -0.34
                2           O8F     -0.32
                3           O6      -0.31
                4           B1V     -0.27
                5           B3V     -0.21
                6           B6V     -0.12
                7           A0V     -0.04
                8           A5V      0.12
                9           F6V      0.37
               10           F8V      0.48
               11           G2V      0.56
               12           G5V      0.66
               13           G8V      0.75
               14           K4V      0.92
               15           K7V      1.28
               16           M1.5V    1.45
               17           M3V      1.44
               17           M3V      1.44
    back    : Background to be added.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
    JITTER  : If set contains the gaussian smearing to apply to the image.
                This is in units of 1/e half width.  If not set, no smearing
                is applied.  This calculation is done in double precision
                or float according to the type of image. The values passed
                to the exp function ( e - (((x/j)^2 + y/j)^2/2)) are 
                restricted to a maximum based on the computational precision
                to avoid floating point underflow.
    OBJRAD  : Radius of object in pixels.  If not set, assumed to be a point
              source.  If set and radius is greater than 0.5, then PSF is
              convolved with a circular function of this radius.  This models
              the object as a Lambert disk, crude but useful for barely
              resolved objects.
    NEW     : If set, clears the output array to zeros before building the
              PSF image(s).
    HSTPATH : Alternate path for HST PSF's.
    VERBOSE : If set, prints informational message.
 OUTPUTS:
    image  : The image array into which the PSF is placed.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The Tiny Tim programs are used, via the procedure HSTPSF, to generate
 a 2X (7.5 micron spacing) PSF at the nearest grid location to the requested
 position. (This grid is defined in hstpsf).
    From the interpolated maximum returned by hstpsf, shift amounts for x
 and y are computed.
    The PSF is shifted by these amounts and then compressed to a 1X
 (15 micron spacing) PSF.
    Finally, the resulting PSF is multiplied by the intensity parameter and
 added into the output array.
    Calls external procedures BADPAR, BOXM, HSTPSF, and SSHIFT2D.
 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, December, 1993.
    12/10/93, DWL, Modified to allow the first three parameters to be
 vectors.
    12/16/93, DWL, Added VERBOSE keyword.
    1/19/94, DWL, Added HSTPATH keyword.
    1/21/94, DWL, Added x-maximum and y-maximum parameters to hstpsf call.
    2003/1/15, DWL, Modified to call the updated routine HSTPSF, which
 uses TinyTim Version 6.1 Alpha. A PSF is returned from HSTPSF, only if
 the requested PSF file is found in disk cache.
   2006/11/20, Peter L. Collins, Lowell Observatory, removed superflous
                defaulting in badpar call for HSTPATH.
   2007/07/24, PLC, add some changes made earlier to pc2model.
   2007/07/25, PLC, propagate changes made to pc2model 2007/07/08 by Marc Buie.
                    Z4 keyword left out for now (pending hstpsf test).
  2019/12/20, MWB, incorporated new routine, mkxyarr