NAME:
  objratio

 PURPOSE:
  Ratio object spectra to one or more comp star spectra.

 DESCRIPTION:
  Ratio object spectra to comp stars, combined appropriately to
  match object airmasses.  For a single comp star, obviously you
  just get a simple ratio - no real airmass correction.  For two
  or more comp stars, an extinction is derived, and used to correct
  each comp star spectrum to the object airmass, prior to averaging
  the comp stars and performing the ratio.  If the /NOEXT keyword
  is set, no extinction correction is derived or applied.

 CATEGORY:
  Spectroscopy

 CALLING SEQUENCE:
  objratio, calib, object, o_am, o_times, comps, c_am, c_times, ratio

 REQUIRED INPUTS:
   object:  Array of object spectra [spectrum number, pixel number].
   o_am:    Array of object airmasses.
   o_times: Array of object mid-point exposure times.
   comps:   Array of comp star spectra [spectrum number, pixel number].
   c_am:    Array of comp star airmasses.
   c_times: Array of comp star mid-point exposure times.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
   O_BAD:  Array of badflags for the object spectra.
   C_BAD:  Array of badflags for the comp star spectra.
   NOEXT:  Force simple averaging (disable airmass correction).

 OUTPUTS:
   ratio:  Array of ratioed object spectra, same size as object array.

 KEYWORD OUTPUT PARAMETERS:
   R_BAD:  The resulting badflags in the ratio spectra.

 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:
  None.

 SIDE EFFECTS:
  Extinction plot is plotted to window 0.

 RESTRICTIONS:

 PROCEDURE:
  Currently, the times are ignored, but including them gives us the
  option of later doing an elaborate solution for extinction changing
  as a function of time, with a whole slew of comp stars, by changing
  only this single routine.  Otherwise we'd later have to track down
  and change all the instances where this routine is invoked.

 MODIFICATION HISTORY:
  1998/07/12 WG   Created by Will Grundy, Lowell Observatory
  1998/07/15 CDP  Changed program to accept the spectra as [pixel number,
                       spectrum number]
  1998/07/17 CDP  Added badflag filtering and creation for ratios
  1998/08, MWB, Rewrote extinction calculation.
  1998/09/08 WG   Generalized so that more than 2 comp stars can be
        used and added /NOEXT keyword.
  1998/09/09, MWB, Rewrote error checking and changed calling sequence.