NAME:
  addstar
 PURPOSE:   (one line only)
  Add a reference star to the data base for fitting
 DESCRIPTION:
  This tool is really designed to be run on one visit at a time.  It
    locates all the Gaia reference stars in the image and posts them
    to the database for subsequent fitting.   What's saved at this step
    is basically the starting point for fitting.  This program can be a
    bit interactive and is pretty fast.  The fitting can be slow and is
    left for the next step.
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  hstaddstar,filestem,det
 INPUTS:
  filestem - String that is used to select a set of file for processing.
             The search string for files will be
               filestem+'*.flc.fits.gz'
  visitid - Two character string for the visit id
  det     - Detector number (1 or 2)
  pattstep - integer that picks out the image in the sequence for that visit
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BOXMRAD - box half-width to search for the local maximum,
               default=value from config.ini
  DW - half-width of fitting region centered on local max,
               default=value from config.ini
  POST - Flag, if set will cause results to be saved to the database
           It is really important to test one file from a visit until
           it looks good then the rest can be run safely without supervision
           The default is to NOT save anything.
 OUTPUTS:
  the hstast.stars database table is modified
 KEYWORD OUTPUT PARAMETERS:
 CONFIGURATION: (optional, overrides xtrack.in)
   File: config.ini
   [global]
     boxmrad  - search half-width for peak of source, default=3
     sdw      - Fitting region half-width for stars, default=40
     subdir   - naem of sub-directory  added to base path to find data
     filetype - type of file to read ('flt' or 'flc'), default='flc'
     satur    - Saturation signal level, default=80000L
     ndet     - Number of detectors, default=2
     fov      - FOV of instrument in arcsec, default=140
     addstars - mode for adding stars to fit list, 'manual' or 'auto'
                  default='manual'
   [ddir]   - section to list potential root directories to find data
     XXX - 
       XXX is a unique string (eg., D01)
        is a directory path
       for additional details see getddir.pro
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  2014/07/08, Written by Marc W. Buie, Southwest Research Institute
  2015/11/24, MWB, modified to put full precision catalog position
                into database
  2016/07/15, MWB, added PROPID keyword
  2020/06/23, MWB, generalized version
  2021/02/03, MWB, fixed bug in getting file type from config.ini