NAME:
  sigratio
 PURPOSE:
  Compute the relative signal level between a set of spectra (1-d vectors).
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  sigratio,stack,relsig,noise,REF=ref
 INPUTS:
  stack - an array of spectra [npts,nspec]
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  BAD       - Array of flags for each point in stack.  0=good, 1=bad. (default=0).
  REF       - If provided, the relative signal levels are measure relative to
                 this spectrum out of the stack.  You can also provide an
                 external spectrum as a vector with npts.
  RBAD      - Bad value flags for the reference (only used if REF is a spectrum).
  SCALE     - range of pixels to use for scaling all spectra to each other.
                 The default is to use all pixels for scaling.
 OUTPUTS:
  relsig - Output array, NSPEC long, that has the relative signal levels.
  noise  - Output array, NSPEC long, that is the noise level in each spectrum
              relative to the reference.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/07/24 - Written by Marc W. Buie, Lowell Observatory
  98/08/14, MWB, added REF spectrum support, RBAD keyword, and noise output.
  98/09/10, MWB, cleanup to eliminate illegal floating point operations.