NAME:
  astwave
 PURPOSE:   (one line only)
  Compute the effective wavelength of an observation for astrometry
 DESCRIPTION:
  This routine computes the effective wavelength of observation.  This
    wavelength is actually a pivot wavelength, or, where half of the
    detected photons (not energy) are blueward of the wavelength and half are
    redward of the wavelength.  This wavelength depends on the target
    color and the filter being used.  This wavelength is used to support
    making a differential refraction correction to an astrometric measurement
    from ground-based imaging of the sky.
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astwave,filter,colname,color,wave
 INPUTS:
  filter - String, name of the filter used for the observation (case-sensitive)
  colname - String, name of the color (eg., 'V-R')
  color   - Value of the color for colname
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  REFFILE - flux reference file to use (see fluxref.pro for more details)
              default is provided by fluxref.pro
  SOLARSYS - Flag, if set treats the object as a reflecting object with
                the Sun's SED and a linear slope for the spectrum of
                the object.  Otherwise, the color defines the SED of the
                source.
  DEBUG - Flag, if set turns on additional debugging output.
  FNQE  - Name of a file that provides the QE of your detector.  The default
          is a flat QE across the filter profile.  If the file is contained
          somewhere in your IDL_PATH it will be located without the need
          to provide an explicit path.
 OUTPUTS:
  wave    - pivot wavelength for the observations in nanometers (nm)
 KEYWORD OUTPUT PARAMETERS:
  INFO    - anonymous structure that contains intermediate information that
               supported the computation.  This also happens to be what is
               stored in the private common block.  Tags defined are:
                 filter - your input filter name
                 fnfilter - name of the filter transmission file
                 wave   - wavelength grid from filter curve.
                 trans  - filter transmission
                 fsun   - solar flux spectrum interpolated to match wave
                 wsun   - wavelength for fsun
                 sun    - solar flux spectrum, matches wsun
                 fnqe   - name of the file with the detector QE
                 qe     - QE of detector, interpolated to match wave
 CONFIGURATION:
 COMMON BLOCKS:
  astwave_com - used to cache the data used for the calculation.  The
                  filter curve is saved to prevent reading the filter
                  curve with each call.  This is effective only if the
                  filter rarely changes between successive calls.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  The filter transmission curve is loaded (or re-used from the prior call).
    The color is on the Vegamag system and defines a linear correction
    to the reference flux spectrum.  This color corrected spectrum is then
    combined with the filter curve to derive the pivot wavlength in photon
    units.
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Southwest Research Institute, 2021/09/02 based
    partially on prototype code written by Brian Keeney.