NAME:
  rephot
 PURPOSE: (one line)
  Reprocess photometry data set by re-extracting from images.
 DESCRIPTION:
  This program will use a previously created photometry log file (new
  format as read and defined by RDPHALT.PRO) to reprocess the photometry
  allowing a change to the CCD gain, photometric aperture, and more.
  It also normally is used to reprocess photometry with new calibration
  information but this is not required.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  rephot,oldlog,newlog,calibs
 INPUTS:
  oldlog - Filename of an alternate format basphot log file.
  newlog - Filename for the new format file (must be different).
  calibs - Filename for the calibration information to be use.
                     (See LDCALIB.PRO for full details.)
              If this name is set to 'none', then all calibration steps
                  are bypassed.

 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  CALIBPATH-   Directory path pointing to calibration information,
                  default=PATH+'calib/'
  EXACT      - Flag, if true: take position as exact; otherwise (re)find it.
  PATH       - Directory path pointing to location for raw images.
  NEWGAIN    - New value of the gain to reduce with, e-/ADU
  NEWRAD     - New value of the object aperture radius in pixels.
  NEWRDNOISE - New value of the readout noise, e-/pixel.
  NEWSKY1    - New value of the inner sky annulus radius in pixels.
  NEWSKY2    - New value of the outer sky annulus radius in pixels.
  PSCALE     - Provide plate scale of data (default = 0.726 arcsec/pixel).
  SILENT     - Do not generate voluminous BASPHOTE output to the screen.
  NSTART     - Starting point number to measure (default is beginning).
  NSTOP      - Ending point number to measure (default is end).
                 Note: NSTART and NSTOP are zero-indexed.
   The following set of keywords controls a feature known as Multi-Aperture
     Photometry, where a number of different apertures are used on the
     same object on the same frame.
  MAPNAME - String array list of object names to apply multi-aperture
               photometry processing to (default=none).  If you want to
               run the multiple apertures on everything, set this to '[[all]]'
               In this case, mapserno is ignored.
  MAPSERNO - Integer scalar or vector giving object serial numbers to
               apply serial numbers to (default=0).  If set to -1, then
               all serial numbers are processed with multiple apertures.
  MAPERTURE - Vector list of apertures to apply to all of MAPNAME/MAPSERNO.
  MAPSKY1   - Inner sky annulus radius.  May be scalar or same length as
                 MAPERTURE.  Default = NEWSKY1
  MAPSKY2   - Outer sky annulus radius.  Must be same length as MAPSKY1.
                 Default = NEWSKY2
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  Rephot will read the log file from start to finish and process those
    points in the range from NSTART to NSTOP.  There can be many extractions
    from a single image so the point range does not usually correspond to
    a frame number.  All of the information required to re-extract the
    photometry from the image is read from the photometry log file or comes
    from the optional override numbers.  This program does NOT read the
    image headers to get its information.  This means that if the log file
    information is wrong, you need only edit (and fix) the log file to get
    the right information.  When editing a log file you need to be a little
    careful but the format is pretty flexible and works by fields, not by
    absolute position.

  If MAPNAME is not set, then each entry is recomputed.

  If MAPNAME and MAPERTURE are set, then the processing considerably more
    complicated.

 MODIFICATION HISTORY:
  Written 1993 Feb 4 by Marc W. Buie, Lowell Observatory
  93/05/10, MWB, Added LORAL instrument option.
  93/11/02, MWB, added PSCALE keyword, fixed overscan code for LORAL
  94/03/16, MWB, added version 2 calibration file support.
  95/03/03, MWB, fixed bug the didn't handle -1 -1 in calib files properly
  95/03/07, MWB, added version 3 calibration file support.
  95/06/12, MWB, added CALIBPATH support.
  95/08/08, MWB, split out calibration info loading to separate routine.
  96/10/31, MWB, added "bad" flag support from rdphalt
  97/10/31, MWB, added calibs='none' option.
  2000/02/08, MWB, added EXACT keyword
  2000/01/24, MWB, added [[all]] option to MAPNAME.
  2006/05/12, Peter L. Collins, Lowell Observatory
                 added read nose keyword parameter and processing.