NAME:
  photphot
 PURPOSE:   (one line only)
  Photometry from photographic image data.
 DESCRIPTION:
  Uses marginal distributions and a pair of 1-D gaussian fits in each
    axis to determine flux and position from an image that derives from
    a photographic medium.
  This routine does NOT do any local peak finding.  It makes its based
    entirely on the input location.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  photphot,img,x0,y0,dw, $
           xcen,ycen,xfwhm,yfwhm,xflux,yflux,xback,yback, $
           xcenerr,ycenerr,xfluxerr,yfluxerr
 INPUTS:
  img        2-d image array. Assumed to have 1 star only.
  x0         vector of starting source x positions
  y0         vector of starting source y positions
  dw         scalar or vector of box size for fit.
 KEYWORD INPUT PARAMETERS:
  SKY - Scalar or vector, if provided is used for the sky background and no
          fit on sky is performed.

  DEBUG - Flag, if set will generate debug plots and printouts.  This is
            not designed to be used when you are providing vector input.
            Implies verbose as well.
  SILENT - Flag, if set will suppress all non-error output.
  VERBOSE - Flag, if set will generate chatty out (but not nearly as much
             as if the debug flag is set).
 
 OUTPUTS:
  xcen  -    fitted x position of source
  ycen  -    fitted y position of source
  xfwhm -    fitted FWHM of source in x direction.
  yfwhm -    fitted FWHM of source in y direction.
  xflux -    fitted flux of source in x direction.
  yflux -    fitted flux of source in y direction.
  xback -    fitted image background in x direction.
  yback -    fitted image background in y direction.
  xcenerr -  uncertainty on fitted x position of source
  ycenerr -  uncertainty on fitted y position of source
  xfluxerr - uncertainty on fitted flux of source in x direction.
  yfluxerr - uncertainty on fitted flux of source in y direction.

 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  2007 Oct 15, Written by Peter L. Collins, Lowell Observatory
               Based on Fortran code kindly supplied by Larry Wasserman.
  2007/10/16,  add SKY keyword and input vectors of source positions.
  2007/10/21, MWB, converted to use IDL builtin, gaussfit
  2007/10/29, MWB, integrated into library
  2013/12/23, MWB, fixed numerous issues with input variables getting changed,
                     the most common problem was promoting scalars to 1-element
                     vectors.