NAME:
  wrphalt
 PURPOSE: (one line)
  Write a photometry log file.
 DESCRIPTION:

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  wrphalt,logname,filename,obj,fil,jd,exptime,gain,rad,sky1,sky2,serial, $
           xpos,ypos,fwhm,maxcnt,sky,skyerr,mag,err,bad,rdnoise
 INPUTS:
  logname  - string containing the photometry log file to write to.
  filename - Original image file name for each point.
  obj      - String array containing all object names.
  fil      - String array with filter codes.
  jd       - Julian date of mid-time of observation.
  exptime  - Exposure time in seconds.
  gain     - Gain of system in photons per count.
  rad      - Radius of object aperture in pixels.
  sky1     - Inner radius of sky annulus in pixels.
  sky2     - Outer radius of sky annulus in pixels.
  serial   - Serial number for observation.
  xpos     - vector containing the x position for each point.
  ypos     - vector containing the y position for each point.
  fwhm     - Full-width at half maximum in arcseconds.
  maxcnt   - Original DN of maximum in image.
  sky      - Sky signal in counts/pixel.
  skyerr   - Uncertainty of the sky signal.
  mag      - Instrumental magnitude.
  err      - Uncertainties of the magnitudes.
  bad      - Bad flag
 OPTIONAL INPUT PARAMETERS:
  bad      - flag that marks data as bad.  1 is bad, 0 or missing is good.
               The vector is optional, default is that all are good.
  rdnoise  - Readout noise in e-/pixel, default is 0.00
 KEYWORD INPUT PARAMETERS:
  APPEND - if set appends data to the named file.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 2000/08/30
  Peter L. Collins, Lowell Observatory. 2006/5/15
    added readout noise support and 'self' handling for badpar.