IDL Help for XIDL

This page was created by the IDL library routine make_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? make_html_help

at the IDL command line prompt.

Last modified: Fri Jun 1 12:01:57 2007.


List of Cloudy/

List of Color/

List of Cosm/

List of DLA/

List of Dust/

List of FIT/

List of FUSE/*/

List of GRB/

List of General/

List of IDLA/

List of IMG/General/

List of IMG/Photometry/

List of IMG/Reduction/

List of Keck/HIRES/

List of Keck/LRIS/*/

List of Lick/Kast/*/

List of Obs/

List of SDSS/*/

List of Spec/Analysis/

List of Spec/Arcs/

List of Spec/Display/

List of Spec/Extraction/

List of Spec/Flux/

List of Spec/General/

List of Spec/Lines/

List of Spec/Rectify/

List of Spec/Slits/

List of Spec/Voigt/

List of lcoovi/


Routine Descriptions

ABSLINSTRCT__DEFINE

[Next Routine] [List of Routines]
 NAME:
 abslinstrct__define
   Version 1.1

 PURPOSE:
  Structure for a simple absorption line. 

 CALLING SEQUENCE:
   tmp = {abslinstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
  Written by JXP

(See Spec/Lines//abslinstrct__define.pro)


AIRMASS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 airmass
   Version 1.1

 PURPOSE:
    Calculate the airmass for an obj with a given DEC at an
  observatory with a given DEC and an offset in RA

 CALLING SEQUENCE:
  airmass = airmass(obs_dec, obj_dec, [hour_angle])

 INPUTS:
  obs_dec -- DEC of the observatory
  obj_dec -- DEC of the object
  [hour_angle]  -- Offset of RA [default: [-2,-1,0,1,2]]

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  APER=   -- Aperture size (boxcar)
  /BOXCAR -- Do boxcar extraction
  /CHK    -- 
  YMODEL= -- 2D solution from extract_image

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
  print, airmass( 20., 45., [-3, -2, -1, 0])

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   Written by E. Gawiser

(See Obs//airmass.pro)


ARCLINSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 arclinstrct__define
    Version 1.1

 PURPOSE:
    Arc line structure

 CALLING SEQUENCE:
   tmp = {arclinstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   Written by JXP

(See Spec/Arcs//arclinstrct__define.pro)


CLDY_2PHAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_2phas   
   Version 1.0

 PURPOSE:
    Finds the best 2-phase solution for a series of ratio
    constraints.  This is not a well devloped or tested routine.

 CALLING SEQUENCE:
   
 cldy_2phas, grid, ratio, sig, ion1, ion2, restrct, NHILMT=, FEHLMT=, /UONLY

 INPUTS:
   grid  - CLOUDY grid
   ratio -  Observed ionic ratios
   sig  -  Error on the ratios
   ion1 - Z, i for ion1  (can be an array of Z,i pairs)
   ion2 - Z, i for ion2  (can be an array of Z,i pairs)

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
   NHILMT - 2-element array giving NHI min,max
   FEHLMT - 2-element array giving FeH min,max
   UONLY  - Value of nH to use

 OPTIONAL OUTPUTS:
   retstrct - Returns a structure of the output

 COMMENTS:

 EXAMPLES:
   cldy_2phas, grid, [0.3], [0.1], [14,4], [14,2], soltn


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   08-Aug-2001 Written by JXP

(See Cloudy//cldy_2phas.pro)


CLDY_ALLFN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_allfn
   Version 1.1

 PURPOSE:
    Plots [X/Fe+], [X/H0] vs. Elem for a range of the grid

 CALLING SEQUENCE:
   
 cldy_allfn, grid, obsi, val, ions

 INPUTS:
   grid  -- CLOUDY grid
   obsi  -- Observed pair of ions
   val   -- Ratio of observed ions
   ions  -- Array of [Z,ion] vectors to plot
   fN_in -- Fraction of the ratio contributed by entirely ionzed gas

 RETURNS:
   

 OUTPUTS:
   Creates a Plot

 OPTIONAL OUTPUTS:

 OPTIONAL KEYWORDS:
   NHI   
   FeH
   nH

 COMMENTS:

 EXAMPLES:
   cldy_allfn, grid, [ [26,3], [26,2] ], -0.5,  [[14,2], [13,2]]

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   04-Dec-2001 Written by JXP

(See Cloudy//cldy_allfn.pro)


CLDY_CALCNCOLL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_calcncoll
  V1.1

 PURPOSE:
    Calculates the column density of a series of ions
     for CIE given a temperature

 CALLING SEQUENCE:
   
  cldy_calcncoll, temp, ions, colms, NHI=, MTL=

 INPUTS:
   temp -- Temperature of the gas (K)
   ions -- Ions to calculate columns for [[Z,i]]

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  NHI - N(HI) value  [default = 15]
  MTL - Metallicity value  [default = 0. (solar)]
  INFIL - Name of fits file containing Cloudy output of 
      collsional ionization calculation (e.g. cloudy_collisions.fits)

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
 cldy_calcncoll, 1e5, [[14,2], [8,6]], colms, NHI=14.8

 PROCEDURES CALLED:
  prs_cldycoll
  printcol

 REVISION HISTORY:
   04-Feb-2004 Written by JXP

(See Cloudy//cldy_calcncoll.pro)


CLDY_CALCNL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_calcnl
   Version 1.1

 PURPOSE:
   Creates a Cloudy input file from a CUBA output file given a
    redshift 

 CALLING SEQUENCE:
   
   cldy_calcnl, fil, z, logU, Jnu, NHVAL=, NHH=, LVAL=

 INPUTS:
   fil  - CUBA output file
   z    - Redshift
   logU    - Ionization parameter
   J912  - Intensity at Lyman limit

 RETURNS:

 OUTPUTS:
   NHV=   -  Value of the volume density
   LVAL= -  Length of the absorber  (kpc)

 OPTIONAL INPUTS:
   NHH=  -  NH value of the sightline (required for lval)

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
 cldy_calcnl, '/u/xavier/Cloudy/Spec/Data/CUBA/Q1G0/bkgthick.out',
 0.5, -1.1, 6e-23, NHVAL=nhval


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   30-Wed-2004 Written by JXP

(See Cloudy//cldy_calcnl.pro)


CLDY_CALCTCOLL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_calctcoll
  V1.1

 PURPOSE:
    Given a pair of ions and the ratio between those ions, calculate
   the temperature for gas with temperature T that gives that ratio

 CALLING SEQUENCE:
   
   cldy_calctcoll, ion1, ion2, rtio, tans, INFIL=, /PLOT

 INPUTS:
   ion1 -- [Z,i]
   ion2 -- [Z,i]
   rtio -- Ratio between ion1 and ion2
   tans -- Temperature which gives that ratio

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  OFFS - 'Error' in rtio to determine temperature range [default: 1.]
  PLOT - Create a plot

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
 cldy_calctcoll, [7,5], [8,6], -0.9, tans, /plot

 PROCEDURES CALLED:
  getabnd
  prs_cldycoll

 REVISION HISTORY:
   04-Feb-2004 Written by JXP

(See Cloudy//cldy_calctcoll.pro)


CLDY_CALCU

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_calcu
   Version 1.0

 PURPOSE:
    Calculate the ionization parameter 'U' for a given redshift
    an nH value assuming the Haardt & Madau (1996) spectrum

 CALLING SEQUENCE:
  cldy_calcu, hm_fil, z, nH, logU, NRM=nrm

 INPUTS:
   hm_fil - Haardt & Madau file of fluxes 
   z - Redshif
   nH - Hydrogen volume density

 RETURNS:
   
 OUTPUTS:

 OPTIONAL OUTPUTS:
  logU -- The log of the ionization parameter

 OPTIONAL KEYWORDS:
   [NRM] - Normalization factor for H&M data  [default: 1e-23]

 COMMENTS:

 EXAMPLES:
   cldy_calcu, hm_fil, z, nH, logU, NRM=

 PROCEDURES/FUNCTIONS CALLED:
  readcol

 REVISION HISTORY:
   02-Nov-2003 Written by JXP

(See Cloudy//cldy_calcu.pro)


CLDY_CUBA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_cuba
   Version 1.1

 PURPOSE:
   Creates a Cloudy input file from a CUBA output file given a
    redshift 

 CALLING SEQUENCE:
   
   cldy_cuba, fil, z, outfil, FIXG=fixg

 INPUTS:
   fil  - CUBA output file
   z    - Redshift

 RETURNS:

 OUTPUTS:
   outfil  - Cloudy output file

 OPTIONAL INPUTS:
  /FIXG -- I do not remember what this is for!

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
 cldy_cuba, '/u/xavier/Cloudy/Spec/Data/CUBA/Q1G0/bkgthick.out',
 0.35, '/u/xavier/Cloudy/Spec/Output/q1g0_z035.spec'


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   06-Nov-2003 Written by JXP

(See Cloudy//cldy_cuba.pro)


CLDY_MKMODELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_mkmodels
  V1.1

 PURPOSE:
    Run a sweet of cloudy models
 CALLING SEQUENCE:

  cldy_mkmodels, infil, fluxfil, z, OUTDIR=,INDIR=,CLOUDYDIR=,NHI=,METALS=,U=,HDEN=
                                    /CLOBBER

  INPUT:
    infil:  
       input file with:
           <Variable name>  <desired minimum value> <desired maximum value> <step size>


           variables which can be input  are:  NHI, nH, U, metals
           NOTE:  MUST use these specific variable tags

     fluxfil: cldy_cuba output file defining flux
     
     z:  redshift 

     NHI, METALS, U, HDEN:  specify a single value for these variables to be used 
                            in all models run (HDEN is for NH)

     OUTDIR:  output file directory
     INDIR:  input file directory
     TITLE:  cloudy title (default: model)
     FILENAME: input/output file name lead (default: cloudy)
     /CLOBBER: clobber previous runs with same FILENAME

  NHI 16.0 18.0 0.25
  metals -1.0 0.0 1.0
  U -6.0 0.0 0.25
  nH -2.0 0.0 2.0


 REVISION HISTORY:
   10-Sep-2005 Written by GEP

(See Cloudy//cldy_mkmodels.pro)


CLDY_PLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_plot   
   Version 1.1

 PURPOSE:
    GUI for plotting a CLOUDY grid and doing quick analysis 

 CALLING SEQUENCE:
   
   cldy_plot, ingrid, /INFIL

 INPUTS:
   flux  - Flux array (or FITS file)
   [inflg]  - Sigma array (or FITS file)

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
   INFIL       -   set to indicate that the 'ingrid' is a file, and should be 
                   read in

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   cldy_plot, 'grid.fits', /INFIL
   
   cldy_plot, grid


 PROCEDURES/FUNCTIONS CALLED:
  XGETX_PLT
  XGETY_PLT
  XGETXPIX_PLT
  XGETYPIX_PLT

 REVISION HISTORY:
  -- Built by GEP

(See Cloudy//cldy_plot.pro)


CLDY_PLT2PHS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_plt2phs
   Version 1.1

 PURPOSE:
  Plots a 2 phase solution (one purely neutral) given a Cloudy
  grid and related values.  The user also inputs a pair of ions and
  a ratio between them.
    

 CALLING SEQUENCE:
   
 cldy_plt2phs, grid, NHI, FeH, nH, obsi, val, ions

 INPUTS:
   grid  - CLOUDY grid
   NHI   - N(HI) value
   FeH   - Metallicity of the gas
   nH    - Hydrogen volume density
   obsi  - Observed pair of ions
   val   - Ratio of observed ions
   ions  - Array of [Z,ion] vectors to plot
   [YMNX=] - Y limits of the plot

 RETURNS:
   

 OUTPUTS:
   Creates a Plot

 OPTIONAL OUTPUTS:

 COMMENTS:
  Developed for the analysis in Prochaska et al. 2002 (Q1755)

 EXAMPLES:
   cldy_plt2phs, grid, 19.0d, -1.0d, -1.0d, [ [26,3], [26,2] ], -0.5,
   [[14,2], [14,3]]


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   15-Nov-2001 Written by JXP

(See Cloudy//cldy_plt2phs.pro)


CLDY_PRSGRID

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_prsgrid
  V1.1

 PURPOSE:
    parse a set of CLOUDY output files and create a FITS file
 CALLING SEQUENCE:

   cldy_prsout, outfil, cldystrct=cldystrct

 INPUT:
    indir:  Directory containing CLOUDY output files
    outfil: name of CLOUDY output file

 OUTPUT:
    cldystrct: output cloudy strct

 REVISION HISTORY:
   12-Sep-2005 Written by JXP

(See Cloudy//cldy_prsgrid.pro)


CLDY_PRSMODELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_prsmodels
  V1.1

 PURPOSE:
    Run a sweet of cloudy models
 CALLING SEQUENCE:

  cldy_prsmodels, infil, fluxfil, OUTDIR=,INDIR=,CLOUDYDIR=,NHI=,METALS=,U=,HDEN=


  INPUT:
    infil:
       input file with:
           <Variable name>  <desired minimum value> <desired maximum value> <step size>
           variables which can be input  are:  NHI, nH, U, metals
           NOTE:  MUST use these specific variable tags

     NHI, METALS, U, HDEN:  specify a single value for these variables to be used
                            in all models run (HDEN is for NH)

     OUTDIR:  output file directory
     INDIR:  input file directory
     FILENAME: input/output file name lead (default: cloudy)

  OUTPUT:
     supstrc:  output cloudy structures


 REVISION HISTORY:
   12-Sep-2005 Written by GEP

(See Cloudy//cldy_prsmodels.pro)


CLDY_PRSOUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_prsout
  V1.1

 PURPOSE:
    parse a single CLOUDY output file

 CALLING SEQUENCE:
   cldy_prsout, outfil, cldystrct=cldystrct

 INPUT:
    outfil: name of CLOUDY output file

 OUTPUT:
    cldystrct: output cloudy strct

 REVISION HISTORY:
   12-Sep-2005 Written by GEP
   27-Apr-2006 Modified to work with Cloudy v06.02 syntax

(See Cloudy//cldy_prsout.pro)


CLDY_QCK2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_qck2
   Version 1.0

 PURPOSE:
   Calculates a quick 2-phase model given a set of ions
   and the ratio of these ions (and the error in the ratio)
   and finally the two elements in the Cloudy grid which
   are to give the input ratios.

 CALLING SEQUENCE:
   
 cldy_qck2, grid, ratio, sig, ion1, ion2

 INPUTS:
   grid  - CLOUDY grid
   ratio -  Observed ionic ratios (array)
   sig  -  Error on the ratios
   ion1 - Z, i for ion1
   ion2 - Z, i for ion2 
   model - Two element array of the Cloudy grid

 RETURNS:
   

 OUTPUTS:

 OPTIONAL KEYWORDS:
   NHILMT - 2-element array giving NHI min,max
   FEHLMT - 2-element array giving FeH min,max

 OPTIONAL OUTPUTS:
  CHISQ - chisq

 COMMENTS:

 EXAMPLES:
   cldy_qck2, grid, [0.4], [0.1], [ 14,3 ], [14,2], model


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   13-Nov-2001 Written by JXP

(See Cloudy//cldy_qck2.pro)


CLDY_STARBURST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_starburst
   Version 1.1

 PURPOSE:
   Creates a Cloudy input file from the Starburst99 template

 CALLING SEQUENCE:
   
   cldy_cuba, fil, age, outfil, FIXG=fixg

 INPUTS:
   fil  - Filname
   age  - Age of the starburst

 RETURNS:

 OUTPUTS:
   outfil  - Cloudy output file

 OPTIONAL INPUTS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   19-Jun-2006 Written by JXP

(See Cloudy//cldy_starburst.pro)


CLDY_UPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_uplot
   Version 1.0

 PURPOSE:
    Creates a 'Uplot' for given NHI, FeH, nH values after inputting
   a Cloudy grid and a set of ions.

 CALLING SEQUENCE:
   
 cldy_uplot, grid, NHI, FeH, nH, ions

 INPUTS:
   grid - Cloudy grid
   NHI  - HI column densities [Can be an array of values]
   FeH  - Metallicity of the gas [must match grid value]
   nH   - Volume density of the gas [must match grid value]
   ions  - Array of [Z,ion] vectors
   YMNX= - Y values of the plot
   INFIL= - Ps file to create (instead of plotting to screen)

 RETURNS:
   
 OUTPUTS:
   Creates a Plot

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   cldy_Uplot, grid, 19.0d, -1.0d, -1.0d, [[14,2], [14,3]]


 PROCEDURES/FUNCTIONS CALLED:
 getcolor
 x_setclrs
 getabnd

 REVISION HISTORY:
   15-Nov-2001 Written by JXP
   27-Apr-2006 Modified to look more like published plots, KLC

(See Cloudy//cldy_uplot.pro)


CLDY_WRIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cldy_wrin
  V1.1

 PURPOSE:
    Create a CLOUDY input file
   
 INPUT
   params:  array of parameters in the following order:  z, logN_HI, metallicity, logU, logn_H
   fluxfil:  text file of rydberg/flux pairs
 
 OPTIONAL
   v0602a: new syntax for Cloudy v06.02
   cie: constant temperature, mmodel collisional ionization equilibrium 
        (exclude ionization parameter and fluxfil)

 CALLING SEQUENCE:

   cldy_wrin, params, fluxfil, OUTFIL=outfil

 REVISION HISTORY:
   10-Sep-2005 Written by GEP
   13-Apr-2006 added v0602a and cie, KLC

(See Cloudy//cldy_wrin.pro)


COSM_COMMON

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_common

 PURPOSE:
    Routine to initialize and set values in the Cosmology common
    block named 'cosmolgy_cmmn'

 CALLING SEQUENCE:
   cosm_common

 INPUTS:
   H0 =   Hubbles constant in km/s/Mpc
   Omegavac = Lambda value   [Default: 0.7]
   OmegaDM = Omega for Dark Matter  [Default: 0.3]

 RETURNS:

 OUTPUTS:
   
 OPTIONAL KEYWORDS:
  /W06MAP -- Applies the WMAP cosmolgy from 2006
  /SILENT -- No screen output

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES CALLED:

 REVISION HISTORY:
   22-Nov-2003 Written by JXP

(See Cosm//cosm_common.pro)


COSM_DIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_dist

 PURPOSE:
  Calculate the cosmological distance (Mpc) given a 
     cosmology and redshift   

 CALLING SEQUENCE:
    dist = cosm_dist(z)

 INPUTS:
   z -  Redshift
   [cosomlogy] -  By default the cosmology is set prior to 
     calling this using cosm_common.  You can have this done by
     keying 

 RETURNS:
   dist  -- Distance in Mpc

 OUTPUTS:

 OPTIONAL KEYWORDS:
  H0=    -- Hubble constant (km/s/Mpc)
  /INIT  -- Initializes the cosmology to the default values
  /LUM   -- Luminosity distance (Mpc)

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   
   dist = cosm_dist(2., /INIT)

 PROCEDURES CALLED:
   x_constants
   cosm_common
   cosm_intdist
   qromb

 REVISION HISTORY:
   22-Nov-2003 Written by JXP

(See Cosm//cosm_dist.pro)


COSM_HUBBLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_hubble

 PURPOSE:
   Calculates Hubbles constant at arbitrary redshift

 CALLING SEQUENCE:
   

 INPUTS:
   z  -- Redshift

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /INIT  -- Initializes the cosmology to the default values

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   hubb = cosm_hubble(2., /INIT)
   

 PROCEDURES CALLED:
   cosm_common

 REVISION HISTORY:
   22-Nov-2003 Written by JXP

(See Cosm//cosm_hubble.pro)


COSM_TIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_time

 PURPOSE:
   Calculates the age of the universe at an arbitrary redshift where
  the interval is from z=0 to z_i.

 CALLING SEQUENCE:

 INPUTS:
   z_i  -- Redshift

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /INIT  -- Initializes the cosmology to default values (0.7, 0.3, 75)
  /W06MAP  -- Initializes the cosmology to WMAP06 (0.72, 0.28, 73)
  H0=    -- Hubbles constant (km/s/Mpc)
  /START  -- Calculate the age from z=Infinity to z_i

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   age = cosm_time(1.)
   

 PROCEDURES CALLED:
   cosm_common

 REVISION HISTORY:
   02-Jul-2004 Written by JXP

(See Cosm//cosm_time.pro)


COSM_XZ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_xz

 PURPOSE:
    Calculate the cosmological distance X from z=0 to z=z

 CALLING SEQUENCE:
   

 INPUTS:
   z -- Redshift

 RETURNS:
   x -- Cosmological pathlength

 OUTPUTS:

 OPTIONAL KEYWORDS:
   H0 -- Hubbles constant (km/s/Mpc)
   OM -- Omega Dark Matter
   OV -- Lambda

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   

 PROCEDURES CALLED:
  cosm_common
  cosm_intxz
  qromb

 REVISION HISTORY:
   11-March-2004 Written by JXP

(See Cosm//cosm_xz.pro)


COSM_ZTIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 cosm_ztime

 PURPOSE:
   Calculates the redshift given the age (z=0 corresponds to t=0yr)

 CALLING SEQUENCE:
  z  = cosm_ztime(t, /init)

 INPUTS:
   t  -- Time

 RETURNS:
   z  -- Redshift

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /INIT  -- Initializes the cosmology to the default values
  H0=    -- Hubbles constant (km/s/Mpc)

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   z = cosm_ztime(1e10)
   

 PROCEDURES CALLED:
   cosm_common

 REVISION HISTORY:
   14-Dec-2004 Written by JXP

(See Cosm//cosm_ztime.pro)


CURVEFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CURVEFIT

 PURPOSE:
       Non-linear least squares fit to a function of an arbitrary
       number of parameters.  The function may be any non-linear
       function.  If available, partial derivatives can be calculated by
       the user function, else this routine will estimate partial derivatives
       with a forward difference approximation.

 CATEGORY:
       E2 - Curve and Surface Fitting.

 CALLING SEQUENCE:
       Result = CURVEFIT(X, Y, Weights, A, SIGMA, FUNCTION_NAME = name, $
                         ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)

 INPUTS:
       X:  A row vector of independent variables.  This routine does
           not manipulate or use values in X, it simply passes X
           to the user-written function.

       Y:  A row vector containing the dependent variable.

  Weights:  A row vector of weights, the same length as Y.
            For no weighting,
                 Weights(i) = 1.0.
            For instrumental (Gaussian) weighting,
                 Weights(i)=1.0/sigma(i)^2
            For statistical (Poisson)  weighting,
                 Weights(i) = 1.0/y(i), etc.

            For no weighting, set Weights to an undefined variable.

       A:  A vector, with as many elements as the number of terms, that
           contains the initial estimate for each parameter.  IF A is double-
           precision, calculations are performed in double precision,
           otherwise they are performed in single precision. Fitted parameters
           are returned in A.

 KEYWORDS:
	FITA:   A vector, with as many elements as A, which contains a zero for
   		each fixed parameter, and a non-zero value for elements of A to
   		fit. If not supplied, all parameters are taken to be non-fixed.

       FUNCTION_NAME:  The name of the function (actually, a procedure) to
       fit.  IF omitted, "FUNCT" is used. The procedure must be written as
       described under RESTRICTIONS, below.

       ITMAX:  Maximum number of iterations. Default = 20.
       ITER:   The actual number of iterations which were performed
       TOL:    The convergence tolerance. The routine returns when the
               relative decrease in chi-squared is less than TOL in an
               interation. Default = 1.e-3.
       CHI2:   The value of chi-squared on exit (obselete)

       CHISQ:   The value of reduced chi-squared on exit
       NODERIVATIVE:   IF this keyword is set THEN the user procedure will not
               be requested to provide partial derivatives. The partial
               derivatives will be estimated in CURVEFIT using forward
               differences. IF analytical derivatives are available they
               should always be used.

       DOUBLE = Set this keyword to force the calculation to be done in
                double-precision arithmetic.

   STATUS: Set this keyword to a named variable in which to return
           the status of the computation. Possible values are:
           STATUS = 0: The computation was successful.
           STATUS = 1: The computation failed. Chi-square was
                       increasing without bounds.
           STATUS = 2: The computation failed to converge in ITMAX
                       iterations.

   YERROR: The standard error between YFIT and Y.

 OUTPUTS:
       Returns a vector of calculated values.
       A:  A vector of parameters containing fit.

 OPTIONAL OUTPUT PARAMETERS:
       Sigma:  A vector of standard deviations for the parameters in A.

     Note: if Weights is undefined, then you are assuming that
           your model is correct. In this case, SIGMA is multiplied
           by SQRT(CHISQ/(N-M)), where N is the number of points
           in X and M is the number of terms in the fitting function.
           See section 15.2 of Numerical Recipes in C (2nd ed) for details.

 COMMON BLOCKS:
       NONE.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Variable passed into CURVEFIT.  It is the job of the user-written
           function to interpret this variable.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated IF the parameter is not
               supplied in call. IF the /NODERIVATIVE keyword is set in the
               call to CURVEFIT THEN the user routine will never need to
               calculate PDER.

 PROCEDURE:
       Copied from "CURFIT", least squares fit to a non-linear
       function, pages 237-239, Bevington, Data Reduction and Error
       Analysis for the Physical Sciences.  This is adapted from:
       Marquardt, "An Algorithm for Least-Squares Estimation of Nonlinear
       Parameters", J. Soc. Ind. Appl. Math., Vol 11, no. 2, pp. 431-441,
       June, 1963.

       "This method is the Gradient-expansion algorithm which
       combines the best features of the gradient search with
       the method of linearizing the fitting function."

       Iterations are performed until the chi square changes by
       only TOL or until ITMAX iterations have been performed.

       The initial guess of the parameter values should be
       as close to the actual values as possible or the solution
       may not converge.

 EXAMPLE:  Fit a function of the form f(x) = a * exp(b*x) + c to
           sample pairs contained in x and y.
           In this example, a=a(0), b=a(1) and c=a(2).
           The partials are easily computed symbolicaly:
           df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0

           Here is the user-written procedure to return F(x) and
           the partials, given x:

       pro gfunct, x, a, f, pder      ; Function + partials
         bx = exp(a(1) * x)
         f= a(0) * bx + a(2)         ;Evaluate the function
         IF N_PARAMS() ge 4 THEN $   ;Return partials?
         pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(f))]]
       end

         x=findgen(10)                  ;Define indep & dep variables.
         y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
         Weights=1.0/y            ;Weights
         a=[10.0,-0.1,2.0]        ;Initial guess
         yfit=curvefit(x,y,Weights,a,sigma,function_name='gfunct')
         print, 'Function parameters: ', a
         print, yfit
       end

 MODIFICATION HISTORY:
       Written, DMS, RSI, September, 1982.
       Does not iterate IF the first guess is good.  DMS, Oct, 1990.
       Added CALL_PROCEDURE to make the function's name a parameter.
              (Nov 1990)
       12/14/92 - modified to reflect the changes in the 1991
            edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
       Mark Rivers, U of Chicago, Feb. 12, 1995
           - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
             These make the routine much more generally useful.
           - Removed Oct. 1990 modification so the routine does one iteration
             even IF first guess is good. Required to get meaningful output
             for errors.
           - Added forward difference derivative calculations required for
             NODERIVATIVE keyword.
           - Fixed a bug: PDER was passed to user's procedure on first call,
             but was not defined. Thus, user's procedure might not calculate
             it, but the result was THEN used.

      Steve Penton, RSI, June 1996.
            - Changed SIGMAA to SIGMA to be consistant with other fitting
              routines.
            - Changed CHI2 to CHISQ to be consistant with other fitting
              routines.
            - Changed W to Weights to be consistant with other fitting
              routines.
            _ Updated docs regarding weighing.

      Chris Torrence, RSI, Jan,June 2000.
         - Fixed bug: if A only had 1 term, it was passed to user procedure
           as an array. Now ensure it is a scalar.
         - Added more info to error messages.
         - Added /DOUBLE keyword.
      CT, RSI, Nov 2001: If Weights is undefined, then assume no weighting,
           and boost the Sigma error estimates according to NR Sec 15.2
           Added YERROR keyword.
      CT, RSI, May 2003: Added STATUS keyword.
	        Added FITA keyword (courtesy B. LaBonte)
      CT, RSI, August 2004: Added ON_ERROR, 2

(See FIT//x_curvefit.pro)


DBLSOBJSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dblsobjstrct__define
   Version 1.1

 PURPOSE:
  This routine creates a structure to describe the spectrum for an
  object in a given slit

 CALLING SEQUENCE:
   tmp = {dlbsobjstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
  Written by JXP

(See Spec/Slits//dblsobjstrct__define.pro)


DISTRUCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 distruct__define
    Version 1.1

 PURPOSE:
    Defines the structure for direct imaging

 CALLING SEQUENCE:
  tmp = {distruct}

 INPUTS:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   ??-2001 Written by JXP

(See IMG/General//distruct__define.pro)


DLANOESTRUCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dlanoestruct__define
    Version 1.1

 PURPOSE:
    Defines the structure for DLA without creating the element arrays

 CALLING SEQUENCE:
  tmp = {dlanoestruct}

 INPUTS:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   1-Oct-2004 Written by JXP

(See DLA//dlanoestruct__define.pro)


DLASTRUCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dlastruct__define
    Version 1.1

 PURPOSE:
    Defines the structure for DLA

 CALLING SEQUENCE:
  tmp = {dlastruct}

 INPUTS:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   1-Oct-2004 Written by JXP

(See DLA//dlastruct__define.pro)


DLA_ANALYSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_analyse
  V1.1

 PURPOSE:
    Launches a GUI which enables simple plotting and inspection of
     individual DLA
 CALLING SEQUENCE:
   dla_analyse, [list]

 INPUTS:
   [list] -- List of DLA to inspect  
       [default: /u/xavier/DLA/Lists/tot_dla.lst]

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  ROOT=  Path to the DLA tree

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_analyse, '/u/xavier/DLA/Lists/tot_dla.lst'

 PROCEDURES CALLED:

 REVISION HISTORY:
   10-Jun-2002 Written by JXP

(See DLA//dla_analyse.pro)


DLA_EPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_eplot   
   Version 1.1

 PURPOSE:
    Given an abundance file and NHI value, create a abundance
   number plot (logarithmic with H = 12)

 CALLING SEQUENCE:
   
   dla_eplot, fil, NHI, ZMTL=, PSFILE=, XR=, YR=

 INPUTS:
   fil -- Abundance file, [format: Zatm, Ncolm, Nsig, Flag, Instr]
   NHI -- NHI value of the DLA

 RETURNS:

 OUTPUTS:
   If PSFILE is set, will create a ps file instead of 
       plotting to the screen

 OPTIONAL KEYWORDS:
  ZMTL -- Metallicity of the gas (for overplotting Solar pattern)
  XR   -- X range of the plot  [default: min and max of Zatm values]
  YR   -- Y range of the plot  [default: [4., 12] ]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_eplot, fil, 20.8, ZMTL=-1.2


 PROCEDURES/FUNCTIONS CALLED:
  readcol

 REVISION HISTORY:
   17-Feb-2004 Written by JXP

(See DLA//dla_eplot.pro)


DLA_ESITOSDSS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_esitosdss   
   Version 1.1

 PURPOSE:
    Turn an ESI spectrum into SDSS 'quality' (i.e. lower resolution)

 CALLING SEQUENCE:
   
   dla_esitosdss, fil, wave, fx, sig, /PLOT

 INPUTS:
   fil  -- ESI fits file  [assumes binning of 1]

 RETURNS:

 OUTPUTS:
   wave -- Wavelength array
   fx -- Flux array
   sig -- Error array

 OPTIONAL KEYWORDS:
  /PLOT -- Plot the spectrum

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_esitosdss, fil, NHI, Z


 PROCEDURES/FUNCTIONS CALLED:
 REVISION HISTORY:
   09-Dec-2002 Written by JXP

(See DLA//dla_esitosdss.pro)


DLA_FNDTRAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_fndtran   
   Version 1.1

 PURPOSE:
    Given a DLA structure, calculates the rest EW of weak, rare
    transitions like OI 1355, BII, etc.

 CALLING SEQUENCE:
   dla_fndtran, dla, [fil], OUTFIL=, LMT=

 INPUTS:
   dla --  IDL DLA structure
   [fil] -- List of weak line transitions [default:
            '/u/xavier/DLA/Abund/weak_lin.dat']

 RETURNS:

 OUTPUTS:
   OUTFIL= -- Writes the values to OUTFIL [default: 'fort.23']

 OPTIONAL KEYWORDS:
   LMT= -- Minimum EW to print the transition [default: 0.5 mA]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_fndtran, dla, outfil='weak_lin.dat'

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   09-Dec-2002 Written by JXP

(See DLA//dla_fndtran.pro)


DLA_GUESSEW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_guessew   
   Version 1.1

 PURPOSE:
    Calcualtes the EW limits for a series of input transitions for a
    DLA with given NHI and metallicity Z.

 CALLING SEQUENCE:
   dla_guessew, fil, NHI, Z, NPIX=, SNR=, NSIG=, DWV=

 INPUTS:
  fil -- File with list of wavlengths
  NHI -- N(HI) value of the DLA (logarithmic)
  Z   -- Metallcitiy  (logarithmic)

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  NPIX=  -- Number of pixels making up the feature [default: 4]
  NSIG=  -- Number of sigma significant [default: 3.]
  SNR=   -- Signal-to-noise per pixel [default: 10.]
  DWV=   -- Width of pixel in Angstromgs [default: 0.1 Ang]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   x_guessew, fil, NHI, Z


 PROCEDURES/FUNCTIONS CALLED:
 REVISION HISTORY:
   14-Nov-2002 Written by JXP

(See DLA//dla_guessew.pro)


DLA_INDX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_indx
  V1.1

 PURPOSE:
    Returns the index for a DLA given the name and z (if necessary)
     Defaults to the first entry if multiple.  This is a simple and
     rather uninteresting program.

 CALLING SEQUENCE:
   
   idx = dla_indx(struct, name, [z]) 

 INPUTS:
   struct - dla structure
   name - Name of the quasar (string; need not be complete)
   [z] - redshift (optional)

 RETURNS:
   index

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   idx = dla_indx(sdla, 'Q0000')


 PROCEDURES CALLED:

 REVISION HISTORY:
   24-Nov-2001 Written by JXP

(See DLA//dla_indx.pro)


DLA_SDSSRICH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_sdssrich   
   Version 1.0

 PURPOSE:
    Inputs a list of absorption lines, and the quasar emission
  redshift and then prints all probably DLA (quality > 0.7)

 CALLING SEQUENCE:
   
   dla_sdssrich, zem, obslin

 INPUTS:
  zem -- Emission redshift of the quasar
  obslin -- List of observed lines

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
 
 GRAN= -- List of metal-line transitions to key on

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_sdssrich


 PROCEDURES/FUNCTIONS CALLED:
 REVISION HISTORY:
   09-Dec-2002 Written by JXP

(See SDSS/DLA/dla_sdssrich.pro)


DLA_SI2STAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_si2star   
   Version 1.1

 PURPOSE:
    Given a normalized QSO spectrum (fits file) and the redshift of
    the DLA, overplots a SiII* feature at the expected spot based on
    the observed CII* profile.  THe program also plots the 
    CII* profile

 CALLING SEQUENCE:
  dla_si2star, fits_fil, zabs, VMNX=, PSFIL=, YMNX=, RTIO=

 INPUTS:
  fits_fil -- FITS file containing the QSO data [Assumes HIRES
              format]
  zabs  -- Absorption redshift

 RETURNS:

 OUTPUTS:
   PSFIL=  -- Writes PS file 

 OPTIONAL KEYWORDS:
  RTIO= -- Ratio of optical depth of SiII* to CII* [deafult: 0.05]
  VMNX= -- Velcoity region to plot [default: -100 to 100 km/s]
  YMNX= -- Ymin, ymax of plot [deafult: 0., 1.]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_si2star, 'Q1331_f.fits', 1.770


 PROCEDURES/FUNCTIONS CALLED:
 REVISION HISTORY:
   29-May-2003 Written by JXP

(See DLA//dla_si2star.pro)


DLA_WRITESTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_writestr
  V1.2

 PURPOSE:
    Given a DLA structre write the files out with the .dat format

 CALLING SEQUENCE:
   dla_writestr, dla

 INPUTS:
  dla -- DLA structure

 RETURNS:

 OUTPUTS:
  Series of DLA files

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_writestr, dla


 PROCEDURES CALLED:

 REVISION HISTORY:
   01-Oct-2004 Written by JXP
   2006   Added metallicity and SDSS tags

(See DLA//dla_writestr.pro)


DLA_XALPHVSA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_xalphvsa
   Version 1.1

 PURPOSE:
    Plots [X/alpha] vs [alpha/H].  Currently, the fig only shows Echelle obs

 CALLING SEQUENCE:
   
   dla_xyvsab, X, XR=, YR=, DLA=

 INPUTS:
   X -- Atomic number of element X

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  XR= -- x-range
  YR= -- y-range
  DLA= -- DLA structure
  /NOXERR -- Suppress x error bars
  /NOLIM  -- Do not show limits
  /NOCLOSE -- Do not close the plot
  MXERR -- Maximum error to plot 

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_xalphavsa, 7

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   14-Sep-2004 Written by JXP

(See DLA//dla_xalphvsa.pro)


DLA_XYVSAB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 dla_xyvsab
   Version 1.1

 PURPOSE:
    Plots [X/Y] vs [A/B].  Currently, the fig only shows Echelle obs

 CALLING SEQUENCE:
   
   dla_xyvsab, [X,Y], [A,B], XR=, YR=, DLA=

 INPUTS:
   X -- Atomic number of element X
   Y -- Atomic number of element Y
   A -- Atomic number of element A
   B -- Atomic number of element B

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  XR= -- x-range
  YR= -- y-range
  DLA= -- DLA structure
  /NOXERR -- Suppress x error bars
  /NOLIM  -- Do not show limits
  /NOCLOSE -- Do not close the plot
  MXERR -- Maximum error to plot 

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   dla_xyvsab, [14,26], [14,1]

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   14-Sep-2004 Written by JXP

(See DLA//dla_xyvsab.pro)


ECHFSPECSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 echfspecstrct__define
   Version 1.1

 PURPOSE:
  Creates a structure for echelle spectroscopy that will hold the
  wavelength, flux and error arrays.  Also includes the ZANS
  structure which is useful for using SDSS redshift identification.
 

 CALLING SEQUENCE:
   tmp = {echfspecstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   Written by JXP

(See Spec/Analysis//echfspecstrct__define.pro)


EMISSSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 emissstrct__define
   Version 1.1

 PURPOSE:
  Structure for a simple emission line. 

 CALLING SEQUENCE:
   tmp = {emissstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
  Written by JXP

(See Spec/Lines//emissstrct__define.pro)


EXTRACT_ASYMBOX2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   extract_asymbox2

 PURPOSE:
   Extract the total flux within a boxcar window at many positions.
   This routine will accept an asymmetric/variable window
   Traces are expected to run vertically to be consistent with other
    extract_  routines

   MODIFIED MODEL WEIGHTING

 CALLING SEQUENCE:
   fextract = extract_asymbox( image, left, right, $
                 [ycen, weight_image=weight_image, f_ivar=f_ivar, model=model])

 INPUTS:
   image     - Image
   left      - Lower boundary of boxcar window (given as floating pt pixels)
   right     - Upper boundary of boxcar window (given as floating pt pixels)

 OPTIONAL KEYWORDS:
   ycen      - Y positions corresponding to "left" (expected as integers)
   weight_image -  Weights to be applied to image before boxcar

 OUTPUTS:
   fextract - Extracted flux at positions specified by (left<-->right, ycen)

 OPTIONAL OUTPUTS:
   f_ivar    - the boxcar summed weights, weights=1 if weight_image is missing
   model     - A model image (of size image)

 COMMENTS:

 EXAMPLES:

 PROCEDURES CALLED:

 REVISION HISTORY:
   24-Mar-1999  Written by David Schlegel, Princeton.
   17-Feb-2003  Written with slow IDL routine, S. Burles, MIT
   27-Jan-2004  Adopted to do asymmetric/varying boxcar

(See Spec/Extraction//extract_asymbox2.pro)


EXTRCTSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 extrctstrct__define
    Version 1.1

 PURPOSE:
  Define the extraction structure

 CALLING SEQUENCE:
   tmp = {extrctstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
   
 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   Written by JXP

(See Spec/General//extrctstrct__define.pro)


F2DPOLY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 f2dpoly
   Version 1.1

 PURPOSE:
    Creates basis functions of a 2dpoly for feeding into SVDFIT for
    2D surface fitting. Requires an initial call with m=-1 to set 
    up the common block.  This code even makes my head spin!

 CALLING SEQUENCE:
   
   fpoly = f2dpoly(s, m, XVAL=, YVAL=, FLG=)

 INPUTS:
   s          - scalar or vector identifying the index number
   m          - Total order (nx*ny) of the polynomial (-1 to
                initialize; -2 to deconstruct)

 RETURNS:
   fpoly      - Basis functions

 OUTPUTS:

 OPTIONAL KEYWORDS:
  XVAL=  -- Dummy array used to initialize the common block
  YVAL=  -- Dummy array used to initialize the common block
  FLG=  -- Number of coefficients in the X direction.   
           If FLG=0, then it is assumed that nx=ny=sqrt(m)

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fpoly = f2dpoly(s, m)


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   31-Jan-2002 Written by JXP

(See FIT//f2dpoly.pro)


FILL_ELMXH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fill_elmxh   
   Version 1.1

 PURPOSE:
  Given a DLA structure, fills up the X/H info.  Simply reads in the
  info from the .XH files.  This program is not likely to be called
  by any program except parse_dlalst.

 CALLING SEQUENCE:
   
  fill_elmxh, dla

 INPUTS:
  dla  -- IDL DLA structure

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /NOHIS -- Do not include HI error in analysis

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:


 PROCEDURES/FUNCTIONS CALLED:
 REVISION HISTORY:
   29-May-2003 Written by JXP

(See DLA//fill_elmxh.pro)


FILL_ION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fill_ion
  V1.1

 PURPOSE:
    Fills up the column densities for all of the ions observed for a
    given DLA.  It parses the .ion files produced by dla_updabd.
    This program is unlikely to be called by anything except parse_dlalst.

 CALLING SEQUENCE:
   fill_ion, sDLA

 INPUTS:

 RETURNS:
   sDLA      - IDL DLA structure

 OUTPUTS:

 OPTIONAL KEYWORDS:
  ROOT=  Path to DLA tree (e.g. '~/DLA/')

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fill_ion, sdla


 PROCEDURES CALLED:

 REVISION HISTORY:
   12-Nov-2001 Written by JXP

(See DLA//fill_ion.pro)


FIT2DSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fit2dstrct__define
   Version 1.1

 PURPOSE:
    IDL structure for 2D surface fitting

 CALLING SEQUENCE:
   
   tmp = {fit2dstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   tmp = {fit2dstrct}


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   31-Jan-2002 Written by JXP

(See FIT//fit2dstrct__define.pro)


FITS2ASC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fits2asc
 V1.1

 PURPOSE:
    Converts fits spectrum to ASCII.   The wavelength array is 
    read from the header.  Particularly useful for VPFIT

 CALLING SEQUENCE:
   
   fits2asc, file, [error], OUTFIL=

 INPUTS:
   file    - Data Filename [spectrum; data in extension 0]
   [error] - Error filename

 RETURNS:

 OUTPUTS:
   outfil  - ASCII file with wavelength, file, [error] in columns

 OPTIONAL KEYWORDS:
  WVMIN -- Minimum wavelength to print out [default: 0.]
  WVMAX -- Maximum wavelength to print out [default: 1e6]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fits2asc, 'Blah.fits'

 PROCEDURES CALLED:
  x_fitswave
  writecol

 REVISION HISTORY:
   27-Aug-2001 Written by JXP

(See General//fits2asc.pro)


FITSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fitstrct__define
   Version 1.1

 PURPOSE:
    IDL structure for 1D fitting

 CALLING SEQUENCE:
   
   tmp = {fitstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   tmp = {fitstrct}


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   31-Jan-2002 Written by JXP

(See FIT//fitstrct__define.pro)


FIT_CONVXPTOX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fit_convxptox
    Version 1.1

 PURPOSE:
    Convert the fitted coefficients of a POLY fit from the normalized
    values to 'sensible' ones.

 CALLING SEQUENCE:
   newcoeff = fit_convxptox( calib, FFIT=, NRM= )

 INPUTS:
  calib -- FIT structure

 RETURNS:
  newcoeff -- Unnormalized coefficients

 OUTPUTS:

 OPTIONAL KEYWORDS:
  FFIT= -- Coefficients [default: *calib.ffit]
  NRM=  -- Normalization values [default: calib.nrm]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   02-Aug-2002 Written by JXP

(See FIT//fit_convxptox.pro)


FRAC_ORDER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 frac_order
     Version 1.1

 PURPOSE:
  For an input array and the order structure defining the echelle
  footprint, this routine calculates the position of a give pixel
  along the slit.

 CALLING SEQUENCE:
  frac = frac_order( ordr_str, xstart, ywave, ocen=, ncoeff=)

 INPUTS:
  ordr_str -- Order structure which describes the echelle footprint
  xstart   -- x values of the pixels
  ywave    -- Wavelength values of the pixels

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   x_slitflat, mike, 1

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   31-Jul-2005 Written by SB

(See Spec/Arcs//frac_order.pro)


FUSELINSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuselinstrct__define
  V1.1

 PURPOSE:
    Defines the structure for FUSE absorption lines

 CALLING SEQUENCE:
  tmp = {fuselinstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES CALLED:

 REVISION HISTORY:
   Nov-2003   Created by JXP

(See FUSE/General/fuselinstrct__define.pro)


FUSE_CALCEWN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_calcewn
  V1.1

 PURPOSE:
    Given a FUSE structure file and a set of instrument files (each
  of which specifies absorption lines), the code measures EW and fills
  up the FUSE structure.  If multiple EW values are measured, then it
  calculates the weighted mean if the two are consistent or otherwise
  the average and sets a large uncertainty.

 CALLING SEQUENCE:
   fuse_calcewn, strct_fil, instr_list

 INPUTS:
  strct_fil  -- IDL FUSE file
  instr_list -- Instrument list containing absorption line lists

 RETURNS:

 OUTPUTS:
  strct_fil  -- The EW tags are filled up by this routine

 OPTIONAL KEYWORDS:
  LIST - File
  ION - Input ionic column densities
  NOELM - Supress inputting Elemental values
  MODLIM - modify wavelength limits with wavelength shift

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fuse_calcewn, struct, fil_instr


 PROCEDURES CALLED:

 REVISION HISTORY:
   10-Sep-2003 Added metallicity sturcture
    2-Feb-2006 added /modlim and /ewgauss options, KLC
    3-Apr-2006 added calculation of zsig
   24-Jan-2007 removed /ewgauss and modify EW summing when flux<0 or flux>1

(See FUSE/Analysis/fuse_calcewn.pro)


FUSE_CALCION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_calcion
  V1.1

 PURPOSE:
   For FUSE observations, calculate ionic column densities for all
   ions in the FUSE structure.  The code allows for limits and does a
   weighted mean for multiple transitions.

 CALLING SEQUENCE:
   fuse_calcion, strct_fil, zabs, ion_fil, NHI=, HAND=

 INPUTS:
   strct_fil -- FITS file for the FUSE structure
   zabs -- Absorption redshift of the system

 RETURNS:

 OUTPUTS:
   ion_fil -- Output ion file

 OPTIONAL KEYWORDS:
  NHI=  -- NHI value and error [required at present!]
  HAND= -- Input file of ionic column densities used to override the
           values that would otherwise be derived by this program.

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fuse_calcion, strct_fil, zabs, 'PKS0405_z495.ion'

 PROCEDURES CALLED:
  getabnd
  getion

 REVISION HISTORY:
   11-Sep-2003 Written by JXP

(See FUSE/Analysis/fuse_calcion.pro)


FUSE_CALCXH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_calcxh
  V1.1

 PURPOSE:
    Calculate X/H values for FUSE observations.  It grabs the info
    from the ion_fil and an input XH_fil and then outputs the XH
    values into a XH data file.  The Input file must contain
    ionization information (Cloudy file, U values) to do the final
    calcalculations of X/H.  You need to see an example file to get
    this set correctly.

 CALLING SEQUENCE:
   fuse_calcxh, xhfil

 INPUTS:
  xhfil -- Input file to run the XH calculations and output

 RETURNS:

 OUTPUTS:
  outfil -- Output file of X/H values

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   fuse_calcxh, 'Input/z0495_XH.inp'

 PROCEDURES CALLED:
  fuse_calcxh_parse

 REVISION HISTORY:
   21-Nov-2003 Written by JXP

(See FUSE/Analysis/fuse_calcxh.pro)


FUSE_COG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_cog
  V1.1

 PURPOSE:
    Calculate a COG solution from a FUSE structure file

 CALLING SEQUENCE:
   
  fuse_cog, strct_fil, cog_fil, [Nlmt, blmt], /CHICHK, PLTONLY=
    NSTP=, BSTP=, PSFILE=, OUTFIL=, /EXACT, ZLBL=,DEBLEND=,UPLIM=,RMS=

 INPUTS:
  strct_fil -- FITS file for the FUSE structure
  cog_fil -- COG input file (lists redshift and transitions to use)
  [Nlmt] -- Range of column densities to explore (2 element array)
  [blmt] -- Range of Doppler parameters to explore (2 element array)

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /CHICHK -- Plot Chi^2 image
  PLTONLY --  4-element array of N,b values and error for a plot
  NSTP -- Number of steps to search N space [default: 100L]
  BSTP -- Number of steps to search b space [default: 100L]
  /EXACT -- Calculate EW exactly (Spline is generally good enough)
  ZLBL= -- Label for Plot giving redshift of the absorber (string)
  UPLIM -- file (like cog_fil) of lines to color upper limits on
           curve (1: excluded, 2: 2-sig upper limit, 4: blend upper limit
  DEBLEND -- file with information of EW to remove for specific 
             features because they are blended OR include upper limits
  RMS -- add RMS to EW error in quadrature
  LABEL -- indicate line across top (either /label or label='FeII')
  ASYMERR -- calculate asymmetric errors by measuring the chi^2=1 ellipse

 OPTIONAL OUTPUTS:
   OUTFIL -- File with best fit values and error
   PSFILE -- File for postscript plot

 COMMENTS:

 EXAMPLES:
  fuse_cog, '/u/xavier/FUSE/data/PKS0405-12/Analysis/pks0405_abslin.fits', $
    '/u/xavier/FUSE/data/PKS0405-12/Analysis/COG/Input/pks0405_z0918.cog', $
    PSFIL='Figures/z0918_cog.ps', PLTONLY=[14.52, 38.2, 0.04, 1.8]

 PROCEDURES CALLED:

 REVISION HISTORY:
   11-Sep-2003 Written by JXP
   30-Nov-2005 modifed so can handle inability to calculate error, KLC
   12-Jan-2006 added UPLIM keyword, KLC
    8-Mar-2006 added DEBLEND keyword, KLC
   13-Sep-2006 added RMS keyword, KLC
   22-Sep-2006 added LABEL keyword, KLC
    2-Jan-2007 added ASYMERR keyword, KLC and PJ; modify plot labels
    8-Jan-2007 corrected and modified UPLIM

(See FUSE/Analysis/fuse_cog.pro)


FUSE_FNDNEVIII

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_fndneviii
    Version 1.1

 PURPOSE:
   GUI which plots the metal line systems including NeVIII

 CALLING SEQUENCE:
   
   fuse_fndneviii, yin, lyalist, VMNX=, INFLG=, VMNX=, XSIZE=,
   YSIZE=, SVSTATE=, INIZ=

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
   VMNX   -- Velocity range for plotting transitions
   INFLG  -- Flag for type of spectrum file (see x_readspec)
   XSIZE  -- Size of gui x-pixels [default: 80% of screen] 
   YSIZE  -- Size of gui y-pixels [default: 80% of screen]
   INIZ   -- Initial redshift to start search at [default: 0.]

 OPTIONAL OUTPUTS:
  SVSTATE  -- Save the state to return to search later

 COMMENTS:

 EXAMPLES:
   fuse_fndneviii, 'file.fits', inflg=4, SVSTATE='save_neviii.idl'


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   29-Oct-2002 Written by JXP

(See FUSE/Analysis/fuse_fndneviii.pro)


FUSE_FNDOVI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_fndovi
    Version 1.1

 PURPOSE:
   GUI which plots the spectra in two strips corresponding to the
   doublet of OVI.  User can indicate the regions where OVI
   could be detected (visually).

 CALLING SEQUENCE:
   
   fuse_fndovi, datfil, XSIZE=, YSIZE=, /STIS, OUTFIL=, GZFIL=

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  XSIZE  -- Size of gui x-pixels [default: 80% of screen] 
  YSIZE  -- Size of gui y-pixels [default: 80% of screen]
  /STIS  -- STIS data file (as opposed to FUSE)
  GZFIL  -- File containing saved regions

 OPTIONAL OUTPUTS:
  SVSTATE  -- Save the state to return to search later
  OUTFIL   -- File to contain saved regions 
              [default: 'find_ovi.fits']

 COMMENTS:

 EXAMPLES:
   fuse_fndovi, 'PKS0405.fits'

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   09-Feb-2004 Written by JXP

(See FUSE/Analysis/fuse_fndovi.pro)


FUSE_GZNEVIII

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_gzneviii
    Version 1.1

 PURPOSE:
   GUI which plots the spectra in two strips corresponding to the
   doublet of OVI.  User can indicate the regions where OVI
   could be detected (visually).

 CALLING SEQUENCE:
   
   fuse_gzneviii, datfil, XSIZE=, YSIZE=, OUTFIL=, GZFIL=

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  XSIZE  -- Size of gui x-pixels [default: 80% of screen] 
  YSIZE  -- Size of gui y-pixels [default: 80% of screen]
  GZFIL  -- File containing saved regions

 OPTIONAL OUTPUTS:
  SVSTATE  -- Save the state to return to search later
  OUTFIL   -- File to contain saved regions 
              [default: 'find_neviii.fits']

 COMMENTS:

 EXAMPLES:
   fuse_gzneviii, x, maskid, expsr


 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   05-Oct-2003 Written by JXP

(See FUSE/Analysis/fuse_gzneviii.pro)


FUSE_H2LIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_h2lin
  (V1.1)

 PURPOSE:
    Sets up a line list of Molecular Hydrogen

 CALLING SEQUENCE:
   
   h2strct = fuse_h2lin([file]) 

 INPUTS:
   [file] - H2 line list [default: $XIDL_DIR/FUSE/H2/h2sort.dat]

 RETURNS:
   h2strct - Structure of molecular hydrogen

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   h2strct = fuse_h2lin()

 PROCEDURES CALLED:

 REVISION HISTORY:
   09-Feb-2004 Written by JXP

(See FUSE/H2/fuse_h2lin.pro)


FUSE_PRSLINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_prsline
  V1.1

 PURPOSE:
    Create a structure for the absorption lines given a set
  of files for the absorption lines.

 CALLING SEQUENCE:
  fuse_prsline, files, strct, OUTFIL=

 INPUTS:
   files -- List of files for absorption lines

 RETURNS:
   strct  - FUSE absorption line structure

 OUTPUTS:
  OUTFIL= -- Writes structure to OUTFIL

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES CALLED:

 REVISION HISTORY:
   Nov-2003   Created by JXP

(See FUSE/General/fuse_prsline.pro)


FUSE_TWOCOG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_twocog
  V1.1

 PURPOSE:
    Perform a COG analysis allowing for two components.  This program
    is best used to plot (use PLTONLY) the results of 
    a two component analysis, not
    to fit for the 2 components.
 CALLING SEQUENCE:
   
  fuse_twocog, strct_fil, cog_fil, N1lmt, b1lmt, N2lmt, b2lmt, delv
   /CHICHK, PLTONLY=, ZLBL=,  NSTP=, BSTP=, PSFILE=, OUTFIL=, /EXACT

   lowzovi_prsdat, stucture, filename

 INPUTS:
  strct_fil -- FITS file for the FUSE structure
  cog_fil -- COG input file (lists redshift and transitions to use)
  [N1lmt] -- Range of column densities to explore (2 element array)
  [b1lmt] -- Range of Doppler parameters to explore (2 element array)
  [N2lmt] -- Range of column densities to explore (2 element array)
  [b2lmt] -- Range of Doppler parameters to explore (2 element array)
  [delv]  -- Separation of the 2 components (km/s)

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:
  /CHICHK -- Plot Chi^2 image
  PLTONLY --  4-element array of N,b values and error for a plot
  NSTP -- Number of steps to search N space [default: 5L]
  BSTP -- Number of steps to search b space [default: 5L]
  ZLBL= -- Label for Plot giving redshift of the absorber (string)

 OPTIONAL OUTPUTS:
  OUTFIL -- File with best fit values and error
  PSFILE -- File for postscript plot

 COMMENTS:

 EXAMPLES:
   fuse_calccolm, struct, fil_instr


 PROCEDURES CALLED:

 REVISION HISTORY:
   15-Sep-2003 Written by JXP

(See FUSE/Analysis/fuse_twocog.pro)


FUSE_VELPLT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 fuse_velplt
  V1.1

 PURPOSE:
    Velcoity plot of FUSE transitions for a given absorption 
    system
 CALLING SEQUENCE:
   
   fuse_velplt, strct_fil, instr_list, vel_fil, NTOT=, CSIZE=,
   LSIZE=, PSFILE=, XTINT=, ENCAPSULATED=, MULTI=, OUTLINE=,
   LABEL=, MSGFIL=, VOIGT=

 INPUTS:

 RETURNS:
  strct_fil -- FITS file for the FUSE abs lin structure
  instr_list -- List of instrument files
  vel_fil -- Input file for velocity plot

 OUTPUTS:

 OPTIONAL KEYWORDS:
  NTOT -- Number of plots per page [default: 16]
  LSIZE -- Label size [default: 1.8]
  CSIZE -- Numbering character size [default: 1.8]
  LTHICK -- Line thickness (Default = 1.)
  XTINT -- xtick interval
  ENCAPSULATED -- create encapsulated postscript
  MULTI -- overplot multiple detections
  OUTLINE -- indicate region used to measure EW with darker line
  LABEL -- print zabs upper right corner and wobs 
  VOIGT -- [ncolm, dopb] or [ion, ncolm, dopb] structure to overplot
           Voigt profile 
  VZABS -- redshift to center voigt profiles (default is input z + float)
  BIN -- bin spectra (simple sum, not S/N-weighted)
  PLTXTR -- array of wrest, instr to plot extra (doesn't work for multi)

 OPTIONAL OUTPUTS:
  PSFILE -- Postscript filename
  MSGFIL -- filename to receive messages from MULTI function

 COMMENTS:

 EXAMPLES:
   fuse_calcewn, struct, fil_instr


 PROCEDURES CALLED:

 REVISION HISTORY:
   12-Sep-2003 Written by JXP
    1-Apr-2005 MULTI capability added by KLC
   28-Apr-2005 Added zabs in upper right-hand corner of MULTI plots
   13-Feb-2006 Added /outline option, KLC
    7-Mar-2006 Handle H2 features, KLC
    7-Jun-2006 Improve handling of combined instrument flags, add /label
   21-Sep-2006 Update /outline,/multi combo
   16-Oct-2006 added VOIGT, KLC
    8-Dec-2006 added BIN, KLC

(See FUSE/Analysis/fuse_velplt.pro)


GAUSSFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GAUSSFIT

 PURPOSE:
   Fit the equation y=f(x) where:

       F(x) = A0*EXP(-z^2/2) + A3 + A4*x + A5*x^2
           and
       z=(x-A1)/A2

   A0 = height of exp, A1 = center of exp, A2 = sigma (the width).
   A3 = constant term, A4 = linear term, A5 = quadratic term.
   Terms A3, A4, and A5 are optional.
   The parameters A0, A1, A2, A3 are estimated and then CURVEFIT is
   called.

 CATEGORY:
   ?? - fitting

 CALLING SEQUENCE:
   Result = GAUSSFIT(X, Y [, A])

 INPUTS:
   X:  The independent variable.  X must be a vector.
   Y:  The dependent variable.  Y must have the same number of points
       as X.

 KEYWORD INPUTS:

   CHISQ: Set this keyword to a named variable that will contain
      the value of the chi-square goodness-of-fit.

   ESTIMATES = optional starting estimates for the parameters of the
       equation.  Should contain NTERMS (6 if NTERMS is not
       provided) elements.

   MEASURE_ERRORS: Set this keyword to a vector containing standard
       measurement errors for each point Y[i].  This vector must be the same
       length as X and Y.

     Note - For Gaussian errors (e.g. instrumental uncertainties),
        MEASURE_ERRORS should be set to the standard
        deviations of each point in Y. For Poisson or statistical weighting
        MEASURE_ERRORS should be set to sqrt(Y).

   NTERMS = Set NTERMS to 3 to compute the fit: F(x) = A0*EXP(-z^2/2).
      Set it to 4 to fit:  F(x) = A0*EXP(-z^2/2) + A3
      Set it to 5 to fit:  F(x) = A0*EXP(-z^2/2) + A3 + A4*x

   SIGMA: Set this keyword to a named variable that will contain
      the 1-sigma error estimates of the returned parameters.

     Note: if MEASURE_ERRORS is omitted, then you are assuming that
           your model is correct. In this case, SIGMA is multiplied
           by SQRT(CHISQ/(N-M)), where N is the number of points
           in X and M is the number of terms in the fitting function.
           See section 15.2 of Numerical Recipes in C (2nd ed) for details.

   YERROR: The standard error between YFIT and Y.

 OUTPUTS:
   The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
   A:  The coefficients of the fit.  A is a three to six
       element vector as described under PURPOSE.

 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   The peak or minimum of the Gaussian must be the largest
   or smallest point in the Y vector.

 PROCEDURE:
   The initial estimates are either calculated by the below procedure
   or passed in by the caller.  Then the function CURVEFIT is called
   to find the least-square fit of the gaussian to the data.

  Initial estimate calculation:
   If NTERMS>=4 then a constant term is subtracted first.
   If NTERMS>=5 then a linear term is subtracted first.
   If the (MAX-AVG) of Y is larger than (AVG-MIN) then it is assumed
   that the line is an emission line, otherwise it is assumed there
   is an absorbtion line.  The estimated center is the MAX or MIN
   element.  The height is (MAX-AVG) or (AVG-MIN) respectively.
   The width is found by searching out from the extrema until
   a point is found less than the 1/e value.

 MODIFICATION HISTORY:
   DMS, RSI, Dec, 1983.
   DMS, RSI, Jun, 1995, Added NTERMS keyword.  Result is now float if
               Y is not double.
   DMS, RSI, Added ESTIMATES keyword.
   CT, RSI, Feb 2001: Change the way estimates are computed.
         If NTERMS>3 then a polynomial of degree NTERMS-4 is subtracted
         before estimating Gaussian coefficients.
   CT, RSI, Nov 2001: Slight change to above modification:
         Because a Gaussian and a quadratic can be highly correlated,
         do not subtract off the quadratic term,
         only the constant and linear terms.
         Also added CHISQ, SIGMA and YERROR output keywords.
   CT, RSI, May 2003: Added MEASURE_ERRORS keyword.
   CT, RSI, March 2004: If estimate[2] is zero, compute a default value.

(See FIT//x_gaussfit.pro)


GETCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETCOLOR

 PURPOSE:
       The original purpose of this function was to enable the
       user to specify one of the 16 colors supported by the
       McIDAS color map by name. Over time, however, the function
       has become a general purpose function for handling and
       supporting drawing colors in a device-independent way.
       In particular, I have been looking for ways to write color
       handling code that will work transparently on both 8-bit and
       24-bit machines. On 24-bit machines, the code should work the
       same where color decomposition is turned on or off. The program
       now supports 88 colors.

 AUTHOR:
       FANNING SOFTWARE CONSULTING:
       David Fanning, Ph.D.
       1645 Sheely Drive
       Fort Collins, CO 80526 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
       result = GETCOLOR(color, index)

 OPTIONAL INPUT PARAMETERS:
       COLOR: A string with the "name" of the color. Valid names are:
           black
           magenta
           cyan
           yellow
           green
           red
           blue
           navy
           pink
           aqua
           orchid
           sky
           beige
           charcoal
           gray
           white

           The color YELLOW is returned if the color name can't be resolved.
           Case is unimportant.

           If the function is called with just this single input parameter,
           the return value is either a 1-by-3 array containing the RGB values of
           that particular color, or a 24-bit integer that can be "decomposed" into
           that particular color, depending upon the state of the TRUE keyword and
           upon whether color decomposition is turned on or off. The state of color
           decomposition can ONLY be determined if the program is being run in
           IDL 5.2 or higher.

       INDEX: The color table index where the specified color should be loaded.
           If this parameter is passed, then the return value of the function is the
           index number and not the color triple. (If color decomposition is turned
           on AND the user specifies an index parameter, the color is loaded in the
           color table at the proper index, but a 24-bit value is returned to the
           user in IDL 5.2 and higher. This assumes the INDEXED keyword is NOT set.)

       If no positional parameter is present, then the return value is either a 16-by-3
       byte array containing the RGB values of all 16 colors or it is a 16-element
       long integer array containing color values that can be decomposed into colors.
       The 16-by-3 array is appropriate for loading color tables with the TVLCT command:

           Device, Decomposed=0
           colors = GetColor()
           TVLCT, colors, 100


 INPUT KEYWORD PARAMETERS:

       NAMES: If this keyword is set, the return value of the function is
              a 88-element string array containing the names of the colors.
              These names would be appropriate, for example, in building
              a list widget with the names of the colors. If the NAMES
              keyword is set, the COLOR and INDEX parameters are ignored.

                 listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16)

       INDEXED:  If this keyword is set, the return value is always an index
              into the color table. In the absence of a color table INDEX
              parameter, the color is loaded at !P.COLOR < (!D.Table_Size-1).

       LOAD:  If this keyword is set, all 88 colors are automatically loaded
              starting at the color index specified by the START keyword.
              Note that setting this keyword means that the return value of the
              function will be a structure, with each field of the structure
              corresponding to a color name. The value of each field will be
              an index number (set by the START keyword) corresponding to the
              associated color, or a 24-bit long integer value that creates the
              color on a true-color device. What you have as the field values is
              determined by the TRUE keyword or whether color decomposition is on
              or off in the absense of the TRUE keyword. It will either be a 1-by-3
              byte array or a long integer value.

       START: The starting color index number if the LOAD keyword is set. This keyword
              value is ignored unless the LOAD keyword is also set. The keyword is also
              ignored if the TRUE keyword is set or if color decomposition in on in
              IDL 5.2 and higher. The default value for the START keyword is
              !D.TABLE_SIZE - 89.

       TRUE:  If this keyword is set, the specified color triple is returned
              as a 24-bit integer equivalent. The lowest 8 bits correspond to
              the red value; the middle 8 bits to the green value; and the
              highest 8 bits correspond to the blue value. In IDL 5.2 and higher,
              if color decomposition is turned on, it is as though this keyword
              were set.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The TRUE keyword causes the START keyword to be ignored.
       The NAMES keyword causes the COLOR, INDEX, START, and TRUE parameters to be ignored.
       The COLOR parameter is ignored if the LOAD keyword is used.
       On systems where it is possible to tell the state of color decomposition
       (i.e., IDL 5.2 and higher), a 24-bit value (or values) is automatically
       returned if color decomposition is ON.

 EXAMPLE:
       To load a yellow color in color index 100 and plot in yellow, type:

          yellow = GETCOLOR('yellow', 100)
          PLOT, data, COLOR=yellow

       or,

          PLOT, data, COLOR=GETCOLOR('yellow', 100)

       To do the same thing on a 24-bit color system with decomposed color on, type:

          PLOT, data, COLOR=GETCOLOR('yellow', /TRUE)

       or in IDL 5.2 and higher,

          DEVICE, Decomposed=1
          PLOT, data, COLOR=GETCOLOR('yellow')

       To load all 88 colors into the current color table, starting at
       color index 100, type:

          TVLCT, GETCOLOR(), 100

       To add the color names to a list widget:

           listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16)

       To load all 88 colors and have the color indices returned in a structure:

           DEVICE, Decomposed=0
           colors = GetColor(/Load, Start=1)
           HELP, colors, /Structure
           PLOT, data, COLOR=colors.yellow

       To get the direct color values as 24-bit integers in color structure fields:

           DEVICE, Decomposed=1
           colors = GetColor(/Load)
           PLOT, data, COLOR=colors.yellow

       Note that the START keyword value is ignored if on a 24-bit device,
       so it is possible to write completely device-independent code by
       writing code like this:

           colors = GetColor(/Load)
           PLOT, data, Color=colors.yellow

 MODIFICATION HISTORY:
       Written by: David Fanning, 10 February 96.
       Fixed a bug in which N_ELEMENTS was spelled wrong. 7 Dec 96. DWF
       Added the McIDAS colors to the program. 24 Feb 99. DWF
       Added the INDEX parameter to the program 8 Mar 99. DWF
       Added the NAMES keyword at insistence of Martin Schultz. 10 Mar 99. DWF
       Reorderd the colors so black is first and white is last. 7 June 99. DWF
       Added automatic recognition of DECOMPOSED=1 state. 7 June 99. DWF
       Added LOAD AND START keywords. 7 June 99. DWF.
       Replaced GOLD with CHARCOAL color. 28 Oct 99. DWF.
       Added INDEXED keyword to force indexed color mode. 28 Oct 99. DWF.
       Fixed problem of "aqua" and "pink" being mixed up. 18 Mar 00. DWF.
       Changed ON_ERROR from 1 to 2, and improved error handling. 2 Aug 00. DWF.
       Increased the known colors from 16 to 88. 19 October 2000. DWF.
       Fixed typos in which "thisColor" was written as "theColor". 10 AUG 2001. DWF.

(See Color//getcolor.pro)


GRBAFTERGLOW__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 grbafterglow__define
   Version 1.1

 PURPOSE:
  Structure for a GRB light curve

 CALLING SEQUENCE:
   tmp = {abslinstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
  Written by JXP

(See GRB//grbafterglow__define.pro)


GRB_AUTOCHRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  grb_autochrt
   Version 1.1

 PURPOSE:
    Creates a DSS chart from a BACODINE.  [old and not well tested]

 CALLING SEQUENCE:
   grb_autochrt, fil

 INPUTS:
     fil -- Email containing the coord

 RETURNS:
   flux= -- PS file of the finding chart

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   grb_fxlum, 'baco_050730'

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   30-Jul-2005 Written by JXP 

(See GRB//grb_autochrt.pro)


GRB_CALCLUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  grb_calclum
   Version 1.1

 PURPOSE:
    Given a grb structure (magnitude at a time t,  z, spectral slope)
    calculates the luminsoity at any time 

 CALLING SEQUENCE:
   
   lum_nu = grb_calclum(grb, nu, [t])

 INPUTS:
     grb -- GRB structure
     nu  -- Frequency (GRB frame)
     [t] -- Time (observer frame). Default = t0 in GRB structure

 RETURNS:
   lum_nu= 

 OUTPUTS:

 OPTIONAL KEYWORDS:
 H0 -- Set Hubble constant
 TAVG=  -- Time interval to calculate average luminosity across

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   17-Feb-2006 Written by JXP 

(See GRB//grb_calclum.pro)


GRB_CALCPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  grb_calcphot
   Version 1.1

 PURPOSE:
  Calculate the number of photons emitted in an energy interval dE
  during a time interval dt.  The user inputs a structure which
  describes the GRB afterglow light curve.

 CALLING SEQUENCE:
   
   total_phot = grb_calcphot( dE, dt, grb_after, Rphot=, nphot=)

 INPUTS:
     dE  -- Energy interval (GRB frame)     
     dt  -- time interval (observer frame)
     grb_after -- Afterglow structure

 RETURNS:
   total_phot -- Number of photons emitted in the energy and time
                 intervals

 OUTPUTS:

 OPTIONAL KEYWORDS:
  Rphot -- Radius at which to calculate the column density of photons
  nphot -- Column density of photons at pecified distance

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   17-Feb-2006 Written by JXP 

(See GRB//grb_calcphot.pro)


GRB_FXLUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  grb_fxlum
   Version 1.1

 PURPOSE:
    Calculates GRB flux as a function of time given the flux at
    one point in time.  The solution is based on the paper by
    Sari, Piran, & Narayan 1998.

 CALLING SEQUENCE:
   
   grb_fxlum, fini, tini, freq, RAD=, FLUX=, LUM=, Z=, $
              tEarth=,  TEXP=, TSTART=, NSTP=

 INPUTS:
     fini -- Flux measured at tini in muJy
     tini -- Time at Earth when fini was measured (seconds)
     freq -- Frequency of the radiation
 RETURNS:
   flux= -- Array of flux values computed as function of time

 OUTPUTS:

 OPTIONAL KEYWORDS:
    /RAD   -- Radiative expansion [Default: adiabatic]
    z=     -- Redshift [default: 1.]
  tstart=  -- Starting time of observation [default: 3600.]
  tend=    -- Starting time of observation [default: 7200.]
  nstp=    -- Number of time steps [default: 1000L]

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:
   grb_fxlum, 1., 7200., 1e15

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   29-Oct-2003 Written by JXP (based on Sari, Piran, Narayan 1998)

(See GRB//grb_fxlum.pro)


GRB_PRSLCURV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  grb_prslcurv
   Version 1.1

 PURPOSE:
    Parses a data file of GRB light curves and returns a structure
    which parameterizes it.

 CALLING SEQUENCE:

 INPUTS:
     fil -- Data file of light curves

 RETURNS:
   struct -- Structure describing afterglow light curves

 OUTPUTS:

 OPTIONAL KEYWORDS:
  NAM=  -- Name of GRB of interest.  Leave blank to get an array of
           structures for the various light curves.

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES/FUNCTIONS CALLED:

 REVISION HISTORY:
   17-Feb-2006 Written by JXP 

(See GRB//grb_prslcurv.pro)


G_MKVOIGT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 g_mkvoigt
 Version 1.0

 PURPOSE:
   create voigt profile flux arrays for output files from vpfit

 CALLING SEQUENCE:
   g_mkvoigt, vpfil, fluxfil, TLIST=, FITSFIL=, PSFIL=, /DAT

 INPUTS:
  vpfil       - output fort.26 vpfil
  fluxfil     - wavelength, flux, sig of qso to be fit
  DAT         - set this flag if the input fluxfil is ASCII 

 OPTIONAL INPUTS:

 OUTPUTS:
  FITSFIL     - output fits file

 OPTIONAL OUTPUTS:
  PSFIL       - output postscript plots of fitting regions

 COMMENTS:
   this procedure (because of call to x_voigt) is VERY expensive!

 EXAMPLES:

 PROCEDURES CALLED:
   x_voigt

 REVISION HISTORY:
   21-Feb-2005  Created by GEP
  

(See Spec/Voigt//g_mkvoigt.pro)


H2LINSTRCT__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 h2linstrct__define
  (V1.1)

 PURPOSE:
    Molecular hydrogen structure

 CALLING SEQUENCE:
   
   tmp = {h2linstrct}

 INPUTS:

 RETURNS:

 OUTPUTS:

 OPTIONAL KEYWORDS:

 OPTIONAL OUTPUTS:

 COMMENTS:

 EXAMPLES:

 PROCEDURES CA