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: Thu Jun 10 14:53:54 2010.
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)
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)
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)
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)
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)
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)
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)
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
COLL - CIE grid
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)
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 [linear]
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)
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!
CALCU= -- Calculate the U parameter assuming n_H = 1 cm^-3
OPTIONAL OUTPUTS:
STRCT -- Stucture containing the wavelength and flux values
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
NAME:
cosm_dist
PURPOSE:
Calculate the cosmological comoving 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)
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)
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)
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)
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)
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)
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)
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
11-June-2007 Modified by LKP for use with NIRC2
(See IMG/General//distruct__define.pro)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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:
MODLIM - modify wavelength limits with wavelength shift
ROOTDIR - pre-pend string to instr_list file names
SUFFIX - for STIS-like files, suffix to search and replace
(default: ['f.fits','e.fits'])
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
PLTERR -- plot error array (changes colors)
ROOTDIR - pre-pend string to instr_list file names
SUFFIX - for STIS-like files, suffix to search and replace
(default: ['f.fits','e.fits'])
;
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)
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)
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)
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)
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)
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 (erg/s/cm^2/Hz)
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)
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) [eV]
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
/SILENT -- Suppress cosmo info
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Feb-2006 Written by JXP
(See GRB//grb_calcphot.pro)
NAME:
grb_fxlum
Version 1.1
PURPOSE:
Calculate the flux for a Band function.
CALLING SEQUENCE:
grb_fxlum, fini, tini, freq, RAD=, FLUX=, LUM=, Z=, $
tEarth=, TEXP=, TSTART=, NSTP=
INPUTS:
E -- Energy (keV)
alpha -- Power-law exponent
beta -- Power-law exponent
RETURNS:
flux= -- Array of flux values computed as function of time
OUTPUTS:
OPTIONAL KEYWORDS:
A= -- Radiative expansion [Default: adiabatic]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
21-Apr-2008 Written by JXP
(See GRB//grb_bandfunc.pro)
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)
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)
NAME:
grb_timeion
Version 1.0
PURPOSE:
Calculates the excitation rate as a function of Luminosity
and distance and abundance
CALLING SEQUENCE:
INPUTS:
grb -- Structure for GRB afterglow
RETURNS:
OUTPUTS:
Creates a Plot
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
May-2007 Written by JXP
(See GRB//grb_timeion.pro)
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)
NAME:
hires_cut_35
Version 1.1
PURPOSE:
Zero out the first 35 points of a HIRES spectrum. I cant
even recall why I do it.
CALLING SEQUENCE:
hires_cut_35, fil
INPUTS:
fil -- Name of HIRES file to edit
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
?? Written by JXP
(See Keck/HIRES//hires_cut_35.pro)
NAME:
hires_upd_nam
Version 1.1
PURPOSE:
Set the FILENAME, SIGFILE, and CONTFILE header key cards
CALLING SEQUENCE:
hires_upd_nam, fil, filnm, signm, contnm
INPUTS:
fil -- Name of HIRES file to edit
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
?? Written by JXP
(See Keck/HIRES//hires_upd_nam.pro)
NAME: hires_wav PURPOSE: Create a line list appropriate for the HIRES emulator provided the redshift. CALLING SEQUENCE: hires_wav, z, fil, /LLS INPUTS: z -- Redshift fil -- Output fil RETURNS: OUTPUTS: OPTIONAL KEYWORDS: /LLS -- Create a line list for LLS OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: hires_wav, 2.2, 'q0440-221_wav.dat' PROCEDURES CALLED: REVISION HISTORY: 17-Nov-2003 Written by JXP
(See Keck/HIRES//hires_wav.pro)
NAME:
kaststrct__define
Version 1.1
PURPOSE:
Kast IDL structure
CALLING SEQUENCE:
tmp = {kaststrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kaststrct__define.pro)
NAME:
kast_ar
Version 1.1
PURPOSE:
Reads the Kast IDL structure from fits file into memory. The
program grabs the first file in the directory with kast_*fits
CALLING SEQUENCE:
kast = kast_ar(file)
INPUTS:
[file] - Filename (default: first file in list ./kast_*fits*)
RETURNS:
kast - Kast IDL structure
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast = kast_ar()
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kast_ar.pro)
NAME:
kast_calibstd
Version 1.1.5
PURPOSE:
Creates a sensitivity function from a standard star; sensfunc can
be used by kast_flux to flux-calibrate science-object spectra
CALLING SEQUENCE:
kast_calibstd, kast, indx, outfil, STFIL=, STTYPE=
INPUTS:
kast -- Kast IDL structure
indx -- Index of standard star (not obj_id)
REQUIRED KEYWORDS:
STFIL= -- Spectrophotometric file for the standard star to be
processed
-- Units are F_lambda vs wavelength
STTYPE= -- Type of standard file - tells the program whether to
read it using xmrdfits (STTYPE=fits, vectors are
st.wavelength and st.flux) or readcol (STTYPE=ascii,
columns are wavelength, f_lambda)
RETURNS:
OUTPUTS:
outfil -- Name of sensitivity function (written with mwrfits,
readable with xmrdfits)
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_calibstd, kast, 83, 'Calibs/sensfunc_test',
stfil='kastsens_g191g1d46', sttype=fits
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Mar-2003 Written by JXP
25-Jan-2005 editing by SLM
12-Nov-2005 revert code to use indx correctly, KLC
(See Lick/Kast/Calibs/kast_calibstd.pro)
NAME:
kast_combspec
Version 1.1
PURPOSE:
Coadd kast spectra using x_combspec
CALLING SEQUENCE:
kast_combspec, kast, setup, side, obj_id, [exp_id]
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
[exp_id] -- Exposure indices
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK -- Show the final combined spectrum
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_combspec, kast, 0, 1, 2
PROCEDURES/FUNCTIONS CALLED:
x_combspec
kast_wrspec
REVISION HISTORY:
28-August-2003 Written by GEP
(See Lick/Kast/Extract/kast_combspec.pro)
NAME:
kast_crays
Version 1.1
PURPOSE:
Detect cosmic rays, set affected pixels to have var = -1
CALLING SEQUENCE:
kast_crays, kast, setup, side, obj_id, [exp_id], CHK=chk
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
[exp_id] -- Exposure indices
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK -- Print out info on CRays
COMMENTS:
EXAMPLES:
kast_crays, kast, 0, 1, 2, /chk
PROCEDURES/FUCTIONS CALLED:
REVISION HISTORY:
01-September-2003 Written by GEP
(See Lick/Kast/Extract/kast_crays.pro)
NAME:
kast_editstrct
Version 1.1
PURPOSE:
Launches a gui to edit the Kast IDL structure
CALLING SEQUENCE:
kast_editstrct, kast
INPUTS:
kast -- Kast IDL structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_editstrct, kast
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kast_editstrct.pro)
NAME:
kast_extract
Version 1.1
PURPOSE:
Extract a 1D spectrum from a Kast 2D image.
CALLING SEQUENCE:
kast_extract, kast, setup, side, obj_id, [exp], $
APER=, SKYNORD=, /STD, YMODEL=, /BOXCAR
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
[exp] -- Exposure indices
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/BOXCAR -- Extract with a boxcar [default: optimal]
APER= -- Aperture (for boxcar primarily)
OPTIONAL OUTPUTS:
YMODEL= -- Image fit created in optimal extraction
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/Extract/kast_extract.pro)
NAME:
kast_flux
Version 1.1
PURPOSE:
Flux a set of Kast spectra given a sensitivity file.
CALLING SEQUENCE:
kast_flux, kast, setup, side, obj_id, [exp], /STD, SENSFIL=
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Side of Kast (blue=1, red=2)
obj_id -- Object ID value
[exp] -- Exposure indices
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/STD -- Flux a standard
SENSFIL -- Name of sensitivity file
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_flux, kast, 0, 1, 0
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Mar-2003 Written by JXP
12-Nov-2005 added blue g2 (600/4310) default (KLC)
(See Lick/Kast/Calibs/kast_flux.pro)
NAME:
kast_fndobj
Version 1.0
PURPOSE:
Find object on the image and then trace using x_trace.
The code can look automatically or the user can look interactively.
CALLING SEQUENCE:
kast_fndobj, kast, setup, side, obj_id, [exp], $
/CHK, /NOCLOBBER, SCICLM=, /STD, /AUTO, SCIROW=
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
[exp] -- Exposure indices
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
SCICLM -- Column to look for object in
SCIROW -- Approximate row expected for the object
/AUTO -- Look for the object automatically
/NOCLOBBER -- Do not overwrite the object structure
/STD -- Standard star
/CHK -- Plot the image and the trace
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_fndobj, kast
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
12-Nov-2005 Added SCICLM defaults for d55, blue G2 (600/4310) and
red 600/7500, KLC
(See Lick/Kast/Extract/kast_fndobj.pro)
NAME:
kast_mkarc
Version 1.0
PURPOSE:
Process arc files (flatten, combine)
CALLING SEQUENCE:
kast_mkarc, kast, setup, /CLOBBER
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CLOBBER -- Clobber any previous processed image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_mkarc, kast
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
27-Aug-2002 Written by JXP
(See Lick/Kast/Calibs/kast_mkarc.pro)
NAME:
kast_mkflat
Version 1.1
PURPOSE:
Process flat file
CALLING SEQUENCE:
kast_mkflat, kast, slit
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
RETURNS:
OUTPUTS:
One normalized flat per slit width
OPTIONAL KEYWORDS:
/CLOBBER -- Clobber any previous processed image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_mkflat, kast, 1L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/Calibs/kast_mkflat.pro)
NAME:
kast_pltobj
Version 1.1
PURPOSE:
Calls x_pltobj after gathering the relevant data
CALLING SEQUENCE:
kast_pltobj, kast, [setup, side, obj_id, obj_nm], EXPSR=, XSIZE=, $
YSIZE=, /FLUX, /FSPEC, XMAX=, /NOIMG, /NOWV, /COMB
INPUTS:
kast -- Kast IDL structure
[setup] -- Setup value
[side] -- Specific camera [blue (1) vs. red (2)]
[obj_id] -- Object value
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/NOIMG -- Do not display 2D image of spectrum
/COMB -- Show the combined 1D spectra
EXPSR -- Index of spectrum
/FLUX -- Show the fluxed spectra
XMAX -- Max height of spectrum [default: 7e-17]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_pltobj, kast, /noimg
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Jul-2002 Written by JXP
?? Major revisions by GEP
(See Lick/Kast/Spec/kast_pltobj.pro)
NAME:
kast_proc
Version 1.1
PURPOSE:
Process an image (flatten) and create variance array. The
routine also turns the DN into electrons by scaling by the gain.
WARNING! Assumes 1 flat for all images
CALLING SEQUENCE:
kast_proc, kast, setup, obj_id, side, INDEX=, /CLOBBER
INPUTS:
kast - Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
RETURNS:
OUTPUTS:
Processed file (Final/f_###.ccd)
OPTIONAL KEYWORDS:
INDEX - Indices of objects to process
FLAT - Flat file
/CLOBBER - Overwrite processed image if it exists
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_proc, kast
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-Jul-2002 Written by JXP
(See Lick/Kast/General/kast_proc.pro)
NAME:
kast_qckredux
Version 1.1
PURPOSE:
Perform a quick and dirty (and rather accurate) reduction of a
Kast spectrum. Very useful at the telescope.
CALLING SEQUENCE:
kast_qckredux, img, flat, spec, sig, ARC=, OVR=, $
CLINE=, APER=, SKYFUNC=, SKYNORD=, SKYREG=,
/DISPLAY, /NOREJ, TRACE=, /NOSKY=, STRCT=, RN=, GAIN=,
VAR=, CRUDE=, TINTER=, /SILENT,
WAVE=, /OPTIMAL, /AINTER, OBJLIN=, /DEBUG, /APINTER,
YMODEL=, SIGMA=, /CHK=
INPUTS:
img -- Image to extract from (raw fits file)
flat -- Name of flat file (fits)
RETURNS:
spec -- 1D spectrum
sig -- Error of 1D spectrum
OUTPUTS:
OPTIONAL KEYWORDS:
/CRUDE -- Use the routine trace_crude to trace [recommended]
CLINE= -- Row to use to identify object [default: half way on image]
APER= -- Aperture for boxcar extraction (output or input)
TRACE= -- Trace of the object (output or input)
/CHKTRC -- Check the trace by eye
/DISPLAY -- Display the sky subtracted image with xatv
/NOREJ -- Turn off rejection in sky subtraction (not recommended)
/AINTER -- Interactively fiddle with the Arc peakup
OBJLIN= -- Row near the object trace [default: center of image]
/OPTIMAL -- Perform optimal extraction
YMODEL -- 2D model of the image created by extract_image
RN= -- Readnoise of the image [default: 3.29]
ARC= -- Arc image (fits file)
/DEBUG -- Debug the program (this one often 'breaks')
SIGMA= -- Approximate sigma of the Gaussian profile (for Optimal)
OPTIONAL OUTPUTS:
WAVE= -- Wavelength array (requires Arc image)
COMMENTS:
EXAMPLES:
kast_qckredux, 'b109.ccd', spec, sig, WAVE=wave, ARC='b102.ccd',
FLAT='b100.ccd', /OPTIMAL, /NOSKY
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/Extract/kast_qckredux.pro)
NAME:
kast_sensstd
Version 1.0
PURPOSE:
Process a standard star and create the sensitivity file
CALLING SEQUENCE:
INPUTS:
kast - ESI structure
RETURNS:
OUTPUTS:
Image with rdxstdered light removed
OPTIONAL KEYWORDS:
DFLAT - Use Dome flats where possible
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
esi_echrdxstd, esi
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Jan-2008 Written by JXP
(See Lick/Kast/Calibs/kast_sensstd.pro)
NAME:
kast_specsetup
Version 1.1
PURPOSE:
Examines the Kast IDL structure, checks for appropriate
Flats and Arcs and then outputs a summary ASCII file.
CALLING SEQUENCE:
kast_specsetup, kast, OUTFIL=
INPUTS:
kast -- Kast IDL structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OUTFIL= -- Name of ASCII file (default: kast_specsumm.txt')
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_specsetup, kast
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kast_specsetup.pro)
NAME:
kast_strct
Version 1.1
PURPOSE:
Creates and outputs a structure for a series of Kast frames.
This structure organizes the data for the night and is used
to run most of the programs in the Kast package
CALLING SEQUENCE:
kast_strct, struct, LIST=, /NOMKDIR, OUTFIL=, /NOEDIT
INPUTS:
RETURNS:
OUTPUTS:
struct -- Kast IDL structure
OPTIONAL KEYWORDS:
LIST= - Image list: e.g. 'gd_files.lst'
[Default is 'Raw/kast*.fits']
/NOMKDIR - Do not make default directories
/NOEDIT - Do not edit the hand
OUTFIL= - Name of fits output file [default: 'kaststrct.fits']
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_strct, nght1_strct, /MKDIR
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kast_strct.pro)
NAME:
kast_wavesol
Version 1.1
PURPOSE:
Create a wavelength solution for a specific object using
an archived solution. The wavelength array in the object
structure and writes that structure out.
CALLING SEQUENCE:
kast_wavesol, kast, setup, side, obj_id, [exp], /STD,
/SILENT, /AINTER, /AUTO, CALIB=, CALIBFIL=, NFIN= ,ARC_SAT =
INPUTS:
kast -- Kast IDL structure
setup -- Setup value
side -- Specific camera [blue (1) vs. red (2)]
obj_id -- Object value
[exp] -- Exposure indices
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/AUTO -- Automatically fit the arc
NFIN= -- Requires nfin lines to start the fit [default: 5]
/SILENT
/AINTER -- Peak up on the arc cross-correlation interactively
ARC_SAT= -- max counts for arc lines for determining which to use
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
12-Nov-2005 Added defaults for Blue G2 (600/4310) and Red 600/7500
and ARC_SAT keyword, KLC
(See Lick/Kast/Calibs/kast_wavesol.pro)
NAME:
kast_wrspec
Version 1.0
PURPOSE:
Writes kastspectrct to a FITS file
CALLING SEQUENCE:
kast_wrspec, kastspecstrct, outfil, /READ
INPUTS:
kastspecstrct - Kast Combined Spectrum structure
RETURNS:
OUTPUTS:
outfil - FITS file for the structure
OPTIONAL KEYWORDS:
/READ -- Reverse the operation (read from the FITS file)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_wrspec, kastspecstrct, outfil
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Aug-2003 Written by GEP
(See Lick/Kast/Extract/kast_wrspec.pro)
NAME:
kast_wrstrct
Version 1.0
PURPOSE:
Write the kast structure to a FITS file and write an ASCII summary
CALLING SEQUENCE:
kast_wrstrct, kast, /ANONLY, OUTFIL=, FITS=
INPUTS:
kast - An ESI structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
ANONLY - Only print files with flg_anly NE 0
OPTIONAL OUTPUTS:
OUTFIL= - Output file (default: kast.list)
FITS= - Name of fits output file
COMMENTS:
EXAMPLES:
kast_wrstrct, kast, FITS='kast_13oct02.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Mar-2003 Written by JXP
(See Lick/Kast/General/kast_wrstrct.pro)
NAME:
lco_guidestr
Version 1.1
PURPOSE:
Inputting a photometry structure, parse out a set of stars
useful for guide stars for WFCCD masks.
CALLING SEQUENCE:
lco_guidestr, phot, mmin, mmax
INPUTS:
phot -- Photometry structure
mmin -- Min mag for guide star
mmax -- Max mag for guide star
RETURNS:
OUTPUTS:
'Masks/guidestr.dat' -- Guide star output file
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
?? Written by JXP
(See lcoovi//lco_guidestr.pro)
NAME:
lco_phot
Version 1.1
PURPOSE:
Turns the photometry output (B,R filters) into a structure
CALLING SEQUENCE:
lco_phot, phot_fil, phot_str
INPUTS:
phot_fil -- Photometry ASCII file
RETURNS:
phot_str -- Photometry structure
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
?? Written by JXP
(See lcoovi//lco_phot.pro)
NAME:
lco_targets
Version 1.1
PURPOSE:
Turns a Sextractor output file into an IDL structure
CALLING SEQUENCE:
lco_targets, name, galstr
INPUTS:
name -- Name of Sextractor file
RETURNS:
galstr -- IDL galaxy structure
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
?? Written by JXP
(See lcoovi//lco_targets.pro)
NAME:
lliststrct__define
Version 1.1
PURPOSE:
Structure for the line lists
CALLING SEQUENCE:
tmp = {lliststrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Lines//lliststrct__define.pro)
NAME:
lls_stat
PURPOSE:
Given a LLS struct and gz list, determine the indices of those
LLS satisfying the statistical sample.
CALLING SEQUENCE:
sdss_llsstat
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
Feb-2009 Written by JXP
(See SDSS/LLS/sdss_llsstat.pro)
NAME:
lndltstr__define
Version 1.1
PURPOSE:
Structure to handle Landolt star data
CALLING SEQUENCE:
tmp = {lndltstr}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/Photometry//lndltstr__define.pro)
NAME:
lris_calibstd
Version 1.1
PURPOSE:
CURRENTLY UNDER CONSTRUCTION
CALLING SEQUENCE:
spec = x_apall(ydat, [head])
INPUTS:
ydat - Values
[head] - Header
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
wave - wavelength array
DISPLAY - Display the sky subtracted image with xatv
OVR - String array for ov region: '[2050:2100, *]'
ERROR - Variance array
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_calibstd, kast, 0, 1, 0
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Mar-2003 Written by JXP
(See Keck/LRIS/Flux/lris_calibstd.pro)
NAME:
lris_flux
Version 1.1
PURPOSE:
Flux an LRIS spectrum given a sensitivity function (archived)
CALLING SEQUENCE:
flux = lris_flux(wave, spec, flux_fil, SIG=, FSIG=)
INPUTS:
wave -- Wavelength array
spec -- LRIS spectrum
flux_fil -- Sensitivity function
RETURNS:
flux -- Fluxed LRIS spectrum
OUTPUTS:
OPTIONAL KEYWORDS:
EXP= -- Exposure time [default: 1.]
SIG= -- Error array to flux as well
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
kast_calibstd, kast, 0, 1, 0
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
29-Aug-2003 Written by JXP
(See Keck/LRIS/Flux/lris_flux.pro)
NAME:
lris_sensstd
Version 1.0
PURPOSE:
Process a standard star and create the sensitivity file for LRIS
CALLING SEQUENCE:
INPUTS:
std_fil -- A processed standard star using the LowRedux pipeline
RETURNS:
OUTPUTS:
Image with rdxstdered light removed
OPTIONAL KEYWORDS:
DFLAT - Use Dome flats where possible
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
esi_echrdxstd, esi
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Jan-2008 Written by JXP
(See Keck/LRIS/CALIBS/lris_sensstd.pro)
NAME:
lwdfspecstrct__define
Version 1.1
PURPOSE:
Creates a structure for Low dispersion 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 = {lwdfspecstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
Currently a maximum of 5000 pixels
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Analysis//lwdfspecstrct__define.pro)
NAME:
manuakea_sky
Version 1.1
PURPOSE:
Gives an estimate of the sky brightness for Mauna Kea
CALLING SEQUENCE:
mag = maunakea_sky( wave, phase )
INPUTS:
wave= -- Wavelength array
phase= -- Phase of the moon [days]
RETURNS:
mag= -- Sky brightness in AB mags
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
27-Oct-2005 Written by JXP based on HIRES S2N code
(See Obs//maunakea_sky.pro)
NAME:
manuakea_trans
Version 1.1
PURPOSE:
Extinction of the atmosphere at Mauna Kea
CALLING SEQUENCE:
extinct = maunakea_trans(wave)
INPUTS:
wave= -- Wavelengths of interest
RETURNS:
extinct -- Extinction in mag
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
showfits
querydss
REVISION HISTORY:
27-Oct-2005 Written by JXP based on HIRES S2N code
(See Obs//maunakea_trans.pro)
NAME:
mslitstrct__define
Version 1.1
PURPOSE:
This structure is used to save info about a slit in a mask. In
particular, one saves the edges of the slit.
CALLING SEQUENCE:
tmp = {mslitstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Flux//thrustrct__define.pro)
NAME:
mslitstrct__define
Version 1.1
PURPOSE:
This structure is used to save info about a slit in a mask. In
particular, one saves the edges of the slit.
CALLING SEQUENCE:
tmp = {mslitstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Slits//mslitstrct__define.pro)
NAME:
newabslinstrct__define
Version 1.1
PURPOSE:
Current structure for absorption lines
CALLING SEQUENCE:
tmp = {newabslinstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Lines//newabslinstrct__define.pro)
NAME:
observable
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:
observable, month, obs_dec, obj_ra, obj_dec, PAR=par, $
POS=pos, L1=l1, L2=l2, KECK=keck, VLT=vlt
INPUTS:
month --
obs_dec -- DEC of the observatory
obj_ra -- RA of the object
obj_dec -- DEC of the object
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/KECK -- Calculate for Keck
/VLT -- Calculate for VLT
OPTIONAL OUTPUTS:
COMMENTS:
written by E. Gawiser, last modified 05jul03
anyone can use this code, please notify gawiser@astro.yale.edu regarding
any errors found!
WARNING: POS=0 is equivalent to not setting it, so use e.g. 0.001
WARNING: "middle of the night" is not local midnight but is much more useful
in Chile it's about 00:40 in winter, 01:40 in summer with daylight savings!
dec in degrees, RA in hours
month is from 1.00 to 12.99, use decimals for days. e.g automnal equinox
is roughly 9.67. (No accounting for 28/30/31 days)
NOTE: To get Keck Nasmyth platform limits, use /keck.
/par will output the amplitude of atmospheric dispersion from L1 to L2
along the parallactic angle (default is 3000,10000A) and if POS is set it
will output the component perpendicular to a slit at position angle POS
EXAMPLE FOR IMAGING:
observable, 1.7, -30., 3.5, -27.
models observing the CDF-S (03 30 -27) on January 21 from CTIO
The program outputs the RA overhead, length of night, and airmass values.
EXAMPLE FOR SPECTROSCOPY:
observable, 10.3, 20., 3.5, -27., /par, /keck, l1=3500, l2=6000, pos=0.01
models observing the CDF-S (03 30 -27) on October 9 from Keck with
slit(s) at position angle = 0.01
The program outputs the Nasmyth platform limits, RA overhead,
length of night, airmass, parallactic angle, total amplitude of ADR from
3500 to 6000A, and amplitude of that ADR perpendicular to POS=0.01
for this field.
you can call /vlt instead of /keck to use atmospheric conditions at
Paranal (about 50% more ADR) instead of Mauna Kea. Calling neither uses
atmospheric conditions at La Silla which cause a bit more ADR than Paranal.
Note that parallactic angle is
defined as angle towards zenith i.e. from blue to red light of the object,
with North=0, East=90, etc. This has been tested versus the skycalc code
and works fine anywhere on the sky (doesn't mean much once the object is
below the horizon however ;) ).
(See Obs//observable.pro)
NAME:
parse_dlalst
V1.2
PURPOSE:
Given a list of DLA base files, fill up the DLA structure. THis
program also defines the DLA structure {sDLA}.
CALLING SEQUENCE:
parse_DLAlst, dla, [list]
INPUTS:
[list] -- List of DLA base files. [default:
'/u/xavier/DLA/Lists/tot_dla.lst']
RETURNS:
OUTPUTS:
dla -- IDL DLA structure
OPTIONAL KEYWORDS:
/ION - Input ionic column densities
/NOELM - Supress elemental and ion structures (saves memory)
/NORELM - Supress inputting Elemental [X/H] values
FILE= -- The input is the dat filename not a list of dat files
/NOHIS -- Suppress HI error in [X/H] values
/EW -- Fill up the ion arrays with EW values instead of column
densities. This reads the .EW files instead of .ion
/FINE -- This fills up arrays for fine-structure states
(e.g. SiII*). By default CII* is already considered
ROOT= Path to the DLA tree
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
parse_dlalst, dla, '/u/xavier/DLA/Lists/tot_dla.lst'
parse_dlalst, dla, '/u/xavier/DLA/Data/GRB051111.z154.dat', /FILE, /ION
PROCEDURES CALLED:
REVISION HISTORY:
31-May-2001 Written by JXP
02-Jan-2003 Added metallicity structure
(See DLA//parse_dlalst.pro)
NAME:
parse_phot
Version 1.1
PURPOSE:
Reads in the BRI ASCII file from DLA photometery to an IDL
structure. Not too useful for the common folk.
CALLING SEQUENCE:
parse_phot, file, nobj, supstrc, FLAG=
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
(See IDLA//parse_phot.pro)
NAME:
parse_sdss
Version 1.1
PURPOSE:
Given an SDSS spectrum, return flux, wavelength, etc.
CALLING SEQUENCE:
parse_sdss, fil, flux, wave, conti, SIG=, IVAR=, ZQSO=, $
NPIX=, HEAD=, CFIL=, CDIR=
INPUTS:
fil -- Name of SDSS file OR [PLATE, FIBER]
RETURNS:
flux -- Spectral flux array
wave -- Wavelength array
conti -- Continuum array (requires CFIL)
OUTPUTS:
OPTIONAL KEYWORDS:
CFIL= -- Name of continuum file
CDIR= -- Name of directory to continuum files
OPTIONAL OUTPUTS:
SIG= -- Sigma array
IVAR= -- Inverse variance array
ZQSO= -- Redshift of the quasar (or galaxy)
NPIX= -- Number of pixels in the spectrum
HEAD= -- Full header of the SDSS spectrum
COMMENTS:
EXAMPLES:
parse_sdss, fil
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Sep-2003 Written by JXP
(See SDSS/General/parse_sdss.pro)
NAME:
pca_qsotilt
Version 1.0
PURPOSE:
Attempt to fit in logarithmic flux a low order polynomial to
match the CIV region (range)
coeffs contains the [npoly,nspec] coefficients based on rlam
This fit is done in logarithmic flux vs. logarithmic wavelength
CALLING SEQUENCE:
pca_qsotilt, rlam, flux, invvar, xmed, ymed, tilt, tiltivar, $
coeff, npoly=, range=, answer=, FLG_TILT=
INPUTS:
rlam -- Observed Wavelength array (logarithmic)
flux -- Flux of quasar
invvar -- Inverse variance array
xmed -- Rest frame wavelength array [logarithmic; rlam / (1+zem) ]
ymed -- 0th channel of the PCA fit (pca[*,0])
RETURNS:
tilt -- Normalized fit to QSO (tilt taken out)
tiltivar -- Inverse variance of the fit
coeff -- Coefficients of the fit to the tilt
OUTPUTS:
OPTIONAL KEYWORDS:
npoly= -- Number of coefficients in POLY fit to tilt
range= -- Rest-wavelength range to fit [default: 1270--2000]
OPTIONAL OUTPUTS:
ANSWER= -- Tilted fit
FLG_TILT -- Flag describing the success of the fit (0=bad, 1=good)
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
09-Sep-2003 Written by JXP (based on qso_tilt by SB)
(See SDSS/PCA/pca_qsotilt.pro)
NAME:
printcol
Version 1.1
PURPOSE:
Prints a series of arrays to the screen in column format.
The program will print as many entries as found in v1.
CALLING SEQUENCE:
printcol, v1, v2, [v3-v8], FORMAT=''
INPUTS:
v1 - Vector 1
v2 - Vector 2
[v3-v8] - Additional vectors.
RETURNS:
OUTPUTS:
Prints v1, v2 to screen
OPTIONAL KEYWORDS:
FORMAT - FORTRAN formatting
OPTIONAL OUTPUTS:
COMMENTS:
The program keys off the number of elements in v1
EXAMPLES:
printcol, array1, array2
PROCEDURES CALLED:
REVISION HISTORY:
17-June-2001 Written by JXP
(See General//printcol.pro)
NAME:
prs_cldycoll
V1.1
PURPOSE:
Parses a standard binary fits file into the CLOUDY struct
for collisional ionization. The default file was created by
J.C. Howk using Cloudy
CALLING SEQUENCE:
prs_cldycoll, stucture, [filename]
INPUTS:
[filename] - Input fits file
[default: $XIDL_DIR/Cloudy/cloud_collisons.fits]
RETURNS:
structure - IDL structure strctcldy
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
03-Nov-2003 Written by JXP
(See Cloudy//prs_cldycoll.pro)
NAME:
prs_cldygrid
V1.1
PURPOSE:
Parses a standard binary fits file into the CLOUDY struct
for Photoionized models
CALLING SEQUENCE:
prs_cldygrid, stucture, filename
INPUTS:
filename - Cloudy File
ROOT= - Path to Cloudy files [default: /u/xavier/Cloudy/Grid/Output]
RETURNS:
structure - IDL structure strctcldy containing the Cloudy info
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
prs_cldygrid, struct, 'HM01A.fits'
PROCEDURES CALLED:
xmrdfits
REVISION HISTORY:
31-May-2001 Written by JXP
(See Cloudy//prs_cldygrid.pro)
Name:
PS_Open
Purpose:
Set the plotting device to be PostScript,
and save the current plotting device (that can thus be restored).
Use in conjunction with ps_close.
Calling sequence:
PS_Open
Example:
IDL> ps_open,file='test.ps',/por
IDL> plot,findgen(10)
IDL> ps_close,/nop
Keywords:
PORTRAIT - Normally, PS_Open defines the plotting area as landscape. If
this keyword is set, the plotting area will be portrait.
FILENAME = <string> - Normally, PS_Open uses '/tmp/idl-$USER.ps' (on
Sparx) for the PostScript file, but the keyword FILENAME can be used
to override that value. ($USER is retrieved with a getenv('USER')).
SQUARE - if set, defines the plotting area to be square. to also get
a square data window, use the position keyword when making the plot.
FONT - set !P.font to value of FONT
ENCAPSULATED - produces an encapsulated PostScript plot.
BPP = <n> - Set the number of bits per pixel; default value is 8,
valid values are 8, 4, OR 2. A higher no produces a better
resolution but also a bigger PostScript file.
COLOR - produces a color PostScript plot.
LEDGER - selects ledger format (17x11; usefull mostly for color printer)
XSIZE - the x size in inches of the plotting region
YSIZE - the y size in inches of the plotting region
MAXS -- Maximize the plot on a standard 8.5 x 11 page (JXP)
CMYK -- generate colors in CMYK for publication
See also:
PS_Close
History:
23-Aug-93: added bpp=[2,4,8] option, with 8 bpp as default
24-Aug-93: added support for /color,
and reduced the page size for QMS color printer
16-Sep-93: added color flag to common block (see also PS_Close)
9-Apr-94: added file name to info message
11-Apr-94: added LEDGER support (see also PS_Close)
28-Apr-94: added SQUARE, and fixed color portrait offset
5-May-94: got /SQUARE to actually work
25-Jun-94: added xsize and ysize keywords
3-Dec-07 added CMYK, KLC
(See General//ps_open.pro)
NAME:
qalcharstrct__define
Version 1.1
PURPOSE:
Defines the QAL structure for SDSS
CALLING SEQUENCE:
tmp = {qalcharstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Sep-2002 Written by JXP
(See SDSS/General/qalcharstrct__define.pro)
NAME: qso_template_nu PURPOSE: CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 2005 Written by Joe Hennawi UCB
(See SDSS/m912/x_qso_template_nu.pro)
NAME:
READCOL
PURPOSE:
Read a free-format ASCII file with columns of data into IDL vectors
EXPLANATION:
Lines of data not meeting the specified format (e.g. comments) are
ignored. Columns may be separated by commas or spaces.
Use READFMT to read a fixed-format ASCII file. Use RDFLOAT for
much faster I/O (but less flexibility). Use FORPRINT to write
columns of data (inverse of READCOL).
CALLING SEQUENCE:
READCOL, name, v1, [ v2, v3, v4, v5, ... v35 , COMMENT=
DELIMITER= ,FORMAT = , /DEBUG , /SILENT , SKIPLINE = , NUMLINE = ]
INPUTS:
NAME - Name of ASCII data file, scalar string.
OPTIONAL INPUT KEYWORDS:
FORMAT - scalar string containing a letter specifying an IDL type
for each column of data to be read. Allowed letters are
A - string data, B - byte, D - double precision, F- floating
point, I - integer, L - longword, Z - longword hexadecimal,
and X - skip a column.
Columns without a specified format are assumed to be floating
point. Examples of valid values of FMT are
'A,B,I' ;First column to read as a character string, then
1 column of byte data, 1 column integer data
'L,L,L,L' ;Four columns will be read as longword arrays.
' ' ;All columns are floating point
If a FORMAT keyword string is not supplied, then all columns are
assumed to be floating point.
/SILENT - Normally, READCOL will display each line that it skips over.
If SILENT is set and non-zero then these messages will be
suppressed.
/DEBUG - If this keyword is non-zero, then additional information is
printed as READCOL attempts to read and interpret the file.
COMMENT - single character specifying comment signal. Any line
beginning with this character will be skipped. Default is
no comment lines.
DELIMITER - single character specifying delimiter used to separate
columns. Default is either a comma or a blank.
SKIPLINE - Scalar specifying number of lines to skip at the top of file
before reading. Default is to start at the first line.
NUMLINE - Scalar specifying number of lines in the file to read.
Default is to read the entire file
OUTPUTS:
V1,V2,V3,...V25 - IDL vectors to contain columns of data.
Up to 25 columns may be read. The type of the output vectors
are as specified by FORMAT.
EXAMPLES:
Each row in a file position.dat contains a star name and 6 columns
of data giving an RA and Dec in sexigesimal format. Read into IDL
variables. (NOTE: The star names must not include the delimiter
as a part of the name, no spaces or commas as default.)
IDL> FMT = 'A,I,I,F,I,I,F'
IDL> READCOL,'position.dat',F=FMT,name,hr,min,sec,deg,dmin,dsec
The HR,MIN,DEG, and DMIN variables will be integer vectors.
Alternatively, all except the first column could be specified as
floating point.
IDL> READCOL,'position.dat',F='A',name,hr,min,sec,deg,dmin,dsec
To read just the variables HR,MIN,SEC
IDL> READCOL,'position.dat',F='X,I,I,F',HR,MIN,SEC
RESTRICTIONS:
This procedure is designed for generality and not for speed.
If a large ASCII file is to be read repeatedly, it may be worth
writing a specialized reader.
Columns to be read as strings must not contain the delimiter character
(i.e. commas or spaces by default). Either change the default
delimiter with the DELIMITER keyword, or use READFMT to read such files.
Numeric values are converted to specified format. For example,
the value 0.13 read with an 'I' format will be converted to 0.
PROCEDURES CALLED
GETTOK(), NUMLINES(), STRNUMBER()
MINIMUM IDL VERSION:
V5.3 (Uses STRSPLIT)
REVISION HISTORY:
Written W. Landsman November, 1988
Modified J. Bloch June, 1991
(Fixed problem with over allocation of logical units.)
Added SKIPLINE and NUMLINE keywords W. Landsman March 92
Read a maximum of 25 cols. Joan Isensee, Hughes STX Corp., 15-SEP-93.
Call NUMLINES() function W. Landsman Feb. 1996
Added DELIMITER keyword W. Landsman Nov. 1999
Fix indexing typos (i for k) that mysteriously appeared W. L. Mar. 2000
Hexadecimal support added. MRG, RITSS, 15 March 2000.
Default is comma or space delimiters as advertised W.L. July 2001
Faster algorithm, use STRSPLIT if V5.3 or later W.L. May 2002
Accept null strings separated by delimiter ,e.g. ',,,'
Use SCOPE_VARFETCH instead of EXECUTE() for >V6.1 W.L. Jun 2005
Added compile_opt idl2 W. L. July 2005
(See General//x_readcol.pro)
NAME: RESOLVE_ALL PURPOSE: Resolve (by compiling) all procedures and functions. This is useful when preparing .sav files containing all the IDL routines required for an application. CATEGORY: Programming. CALLING SEQUENCE: RESOLVE_ALL INPUTS: None. KEYWORD PARAMETERS: CLASS = if set, a list of object class names. RESOLVE_ALL's rules for finding uncompiled functions and procedures are not able to find object definitions or methods, because those things are not known to IDL until the object classes are actually instantiated and the methods called. However, if CLASS is set, RESOLVE_ALL will ensure that the __DEFINE files for those classes and their superclasses are compiled and execute. If then locates all methods for those classes and their superclasses and makes sure they are also compiled. CONTINUE_ON_ERROR = if set, continue when a routine fails to resolve, otherwise throw an error and stop. QUIET = if set, produce no messages. RESOLVE_EITHER = A scalar or array of routine names to resolve. Use this keyword instead of RESOLVE_FUNCTION or RESOLVE_PROCEDURE if you do not know the type of the routine being resolved. If the routines are already compiled, they are not recompiled. RESOLVE_FUNCTION = a scalar or array of function names to resolve. If the routines are already compiled, they are not recompiled. RESOLVE_PROCEDURE = a scalar or array of procedure names to resolve. If the routines are already compiled, they are not recompiled. SKIP_ROUTINES = an optional string array containing the names of routines to NOT resolve. This is useful when a library file containing the designated routines will be later included. UNRESOLVED = if CONTINUE_ON_ERROR is set, this output parameter will contain the names of the unresolved procedures and functions in a string array. Routines in the SKIP_ROUTINES list are also included in this result. OUTPUTS: No explicit outputs. COMMON BLOCKS: None. SIDE EFFECTS: RESTRICTIONS: Will not resolve procedures or functions that are called via CALL_PROCEDURE, CALL_FUNCTION, or EXECUTE, or object methods. Only explicit calls are resolved. If an unresolved procedure or function is not in the IDL search path, an error occurs, and no additional routines are resolved unless CONTINUE_ON_ERROR is specified. This routine does not support the idea of a function and procedure both having the same name, and does not handle that case. This is generally not a good idea anyway, as it is confusing. PROCEDURE: This routine iteratively determines the names of unresolved calls to user-written or library procedures and functions, and then compiles them. The process stops when there are no unresolved routines. If the CLASS keyword is set, this routine first ensures that all the class definitions are compiled (from the __define.pro) file, and that all methods for those classes and their superclasses are compiled. EXAMPLE: RESOLVE_ALL. MODIFICATION HISTORY: Written by: DMS, RSI, January, 1995. DMS, RSI, April, 1997, Added SKIP_ROUTINES keyword. AB, RSI, April 1998, Added CONTINUE_ON_ERROR keyword. Reorganized the body of the resolving code. DMS, Aug, 1998. Added UNRESOLVED keyword. AB, 13 January 1999, Added RESOLVE_EITHER keyword. Removed the old restriction that only one of the RESOLVE_ keywords are processed in a single call. AB, 6 February 2003, Added CLASS keyword. CT, August 2004: Fix RESOLVE_FUNCTION keyword so it works.
(See General//x_resolve_all.pro)
NAME:
sdssdlastrct__define
PURPOSE:
Structure for SDSS DLA searches
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by SHF
14-Oct-2004 Modified by JXP
(See SDSS/DLA/sdssdlastrct__define.pro)
NAME:
sdssdlastrct__define
PURPOSE:
Structure for SDSS DLA searches
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by SHF
14-Oct-2004 Modified by JXP
(See SDSS/LLS/sdssllsstrct__define.pro)
NAME:
sdssmgiistrct__define
PURPOSE:
Structure for MgII search
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by GEP
(See SDSS/MgII/sdssmgiistrct__define.pro)
NAME:
sdss_chkbal
Version 1.1
PURPOSE:
GUI used to check for (and designate) BAL quasars from SDSS
CALLING SEQUENCE:
sdss_chkbal, qalfil, IQSO=, XSIZE=, YSIZE=, /RECHK
INPUTS:
qalfil -- Name of FITS file containing the QAL structure
RETURNS:
OUTPUTS:
qalfil -- With the BAL info modified accordingly
OPTIONAL KEYWORDS:
IQSO -- Number of the first QSO to start with [default: 0L]
/RECHK -- Only plot thos QSOs identified as BAL previously
MATCHFIL -- to skip QSOs that have already been checked
(see sdss_balupdate.pro)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chkbal, 'DR2_QSO/sdss_DR2_QAL.fits', MATCHFIL='DR2_QSO/matched.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Feb-2004 Written by JXP
07-Jun-2004 Revised by SHF
(See SDSS/DLA/sdss_chkpdla.pro)
NAME:
sdss_chkbal
Version 1.1
PURPOSE:
used to select the QSOs that have already been checked
for BALs (in 'oldqalfil') and update their values (in 'newqalfil').
The 'matchfil' is then fed to sdss_chkbal and those
QSOs are skipped.
CALLING SEQUENCE:
sdss_balupdate, oldqalfil, newqalfil, matchfil, SDSSPATH=sdsspath
INPUTS:
oldqalfil -- Name of FITS file containing the previous QAL structure
newqalfil -- Name of FITS file containing the current QAL structure
RETURNS:
OUTPUTS:
newqalfil -- With the 'flg_bal' info modified accordingly
matchfil -- Name of FITS file containing array of 'newqsofil'
indices that matched
OPTIONAL KEYWORDS:
SDSSPATH -- maybe already set in .cshrc file, but just in case- a
path to the data
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_balupdate, 'DR1_QSO/sdss_DR1_QAL.fits', $
'DR2_QSO/sdss_DR2_QAL.fits', ['DR2_QSO/matched.fits']
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Jun-2004 Written by SHF
23-Nov-2004 Update by JXP
(See SDSS/General/sdss_balupdate.pro)
NAME:
sdss_chkbal
Version 1.1
PURPOSE:
GUI used to check for (and designate) BAL quasars from SDSS
CALLING SEQUENCE:
sdss_chkbal, qalfil, IQSO=, XSIZE=, YSIZE=, /RECHK
INPUTS:
qalfil -- Name of FITS file containing the QAL structure
RETURNS:
OUTPUTS:
qalfil -- With the BAL info modified accordingly
OPTIONAL KEYWORDS:
IQSO -- Number of the first QSO to start with [default: 0L]
/RECHK -- Only plot thos QSOs identified as BAL previously
MATCHFIL -- to skip QSOs that have already been checked
(see sdss_balupdate.pro)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chkbal, 'DR2_QSO/sdss_DR2_QAL.fits', MATCHFIL='DR2_QSO/matched.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Feb-2004 Written by JXP
07-Jun-2004 Revised by SHF
(See SDSS/General/sdss_chkbal.pro)
NAME:
sdss_chkciv
Version 1.0
PURPOSE:
Visually check SDSS CIV absorption detected with sdss_fndciv
CALLING SEQUENCE:
sdss_chkciv,
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chkciv, x, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Dec-2003 Written by GEP/SHF
(See SDSS/CIV/sdss_chkciv.pro)
NAME:
sdss_chkdla
Version 1.1
PURPOSE:
Launches a GUI that is used to check the DLA candidates
(and metal-line systems) identified by the automated algorithm
CALLING SEQUENCE:
sdss_chkdla, qalfil, dlafil, con_dir, IQSO=, /FNEW, XSIZE=, YSIZE=
INPUTS:
qalfil -- FITS file containing the QAL structure
dlafil -- FITS file containing the SDSS DLA structure (may be old)
con_dir -- Path to the directory containting the continuum files
RETURNS:
OUTPUTS:
dlafil -- FITS file containing the SDSS DLA structure
OPTIONAL KEYWORDS:
/FNEW -- Start with first quasar that hasnt been checked
OBJNM= --
XSIZE -- Size of gui in screen x-pixels [default: screen-200]
YSIZE -- Size of gui in screen y-pixels [default: screen-200]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chkdla, 'sdss_dr3_QAL.fits', 'dr3_qal_chkd.fits', 'ABSLIN/',
/FNEW
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Oct-2003 Written by JXP
(See SDSS/DLA/sdss_chkdla.pro)
NAME:
sdss_chklls
Version 1.0
PURPOSE:
Visually check SDSS LLS candidates
CALLING SEQUENCE:
sdss_chklls, x, maskid, expsr, XSIZE=, YSIZE=
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chklls, x, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Dec-2005 Written by JXP/JMO
(See SDSS/LLS/sdss_chklls.pro)
NAME:
sdss_chklya
Version 1.1
PURPOSE:
GUI used to check for missing DLA
CALLING SEQUENCE:
sdss_chklya, qalfil, IQSO=, XSIZE=, YSIZE=, /RECHK, ZMIN=
INPUTS:
qalfil -- Name of FITS file containing the QAL structure
RETURNS:
OUTPUTS:
qalfil -- With the BAL info modified accordingly
OPTIONAL KEYWORDS:
ZMIN= -- Minimum redshift [default: 2.]
IQSO -- Number of the first QSO to start with [default: 0L]
/RECHK -- Only plot thos QSOs identified as BAL previously
MATCHFIL -- to skip QSOs that have already been checked
(see sdss_balupdate.pro)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chklya, '/DR2_QSO/sdss_DR2_QAL.fits', MATCHFIL='DR2_QSO/matched.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Feb-2004 Written by JXP
07-Jun-2004 Revised by SHF
(See SDSS/DLA/sdss_chklya.pro)
NAME:
sdss_chkmgii
Version 1.0
PURPOSE:
Visually check SDSS Mg II absorption with a GUI
CALLING SEQUENCE:
sdss_chkmgii, x, maskid, expsr, XSIZE=, YSIZE=
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chkmgii, x, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Dec-2003 Written by GEP/SHF
(See SDSS/MgII/sdss_chkmgii.pro)
NAME:
sdss_chksiew
Version 1.0
PURPOSE:
Visually check SDSS CIV absorption detected with sdss_fndciv
CALLING SEQUENCE:
sdss_chksiew,
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_chksiew, x, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Jun-2007 Written by JXP
(See SDSS/DLA/sdss_chksiew.pro)
NAME:
sdss_civsearch
Version 1.0
PURPOSE:
Given a list of SDSS quasars, search these spectra for CIV
absorbers and output a structure of detections and EWs
CALLING SEQUENCE:
sdss_civsearch, filename, outfil, SDSSSUM=sdsssum, ZMIN=zmin, $
RMAX=rmax,LZ=lz, DATR=datr, INIFIL=inifil
INPUTS:
filename - File containing a (long) list of SDSS quasar data files
(1d spectra, .fit)
SDSSSUM= - Summary file of QSO properties [required]
INIFIL= - File containing the CIV structure which was created
previously. These will not be redone.
RETURNS:
OUTPUTS:
outfil - Name for outputted structure of CIV absorbers
OPTIONAL KEYWORDS:
ZMIN= -- Minimum redshift of the CIV absorber [default: 1.45]
DATR= -- Additional path to the data
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_civsearch, 'Lists/dr3_abs.lst', 'sdss_DR3_CIV.fits',
SDSSSUM='dr3_qso.fits', DATR='DR3_QSO/'
sdss_civsearch, '../Lists/dr7_qso.lst', 'sdss_DR7_CIV.fits',
SDSSSUM='../dr7_qso.fits', DATR='DR7_QSO/'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/CIV/sdss_civsearch.pro)
NAME:
sdss_compare
Version 1.1
PURPOSE:
Given the structure containing DLA info, combine the values to
create a final quality value.
CALLING SEQUENCE:
sdss_compare, strct, FSTRCT=
INPUTS:
strct -- QALstrct with the relevant info
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
FSTRCT= -- Struct containing the combined values [required?]
COMMENTS:
EXAMPLES:
sdss_chkbal, 'sdss_DR1_QAL.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2003 Written by SHF
(See SDSS/General/sdss_compare.pro)
NAME:
sdss_comptst
Version 1.1
PURPOSE:
Monte-carlo routine to check the completeness of our automoated
algorithm
CALLING SEQUENCE:
sdss_comptst, fil, outfil, NTRIAL=, /CHK, /DEBUG
INPUTS:
fil -- SDSS spectrum (without a DLA present)
RETURNS:
OUTPUTS:
outfil -- FITS file with the qalstrct
OPTIONAL KEYWORDS:
NTRIAL= -- Number of simulations to run [default: 1000L]
/CHK -- Plot the spectrum
/DEBUG --
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_comptst, '/data5/SDSS/DR1_QSO/spectro/1d/0463/0463-51312-122.fit',
'monte_snr10.fits', NTRIAL=10000L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2003 Written by SHF
(See SDSS/General/sdss_comptst.pro)
NAME:
sdss_dla
Version 1.1
PURPOSE:
Main routine to search for DLA in SDSS spectra (or ESI). This
is the key driver of the N(HI) search for DLA.
CALLING SEQUENCE:
sdss_dla, n2=, ESI=, SDSS=, WIN_REST=, /PFLUX, /SMOOTH, /NORM,
SIGV=, STRCT=, ZEM=
INPUTS:
RETURNS:
OUTPUTS:
STRCT= -- QAL structure created by this program
OPTIONAL KEYWORDS:
n2= -- Sigma value above which a pix is bad in the DLA profile [default: 5]
SIGV= -- Sigma value to add to flux of all pixels
SDSS= -- Name of SDSS file to examine
/PFLUX -- Plot the spectrum
/SMOOTH -- Smooth the spectrum by 5 pixels
/NORM -- The flux is normalized
WIN_REST -- Width of DLA window (angstroms) [default: 6]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_comptst, '/data5/SDSS/DR1_QSO/spectro/1d/0463/0463-51312-122.fit',
'monte_snr10.fits', NTRIAL=10000L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2003 Written by SHF
Aug2006 -- Modified for PDLA
(See SDSS/DLA/sdss_dla.pro)
NAME:
sdss_dladx
Version 1.1
PURPOSE:
Calculate the cosmological path length dX for a given
cosmology for the sample of quasars searched for DLA in the SDSS.
For now, the code defaults to point at the dX vector calcualted
when we did the DR1 search (PH04).
This code can also return dz, the redshift path length.
CALLING SEQUENCE:
dX = sdss_dladx(zmin, zmax, GZFIL=, XZFIL=)
INPUTS:
zmin -- Min redshift of the bin
zmax -- Max redshift of the bin
[vprox] -- Proximity velocity (to avoid in calculation)
GZSTR= -- Structure summarizing g(z) for the quasars
GZFIL= -- Filename of the g(z) file for the quasars
XZFIL= -- Filename of the dX calculation as a function of z.
RETURNS:
dX -- The cosmological pathlength
OUTPUTS:
OPTIONAL KEYWORDS:
BUFF= -- Require DLA occur BUFF km/s to the red of z1
OPTIONAL OUTPUTS:
dz= -- Redshift pathlength instead of dX
COMMENTS:
The program keys off the number of elements in v1
EXAMPLES:
writecol, 'arrays.dat', array1, array2
PROCEDURES CALLED:
REVISION HISTORY:
15-March-2004 Written by JXP
(See SDSS/DLA/sdss_dladx.pro)
NAME:
sdss_dladx
Version 1.1
PURPOSE:
Calculate the cosmological path length dX for a given
cosmology for the sample of quasars searched for DLA in the SDSS.
For now, the code defaults to point at the dX vector calcualted
when we did the DR1 search (PH04).
This code can also return dz, the redshift path length.
CALLING SEQUENCE:
dX = sdss_dladx(zmin, zmax, GZFIL=, XZFIL=)
INPUTS:
zmin -- Min redshift of the bin
zmax -- Max redshift of the bin
[vprox] -- Proximity velocity (to avoid in calculation)
GZSTR= -- Structure summarizing g(z) for the quasars
GZFIL= -- Filename of the g(z) file for the quasars
XZFIL= -- Filename of the dX calculation as a function of z.
RETURNS:
dX -- The cosmological pathlength
OUTPUTS:
OPTIONAL KEYWORDS:
BUFF= -- Require DLA occur BUFF km/s to the red of z1
OPTIONAL OUTPUTS:
dz= -- Redshift pathlength instead of dX
COMMENTS:
The program keys off the number of elements in v1
EXAMPLES:
writecol, 'arrays.dat', array1, array2
PROCEDURES CALLED:
REVISION HISTORY:
15-March-2004 Written by JXP
(See SDSS/LLS/sdss_sllsdx.pro)
NAME:
sdss_dlastat
PURPOSE:
Given a DLA struct and gz list, determine the indices of those
DLA satisfying the statistical sample.
CALLING SEQUENCE:
sdss_dlastat
INPUTS:
dlastr -- Structure of SDSS DLAs
gzstr -- Structure containing g(z) info
[vprox] -- Proximity velocity (to avoid in calculation)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/ALL -- Return all DLA and candidates
BUFF= -- Require DLA occur BUFF km/s to the red of z1
VMAX= -- Require the DLA occur at less than VMAX km/s of z_em
(for PDLA searches)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
Nov-2004 Written by JXP
(See SDSS/DLA/sdss_dlastat.pro)
NAME:
sdss_dlastrct
Version 1.1
PURPOSE:
Produces a DLA structure of SDSS DLAs
CALLING SEQUENCE:
sdss_dlastrct, dla
INPUTS:
GZSTR= -- Structure summarizing g(z) for the quasars
GZFIL= -- Filename of the g(z) file for the quasars
RETURNS:
dla -- DLA structure
OUTPUTS:
OPTIONAL KEYWORDS:
/ACAND -- Return all absorbers (not just DLA)
/ALL -- Return all statistical DLA from all DRs
vprox= -- Proximity velocity (to avoid in calculation)
BUFF= -- Require DLA occur BUFF km/s to the red of z1
/DR3 -- Return DLA from DR3 (but not DR2 or DR1 unless indicated)
/DR5 -- Return DLA from DR4,DR5 (but not early data releases
unless indicated)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_uniqdla, dr1, dr2, uni
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-Nov-2004 Written by JXP
(See SDSS/DLA/sdss_dlastrct.pro)
NAME:
sdss_dla_2
Version 1.1
PURPOSE:
Main routine to search for DLA in SDSS spectra (or ESI). This
version is used primarily with the Monte-Carlo simulations.
CALLING SEQUENCE:
sdss_dla_2, flux, wave, sig, i, zabs, n1=, n2=, ESI=, $
SDSS=, WIN_REST=, /PFLUX, /SMOOTH, /NORM, SIGV=, $
STRCT=, ZEM=
INPUTS:
flux -- QSO flux array
wave -- QSO wavelength array
sig -- QSO error array
i -- INDEX of QALstrct
RETURNS:
OUTPUTS:
outfil -- FITS file with the qalstrct
OPTIONAL KEYWORDS:
n1= -- Sigma value below which a pix is good [default: code determines]
n2= -- Sigma value above which a pix is bad in the DLA profile [default: 5]
SIGV= -- Sigma value to add to flux of all pixels
SDSS= -- Name of SDSS file to examine
/PFLUX -- Plot the spectrum
WIN_REST -- Width of DLA window (angstroms)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_comptst, '/data5/SDSS/DR1_QSO/spectro/1d/0463/0463-51312-122.fit',
'monte_snr10.fits', NTRIAL=10000L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2003 Written by SHF
(See SDSS/DLA/sdss_dla_2.pro)
NAME: sdss_dr1_goz PURPOSE: g(z) prescription for DR1. OBSOLETE CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 27-Feb-2004 Written by SHF
(See SDSS/DLA/sdss_dr1_goz.pro)
NAME: sdss_ewciv Version 1.1 PURPOSE: Measures the EW of the CIV lines (rest values) in the SDSS CALLING SEQUENCE: sdss_ewciv, wave, flux, sig, strct, ZABS= INPUTS: wave -- Wavelength array flux -- Flux array (normalized) sig -- Sigma array RETURNS: strct -- MgII structure with MgII EW filled up OUTPUTS: OPTIONAL KEYWORDS: ZABS= -- Absorption redshift (required) OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 27-Feb-2004 Written by JXP
(See SDSS/CIV/sdss_ewciv.pro)
NAME: sdss_ewmgii Version 1.1 PURPOSE: Measures the EW of the MgII lines (rest values) in the SDSS CALLING SEQUENCE: sdss_ewmgii, wave, flux, sig, strct, ZABS= INPUTS: wave -- Wavelength array flux -- Flux array (normalized) sig -- Sigma array RETURNS: strct -- MgII structure with MgII EW filled up OUTPUTS: OPTIONAL KEYWORDS: ZABS= -- Absorption redshift (required) /TI2 -- Also measure TiII if it is present /ONLYTI2 -- Only measure TiII if it is present OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 27-Feb-2004 Written by JXP
(See SDSS/MgII/sdss_ewmgii.pro)
NAME: sdss_ewna1 Version 1.1 PURPOSE: Measures the EW of the MgII lines (rest values) in the SDSS CALLING SEQUENCE: sdss_ewna1, wave, flux, sig, strct, ZABS= INPUTS: wave -- Wavelength array flux -- Flux array (normalized) sig -- Sigma array RETURNS: strct -- MgII structure with MgII EW filled up OUTPUTS: OPTIONAL KEYWORDS: ZABS= -- Absorption redshift (required) OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 27-Feb-2004 Written by JXP
(See SDSS/NaI/sdss_ewna1.pro)
NAME: sdss_filter_nu PURPOSE: CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 2005 Written by Joe Hennawi UCB
(See SDSS/Photo/sdss_filter_nu.pro)
NAME:
sdss_finchk
Version 1.1
PURPOSE:
GUI used to make a final check of metal-strong candidates
CALLING SEQUENCE:
sdss_finchk, dlafil, con_dir, MAG=mag, XSIZE=, YSIZE=,
OUTFIL=outfil, RA=ra
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
MAG= -- Largest magnitude to include in the check
RA= -- 2-element array giving constraint on RA
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_finchk, 'dla_dr1.fits', 'ABSLIN/'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Oct-2003 Written by JXP
(See SDSS/DLA/sdss_finchk.pro)
NAME:
sdss_fixciv
Version 1.0
PURPOSE:
Visually check SDSS CIV absorption detected with sdss_fndciv
Edit EW and continuum as desired
CALLING SEQUENCE:
sdss_fixciv,
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_fixciv
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
1-Dec-2008 Written by JXP
(See SDSS/CIV/sdss_fixciv.pro)
NAME:
sdss_fixmgii
Version 1.0
PURPOSE:
Visually check SDSS CIV absorption detected with sdss_fndciv
Edit EW and continuum as desired
CALLING SEQUENCE:
sdss_fixmgii,
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 1000)
YSIZE - Size of gui in screen y-pixels (default = 600)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_fixmgii
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
1-Dec-2008 Written by JXP
(See SDSS/MgII/sdss_fixmgii.pro)
NAME:
sdss_fix_rep
Version 1.1
PURPOSE:
Remove repeat entries from the 'checked' file of QAL. Defaulted
to deal with DR2 using dr2_bd.list
CALLING SEQUENCE:
sdss_fix_rep, fil=, bdlst=, new=new
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
FIL= -- File name of file including duplicates
BDLST= -- List of indices which are to be removed
NEW= -- Name of new DR2_chkd file [default: 'DR2_chkd.fits']
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Apr-2004 Written by SHF
(See SDSS/General/sdss_fix_rep.pro)
NAME:
sdss_fndciv
Version 1.0
PURPOSE:
Brute force algorithm which examines the absorption lines
detectedin a SDSS spectrum and searches for matches with CIV
CALLING SEQUENCE:
sdss_fndciv, abswav
INPUTS:
abswav - Array of observed wavelengths of detected absorption lines
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/CIV/sdss_fndciv.pro)
NAME:
sdss_fndla
PURPOSE:
Calculates f(N,X) for a set of DLA
CALLING SEQUENCE:
INPUTS:
GZSTR= -- Structure summarizing g(z) for the quasars
GZFIL= -- Filename of the g(z) file for the quasars
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/DR3 -- Restrict to DR3
/NODBL -- Do not solve for double power-law
CL= -- Confidence limits for error calculations
ZBIN= -- redshift interval [default: 2.2 to 5.5]
/SALL -- Use all of the DR releases
BINS -- NHI bins
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
20-Aug-2006 Written by JXP (based on fig_fndla)
(See SDSS/DLA/sdss_fndla.pro)
NAME:
sdss_fndlls
Version 1.0
PURPOSE:
Searches SDSS QSO spectra for LLS absorption.
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2005 Written by JO
(See SDSS/LLS/sdss_findlls.pro)
NAME:
sdss_fndqso
Version 1.1
PURPOSE:
Return the indices of the QAL structure corresponding to fiber,id
CALLING SEQUENCE:
indx = sdss_fndqso(qalstr, platfib, /ALL)
INPUTS:
fibid -- 2 element vector of plate,fiberid
RETURNS:
indices in qalstr matching indx
OUTPUTS:
OPTIONAL KEYWORDS:
/ALL -- Return all QSO's with the same ra,dec and redshift
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
indx = sdss_fndqso(qalstr, [424,124], /all)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Oct-2004 Written by JXP
(See SDSS/General/sdss_fndqso.pro)
NAME:
sdss_getqmag
Version 1.1
PURPOSE:
Return the magnitude of a QSO with plate+fiber
CALLING SEQUENCE:
mag = sdss_getqmag(qalstr, platfib, /ALL)
INPUTS:
RETURNS:
mag -- Array of u-z magnitudes for SDSS QSO
OUTPUTS:
OPTIONAL KEYWORDS:
QSOFIL= -- File containing the QSO summary FITS table [default:
dr5_qso.fits]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mag = sdss_getqmag([424,124])
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Oct-2004 Written by JXP
(See SDSS/General/sdss_getqmag.pro)
NAME:
sdss_goz
PURPOSE:
Determines the g(z) path for each QSO in the inputted list
CALLING SEQUENCE:
sdss_goz, qalfil, outfil
INPUTS:
qalfil -- Filename of QSO structure for g(z) calculation
XZFIL= -- Filename of the dX calculation as a function of z.
RETURNS:
OUTPUTS:
OUTFIL= -- Filename for g(z) FITS file
OPTIONAL KEYWORDS:
ORIG_ZEM= -- Use the original redshifs from SDSS (in this file)
SNRLMT= -- SNR limit for DLA search [default: 4]
OPTIONAL OUTPUTS:
/CHK -- Plot g(z) to the screen
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by SHF
14-Oct-2004 Modified by JXP
(See SDSS/DLA/sdss_goz.pro)
NAME:
sdss_hizmedian
Version 1.0
PURPOSE:
Calculates a median QSO spectrum for a set of high z SDSS QSOs
CALLING SEQUENCE:
sdss_hizmedian, DR3_fits, new_template, szstart=, szend=
INPUTS:
DR3_fits -- Filename of qso file
RETURNS:
OUTPUTS:
new_template -- Filename of median spectrum (FITS file)
OPTIONAL KEYWORDS:
DR3PATH -- Path to the DR3 data
szstart -- Starting redshift for the stack
szend -- Ending redshift for the stack
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JO
(See SDSS/LLS/sdss_hizmedian.pro)
NAME:
sdss_hiztemplate
Version 1.0
PURPOSE:
Calculates a template QSO spectrum for a set of high z SDSS QSOs
I am not sure how this is different than sdss_hizmedian, but I
suspect this is the better routine.
CALLING SEQUENCE:
sdss_hizmedian, DR3_fits, new_template, szstart=, szend=
INPUTS:
DR3_fits -- Filename of qso file
RETURNS:
OUTPUTS:
new_template -- Filename of median spectrum (FITS file)
OPTIONAL KEYWORDS:
DR3PATH -- Path to the DR3 data
szstart -- Starting redshift for the stack
szend -- Ending redshift for the stack
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JO
(See SDSS/LLS/sdss_hiztemplate.pro)
NAME:
sdss_llsdx
Version 1.1
PURPOSE:
Calculate the cosmological path length dX for a given
cosmology for the sample of quasars searched for LLS in the SDSS.
This code can also return dz, the redshift path length.
CALLING SEQUENCE:
dX = sdss_llsdx(zmin, zmax, GZFIL=, XZFIL=)
INPUTS:
zmin -- Min redshift of the bin
zmax -- Max redshift of the bin
[vprox] -- Proximity velocity (to avoid in calculation)
GZSTR= -- Structure summarizing g(z) for the quasars
GZFIL= -- Filename of the g(z) file for the quasars
XZFIL= -- Filename of the dX calculation as a function of z.
RETURNS:
dX -- The cosmological pathlength
OUTPUTS:
OPTIONAL KEYWORDS:
BUFF= -- Require DLA occur BUFF km/s to the red of z1
OPTIONAL OUTPUTS:
dz= -- Redshift pathlength instead of dX
COMMENTS:
The program keys off the number of elements in v1
EXAMPLES:
writecol, 'arrays.dat', array1, array2
PROCEDURES CALLED:
REVISION HISTORY:
Feb-2009 Written by JXP
(See SDSS/LLS/sdss_llsdx.pro)
NAME:
sdss_llsfit
Version 1.11
PURPOSE:
GUI used to fit DLA profiles interactively. The user determines
the continuum at the same time.
CALLING SEQUENCE:
sdss_llsfit, flux_fil, [err_fil], XSIZE=, YSIZE=, TITLE=,
WAVE=, /BLOCK, FWHM=, INIFIT=, INFLG=
INPUTS:
flux_fil - FITS file (or array) containing flux
[err_fil] - FITS error array
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
wave - wavelength array
FWHM= - Resoltuion (FWHM in pixels) [default: 2]
INFLG= - Usual flag for reading the FITS file (see x_readspec)
INIFIT= - IDL file containing a saved version of the fit
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_llsfit, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Oct-2002 Written by JXP
(See SDSS/LLS/sdss_llsfit.pro)
NAME:
sdss_llsfn
PURPOSE:
Given a LLS struct and gz list, calculate f(N)
CALLING SEQUENCE:
sdss_llsfn
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
Nov-2004 Written by JXP
(See SDSS/LLS/sdss_llsfn.pro)
NAME:
sdss_llsgoz
PURPOSE:
Determines the g(z) path for a LLS search
CALLING SEQUENCE:
sdss_llsgoz
INPUTS:
qalfil -- Filename of QSO structure for g(z) calculation
RETURNS:
OUTPUTS:
OUTFIL= -- Filename for g(z) FITS file
OPTIONAL KEYWORDS:
ORIG_ZEM= -- Use the original redshifs from SDSS (in this file)
SNRLMT= -- SNR limit for DLA search [default: 2]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_llsgoz, '../dr5_qso.fits', 'dr5_lls_goz_sn2.fits'
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by SHF
14-Oct-2004 Modified by JXP
(See SDSS/LLS/sdss_llsgoz.pro)
NAME:
sdss_llsinit
Version 1.0
PURPOSE:
Produces a LLS structure of SDSS LLS
CALLING SEQUENCE:
sdss_llsstrct, lls
INPUTS:
RETURNS:
lls -- LLS structure
OUTPUTS:
OPTIONAL KEYWORDS:
QSOS= -- Structure of statistical QSOs in the sample
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
16-Feb-2010 Written by JXP
(See SDSS/LLS/sdss_llsinit.pro)
NAME:
sdss_llslozx
PURPOSE:
Calculate dn/dz or dn/dX for a set of redshift bins
CALLING SEQUENCE:
sdss_llslozx
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
Jul-2009 Written by JXP
(See SDSS/LLS/sdss_llslozx.pro)
NAME:
sdss_llsnchk
PURPOSE:
Launches x_specplot to fiddle (and set) the redshift of a LLS in
SDSS given the LLS structure.
CALLING SEQUENCE:
sdss_llszchk
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
30-May-2007 Modified by JXP
(See SDSS/LLS/sdss_llsnchk.pro)
NAME:
sdss_llsstrct
Version 1.0
PURPOSE:
Produces a LLS structure of SDSS LLS
CALLING SEQUENCE:
sdss_llsstrct, lls
INPUTS:
RETURNS:
lls -- LLS structure
OUTPUTS:
OPTIONAL KEYWORDS:
QSOS= -- Structure of statistical QSOs in the sample
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
16-Feb-2010 Written by JXP
(See SDSS/LLS/sdss_llsstrct.pro)
NAME:
sdss_llsview
Version 1.1
PURPOSE:
GUI used to check for (and designate) BAL quasars from SDSS
CALLING SEQUENCE:
sdss_llsview, qalfil, IQSO=, XSIZE=, YSIZE=, /RECHK
INPUTS:
qalfil -- Name of FITS file containing the QAL structure
RETURNS:
OUTPUTS:
qalfil -- With the BAL info modified accordingly
OPTIONAL KEYWORDS:
IQSO -- Number of the first QSO to start with [default: 0L]
/RECHK -- Only plot thos QSOs identified as BAL previously
MATCHFIL -- to skip QSOs that have already been checked
(see sdss_balupdate.pro)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_llsview, 'DR2_QSO/sdss_DR2_QAL.fits', MATCHFIL='DR2_QSO/matched.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Feb-2004 Written by JXP
07-Jun-2004 Revised by SHF
(See SDSS/LLS/sdss_llsview.pro)
NAME:
sdss_llszchk
PURPOSE:
Launches x_specplot to fiddle (and set) the redshift of a LLS in
SDSS given the LLS structure.
CALLING SEQUENCE:
sdss_llszchk
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
30-May-2007 Modified by JXP
(See SDSS/LLS/sdss_llszchk.pro)
NAME:
sdss_m912
PURPOSE:
Compute the apparent magnitude one would measure at the
Lyman limit in the observed frame at lambda = (1 + z)912
CALLING SEQUENCE:
m_912 = m912(z,m,filter,[ logLv = , ALPHA_EUV = , OMEGA0 = , LAMBDA0 = $
, W = , LIT_H = ])
INPUTS:
z - Redshift of the quasar
m - Apparent magnitude
filter - filter name SDSS [u,g,r,i,z,B,B_J]
OPTIONAL KEYWORDS:
logLv - Log_10 of the specific luminosity at the Lyman edge (ergs/s/Hz)
ALPHA_EUV - Spectral slope in the extreme UV. Default is 1.57
(Tefler et al 2002). A power law v^{-ALPHA_EUV}
is pasted onto the quasar spectrum at 1285 A.
OMEGA0 - Matter density. Default is 0.27
LAMBDA0 - Dark energy density. Default is 0.73
W - Equation of state parameter. Default is w = -1.0
LIT_H - Hubble h parameter. Required if logLv is specified
OUTPUTS:
m_912 - Apparent magnitude one would measure at the Lyman
limit in the observed frame at lambda = (1 + z)912
COMMENTS:
The code will return an error if one tries to use a filter with
lambda_min < (1 + z)*1216. The lyman alpha forest will reduce the
observed apparent magnitude, and the mean flux blueward of 1216
is not reproduced correctly in the quasar template used here.
EXAMPLE:
Compute m_912 for a quasar at z=2.43 which has g=20.5
m_912=m912(2.43,20.5,1,logLv=logLv)
print,m_912
22.199551
print,loglv
29.812608
PROCEDURES CALLED:
dofa()
sdss_filter_nu()
qso_template_nu()
obs_int_nu()
REVISION HISTORY:
17-Sep-2005 Written by Joe Hennawi UCB
(See SDSS/m912/sdss_m912.pro)
NAME:
sdss_metals
Version 1.1
PURPOSE:
Identify metal-line systems given a set of absorption lines
CALLING SEQUENCE:
sdss_metals, abswave, zem, WAVE=, FLUX=, QSTRCT=
INPUTS:
abswave -- Absorption line array
zem -- Emission redshift of the QSO
RETURNS:
OUTPUTS:
QSTRCT= -- Structure containing the key output of this routine
OPTIONAL KEYWORDS:
WAVE= -- Wavelength array for plotting (not required)
FLUX= -- Flux array for plutting (not required)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Apr-2004 Written by SHF
(See SDSS/General/sdss_metals.pro)
NAME:
sdss_mgii
Version 1.0
PURPOSE:
Brute force algorithm which examines the absorption lines
detectedin a SDSS spectrum and searches for matches with MgII
CALLING SEQUENCE:
sdss_fndciv, abswav
INPUTS:
abswav - Array of observed wavelengths of detected absorption lines
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/MgII/sdss_mgii.pro)
NAME:
sdss_mgiisearch
Version 1.0
PURPOSE:
Given a list of SDSS quasars, search these spectra for MgII
absorbers and output a structure of detections and EWs
CALLING SEQUENCE:
INPUTS:
filename - File containing a (long) list of SDSS quasar data files
(1d spectra, .fit)
SDSSSUM= - Summary file of QSO properties [required]
INIFIL= - File containing the MgII structure which was created
previously. These will not be redone.
RETURNS:
OUTPUTS:
outfil - Name for outputted structure of MgII absorbers
OPTIONAL KEYWORDS:
/LZ -- Restrict to low redshift (z = 0.45)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_mgiisearch, 'Lists/dr6_qso.list', 'DR6_QSO/', 'dr6_qso.fits', 'mgii_search.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/MgII/sdss_mgiisearch.pro)
NAME:
sdss_mkllstmpl
PURPOSE:
Routine to make a series of LLS absorption templates by only
varying NHI
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by JXP
(See SDSS/LLS/sdss_mkllstmpl.pro)
NAME:
sdss_na1search
Version 1.0
PURPOSE:
Given an array of strings, return an array of unique values +
number
CALLING SEQUENCE:
uniq = x_chkfil(strings, COUNT=count)
INPUTS:
strings - Array of strings
RETURNS:
uniq - Array of unique members
OUTPUTS:
OPTIONAL KEYWORDS:
sort - Sort the output
OPTIONAL OUTPUTS:
COUNT - number of unique strings
COMMENTS:
EXAMPLES:
flg = x_chkfil( lbls, count=count)
sdss_na1search, 'Lists/dr3_abs.lst', 'sdss_DR3_NaI.fits',
SDSSSUM='dr3_qso.fits', DATR='DR3_QSO/'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/NaI/sdss_na1search.pro)
NAME: sdss_newzem Version 1.1 PURPOSE: Returns the new QSO redshift if a new one has been calculated. The redshifts generally come from the Shin et al. 2007 prescription. CALLING SEQUENCE: zem = sdss_newzem(zmin, zmax, GZFIL=, XZFIL=) INPUTS: plate -- Plate fiber -- Fiber RETURNS: zem -- New QSO emission redshift OUTPUTS: OPTIONAL KEYWORDS: /FMATCH -- Demand that there is a match OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 10-Nov-2005 Written by JXP
(See SDSS/General/sdss_newzem.pro)
NAME:
sdss_objinf
Version 1.1
PURPOSE:
Routine to quickly parse the SDSS QSO database.
CALLING SEQUENCE:
sdss_objinf, names, SUMMF=, /PLOT, DATDIR=, $
FILNM=, CHKDF=, PATH=, ZEM=,$
RMAG=, RA=, DEC=, /SILENT, /NMRAD
INPUTS:
names -- List of filenames or 2-element array giving plate and fiber
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
SUMMF= -- Summary file [default: 'sdss2_qsoi205.fits']
PATH= -- Path to SDSS data [default: 'SDSSPATH'+'/DR2_QSO']
DATDIR= -- Data directory [default: 'spectro/1d_23']
/NMRAD -- Input is ['RA:::', 'DED:::']
/DECI -- Input is [rad, decd]
/DR1 -- Check the DR1 list (r <= 19.5)
ZIN= -- Input redshift for plotting
SDSS= -- Structure contaning the QSO info
/LLS -- Use the LLS line list
/QSO -- Use the quasar line list
/PHOTOM -- Print all photometry
OPTIONAL OUTPUTS:
FILNM= -- File name of the data
RA= -- RA of the QSO
DEC= -- DEC of the QSO
FLGSDSS= -- Flag signifying success (1) or failure (0)
COMMENTS:
EXAMPLES:
sdss_objinf, '0571-52286-276', /plot
sdss_objinf, [463, 95], filnm=filnm
sdss_objinf, ['12:00:21.3', '+32:22:12'], /nmrad
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Nov-2003 Written by JXP
(See SDSS/General/sdss_objinf.pro)
NAME:
sdss_omgdla
PURPOSE:
Calculates the first moment of f(N,X) [i.e. Omega_DLA]
Includes He as the default
CALLING SEQUENCE:
sdss_omgdla, GZFIL=, PEROUX=, MODELS=, STRCT=, BINS=, VPROX=, DR3=, ALL=
INPUTS:
GZFIL= -- Filename of the g(z) file for the quasars
RETURNS:
OUTPUTS:
STRCT= -- Structure summarizing the calculation
OPTIONAL KEYWORDS:
BINS= -- Redshift intervals, e.g. [ [1,2], [2,3]]
/PEROUX -- Include DLAs in Peroux03 in the stats
/DR3 -- Restrict the DLAs to DR3
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
14-Nov-2006 Written by JXP (based on fig_omega)
(See SDSS/DLA/sdss_omgdla.pro)
NAME:
sdss_proxgoz
PURPOSE:
Determines the g(z) path for each QSO in the inputted list.
Restrict to the proximate DLAs
CALLING SEQUENCE:
sdss_proxgoz
INPUTS:
qalfil -- Filename of QSO structure for g(z) calculation
XZFIL= -- Filename of the dX calculation as a function of z.
RETURNS:
OUTPUTS:
OUTFIL= -- Filename for g(z) FITS file
OPTIONAL KEYWORDS:
ORIG_ZEM= -- Use the original redshifs from SDSS (in this file)
SNRLMT= -- SNR limit for DLA search [default: 4]
OPTIONAL OUTPUTS:
/CHK -- Plot g(z) to the screen
COMMENTS:
EXAMPLES:
sdss_proxgoz, 'sdss_dr3_QAL.fits', 'dr3_proxdlagz_s2n4.fits'
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2004 Written by SHF
14-Oct-2004 Modified by JXP
(See SDSS/DLA/sdss_proxgoz.pro)
NAME:
sdss_qsoflux
PURPOSE:
Measure the QSO fluxes for the QAL structure and fill up the
appropriate tag. Uses SDSS photometry
CALLING SEQUENCE:
sdss_qsoflux, qalfil
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
04-Jan-2005 Written by JXP
(See SDSS/General/sdss_qsoflux.pro)
NAME:
sdss_qsolin
Version 1.0
PURPOSE:
Fits a continuum to SDSS QSO spectroscopic data interactively
using a PCA as a guess for the Lya and CIV emission lines. The
code then automoatically searches for absorption line features
redward of Lya.
CALLING SEQUENCE:
sdss_qsolin, sdss_list
INPUTS:
sdss_list -- List of QSOs to analyze
RETURNS:
OUTPUTS:
One FITS file per QSO which contains the continuum and a list of
absorption lines detected
OPTIONAL KEYWORDS:
LSNR= -- Statistical significance for an absorption line feature
[default: 3.5]
/NOPLOT -- Do not plot to screen
/REDO -- Redo the search even if the file exists
/NOCOMPRESS -- Do not gzip suprress the output
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
parse_sdss, fil
sdss_qsolin, 'dr1_fit.lst', OUTDIR='ABSLIN/', /noplt
sdss_qsolin, 'dr3_fit.list', OUTDIR='ABSLIN/', /noplt
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
09-Sep-2003 Written by JXP
(See SDSS/General/sdss_qsolin.pro)
NAME:
sdss_qsostrct
Version 1.1
PURPOSE:
Routine to quickly grab the SDSS QSO structure
CALLING SEQUENCE:
sdss_objinf, names, SUMMF=, /PLOT, DATDIR=, $
FILNM=, CHKDF=, PATH=, ZEM=,$
RMAG=, RA=, DEC=, /SILENT, /NMRAD
INPUTS:
names -- List of filenames or 2-element array giving plate and fiber
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
qso = sdss_qsostrct()
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Mar-2010 Written by JXP
(See SDSS/General/sdss_qsostrct.pro)
NAME:
sdss_qsotempl
PURPOSE:
Extrapoles a continuum for a SDSS QSO in the Lya forest based on
a template, a fit to the QSO slope and the known average
absorption by the Lya forest.
CALLING SEQUENCE:
sdss_qsotempl
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
ORIG_ZEM = Use the original redshifs from SDSS (in this file)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
27-Feb-2005 Written by JO
14-Oct-2006 Modified by JXP
(See SDSS/General/sdss_qsotempl.pro)
NAME: sdss_queryimage PURPOSE to query SDSS image SYNTAX sdss_queryimage, ra, dec [, scale , xs=xs, ys=ys, /gridoff, /labeloff] INPUTS ra: right ascension (J2000 decimal degrees) dec: declination (J2000 decimal degrees) scale: plate scale (arcsec/pixel) [default to .3961] KEYWORDS filename: name of filt to be written to [default to temp.jpeg] xs: xsize (in pixels) [default to 512] ys: y size (in pixels) [default to 512] labeloff: if set leaves off label gridoff: if set leaves off Gid RETURNS: jpeg of the image OPTIONAL OUTPUTS FILENAME= writes a file to the filename given by the keyword NOTES by default gives you pretty picture of blue spiral galaxy (default SDSS image) with ra=18.87667, dec=-0.86083 Written by R. da Silva, UCSC, 3-11-09
(See SDSS/General/sdss_queryimage.pro)
NAME:
sdss_repeats
Version 1.1
PURPOSE:
Identify repeats in DLA/MSDLA candidates in the the checked file (default: DR2)
CALLING SEQUENCE:
sdss_repeats, fil
INPUTS:
fil -- Name of checked file
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by SHF
(See SDSS/General/sdss_repeats.pro)
NAME:
sdss_search
Version 1.1
PURPOSE:
Main program which drives the search for LLS, DLA and metal-line systems
CALLING SEQUENCE:
sdss_search, filename, outfil, ESIF=, SDSSSUM=, ZMIN=, $
RMAX=, SDSSPATH=
INPUTS:
filename -- ASCII file listing all SDSS quasars
RETURNS:
OUTPUTS:
outfil -- Name of QAL file
OPTIONAL KEYWORDS:
ZMIN= -- Minimum redshift to search
RMAX= -- Maximum magnitude to include [default: 21.]
INIFIL= -- Name of QAL file (good to restart after a 'bomb')
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
flg = x_chkfil( lbls, count=count)
sdss_search, 'Lists/dr3_abs.lst', 'sdss_DR3_QAL.fits',
SDSSSUM='dr3_qso.fits'
PROCEDURES/FUNCTIONS CALLED:
sdss_dla
sdss_metals
REVISION HISTORY:
07-May-2002 Written by JXP
(See SDSS/DLA/sdss_search.pro)
NAME:
sdss_searchlls
PURPOSE:
Search for LLS in the SDSS QSO distribution
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
2005 Written by JO + JXP
(See SDSS/LLS/sdss_searchlls.pro)
NAME:
sdss_sllsstat
PURPOSE:
Given a LLS struct and gz list, determine the indices of those
LLS satisfying the statistical sample.
CALLING SEQUENCE:
sdss_llsstat
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
Nov-2004 Written by JXP
(See SDSS/LLS/sdss_sllsstat.pro)
NAME:
sdss_uniqdla
Version 1.1
PURPOSE:
Finds those entires unique in data set 2
CALLING SEQUENCE:
sdss_uniqdla, data1, data2, uni
INPUTS:
data1 -- DLA structure
data2 -- DLA structure
RETURNS:
uni -- Unique index in data2
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sdss_uniqdla, dr1, dr2, uni
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-Nov-2004 Written by JXP
(See SDSS/DLA/sdss_uniqdla.pro)
NAME:
sdss_wave
Version 1.1
PURPOSE:
Create a wavelength array for SDSS data
CALLING SEQUENCE:
sdss_wave, wave, pxiels=, iwave=
INPUTS:
RETURNS:
wave -- Wavelength array
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by SHF
(See SDSS/General/sdss_wave.pro)
NAME:
skyspec_paranal
PURPOSE:
Return the sky spectrum at Paranal
CALLING SEQUENCE:
skyflux = skyspec_paranal(loglam, [ disp= ] )
INPUTS:
loglam - Log10 of wavelengths [vacuum Ang]; need not be uniformly
spaced
OPTIONAL INPUTS:
disp - Sigma of the intrumental response (dispersion) in units
of the LOGLAM pixels, either as a scalar, or as a vector
with the same number of elements as LOGLAM.
If not set, then the returned sky spectrum is at the
resolution of the Paranal data files, and will be
undersampled for any resolution worse than about 100,000.
OUTPUTS:
skyflux - Sky spectrum in units of e-17 erg/s/cm^2/Ang/asec^2
OPTIONAL OUTPUTS:
COMMENTS:
The lowest sky level is on plate 1292/52736 taken at airmass=1.04.
A representative low sky level is plate 406/51817.
A high sky level is plate 298/51955.
EXAMPLES:
BUGS:
The Paranal sky spectra are missing data from 8550-8610 Ang.
There are a few regions where their spectra are not in agreement
with the lower-resolution SDSS sky spectra such as at 7600-7650 Ang,
probably because the SDSS spectra "correct up" the sky level for
the telluric absorption. Also, the Paranal sky is higher than SDSS
by about a factor of 2 blueward of 4800 Ang.
DATA FILES:
$IDLSPEC2D_DIR/templates/fluxed_sky_346.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_580L.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_860L.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_437.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_580U.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_860U.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_564U.fits
$IDLSPEC2D_DIR/templates/fluxed_sky_800U.fits
PROCEDURES CALLED:
djs_maskinterp()
mrdfits()
populate_image
sxpar()
REVISION HISTORY:
20-Mar-2006 Written by D. Schlegel, LBL
17-Mar-2008 Bastardized by JXP for Lick
(See Lick/Kast/Calibs/skyspec_lick.pro)
NAME:
specobjstrct__define
Version 1.1
PURPOSE:
This routine creates a structure to describe the spectrum for an
object in a given slit
CALLING SEQUENCE:
tmp = {specobjstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Slits//specobjstrct__define.pro)
NAME:
stdstruct__define
Version 1.1
PURPOSE:
Structure to handle observations of Standard stars
CALLING SEQUENCE:
tmp = {stdstruct}
INPUTS:
RETURNS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/Photometry//stdstruct__define.pro)
NAME:
strctcldy__define
V1.1
PURPOSE:
Named IDL Structure for Cloudy output
CALLING SEQUENCE:
tmp = {strctcldy}
REVISION HISTORY:
31-May-2001 Written by JXP
(See Cloudy//strctcldy__define.pro)
NAME: STRINGIFY PURPOSE: This function converts a real value into a string based on the specified format. CATEGORY: Formatting. CALLING SEQUENCE: Result = STRINGIFY( Value, Format) INPUTS: Value Value which is to be converted. OPTIONAL INPUTS: Format Optional format statement OUTPUTS: This function returns a string version of the input array with leading and trailing spaces removed. RESTRICTIONS: None EXAMPLE: 1) format a number into a string: label = "X=" + stringify(x) 1) format a number into a string, with formatting: label = "X=" + stringify(x,'(f15.3)') AUTHOR: Gregory D. Wirth, W. M. Keck Observatory MODIFICATION HISTORY: 1999-Dec-14 GDW Original version
(See Keck/LRIS/General/x_readmhdufits.pro)
NAME:
synthspec
PURPOSE:
Construct synthetic spectrum from eigen-templates. Stolen from
the SDSS codes.
CALLING SEQUENCE:
synflux = synthspec(zans, [ loglam=, hdr=, eigendir= ])
INPUTS:
zans - Structure(s) with redshift-fit information (from SPREDUCE1D).
OPTIONAL KEYWORDS:
loglam - Log-10 wavelengths at which to synthesize the spectrum;
this can either be a single vector if all spectra have
the same wavelength mapping, or an array of [NPIX,NOBJ].
hdr - If specified, then use this header to construct LOGLAM.
Either LOGLAM or HDR must be specified.
eigendir - Directory for EIGENFILE; default to $IDLSPEC2D/templates.
OUTPUTS:
synflux - Synthetic spectra
COMMENTS:
The sub-pixel shifts are applied with the COMBINE1FIBER procedure.
EXAMPLES:
BUGS:
DATA FILES:
$IDLSPEC2D_DIR/etc/TEMPLATEFILES
PROCEDURES CALLED:
combine1fiber
concat_dir()
poly_array()
readfits()
sxpar()
REVISION HISTORY:
20-Aug-2000 Written by D. Schlegel, Princeton
(See Spec/Analysis//x_synthspec.pro)
NAME:
tracestrct__define
Version 1.1
PURPOSE:
This routine defines the trace structure
Not in use
CALLING SEQUENCE:
tmp = {tracestrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Rectify//tracestrct__define.pro)
NAME:
velpltstrct__define
Version 1.1
PURPOSE:
Structure that is useful for velocity plots
CALLING SEQUENCE:
tmp = {velpltstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by JXP
(See Spec/Lines//velpltstrct__define.pro)
NAME:
voigtq
Version 1.0
PURPOSE:
Creates a quick Voigt profile using code written by SB.
Not recommended for usage
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Feb-2002 Written by JXP
(See Spec/Voigt//voigtq.pro)
NAME:
voigtwal
PURPOSE:
Calculate a single voigt profile, given wavelength, absorber, and
an array of lines. I recommend x_voigt
CALLING SEQUENCE:
tau = voigtwal(wave,abs,lines)
INPUTS:
wave - Array of wavelengths to realize voigt profile
abs - single absorber
lines - line(s) structure to compute voigt profile, if mutliple,
the entire list will be looped through.
OUTPUTS:
tau - Optical depth at each wavelength
OPTIONAL OUTPUTS:
COMMENTS:
Line is a structure with:
** Structure <81a5f94>, 4 tags, length=24, refs=3:
ION STRING 'H I'
WAVE DOUBLE 1215.6701
F FLOAT 0.416400
GAMMA FLOAT 6.26500e+08
Abs must have at least :
** Structure ABS, 10 tags, length=44:
N FLOAT 15.0000 log 10 Column density
B FLOAT 5.00000 velocity dispersion (km/s)
Z FLOAT 2.00000 redshift
EXAMPLES:
BUGS:
PROCEDURES CALLED:
REVISION HISTORY:
25-May-2000 Created by S. Burles, FNAL/IAP
(See Spec/Voigt//voigtwal.pro)
NAME: vpparse Version 1.1 PURPOSE: given a vpstrct, creates a fort.13 input file for vpfit CALLING SEQUENCE: mkvpin, vpstr, FIL= INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: Written by GEP
(See Spec/Voigt//g_mkvpin.pro)
NAME: vpparse Version 1.1 PURPOSE: parses a vpfit fort.26 output file and puts data into a structure of type 'vpstrct' which holds the relavent data. CALLING SEQUENCE: vpparse, vpfil, VPSTR=vpstr INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: Written by GEP
(See Spec/Voigt//g_vpparse.pro)
NAME:
vpstrct__define
Version 1.1
PURPOSE:
creates structure to contain data from a vpfit fort.26 output file,
including flux file names, region start/stop, abs. lines, N, Nerr, etc.
For the lines, has both string and double representations of the data,
so information on 'tied' or 'locked' lines is not lost.
CALLING SEQUENCE:
tmp = {vpstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
Limits total number of regions to 500, total number of lines to 1000
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written by GEP
(See Spec/Voigt//vpstrct__define.pro)
NAME:
writecol
Version 1.1
PURPOSE:
Prints a series of arrays to a file in ASCII format
CALLING SEQUENCE:
writecol, filename, v1, v2, FMT=''
INPUTS:
file - Name of the ASCII file
v1 - Vector 1
v2 - Vector 2
[v3-v19] - Vectors 3-14
RETURNS:
OUTPUTS:
Prints v1, v2 to screen
OPTIONAL KEYWORDS:
FMT - FORTRAN formatting
FILNUM - File number (as opposed to file)
OPTIONAL OUTPUTS:
COMMENTS:
The program keys off the number of elements in v1
EXAMPLES:
writecol, 'arrays.dat', array1, array2
PROCEDURES CALLED:
REVISION HISTORY:
17-June-2001 Written by JXP
(See General//writecol.pro)
NAME:
write_dimgstr
Version 1.1
PURPOSE:
Write a dimg_struct (direct image) to an ASCII file and/or FITS file
CALLING SEQUENCE:
write_dimgstr, struct, ANONLY=anonly, OUTFIL=outfil, FITS=fits
INPUTS:
struct - A dimg_struct
RETURNS:
OUTPUTS:
OUTFIL - Output file for ASCII [default is image.list]
OPTIONAL KEYWORDS:
/ANONLY - Only print files with flg_anly NE 0
FITS= - Fits file output for the structure
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
write_dimgstr, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-July-2001 Written by JXP
29-Dec-2001 Added fits option
(See IMG/General//write_dimgstr.pro)
NAME:
x1dfit
Version 1.3
PURPOSE:
GUI for fitting a function to a set of x,y data. This
program does far too much! Warning: This was one of my first
GUIs. It works pretty well, but is a bit old.
CALLING SEQUENCE:
fit = x1dfit([xdat],ydat,func=,nord=, /inter, xsize=, ysize=)
INPUTS:
xdat - Values along one dimension [optional]
ydat - Values along the other
RETURNS:
fit - Values at each xdat
OUTPUTS:
OPTIONAL KEYWORDS:
func - String for Fitting function (POLY, LEGEND, BSPLINE,
GAUSS, CHEBY)
nord - Order of the fit
/inter - Interactive fitting
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
sig - Errors in the points
reg - Regions of data to fit
LSIG - Lower SIGMA
HSIG - High SIGMA
/REJ - Turn rejection on
DELPTS - Array of user-deleted points
MSK - Array of 0,1 values [0=do not include]
OPTIONAL OUTPUTS:
bset - Bspline info
rms - RMS of the fit (only valid for fits with rejection)
COMMENTS:
EXAMPLES:
fit = x1dfit(x, y, 'POLY', nord=5, /inter)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
BSPLINE
GAUSS
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
GETCOLOR (coyote package)
REVISION HISTORY:
22-June-2001 Written by JXP
28-June-2001 Added LEGENDRE fits (JXP)
23-Nov-2001 Added BSPLIN (SB), GAUSS, REJECTION (JXP)
31-Jan-2002 Added CHEBYSHEV
(See FIT//x1dfit.pro)
NAME:
xcombine
Version 1.2
PURPOSE:
Combines a set of images with a variety of options.
CALLING SEQUENCE:
xcombine, img, comb, [header], FCOMB=, GAIN=, RN=, MASKS=, SCALE=,
STATSEC=, MMEM=, SIGHI=, SIGLO=, MXITER=, OUTNM=, /SILENT,
WEIGHT=, IMGINDX=
INPUTS:
img -- Array of image names
RETURNS:
OUTPUTS:
comb -- Combined image
OPTIONAL KEYWORDS:
fcomb -- Binary keyword describing combine method
0,1 = Median, Avg
2 = SIG Rej
4 = Masks
8 = Weight
mmem -- Maximum memory to use at any one time [default: Approx 200Mb]
outnm -- File to write combined fits image
gain -- Gain (required for SIGMEDCLIP)
rn -- ReadNoise (required for SIGMEDCLIP)
scale -- scale: Could be array of floats, 'MED', 'AVG', or
Keyword
statsec -- Section to perform stats on (for scale)
imgindx -- Index number of image [default: 0L]
siglo -- Lower sigma for rejection [default: 3.]
sighi -- Upper sigma for rejection [default: 3.]
OPTIONAL OUTPUTS:
header -- Header of one of the files
COMMENTS:
EXAMPLES:
xcombine, all_img, comb_img
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-Jul-2001 Written by JXP
28-Jul-2001 Added masks, sigma clipping
29-Jul-2001 Added scaling, median routines
07-Jan-2002 Fixed memory leak
(See IMG/Reduction//xcombine.pro)
NAME:
xdimg_ar
Version 1.1
PURPOSE:
Reads in the first file in the directory with 'xdimg*fits'
CALLING SEQUENCE:
xdimg = xdimg_ar()
INPUTS:
RETURNS:
xdimg - WFCCD structure
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg = xdimg_ar()
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Nov-2001 Written by JXP
(See IMG/General//xdimg_ar.pro)
NAME:
xdimg_badpix
Version 1.1
PURPOSE:
Creates a bad pixel mask given a structure which contains either a flat or dark image.
CALLING SEQUENCE:
xdimg_badpix, struct
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
OUTFIL - Name of bad pixel mask file [default is e.g. 'PixMask/BadPixMask_w.fits']
NOTE: the "w" indicates NIRC2 wide camera and the "n" indicates narrow camera.
OPTIONAL KEYWORDS:
OUTFIL - Name of bad pixel mask to be created, including directory.
CCD - Name of the ccd for which a bad pixel mask should be made. ('NIRC2W' or 'NIRC2N')
DEADPERCENT - percentage of saturation to be identified as a dead pixel in a well-exposed flat frame. (default is 10%)
HOTPERCENT - percentage of saturation to be identified as a hot pixel in a dark frame. (default is 50%)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_badpix, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
XDIMG_DELCODIV
REVISION HISTORY:
11-June-2007 Written by LKP
(See IMG/Reduction//xdimg_badpix.pro)
NAME:
xdimg_bias
Version 1.1
PURPOSE:
Creates Bias frame given direct image structure (which must
contain a number of bias files!)
CALLING SEQUENCE:
xdimg_bias, struct, /SVOV, OUTFIL=
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
OUTFIL - Name of Bias file [default is 'Bias/Bias.fits']
OPTIONAL KEYWORDS:
SVOV - Save ov files (default is to delete them)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_bias, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
XDIMG_OVER
XCOMBINE
MWRFITS
XDIMG_DELOV
REVISION HISTORY:
26-July-2001 Written by JXP
(See IMG/Reduction//xdimg_bias.pro)
NAME:
xdimg_dark
Version 1.1
PURPOSE:
Creates super dark frame given direct image structure.
CALLING SEQUENCE:
xdimg_dark, struct
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
OUTFIL - Name of Dark file [default is e.g. 'Darks/Dark_n10.000_1_3_8.fits']
The 10.000 is the exposure time, the "n" indicates the narrow camera,
the "1_3_8" means coadds=1, sampmode=3, multisam=8.
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_dark, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-June-2007 Written by LKP
(See IMG/Reduction//xdimg_dark.pro)
NAME:
xdimg_darksub
Version 1.1
PURPOSE:
Dark subtracts an image.
CALLING SEQUENCE:
xdimg_darksub, struct, imgarr, /SVSTRCT
INPUTS:
struct -- dimg_strct defining the images of interest
imgarr -- integer array defining the images to be process
RETURNS:
OUTPUTS:
imgarr - fits files in the dir Coadd_divided
OPTIONAL KEYWORDS:
/svstrct -- Save the updated structure.
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_dividecoadds, nght1_strct, imgarr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-June-2007 Written by LKP
(See IMG/Reduction//xdimg_darksub.pro)
NAME:
xdimg_deldrksub
Version 1.1
PURPOSE:
Delete a set of dark subtracted images.
CALLING SEQUENCE:
xdimg_deldrksub, strct, delimg
INPUTS:
strct -- Direct image structure
delimg -- Indices of direct images
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-June-2007 Written by LKP
(See IMG/General//xdimg_deldrksub.pro)
NAME:
xdimg_delov
Version 1.1
PURPOSE:
Delete a set of OV images
CALLING SEQUENCE:
xdimg_delov, strct, delimg
INPUTS:
strct -- Direct image structure
delimg -- Indices of direct images
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Nov-2001 Written by JXP
(See IMG/General//xdimg_delov.pro)
NAME:
xdimg_dflat
Version 1.1
PURPOSE:
Creates dome flats given the direct image structure (assuming
there are dome flats in the structure)
CALLING SEQUENCE:
xdimg_dflat, struct, /IR, /SVOV, /SVDRKSUB, BPM=, OUTROOT=, /ALLOUT
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
flats - fits files in the dir Flats; 1 per filter
OPTIONAL KEYWORDS:
/SVOV - save ov files
OUTROOT - Root name of Dome flats (default is 'Flats/DFlat')
/ALLOUT - Output unnormalized frame too
BPM - Name of the bad pixel mask to apply, including directory name.
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_dflat, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
XDIMG_OVER
XCOMBINE
MWRFITS
XDIMG_DELOV
XDIMG_DELCODIV
XDIMG_DELDRKSUB
X_FILTERS
REVISION HISTORY:
18-July-2001 Written by JXP
24-Apr-2002 Allow for non-linearity
14-June-2007 Updated by LKP to allow for making flats for IR data
(See IMG/Reduction//xdimg_dflat.pro)
NAME:
xdimg_finddark
Version 1.1
PURPOSE:
Finds the superdark file associated with the requested images.
Updates the structure with the flg_drk and img_drk keywords.
CALLING SEQUENCE:
xdimg_finddark, struct, imgarr
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_finddark, struct, imgarr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
21-June-2007 Written by LKP
(See IMG/Reduction//xdimg_finddark.pro)
NAME:
xdimg_nonlinear
Version 1.0
PURPOSE:
Performs non-linear correction on a ccd image. Only setup
for SITe3 at this point.
CALLING SEQUENCE:
newimg = xdimg_nonlinear(img, ccd)
INPUTS:
img - image
ccd - (SITe3)
RETURNS:
newimg - Corrected image
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
newimg = xdimg_nonlinear(img, 'SITe3')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
24-Apr-2002 Written by JXP
(See IMG/Reduction//xdimg_nonlinear.pro)
NAME:
xdimg_objmsk
Version 1.0
PURPOSE:
Builds a sky mask for each input image using xmkmask, an
IDL gui built for this procedure.
CALLING SEQUENCE:
xdimg_skymask, struct, objimg, XSIZE=, YSIZE=, IMSK=
INPUTS:
struct -- dimg_strct defining the images of interest
objimg -- integer array defining the images to mask
RETURNS:
OUTPUTS:
skymasks -- Builds sky masks and puts them into 'Masks/Sky/'
OPTIONAL KEYWORDS:
XSIZE, YSIZE -- Size of GUI
OPTIONAL OUTPUTS:
IMSK -- Image of mask
COMMENTS:
EXAMPLES:
xdimg_objmsk, nght1_strct, objimg
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Oct-2002 Written by JXP
(See IMG/Reduction//xdimg_objmsk.pro)
NAME:
xdimg_over
Version 1.1
PURPOSE:
Overscan subtracts a list of images of a structure. Calls
routine xoverscan extensively.
CALLING SEQUENCE:
xdimg_over, struct, imgs, ORDR=, /ERASE, /INTER, /NOSV
INPUTS:
struct -- dimg_strct defining the images of interest
imgs -- integer array defining the images to process
RETURNS:
OUTPUTS:
ovimg - fits files in the dir OV
OPTIONAL KEYWORDS:
/erase - Erase pre-existing ov files
/inter - Interactive OV fitting (uses x1dfit)
/nosv -- Dont save the OV image!
ORDR= -- Order to fit the overscan
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_over, nght1_strct, ovimg
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
22-July-2001 Written by JXP
(See IMG/Reduction//xdimg_over.pro)
NAME:
xdimg_photcal
Version 1.1
PURPOSE:
Drives the program x_intphotcal which allows the user to
interactively create photometric solutions.
CALLING SEQUENCE:
xdimg_photcal, struct, LNDTFIL=, SETAM=, XSIZE=, YSIZE=, MIN_NOBS=
MIN_MOBS=, SETAM=, OUTROOT=, MAGROOT=, /NCLR
INPUTS:
struct -- dimg_strct defining the images of interest. This
program focuses on the STD frames only.
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
LNDTFIL = Filename of landolt fits file [default:
$XIDL_DIR/IMG/Photometry/Lists/nlandolt.fits ]
SETAM = AM terms (one per filter: UBVRI)
MIN_MOBS = Minimum number of nights observed by Landolt (default=2)
MIN_NOBS = Minimum number of observations by Landolt (default=4)
XSIZE= - Size of gui in screen x-pixels (default = 1000)
YSIZE= - Size of gui in screen y-pixels (default = 600)
OUTROOT - Root name of Twilight flats (default is 'Photo/soln_')
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_photcal, dimg
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/Photometry//xdimg_photcal.pro)
NAME:
xdimg_proc
Version 1.1
PURPOSE:
Processes a set of images (OV, TRIM, FLAT)
CALLING SEQUENCE:
xdimg_proc, struct, img, flat, OUTPTH=, /IR, /INTER, /SVOV, /SVCODIV,
/SVDRKSUB, /GAIN, /SILENT, MSK=, BPM=, FILEOUT=
INPUTS:
struct -- dimg_strct defining the images of interest
img -- intarr of images to process
flatnm -- Flat root to use (e.g. 'Flats/SkyFltN')
RETURNS:
OUTPUTS:
Processed image (e.g. Final/f_ccd001.fits)
OPTIONAL KEYWORDS:
OUTPTH = Output directory (default = 'Final/')
/INTER = Interactive OV fitting
/SVOV = Delete ov files when through
/SVCODIV = Delete coadd divided files when through
/SVDRKSUB = Delete dark subtracted files when through
MSK = Default name for mask file
/GAIN = Multiply by the gain
BPM = Name of bad pixel mask file to apply to image. (including directory)
OPTIONAL OUTPUTS:
FILEOUT = Name of output file which has the names of the reduced images.
Useful for call to stacking procedure.
COMMENTS:
EXAMPLES:
xdimg_proc, dimg, STDS, 'Flats/SkyFltN'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Aug-2001 Written by JXP
03-Jan-2002 Dealt with Gain
14-June-2007 Updated by LKP to allow for IR images, like NIRC2.
(See IMG/Reduction//xdimg_proc.pro)
NAME:
xdimg_skyflt
Version 1.1
PURPOSE:
Creates Super-sky flat given the image list structure.
The routine first OV subtracts (or dark subtracts, for IR images) each image as necessary.
It then calls xdimg_skymask to create masks for each of the images (unless the /NOMSK keyword is set).
It then calls xcombine which: (1) scales each image
by the median calculated for the OV (or dark subtracted) image (2) does a median
combine with 3sigma/2.5sigma (low/high) clipping.
CALLING SEQUENCE:
xdimg_skyflt, struct, MMEM=, /NOMSK, /INTER, /IR, CCD='NIRC2W'
INPUTS:
struct -- dimg_strct defining the images of interest
RETURNS:
OUTPUTS:
skyflt - fits files; 1 per filter (and per CCD, if CCD option is given)
OPTIONAL KEYWORDS:
MMEM - Max memory to use with this routine (default = 200M)
NOMSK - Don't create new masks
OUTROOT - Root name of Sky flats (default is 'Flats/SkyFlt')
INTER - Interactive OV subtraction
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_skyflt, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
XDIMG_OVER
XCOMBINE
MWRFITS
XDIMG_DELOV
XDIMG_DELDRKSUB
X_FILTERS
XDIMG_SKYMASK
REVISION HISTORY:
26-July-2001 Written by JXP
24-Apr-2002 Added nonlinearity correction
25-Jun-2007 LKP added ability to use with IR, NIRC2 images
(See IMG/Reduction//xdimg_skyflt.pro)
NAME:
xdimg_skymsk
Version 1.1
PURPOSE:
Builds a sky mask for each input image using xmkmask, an
IDL gui built for this procedure.
CALLING SEQUENCE:
xdimg_skymask, struct, objimg, /ERASE, /DOOV, XSIZE=, YSIZE=
INPUTS:
struct -- dimg_strct defining the images of interest
objimg -- integer array defining the images to mask
RETURNS:
OUTPUTS:
skymasks -- Builds sky masks and puts them into 'Masks/Sky/'
OPTIONAL KEYWORDS:
erase - Erase pre-existing sky masks first
doov - Make OV files as necessary
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_skymsk, nght1_strct, objimg
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-July-2001 Written by JXP
(See IMG/Reduction//xdimg_skymsk.pro)
NAME:
xdimg_starid
Version 1.1
PURPOSE:
Helps identify standard stars in a field by driving the program
x_starid which is an interactive, GUI program.
CALLING SEQUENCE:
xdimg_starid, struct, LST_PATH=, INDX=
INPUTS:
struct -- dimg_strct defining the images of interest. This
program focuses on the STD frames only.
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
LST_PATH - Path name for Lists (default: Take x_starid default)
OUT_PATH - Output name for id files (default: 'Photo/')
OPTIONAL OUTPUTS:
INDX -- Subset of indices for standards to fit
INORIENT -- Choose a number in the range [-4,4] to change the
orientation of standards plotted on the image.
COMMENTS:
EXAMPLES:
xdimg_starid, strct
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
08-Jan-2002 Added paths (JXP)
14-Oct-2002 Added indx (JXP)
(See IMG/Photometry//xdimg_starid.pro)
NAME:
xdimg_stdmag
Version 1.1
PURPOSE:
Does aperture photometry on the objects in the std_* lists.
Drives the program x_aper
CALLING SEQUENCE:
xdimg_stdmag, struct, SKYR=, STRROOT=, OUTROOT=
INPUTS:
struct -- dimg_strct defining the images of interest. This
program focuses on the STD frames only.
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
SKYR = 2 float array describing sky annulus in arcsec
(default=15,30)
STRROOT= Path for standard stars [default: 'Photo/std_']
OUTROOT= Path for output of magnitudes [default: 'Photo/mag_']
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_stdmag, dimg
PROCEDURES/FUNCTIONS CALLED:
X_APER
X_CCDINF
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/Photometry//xdimg_stdmag.pro)
NAME:
xdimg_strct
Version 1.2
PURPOSE:
Creates and outputs a structure for a series of direct images.
This is a key routine in organizing a night of imaging data.
CALLING SEQUENCE:
xdimg_strct, struct, ccd, tel, LIST=, /MKDIR, /NOFILE
INPUTS:
CCD - CCD/INSTRUMENT; Options: Tek5, LRISR, SITe1, SITe3, NIRC2
tel - Telescope; Options: (Keck, LCO-40, LCO-100)
RETURNS:
OUTPUTS:
struct - Creates an IDL structure for direct images
+ an ASCII file summarizing the structure
+ a FITS file saving the IDL structure
OPTIONAL KEYWORDS:
LIST - Image list [default is Raw/*.fits]
/NOFILE - Do not create the ASCII file
/MKDIR - Create a set of directories which facilitate the rest
of the reduction process (e.g. Flats/ Bias/
Photo/)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_strct, nght1_strct, 'Tek5', /MKDIR
PROCEDURES/FUNCTIONS CALLED:
MRDFITS
SXPAR
X_SETJDATE
MWRFITS
WRITE_DIMGSTR
REVISION HISTORY:
18-July-2001 Written by JXP
22-Aug-2001 Allows for LRISR
24-Dec-2001 LRISR modifications
14-June-2007 LKP updated to allow for NIRC2 data
(See IMG/General//xdimg_strct.pro)
NAME:
xdimg_twiflt
Version 1.1
PURPOSE:
Creates twilight flats given the image list structure (assuming
twilight flats were taken!)
CALLING SEQUENCE:
xdimg_twiflt, struct, /SVOV, OUTROOT=
INPUTS:
struct -- 'distruct' defining the images of interest
RETURNS:
OUTPUTS:
twiflats - fits files; 1 per filter
OPTIONAL KEYWORDS:
SVOV - Save ov files
OUTROOT - Root name of Twilight flats (default is 'Flats/TwiFlat')
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_twiflt, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
XDIMG_OVER
XCOMBINE
MWRFITS
XDIMG_DELOV
X_FILTERS
REVISION HISTORY:
26-July-2001 Written by JXP
24-Apr-2002 Added nonlinearity correction
(See IMG/Reduction//xdimg_twiflt.pro)
NAME:
xdimg_updstr
Version 1.1
PURPOSE:
Looks around for OV and other images and resets the appropriate
flags.
CALLING SEQUENCE:
xdimg_updstr, strct, /REDOMED
INPUTS:
strct -- Direct Image strcure DISTRUCT
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xdimg_updstr, struct
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/General//xdimg_updstr.pro)
NAME:
xgetx_plt
Version 1.1
PURPOSE:
Returns the x-value corresponding to the x-pixel on a GUI.
Requires pos, xymnx or the appropriate Structure.
CALLING SEQUENCE:
xval = xgetx_plt(xtmp, pos, xymnx, size, /STRCT)
INPUTS:
xtmp -- x-pixel value
pos -- Fraction of plot window covered by plot (2 element array)
xymnx -- x-y limits of plot window (4 element array: x0,y0,x1,y1)
RETURNS:
xval --
OUTPUTS:
OPTIONAL KEYWORDS:
/STRCT -- xtmp contains a structure with the relevant tags
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
uniq = x_uniqstr( lbls, count=count)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See General//xgetx_plt.pro)
NAME:
xgetx_plt
Version 1.1
PURPOSE:
Returns the x-pixel value corresponding to the x-value.
Requires pos, xymnx or the appropriate Structure.
CALLING SEQUENCE:
xpix = xgetx_plt(xtmp, pos, xymnx, size, /STRCT)
INPUTS:
xtmp -- x-pixel value
pos -- Fraction of plot window covered by plot (2 element array)
xymnx -- x-y limits of plot window (4 element array: x0,y0,x1,y1)
RETURNS:
xpix --
OUTPUTS:
OPTIONAL KEYWORDS:
/STRCT -- xtmp contains a structure with the relevant tags
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See General//xgetxpix_plt.pro)
NAME:
xgetx_plt
Version 1.1
PURPOSE:
Returns the y-value corresponding to the y-pixel on a GUI.
Requires pos, xymnx or the appropriate Structure.
CALLING SEQUENCE:
yval = xgety_plt(ytmp, pos, xymnx, size, /STRCT)
INPUTS:
ytmp -- y-pixel value
pos -- Fraction of plot window covered by plot (2 element array)
xymnx -- x-y limits of plot window (4 element array: x0,y0,x1,y1)
RETURNS:
yval --
OUTPUTS:
OPTIONAL KEYWORDS:
/STRCT -- ytmp contains a structure with the relevant tags
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
uniq = x_uniqstr( lbls, count=count)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See General//xgety_plt.pro)
NAME:
xgety_plt
Version 1.1
PURPOSE:
Returns the y-pixel corresponding to the y-value on a GUI.
Requires pos, xymnx or the appropriate Structure.
CALLING SEQUENCE:
yval = xgety_plt(ytmp, pos, xymnx, size, /STRCT)
INPUTS:
ytmp -- y-pixel value
pos -- Fraction of plot window covered by plot (2 element array)
xymnx -- x-y limits of plot window (4 element array: x0,y0,x1,y1)
RETURNS:
yval --
OUTPUTS:
OPTIONAL KEYWORDS:
/STRCT -- ytmp contains a structure with the relevant tags
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
uniq = x_uniqstr( lbls, count=count)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See General//xgetypix_plt.pro)
NAME:
xheadfits
Version 1.1
PURPOSE:
Uses headfits to read the header of a fits file. The only
advantage of xheadfits is that the file can be compressed and
yet the filename may be named without the gz extension.
CALLING SEQUENCE:
head = xheadfits(fil, _EXTRA)
INPUTS:
fil -- FITS Filename
RETURNS:
head -- Header
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
head = xheadfits('spec.fits')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Sep-2002 Written by JXP
(See General//xheadfits.pro)
NAME:
xmkmask
Version 1.1
PURPOSE:
Allows the user to interactively choose pixels to mask in an
image. The resulting images are saved as gzipped fits images.
CALLING SEQUENCE:
xmkmask, img, IMSK=, OUTDIR=, XSIZE=, YSIZE=, /SKYMSK
INPUTS:
img - Image(s) for Masking
RETURNS:
OUTPUTS:
mask - Creates a fits table of pixel values to mask
OPTIONAL KEYWORDS:
outdir - Output directory: Default = './Masks/'
IMSK - Initial mask to include; Convenient for dealing with
bad columns and the like in the CCD
XSIZE - Size of gui in screen x-pixels (default = 700)
YSIZE - Size of gui in screen y-pixels (default = 700)
SKYMSK - Create sky mask (default into Masks/Sky/)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xmkmask,'OV/ccd001.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-July-2001 Written by JXP
(See IMG/Reduction//xmkmask.pro)
NAME:
xmrdfits
Version 1.1
PURPOSE:
Uses mrdfits to read the header of a fits file. The only
advantage of xheadfits is that the file can be compressed and
yet the filename may be named without the gz extension.
CALLING SEQUENCE:
dat = xmrdfits(fil, [extension, header], _EXTRA)
INPUTS:
fil -- FITS Filename
[extension] -- Extension of the data array
RETURNS:
dat - Data array
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
header -- Header of the FITS extension
COMMENTS:
EXAMPLES:
dat = xmrdfits('spec.fits')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Sep-2002 Written by JXP
(See General//xmrdfits.pro)
NAME:
xoffset
Version 1.1
PURPOSE:
Calculates integer offsets between a series of images. The
program uses Sextractor to find objects in the image and then
uses a brute force algorithm to find the integer offset.
CALLING SEQUENCE:
xoffset, imglist, INSTR=
INPUTS:
imglist - List of images
RETURNS:
OUTPUTS:
offsets - ASCII file with offsets
OPTIONAL KEYWORDS:
INSTR - Instrument keyword
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xoffset, 'offR.list', INSTR='SITe3'
PROCEDURES CALLED:
REVISION HISTORY:
26-Apr-2001 Written by JXP
(See IMG/Reduction//xoffset.pro)
NAME:
xoverscan
Version 1.2
PURPOSE:
Subtracts an overscan region from an image
CALLING SEQUENCE:
xoverscan, img, ccd, [medov], OVSEC=, OVROOT=, /INTER, /ERASE
OVIMG=, /NOFITS, /SILENT, /MEDONLY, /COMPRESS, TRIMSEC=
INPUTS:
img - Raw fits file
ccd - CCD name (Tek5, SITe1, LRISR, LRISb, GEN, WFTek5,
SITe3)
RETURNS:
OUTPUTS:
nwimg - Writes overscan subtracted image to OV directory
with an ov_ prefix (default)
OPTIONAL KEYWORDS:
func - String defining function to fit with (POLY is
default)
ordr - Order of the function
ovsec - String defining overscan section
ovroot - String for OV root ('OV/' is the default)
erase - Erase pre-existing ov files
NOFITS - Suppress output to fits file
MEDONLY - Useful in updating distruct
/COMPRESS - Spawn gzip on the output image
TRIMSEC - Image region to trim to
OPTIONAL OUTPUTS:
medov - Median of each OV image
OVIMG - Float array of OV image
COMMENTS:
EXAMPLES:
xoverscan, 'ccd001.fits', 'Tek5'
PROCEDURES CALLED:
xregtovec
djs_median
x1dfit
REVISION HISTORY:
20-June-2001 Written by JXP
05-Dec-2001 Added OVIMG option
(See IMG/Reduction//xoverscan.pro)
NAME: xpix_circ Version 1.1 PURPOSE: Finds all pixels within a circle on an image. CALLING SEQUENCE: pval = xpix_circ(x0, y0, radius, /NOZERO, MAXX=, MAXY=, COUNT=) INPUTS: x0 -- Circle x position y0 -- Circle y position radius -- Radius of the circle RETURNS: pval -- pixels in the circle: array[2,npt] OUTPUTS: OPTIONAL KEYWORDS: /NOZERO -- Disallow value of 0 (minimum is 1 instead) OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 17-Sep-2002 Written by JXP
(See General//xpix_circ.pro)
NAME: xpix_line Version 1.1 PURPOSE: Finds all pixels within a ray (or line) of specified width. CALLING SEQUENCE: pval = xpix_line(x0, y0, x1, y1, wid, xmax, ymax, /NOZERO, COUNT=) INPUTS: x0 -- x position of one point on the ray y0 -- y position of one point on the ray x1 -- x position of one point on the ray y1 -- y position of one point on the ray wid -- Width of the line RETURNS: pval -- pixels in the circle: array[2,npt] OUTPUTS: OPTIONAL KEYWORDS: /NOZERO -- Disallow value of 0 (minimum is 1 instead) COUNT= -- Number of the pixels in the ray OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 17-Sep-2002 Written by JXP
(See General//xpix_line.pro)
NAME:
xregtovec
Version 1.1
PURPOSE:
Converts a string region into a vector for an image
CALLING SEQUENCE:
vect = xregtovec(sreg, size)
INPUTS:
string - String defining the region (e.g. '[1:10,*]')
size - Size of the image
RETURNS:
vect - Integer vector defining the region in sreg
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
area = xregtovec('[1:10,*]',size(img))
PROCEDURES CALLED:
REVISION HISTORY:
21-June-2001 Written by JXP
(See IMG/Reduction//xregtovec.pro)
NAME:
xsp1dstrct__define
Version 1.0
PURPOSE:
This routine defines the structure for individual object spectra
CALLING SEQUENCE:
tmp = {xsp1dstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-Aug-2002 Written by JXP
(See Spec/Analysis//contistrct__define.pro)
NAME:
xsp1dstrct__define
Version 1.0
PURPOSE:
This routine defines the structure for individual object spectra
CALLING SEQUENCE:
tmp = {xsp1dstrct}
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-Aug-2002 Written by JXP
(See Spec/Analysis//xsp1dstrct__define.pro)
NAME:
XSPLINE
-- Copied version of the RSI program
PURPOSE:
This function performs cubic spline interpolation.
CATEGORY:
Interpolation - E1.
CALLING SEQUENCE:
Result = SPLINE(X, Y, T [, Sigma])
INPUTS:
X: The abcissa vector. Values MUST be monotonically increasing.
Y: The vector of ordinate values corresponding to X.
T: The vector of abcissae values for which the ordinate is
desired. The values of T MUST be monotonically increasing.
OPTIONAL INPUT PARAMETERS:
Sigma: The amount of "tension" that is applied to the curve. The
default value is 1.0. If sigma is close to 0, (e.g., .01),
then effectively there is a cubic spline fit. If sigma
is large, (e.g., greater than 10), then the fit will be like
a polynomial interpolation.
OUTPUTS:
SPLINE returns a vector of interpolated ordinates.
Result(i) = value of the function at T(i).
RESTRICTIONS:
Abcissa values must be monotonically increasing.
EXAMPLE:
The commands below show a typical use of SPLINE:
X = [2.,3.,4.] ;X values of original function
Y = (X-3)^2 ;Make a quadratic
T = FINDGEN(20)/10.+2 ;Values for interpolated points.
;twenty values from 2 to 3.9.
Z = SPLINE(X,Y,T) ;Do the interpolation.
MODIFICATION HISTORY:
Author: Walter W. Jones, Naval Research Laboratory, Sept 26, 1976.
Reviewer: Sidney Prahl, Texas Instruments.
Adapted for IDL: DMS, Research Systems, March, 1983.
(See General//xspline.pro)
NAME:
x_abtoflam
PURPOSE:
Converts AB mag to flambda (given a wavelength)
CALLING SEQUENCE:
INPUTS:
AB -- AB magnitude
WAVE -- Wavelength (Angstroms)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
24-Jan-2008 Written by JXP
(See General//x_abtoflam.pro)
NAME:
x_addimg
Version 1.1
PURPOSE:
Combines a set of images. I think this routine is entirely
superseded by xcombine.
CALLING SEQUENCE:
x_addimg, img, comb, var, SCALE=, WEIGHT=, IMGINDX=, VARINDX=
INPUTS:
RETURNS:
OUTPUTS:
comb -- Combined image
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_addimg, all_img, comb_img
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
10-Dec-2002 Written by JXP
(See IMG/Reduction//x_addimg.pro)
NAME: x_addnoise Version 1.1 PURPOSE: Simple routine to add noise to a normalized spectrum. CALLING SEQUENCE: newf = x_addnoise(fx, snr, SEED=) INPUTS: fx - Flux array snr - Signal-to-noise per pixel of the data RETURNS: newfx - Flux array with noise OUTPUTS: OPTIONAL KEYWORDS: SEED= -- Seed for random number generator [Default: -1322] OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: newfx = x_addnoise(fx, 15.) PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 04-Nov-2002 Written by JXP
(See Spec/Analysis//x_addnoise.pro)
NAME:
x_addtwoflats
Version 1.1
PURPOSE:
Combines two flats, rejecting Cosmic Rays. This routine is
used extensively in the WFCCD routines.
CALLING SEQUENCE:
flat = x_addtwoflats, img1, img2, VAR=, GAIN=, RN=
INPUTS:
img1 - OV subtracted img1 (data or fits)
img2 - OV subtracted img2 (data or fits)
RETURNS:
OUTPUTS:
flat - Combined flat with CR rejected
OPTIONAL KEYWORDS:
GAIN - gain
RN - Read noise (for the VAR output only)
OPTIONAL OUTPUTS:
VAR - Variance image
COMMENTS:
EXAMPLES:
flat = x_addtwoflats(img1, img2)
PROCEDURES CALLED:
REVISION HISTORY:
17-Jan-2002 Written by JXP
(See IMG/Reduction//x_addtwoflats.pro)
NAME:
x_alav
Version 1.0
PURPOSE:
Report A_lambda/A(V) given lambda for a user specific extinction
law. Default is the Cardelli 1989 paramaterization of the MW.
The 'laws' are contained in .dat files in XIDL_DIR/Dust
CALLING SEQUENCE:
dat = x_alav(lambda, RV=, /SMC, /CALZ)
INPUTS:
lambda -- Wavelengths to evaluate A at (angstroms)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
RV= -- Value of R_V
/SMC -- Use the SMC law
/CALZ -- Use the Calzetti law
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2006 Written by JXP
(See Dust//x_alav.pro)
NAME: x_allvelo PURPOSE: Create an array of velocity arrays for a string of transitions CALLING SEQUENCE: all_velo = x_allvelo(wave, zabs, wrest, vmnx, ALL_PMNX=, NPIX=) INPUTS: wave -- Wavelength array zabs -- Redshift of absorption system wrest -- Array of rest wavelengths vmnx -- 2-element array of velocities RETURNS: all_velo -- Velocity array (one per rest wavelength) OUTPUTS: OPTIONAL KEYWORDS: NPIX -- Number of pixels in the array OPTIONAL OUTPUTS: ALL_PMNX= -- pixmin and pixmax array COMMENTS: EXAMPLES: all_velo = x_allvelo(wave, zabs, wrest, vmnx, ALL_PMNX=) PROCEDURES CALLED: REVISION HISTORY: 24-Oct-2002 Written by JXP
(See Spec/General//x_allvelo.pro)
NAME:
x_allvoigt
Version 1.1
PURPOSE:
Calculate a single voigt profile, given wavelength, absorber, and
an array of lines. Warning: This program is not exact!
CALLING SEQUENCE:
tau = x_allvoigt(wave,lines, SIGMA=, MNDV=)
INPUTS:
wave - Array of wavelengths to realize voigt profile
lines - Line(s) structure to compute voigt profile, if mutliple,
the entire list will be looped through.
RETURNS:
tau - Optical depth at each wavelength
OPTIONAL INPUTS:
SIGMA= - Resolution of instrument in pixels
MNDV= - Range in velocity to calculate Voigt over [defalut:
1000 km/s]
OUTPUTS:
OPTIONAL OUTPUTS:
COMMENTS:
Line is a structure with:
** Structure <81a5f94>, 4 tags, length=24, refs=3:
ION STRING 'H I'
WAVE DOUBLE 1215.6701
F FLOAT 0.416400
GAMMA FLOAT 6.26500e+08
Abs must have at least :
** Structure ABS, 10 tags, length=44:
N FLOAT 15.0000 log 10 Column density
B FLOAT 5.00000 velocity dispersion (km/s)
Z FLOAT 2.00000 redshift
EXAMPLES:
BUGS: ;
PROCEDURES CALLED:
REVISION HISTORY:
25-May-2000 Created by S. Burles, FNAL/IAP
Modified by JXP
(See Spec/Voigt//x_allvoigt.pro)
NAME:
x_apall
Version 1.1
PURPOSE:
Performs an aperture extraction on a 2D image. Much like IRAFs
apall routine.
CALLING SEQUENCE:
spec = x_apall( img, OVR=, CLINE=, APER=, $
SKYFUNC=, SKYNORD=, SKYREG=, $
/DISPLAY, /NOREJ, TRACE=, /NOOV, $
/NOSKY=, STRCT=, RN=, GAIN=, VAR=, $
/CRUDE, TINTER=, ERROR=, /SILENT )
INPUTS:
img -- 2D spectrum
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/DISPLAY - Display the sky subtracted image with xatv
OVR= - String array for ov region: '[2050:2100, *]'
VAR= - Variance image
RN= - Read noise [default: 5.]
GAIN= - Gain [default: 1.]
/CRUDE - Use trace_crude to trace the object
/TINTER - Fit the trace interactively
/NOSKY - Do not sky subtract
SKYFUNC= - Function to use to fit the sky [default: POLY]
SKYNORD= - Order for sky fit [default: 1]
SKYREG= - Region to fit the sky
/NOREJ - Do not do rejection when fitting the sky
CLINE= - Line to identify object in [default: sz[0]/2]
APER= - Aperture to extract [default: determine interactively]
/NOOV - Do not perform OV subtraction
/ROT - Transpose the data (code expects data parallel to rows)
OPTIONAL OUTPUTS:
ERROR= - Sigma array (or is it variance?)
STRCT= - Structure defining the various extraction parameters.
Useful for performing wavelength subtraction
TRACE= - Output trace
COMMENTS:
EXAMPLES:
spec = x_apall('spec.fits', STRCT=strct)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Nov-2001 Written by JXP
05-Dec-2001 Modularized most of the routine
(See Spec/Extraction//x_apall.pro)
NAME:
X_APER
PURPOSE:
Compute concentric aperture photometry (adapted from DAOPHOT)
EXPLANATION:
APER can compute photometry in several user-specified aperture radii.
A separate sky value is computed for each source using specified inner
and outer sky radii.
CALLING SEQUENCE:
APER, image, xc, yc, [ mags, errap, sky, skyerr, phpadu, apr, skyrad,
badpix, /NAN, /EXACT, /FLUX, /MED_SKY, PRINT = , /SILENT,
SETSKYVAL = ]
INPUTS:
IMAGE - input image array
XC - vector of x coordinates.
YC - vector of y coordinates
OPTIONAL INPUTS:
PHPADU - Photons per Analog Digital Units, numeric scalar. Converts
the data numbers in IMAGE to photon units. (APER assumes
Poisson statistics.)
APR - Vector of up to 12 REAL photometry aperture radii.
SKYRAD - Two element vector giving the inner and outer radii
to be used for the sky annulus. Ignored if the SETSKYVAL
keyword is set.
BADPIX - Two element vector giving the minimum and maximum value
of a good pixel. If badpix is not supplied or if BADPIX[0] is
equal to BADPIX[1] then it is assumed that there are no bad
pixels. Note that fluxes will not be computed for any star
with a bad pixel within the aperture area, but that bad pixels
will be simply ignored for the sky computation. The BADPIX
parameter is ignored if the /NAN keyword is set.
OPTIONAL KEYWORD INPUTS:
/EXACT - By default, APER counts subpixels, but uses a polygon
approximation for the intersection of a circular aperture with
a square pixel (and normalize the total area of the sum of the
pixels to exactly match the circular area). If the /EXACT
keyword, then the intersection of the circular aperture with a
square pixel is computed exactly. The /EXACT keyword is much
slower and is only needed when small (~2 pixels) apertures are
used with very undersampled data.
/FLUX - By default, APER uses a magnitude system where a magnitude of
25 corresponds to 1 flux unit. If set, then APER will keep
results in flux units instead of magnitudes.
/NAN - If set then APER will check for NAN values in the image. /NAN
takes precedence over the BADPIX parameter. Note that fluxes
will not be computed for any star with a NAN pixel within the
aperture area, but that NAN pixels will be simply ignored for
the sky computation.
PRINT - if set and non-zero then APER will also write its results to
a file aper.prt. One can specify the output file name by
setting PRINT = 'filename'.
READNOISE - Scalar giving the read noise (or minimum noise for any
pixel. This value is passed to the procedure mmm.pro when
computing the sky, and is only need for images where
the noise is low, and pixel values are quantized.
/SILENT - If supplied and non-zero then no output is displayed to the
terminal.
SETSKYVAL - Use this keyword to force the sky to a specified value
rather than have APER compute a sky value. SETSKYVAL
can either be a scalar specifying the sky value to use for
all sources, or a 3 element vector specifying the sky value,
the sigma of the sky value, and the number of elements used
to compute a sky value. The 3 element form of SETSKYVAL
is needed for accurate error budgeting.
/MED_SKY - Instead of using MMM to calculate sky value, just take a simple median.
Does nothing if SETSKYVAL is set.
OUTPUTS:
MAGS - NAPER by NSTAR array giving the magnitude for each star in
each aperture. (NAPER is the number of apertures, and NSTAR
is the number of stars). If the /FLUX keyword is not set, then
a flux of 1 digital unit is assigned a zero point magnitude of
25.
ERRAP - NAPER by NSTAR array giving error for each star. If a
magnitude could not be determined then ERRAP = 9.99 (if in
magnitudes) or ERRAP = !VALUES.F_NAN (if /FLUX is set).
SKY - NSTAR element vector giving sky value for each star in
flux units
SKYERR - NSTAR element vector giving error in sky values
EXAMPLE:
Determine the flux and error for photometry radii of 3 and 5 pixels
surrounding the position 234.2,344.3 on an image array, im. Compute
the partial pixel area exactly. Assume that the flux units are in
Poisson counts, so that PHPADU = 1, and the sky value is already known
to be 1.3, and that the range [-32767,80000] for bad low and bad high
pixels
IDL> aper, im, 234.2, 344.3, flux, eflux, sky,skyerr, 1, [3,5], -1, $
[-32767,80000],/exact, /flux, setsky = 1.3
PROCEDURES USED:
GETOPT, MMM, PIXWT(), STRN(), STRNUMBER()
NOTES:
Reasons that a valid magnitude cannot be computed include the following:
(1) Star position is too close (within 0.5 pixels) to edge of the frame
(2) Less than 20 valid pixels available for computing sky
(3) Modal value of sky could not be computed by the procedure MMM
(4) *Any* pixel within the aperture radius is a "bad" pixel
(5) The total computed flux is negative
APER was modified in June 2000 in two ways: (1) the /EXACT keyword was
added (2) the approximation of the intersection of a circular aperture
with square pixels was improved (i.e. when /EXACT is not used)
REVISON HISTORY:
Adapted to IDL from DAOPHOT June, 1989 B. Pfarr, STX
Adapted for IDL Version 2, J. Isensee, July, 1990
Code, documentation spiffed up W. Landsman August 1991
TEXTOUT may be a string W. Landsman September 1995
FLUX keyword added J. E. Hollis, February, 1996
SETSKYVAL keyword, increase maxsky W. Landsman, May 1997
Work for more than 32767 stars W. Landsman, August 1997
Don't abort for insufficient sky pixels W. Landsman May 2000
Added /EXACT keyword W. Landsman June 2000
Allow SETSKYVAL = 0 W. Landsman December 2000
Set BADPIX[0] = BADPIX[1] to ignore bad pixels W. L. January 2001
Fix chk_badpixel problem introduced Jan 01 C. Ishida/W.L. February 2001
Set bad fluxes and error to NAN if /FLUX is set W. Landsman Oct. 2001
Remove restrictions on maximum sky radius W. Landsman July 2003
Added /NAN keyword W. Landsman November 2004
Set badflux=0 if neither /NAN nor badpix is set M. Perrin December 2004
Added READNOISE keyword W. Landsman January 2005
LKP added MED_SKY keyword Oct 2007
(See IMG/Photometry//x_aper.pro)
NAME:
x_arcimage
Version 1.0
PURPOSE:
Creates an arcimage given a tracestructure. This code has been
superseded by x_mkaimg.
CALLING SEQUENCE:
arcimg = x_arcimage( trcstrct, arcfit, sz_img )
INPUTS:
trcstrct - Trace structure (contains all of the info on the
position and value of various arc lines)
arcfit - Template fit structure ; Includes fit instructions
sz_img - Size of output image
[lines] - Line list strurcture (Usually defined)
RETURNS:
arcimg
OUTPUTS:
OPTIONAL KEYWORDS:
YSTRT - Row defining the arcfit [default = middle]
LINELIST - Arc line list (in lieu of lines)
NSIG - Sig of RMS from the fit that line must match
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
arcimg = x_arcimage( trcstrct, arcfit, imgsz)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-Feb-2002 Written by JXP
(See Spec/Arcs//x_arcimage.pro)
NAME:
x_arclist
Version 1.1
PURPOSE:
Reads a line list into an arclin strutcture
CALLING SEQUENCE:
x_arclist, linelist, lines, /GDONLY
INPUTS:
linelist - Name of line list (formatted: D, I, A)
RETURNS:
arclinstr - Arc line structure
OUTPUTS:
OPTIONAL KEYWORDS:
/GDONLY -- Restrict the line list to those where flg_qual NE 0
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_arclist, linelist, lines
PROCEDURES/FUNCTIONS CALLED:
arclinstrct__define
readcol
REVISION HISTORY:
14-Feb-2002 Written by JXP
(See Spec/Arcs//x_arclist.pro)
NAME:
x_arcpeakup
Version 1.1
PURPOSE:
Finds the fit iteratively to a set of lines given the Arc
spectrum and a line list. This code has been superseded by
x_arctempl.
CALLING SEQUENCE:
x_arcpeakup, spec, lines, FFIT=, WV=, NFRST=, NFIN=, /INTER, SIG=
INPUTS:
spec - Input arc spectrum
lines - Arc line list structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
NFRST= -- Order of fit for the first try [default: 3L]
NFIN= -- Order of fit for the final fit
MXOFF= -- Maximum pixel offset between a line and its expected
position
SIG= -- Lower and upper sigma values for fitting
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_arcpeakup, spec, lines, guessfit
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-Aug-2002 Written by JXP
(See Spec/Arcs//x_arcpeakup.pro)
NAME:
x_autoid
Version 1.0
PURPOSE:
Given a 1D arc-line spectrum from the WFCCD or ESI-LowD, this
code will automatically determine the wavelength solution.
CALLING SEQUENCE:
x_autoid, img, [extrct], instr=, IDLIST=, GUESS=, LINELIST=,
TOLER=
INPUTS:
img - Input arc image or spectrum
[extrct] - Slit edges (default to image edges)
RETURNS:
OUTPUTS:
FITSTR - Fit structure; Set values prior to passing for
OPTIONAL KEYWORDS:
CPROG - Run the monte-carlo in the c program (advised)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_autoid, img, instr='WFCCDB'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Feb-2002 Written by JXP
(See Spec/Arcs//x_autoid.pro)
NAME:
x_autophot
PURPOSE:
Compute concentric aperture photometry (adapted from DAOPHOT)
I have adopted this from the Goddard routines
EXPLANATION:
APER can compute photometry in several user-specified aperture radii.
A separate sky value is computed for each source using specified inner
and outer sky radii.
CALLING SEQUENCE:
APER, image, xc, yc, [ mags, errap, sky, skyerr, phpadu, apr, skyrad,
badpix, /EXACT, /FLUX, PRINT = , /SILENT, SETSKYVAL = ]
INPUTS:
IMAGE - input image array
XC - vector of x coordinates.
YC - vector of y coordinates
OPTIONAL INPUTS:
PHPADU - Photons per Analog Digital Units, numeric scalar. Converts
the data numbers in IMAGE to photon units. (APER assumes
Poisson statistics.)
APR - Vector of up to 12 REAL photometry aperture radii.
SKYRAD - Two element vector giving the inner and outer radii
to be used for the sky annulus
BADPIX - Two element vector giving the minimum and maximum value
of a good pix (Default [-32765,32767]). If BADPIX[0] is
equal to BADPIX[1] then it is assumed that there are no bad
pixels.
OPTIONAL KEYWORD INPUTS:
/EXACT - By default, APER counts subpixels, but uses a polygon
approximation for the intersection of a circular aperture with
a square pixel (and normalize the total area of the sum of the
pixels to exactly match the circular area). If the /EXACT
keyword, then the intersection of the circular aperture with a
square pixel is computed exactly. The /EXACT keyword is much
slower and is only needed when small (~2 pixels) apertures are
used with very undersampled data.
/FLUX - By default, APER uses a magnitude system where a magnitude of
25 corresponds to 1 flux unit. If set, then APER will keep
results in flux units instead of magnitudes.
PRINT - if set and non-zero then APER will also write its results to
a file aper.prt. One can specify the output file name by
setting PRINT = 'filename'.
/SILENT - If supplied and non-zero then no output is displayed to the
terminal.
SETSKYVAL - Use this keyword to force the sky to a specified value
rather than have APER compute a sky value. SETSKYVAL
can either be a scalar specifying the sky value to use for
all sources, or a 3 element vector specifying the sky value,
the sigma of the sky value, and the number of elements used
to compute a sky value. The 3 element form of SETSKYVAL
is needed for accurate error budgeting.
OUTPUTS:
MAGS - NAPER by NSTAR array giving the magnitude for each star in
each aperture. (NAPER is the number of apertures, and NSTAR
is the number of stars). A flux of 1 digital unit is assigned
a zero point magnitude of 25.
ERRAP - NAPER by NSTAR array giving error in magnitude
for each star. If a magnitude could not be deter-
mined then ERRAP = 9.99.
SKY - NSTAR element vector giving sky value for each star
SKYERR - NSTAR element vector giving error in sky values
PROCEDURES USED:
DATATYPE(), GETOPT, MMM, PIXWT(), STRN(), STRNUMBER()
NOTES:
Reasons that a valid magnitude cannot be computed include the following:
(1) Star position is too close (within 0.5 pixels) to edge of the frame
(2) Less than 20 valid pixels available for computing sky
(3) Modal value of sky could not be computed by the procedure MMM
(4) *Any* pixel within the aperture radius is a "bad" pixel
APER was modified in June 2000 in two ways: (1) the /EXACT keyword was
added (2) the approximation of the intersection of a circular aperture
with square pixels was improved (i.e. when /EXACT is not used)
REVISON HISTORY:
Adapted to IDL from DAOPHOT June, 1989 B. Pfarr, STX
Adapted for IDL Version 2, J. Isensee, July, 1990
Code, documentation spiffed up W. Landsman August 1991
TEXTOUT may be a string W. Landsman September 1995
FLUX keyword added J. E. Hollis, February, 1996
SETSKYVAL keyword, increase maxsky W. Landsman, May 1997
Work for more than 32767 stars W. Landsman, August 1997
Converted to IDL V5.0 W. Landsman September 1997
Don't abort for insufficient sky pixels W. Landsman May 2000
Added /EXACT keyword W. Landsman June 2000
Allow SETSKYVAL = 0 W. Landsman December 2000
Set BADPIX[0] = BADPIX[1] to ignore bad pixels W. L. January 2001
Fix chk_badpixel problem introduced Jan 01 C. Ishida/W.L. February 2001
(See IMG/Photometry//x_autophot.pro)
NAME:
x_avsigclip
PURPOSE:
Average multiple images with sigma-rejection. This routine
makes extensive use of Schlegels avsigclip routine.
CALLING SEQUENCE:
result = x_avsigclip( array, [ dimension, siglo=, sighi=, maxiter=, $
inmask=, outmask= ] )
INPUTS:
array - N-dimensional array
OPTIONAL INPUTS:
dimension - The dimension over which to collapse the data. If ommitted,
assume that the last dimension is the one to collapse.
siglo - Low Sigma for rejection; default to 3.0.
sighi - High Sigma for rejection; default to 3.0.
maxiter - Maximum number of sigma rejection iterations. One iteration
does no sigma rejection; default to 10 iterations.
inmask - Input mask, setting =0 for good elements
OUTPUTS:
result - The output array.
outmask - Output mask, setting =0 for good elements, =1 for bad.
Any pixels masked in INMASK are also masked in OUTMASK.
OPTIONAL OUTPUTS:
COMMENTS:
The DIMENSION input is analogous to that used by the IDL built-in
function TOTAL.
EXAMPLES:
Create a data cube of 10 random-valued 100x200 images. At each pixel in
the image, compute the average of the 10 values, but rejecting 3-sigma
outliers:
> array = randomu(123,100,200,10)
> ave = x_avsigclip(array, siglo=3., sighi=4.)
If all points are masked in any given vector or array, a mean and
dispersion are computed for all the points. Is this the behaviour we want?
If you want to replace those values with zeros instead, look at OUTMASK:
> array = randomu(123,100,200)
> inmask = bytarr(100,200)
> inmask[*,8] = 1 ; mask all of row #8
> ave = x_avsigclip(array, 1, inmask=inmask, outmask=outmask)
> ibad = where( total(1-outmask, 1) EQ 0)
> if (ibad[0] NE -1) then ave[ibad] = 0 ; zero-out bad rows
BUGS:
PROCEDURES CALLED:
Dynamic link to arravsigclip.c
REVISION HISTORY:
07-Jul-1999 Written by David Schlegel, Princeton.
28-Jul-2001 Revised by JXP (Added lo/hi sigrej)
(See IMG/Reduction//x_avsigclip.pro)
NAME:
x_calc2dfit
Version 1.1
PURPOSE:
Calculates a 2d fit-function at a set of xy pairs.
Restricted to a 2D polynomial for now.
CALLING SEQUENCE:
fit = x_calc2dfit(xyval, func, ffit, nx, ny, NRM=, FITSTR=)
INPUTS:
xyval - 2D array [npix, 2] of the x,y values
[func] - String for Fitting function (POLY)
[ffit] - Output from the fitting stuff
[nx] - order of the 2d surface in x
[ny] - order of the 2d surface in y
RETURNS:
fit - Values at each xyval [1D array]
OUTPUTS:
OPTIONAL KEYWORDS:
FITSTR= -- IDL structure for 2D fitting (recommended)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
fit = x_calc2dfit(xy, 'POLY', ffit, 3, 3)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
31-Jan-2002 Written by JXP
(See FIT//x_calc2dfit.pro)
NAME: x_calccog Version 1.1 PURPOSE: Perform a COG solution given a list of flambda values, EW measurements and the errors in those measurements. The user inputs an array of column densities to search over and the code finds the minimum in chi^2 and returns the value. This code is currently only used to calculate the best b value for the lines for the given N values. See fuse_cog for a better COG routine. [JXP: 5/25/04] CALLING SEQUENCE: x_calccog, ew_red, sig_ew, flambda, Nval, blmt, FNDB= BANS=, /EXACT INPUTS: ew_red -- Reduced ew array sigew -- Error in ew flambda -- f lambda (assumes A not cm) Nval -- List of Nval to consider blmt -- Limits for b value search (assumes km/s) RETURNS: OUTPUTS: OPTIONAL KEYWORDS: /EXACT -- Calculate the COG exactly (otherwise use lookup table) /FNDB -- Find the b-value (only option now) OPTIONAL OUTPUTS: BANS= -- The b value which minimizes chi^2 COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: x_calccog_initcomm x_calccog_cog x_calccog_ftau REVISION HISTORY: 05-Mar-2002 Written by JXP
(See Spec/Analysis//x_calccog.pro)
NAME:
x_calcew
Version 1.1
PURPOSE:
Calculates the EW given a wavelength and flux array and limits to
integrate over. Can also calculate the error in the EW as well
as the reduced values.
CALLING SEQUENCE:
ew = x_calcew(wav, fx, lmts, [sig, sigew], /REDUCED, FPIX=)
INPUTS:
wav - Rest wavelength [Angstromgs]
fx - Flux (presumed normalized)
lmts - Limits of integration (wavelength unless /FPIX is set)
[sig] - Error in fx
RETURNS:
ew - Equivalent width
OUTPUTS:
OPTIONAL KEYWORDS:
/REDUCED -- Divide EW value by lambda
/FPIX -- If flagged, this indicates the lmts array contains the
pixel endpoints for the EW calculation.
OPTIONAL OUTPUTS:
sigew - Error in ew
COMMENTS:
The flux array should be normalized to unity
EXAMPLES:
ew = x_calcew( fx, sig, [50, 100], ERR=sigew, /FPIX)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Mar-2002 Written by JXP
(See Spec/Analysis//x_calcew.pro)
NAME:
x_calcfit
Version 1.2
PURPOSE:
Calculates a fit-function at a set of x points
CALLING SEQUENCE:
fit = x_calcfit(xval,func,ffit, NORD=)
INPUTS:
xval - Value(s) along one dimension
[func] - String for Fitting function (POLY, LEGEND, BSPLIN,
GAUSS)
[ffit] - Output from the fitting stuff
RETURNS:
fit - Values at each xval
OUTPUTS:
OPTIONAL KEYWORDS:
nord= - Required for LEGEND
FITSTR= - Fit structure (OVERRIDES input values of func, ffit)
OPTIONAL OUTPUTS:
NRM= - Normalization parameters (-1 to 1)
COMMENTS:
EXAMPLES:
fit = x_calcfit(x, 'POLY', 5)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
BSPLIN
GAUSS
REVISION HISTORY:
20-Nov-2001 Written by JXP
31-Jan-2002 Added NRM, CHEBY func, FITSTR
(See FIT//x_calcfit.pro)
NAME:
x_calcgain
Version 1.1
PURPOSE:
Calculate the inverse gain, e-/DN with two very similiar input images
For MIKE, milky flats or well illuminated flats are best.
CALLING SEQUENCE:
estimated_gain = x_gain(image1, image2)
INPUTS:
image1 - Any array of pixels with reasonable gaussian errors
image2 - A very similar image to image1, but not identical!
RETURNS:
gain - A floating point number: the inverse gain
OUTPUTS:
OPTIONAL KEYWORDS:
MINPIX -- Minimum number of pixels with DN>MINVAL in both images to
perform statistics (Default: 1000)
MINVAL -- Minimum flux to perform stats (default: 100)
OPTIONAL OUTPUTS:
COMMENTS:
The gain is calculated from the variance of the natural logarithm
of the ratio of two images which have units of ADU (Poisson counts / gain)
<gain> = 1.0 / { variance [ sqrt(reduced_flux) * ln(i1/i2) ] }
EXAMPLES:
image1 = readfits('ov_mr0405.fits')
image2 = readfits('ov_mr0406.fits')
gain = x_calcgain(image1, image2)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
16-Jul-2003 Written by SMB
04-Apr-2005 Ported to XIDL by JXP
(See IMG/Reduction//x_calcgain.pro)
NAME:
x_calclstar
Version 1.1
PURPOSE:
Calculate apparent magnitude for Lstar at a given
redshift for a given cosmology and Hubbles constant.
CALLING SEQUENCE:
lstar = x_calclstar( z, H0=, AMIN=, /SILENT, OM=, OV=)
INPUTS:
z -- Redshift
RETURNS:
lstar -- Apparent magnitude for Lstar
OUTPUTS:
OPTIONAL KEYWORDS:
lstr0 -- Assumed value of Lstar at z=0 [default: -21.06]
H0 -- Hubbles constant (km/s/Mpc)
OM -- Omega Dark Matter
OV -- Lambda
/SILENT -- No printing to the screen
OPTIONAL OUTPUTS:
AMIN -- Mpc per arcmin at z
COMMENTS:
EXAMPLES:
lstar = x_calclstar(2., H0=75., AMIN=amin)
PROCEDURES CALLED:
REVISION HISTORY:
22-Nov-2003 Written by JXP
(See Cosm//x_calclstar.pro)
NAME:
x_calctb
Version 1.1
PURPOSE:
Calculate the temperature of a gas given its Doppler parameter
CALLING SEQUENCE:
x_calctb, b, T, /LOGT, MA=
INPUTS:
b -- Doppler parameter (km/s)
RETURNS:
OUTPUTS:
T -- Temperature (K)
OPTIONAL KEYWORDS:
/LOGT -- Return logarithmic temperature
MA -- Mass of nucleus [1 for Hydrogen]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_calctb, 25., T, /LOGT
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Dec-2001 Written by JXP
(See General//x_calctb.pro)
NAME:
x_calctwilight
Version 1.0
PURPOSE:
Calculate twilight in LST given a lat+long+date
CALLING SEQUENCE:
INPUTS:
date - String name of the date of the night of observing at
the observatory (not UT)
Allowed formats: DDmmmYY (e.g. 22Oct99)
DD-MM-YY (e.g. 20-12-99)
YYYY-MM-DD (e.g. 1999-12-20)
DDMMMYYYY (e.g. 20JAN2004)
obs_str - Observatory structure (long, latitute, time zone)
RETURNS: twlight in LST (decimal hours)
OUTPUTS:
OPTIONAL KEYWORDS:
stmid -- LST at midnight (end of the input date)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
x_calclst
REVISION HISTORY:
Based on code in skycalendar v5 written by John Thorstensen
Dartmouth College
10-Dec-2009 Written by JXP
(See Obs//x_calctwilight.pro)
NAME:
x_calibstd
Version 1.1
PURPOSE:
Given a standard star spectrum and a calibration file, calculate a
sensitivity function parameterized by a BSLINE or some other function.
CALLING SEQUENCE:
x_calibstd, wave, flux, outfil, HSTFIL=, /CHKFIT,
EXP=, BSPLIN=, SWV=, SFX=,
GDWV=, BSET=, YFIT=, SENS=, EVERYN=
INPUTS:
wave -- Wavelength array of standard star
flux -- Flux array of standard star
RETURNS:
OUTPUTS:
outfil -- FITS file to write sensitivity function
OPTIONAL KEYWORDS:
EXP= -- Exposure time [default: 1.]
HSTFIL= -- HST calibration file
/CHKFIT -- Plot the fit to the sensitivity function
EVERYN= -- Spacing of b-spline breakpoints in pixel space [default: 5]
OPTIONAL OUTPUTS:
SWV= -- Wavelength array of calibration data
SFX= -- Flux array of calibration data
SENS= -- Sensitivity function
COMMENTS:
EXAMPLES:
x_calibstd, kast, 0, 1, 0
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
29-Aug-2003 Written by JXP
(See Spec/Flux//x_calibstd.pro)
NAME:
x_ccdinf
Version 1.0
PURPOSE:
Returns arcpix and orientation of ccd+tel combination. This
routine saves all of that key info in one spot, although it
is primarily used only for direct imaging.
CALLING SEQUENCE:
x_ccdinf, ccd, tel, arcpix, [orient], SAT=
INPUTS:
ccd - Name of CCD ('SITe1', 'LRISR', 'WFTek5')
tel - Name of Telescope ('LCO-40', 'Keck', 'LCO-100')
RETURNS:
arcpix -- Arcsec per pixel
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
orient - Orientation of the CCD:
; -2 = SITe1 on LCO-40 (E up, N left)
SAT= -- Saturation limit of the CCD
COMMENTS:
EXAMPLES:
x_ccdinf, 'SITe1', 'LCO-40', arcpix, SAT=sat
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See IMG/General//x_ccdinf.pro)
NAME:
x_centerpk
Version 1.1
PURPOSE:
Finds the center of a peak
CALLING SEQUENCE:
center = x_centerpk(xdat, ydat, [fracpk], VAR=, FUNC=, NORD=, HSIG=, LSIG=,
IPX=, MINVAL=, FFIT=, /INTER)
INPUTS:
xdat - x Values
ydat - y Values
[fracpk] - Fraction of peak relative to the minimum
(default=1/3 max + min)
RETURNS:
center - center of the peak
OUTPUTS:
ffit - Fit parameters
OPTIONAL KEYWORDS:
func - Function
VAR - variance in ydat
nord - order number
HSIG - upper sigma
LSIG - lower sigma
IPX - Allows user to give best guess
INTER - Interative fit
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
center = x_centerpk(xdat, ydat, /inter)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
23-Nov-2001 Written by JXP
(See Spec/General//x_centerpk.pro)
NAME: x_centfwgt Version 1.1 PURPOSE: Given a 'peak', this routine will find the center of that peak in a using flux weighting. CALLING SEQUENCE: xcen = x_centfwgt(xval, yval, [radius]) INPUTS: xval - x values of the peak yval - y values of the peak [RADIUS] - radius of data around the peak for centroiding RETURNS: xcen - Center OUTPUTS: OPTIONAL KEYWORDS: /SILENT -- Turn off warnings OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: trace_fweight REVISION HISTORY: 22-Jun-2005 Written by JXP
(See FIT//x_centfwgt.pro)
NAME: x_centfwgt Version 1.1 PURPOSE: Given a 'peak', this routine will find the center of that peak in a using flux weighting. CALLING SEQUENCE: xcen = x_centfwgt(xval, yval, [radius]) INPUTS: xval - x values of the peak yval - y values of the peak [RADIUS] - radius of data around the peak for centroiding RETURNS: xcen - Center OUTPUTS: OPTIONAL KEYWORDS: /SILENT -- Turn off warnings OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: trace_fweight REVISION HISTORY: 22-Jun-2005 Written by JXP
(See FIT//x_centgauss.pro)
NAME: x_centspln Version 1.1 PURPOSE: Given a 'peak', this routine will find the center of that peak in a non-parameteric manner. The routine first spliens the peak. It then steps in from both sides until it hits FRACPK of the peak value of the line. Finally, the centroid is the midpoint of these two spots. CALLING SEQUENCE: xcen = x_centspln(xval, yval, [fracpk]) INPUTS: xval - x values of the peak yval - y values of the peak [FRACPK] - Fraction of the peak for centroiding [default=0.3333] RETURNS: xcen - Center OUTPUTS: OPTIONAL KEYWORDS: /SILENT -- Turn off warnings /FORCE -- Calculate a centroid even if the edges are non-sensical OPTIONAL OUTPUTS: EDGES= -- Values of the spots on the peak corresponding to FRACPK COMMENTS: EXAMPLES: xcen = x_centspln(data) PROCEDURES/FUNCTIONS CALLED: x_fndspln x_golden REVISION HISTORY: 07-Feb-2002 Written by JXP
(See FIT//x_centspln.pro)
NAME: x_chgbw Version 1.1 PURPOSE: Sets colors to black and white CALLING SEQUENCE: x_chgbw INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: x_chgbw PROCEDURES CALLED: getcolor REVISION HISTORY: 19-Dec-2001 Written by JXP
(See General//x_chgbw.pro)
NAME:
x_chkfil
Version 1.1
PURPOSE:
Check for a file and return the number of entries matching
CALLING SEQUENCE:
flag = x_chkfil(fil, COUNT=, /SILENT)
INPUTS:
fil - Filename
RETURNS:
flag - 0: No file; 1: One file; 2: More than one
OUTPUTS:
OPTIONAL KEYWORDS:
/SILENT -- Suppress messages to screen
OPTIONAL OUTPUTS:
COUNT - number of unique strings
COMMENTS:
EXAMPLES:
flg = x_chkfil('junk.dat', count=cnt, /SILENT)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See General//x_chkfil.pro)
NAME: x_chkwindow Version 1.1 PURPOSE: Check to see if a window is open CALLING SEQUENCE: x_chkwindow, win_id, get_all_active= INPUTS: win_id RETURNS: dat - Byt array describing open windows OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: HEAD - Header COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 03-Jan-2005 Written by JXP
(See General//x_chkwindow.pro)
NAME:
x_combspec
Version 1.2
PURPOSE:
Combines multiple exposures of the same slit
CALLING SEQUENCE:
x_combspec, flux, var, fflux, fvar, NRMFLUX=, WAVE=, NSIG=,
SCALE=, SNR=
INPUTS:
flux -- 2D flux array
var -- 2D variance array
RETURNS:
fflux -- Combined flux array
fvar -- Combined variance array
OUTPUTS:
OPTIONAL KEYWORDS:
NRMFLUX - Array of 2 elements (wave min,max) to normalize flux
WAVE= -- Wavelength array for normalizing
WVMNX= -- Wavelength region for normalizing
NSIG= -- Number of sigma to reject on
SCALE= -- Scale the flux arrays by this array
SNR= -- Signal-to-noise ratios to weight by
SKY= -- Array containing the sky level
OPTIONAL OUTPUTS:
FSKY= -- Combined sky spectrum
FNOVAR= -- Variance without object noise
COMMENTS:
EXAMPLES:
x_combspec, flux, var, fflux, fvar
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-May-2002 Written by JXP
03-Sep-2002 Added SCALE keyword + weighted means for 2 exposures
25-Aug-2004 Modified x_combspec_two to scale both spectra and to
combine if one spectra has zero flux (Kathy Cooksey)
27-Dec-2006 Added novar functionality to combine variances which do
not include object noise (Joe Hennawi).
(See Spec/Extraction//x_combspec.pro)
NAME:
x_constants
Version 1.1
PURPOSE:
Return a structure of the usual physical constants. Default is
cgs units.
CALLING SEQUENCE:
cstr = x_constants(/KSG)
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/KSG -- Return mks units
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
cstr = x_constants()
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-May-2002 Written by JXP
(See General//x_constants.pro)
NAME:
x_continuum
Version 1.1
PURPOSE:
GUI used to fit the continuum of a spectrum (usually quasars).
The user can dictate a SPLINE or perform a minimum chi^2 fit to
regions with rejection.
CALLING SEQUENCE:
x_continuum, flux_fil, error_fil, FITSTR=, CONTI=, LSIG=, XSIZE=, YSIZE=,
INFLG=, OUTFIL=, /SPLINE, INISPL=
INPUTS:
flux_fil - Values along one dimension [optional]
error_fil - Values along the other
RETURNS:
OUTPUTS:
OUTFIL= -- Name of FITS file to save continuum
OPTIONAL KEYWORDS:
CONTI= -- Name of FITS file containing previously saved
continuum
INFLG -- 0 = yin, ysin as data arrays (fits allowed and
expected)
1 = One fits file (flux, sig)
2 = One fits file (flux, sig, wave)
3 = FUSE format
5 = SDSS file
XSIZE= -- Window size in pixels
YSIZE= -- Window size in pixels
LSIG= -- Value for sigma rejection on low side [default: 2.5]
INISPL= -- IDL file containing a saved SPLINE for the continuum
FITSTR -- Fit structure
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_continuum, 'Q0000.fits', OUTFIL='Q0000_c.fits', /SPLINE
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
BSPLINE
GAUSS
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
GETCOLOR (coyote package)
; REVISION HISTORY:
26-Feb-2002 Written by JXP
(See Spec/Analysis//x_continuum.pro)
NAME:
x_convdeimosarc
Version 1.0
PURPOSE:
Simple program to convert the DEIMOS line list to my own format
CALLING SEQUENCE:
INPUTS:
OPTIONAL KEYWORDS:
OUTPUTS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
(See Spec/Arcs//x_convdeimosarc.pro)
NAME:
x_crossarc
Version 1.1
PURPOSE:
Finds shift between saved template and current arc spectra.
CALLING SEQUENCE:
x_crossarc, guessarc, cur_aspec, guess_spec, guess_fit, ordrs, $
ordr_shift, row_shift, chk=chk, sigrej=sigrej, /DEBUG
INPUTS:
guessarc - Filename of IDL save file with known wavelength solution
cur_aspec - Current extracted Arc spectra to be fit
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
guess_spec - saved arc spectrum rebinned to match cur_aspec
guess_fit - polynomial wavelength fits in rebinned space
ordrs - Orders matching saved spectrum
ordr_shift - Order offset between template and current
row_shift - Pixel offset between template and current
OPTIONAL KEYWORDS:
/CHK - Manually check steps along the way
/DEBUG - Debugging
SIGREJ= - Rejection sigma for outliers in arc line fitting
(default: 2.)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
restore
fft()
REVISION HISTORY:
2004 Written by SB
(See Spec/Arcs//x_crossarc.pro)
NAME:
x_cumulative
Version 1.1
PURPOSE:
Calculates a histogram of sorts [defunct]
CALLING SEQUENCE:
INPUTS:
Array, binsize or nbin
RETURNS:
cumulative array
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
XARR -- Value of xarray
COMMENTS:
EXAMPLES:
cumul = x_cumulative(array, 0.05)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Dec-2004 Written by JXP
(See General//x_cumulative.pro)
NAME:
x_curvefill
PURPOSE:
Shade the region between two curves
CALLING SEQUENCE:
x_curvefill, x, y1, y2, COLOR=, OUTLINECOLOR=, OUTHICK=
INPUTS:
x -- x-values of the curve
y1 -- lower set of y-values
y2 -- upper set of y-values
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
color= -- Color for shading
/LINE_FILL -- Hashes instead of fills
ORIENTATION -- Sets the angle of the lines
/xyreverse -- Lets you fill based on x rather than y
ie: x->y, y1->x1, y2->x2
x2= -- Lets you input a second array specifying both x1 and x2.
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
18-May-2006 Written by Joe H.
7-Dec-2009 Modified by Marc R. (xyreverse and x2)
(See Color//x_curvefill.pro)
NAME:
x_echcombspec
Version 1.1
PURPOSE:
Combines multiple exposures of the same obj
Must be run even on an object with a single exposure
CALLING SEQUENCE:
x_echcombspec, allobj, finspec, ordrs, keyindx
INPUTS:
allobj -- Array of echspec structures
ordrs -- Orders to coadd
keyindx -- Exposure to serve as the fiducial for stats
RETURNS:
OUTPUTS:
finspec -- echfspec structure containing the combined spectrum
OPTIONAL KEYWORDS:
/SILENT - No text output
/NOFLUX - Use the fluxed array
MINPIX1= - Minimum 'good' pixels to calculate fitting profile
ORDNM= - Fitting profile order [default: 1]
SNRMIN= - Minimum S/N per pixel for stats [Default: 2]
REJSIG= - Parameter passsed to x_combine [default = 4.]
MEDINDX= - Value for median smoothing [default: 100]
/NOREJ - Do not search for and reject bad pixels (e.g. cosmic
/ACHK - Force check of all orders
OPTIONAL OUTPUTS:
COMMENTS: ;
EXAMPLES:
hires_combspec, hires, setup, obj_id, side
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 Written by JXP
10-Jun-2004 Revisited by GEP
Sep-2005 Revisited by JXP
(See Spec/Analysis//x_echcombspec.pro)
NAME:
x_echfitstd
Version 1.3
PURPOSE:
GUI for tweaking a sensitivity function for an Echelle spectrum
CALLING SEQUENCE:
fit = x_echfitstd([xdat],ydat,func=,nord=, /inter, xsize=, ysize=)
INPUTS:
xdat - Values along one dimension [optional]
ydat - Values along the other
RETURNS:
fit - Values at each xdat
OUTPUTS:
OPTIONAL KEYWORDS:
func - String for Fitting function (POLY, LEGEND, BSPLINE,
GAUSS, CHEBY)
nord - Order of the fit
/inter - Interactive fitting
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
sig - Errors in the points
reg - Regions of data to fit
LSIG - Lower SIGMA
HSIG - High SIGMA
/REJ - Turn rejection on
DELPTS - Array of user-deleted points
MSK - Array of 0,1 values [0=do not include]
OPTIONAL OUTPUTS:
bset - Bspline info
rms - RMS of the fit (only valid for fits with rejection)
COMMENTS:
EXAMPLES:
fit = x_echfitstd(x, y, 'POLY', nord=5, /inter)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
BSPLINE
GAUSS
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
GETCOLOR (coyote package)
REVISION HISTORY:
22-June-2001 Written by JXP
28-June-2001 Added LEGENDRE fits (JXP)
23-Nov-2001 Added BSPLIN (SB), GAUSS, REJECTION (JXP)
31-Jan-2002 Added CHEBYSHEV
(See Spec/Flux//x_echfitstd.pro)
NAME:
x_echtrcarc
Version 1.1
PURPOSE:
To trace the arc lines in each order (individually) and fit a
straight line to each one. The following steps are taken:
1. Scattered light is removed from the image
2. All significant arc lines are identified (5 sigma)
3. trace_crude is used to trace the lines
4. trace_crude is reapplied to only those lines which are
entirely in the order
5. xy2traceset is used to fit a straight line to each arc line
6. Only the good lines are saved for 2D fitting in a structure
which is written to disk
CALLING SEQUENCE:
x_echtrcarc, arc_fil, ordr_str, out_fil, SZCCD=, $
INIO=, ALL_XSET=, /CLOBBER, $
QAFIL=
INPUTS:
arc_fil -- Name of arc file for tracing
ordr_str -- Order strucure describing the echelle footprint
out_fil -- Name of FITS file describing the traces
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
INIO - Initial order to trace (for debugging)
/CLOBBER - Overwrite previous fits
SZCCD -- Dimensions of the ccd
OPTIONAL OUTPUTS:
ALL_XSET -- A structure containing the info
QAFIL -- Filename for QA output
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Apr-2003 Written by SB
(See Spec/Arcs//x_echtrcarc.pro)
NAME:
x_editspec
Version 1.1
PURPOSE:
Allows user to reset values of a spectrum to reject bad regions
using a simple GUI
CALLING SEQUENCE:
x_editspec, wv, fx, var, [title], XSIZE=, YSIZE=, ISPEC=,
/BLOCK, NEWVAR=, FLG=, NEWFLG=
INPUTS
wv -- Wavelength array (expected to be a 2D array [npix, nspec])
fx -- Flux array (expected to be a 2D array [npix, nspec])
var -- Variance array (expected to be a 2D array [npix, nspec])
[title] -- List of object ID numbers
RETURNS:
OUTPUTS:
NEWVAR= -- Updated variance array which has bad pixels (regions) masked
NEWFLG= -- Flag used to specify whether to analyse the spectrum
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
/BLOCK - Block the window
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_editspec
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
03-May-2002 Written by JXP
(See Spec/Analysis//x_editspec.pro)
NAME:
x_extapprof
Version 1.0
PURPOSE:
Given the flux and wave images and the starting position of the
object to extract (x,y), do a trace (if necessary) and then
calcualte the aperture and a Gaussian fit to the aperture.
CALLING SEQUENCE:
x_extapprof, fx, wv, xyguess
INPUTS:
fx -- Flux image
wv -- Wavelength image
xyguess -- Guess at the trace
RETURNS:
OUTPUTS:
apstrct -- Structure containing the key info for the aperture and
profile
OPTIONAL KEYWORDS:
WVMNX - Endpoints for extraction (default: [3200., 11000.])
COLLMNX - Endpoints for collapsing the spectrum prior to extraction
(default: [3400., 8000.])
VAR= -- Variance array
FRAC= -- Fraction of flux NOT to include in aperture [default:
0.025, which corresponds to 5% total]
TRC_ORD= -- Polynomial order for fitting the trace [default: 5]
/SKYSUB -- Perform simple sky subtraction before calculating the
profile
PARAMETERS to TRACE_CRUDE: NMED, NAVE, TRADIUS, MXSHIFT
OPTIONAL OUTPUTS:
TOT_TRC -- Final trace (can be an input too)
FLG_APER= -- Flag describing the success (1= good)
COMMENTS:
EXAMPLES:
x_extapprof, slitstr, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Sep-2004 Written by JXP
(See Spec/Extraction//x_extapprof.pro)
NAME:
x_extechopt
Version 1.1
PURPOSE:
Extract 1D spectra from the 2D images. For each order, a boxcar
and an optimal extraction is performed. For the latter, an object
profile is derived and both the object flux and sky are fit throughout
the order (i.e. not row by row). The main driver is
x_extechopt. For the optimal extraction, the data is extracted
to a specific set of vacuum wavelengths, chosen to be the same for
every spectrum to facilitate coadding without rebinning. Here are
the steps in detail:
1. Perform a boxcar extraction using extract_box
2. Estimate the SNR per order from the boxcar extraction
-- LOOP ON ORDERS IN DECREASING SNR --
3. Fit the boxcar extraction with a bspline
4. Calculate the object profile
a. bspline_iterfit the flux vs position on slit
b. Force the profile to be positive everywhere and have a
sensible FWHM
5. Fit the order using the profile and sky (bspline_extract)
CALLING SEQUENCE:
x_extechopt, img, skysub, ivar, ordr_str, obj_str, velpix, radius=
INPUTS:
img -- Data image
skysub -- Sky subtraction image from x_echskysub
ivar -- Inverse variance image
ordr_str -- Order structure describing the echelle footprint
velpix -- Size of pixel in velocity units (km/s)
RETURNS:
OUTPUTS:
obj_str -- Structure containing the trace and extracted data
OPTIONAL KEYWORDS:
/BOXONLY -- Only do boxcar extraction
SKYFIL= -- Filename containing the sky spectrum
IMG_ARC= -- Wavelength image
BASE_APER= -- Aperture for boxcar [default: 0.75, 0.75]
/OCHK - Plot the extracted flux (optimal) for each order
/RESCHK - Check the residuals of the 2D, fully extracted image
/DEBUG - Stop within extraction routine to check stuff
HIGHSNR - Value of SNR^2 of the data for a given order which when
exceeded mike_box uses an additional parameter for the
profile shape. (Default: 500 corresponding to SNR=22)
Lowering this parameter may improve extraction.
ORDRS - Input array of physical order numbers to extract
/EXTENBOX - Allows the boxcar aperture to be larger than the
slit length defined by the trace flats (only
recommended for very bright stars)
MIN_CUT - Minimum length for cutoff aper in fractional slit length
[default: 0.]. For
longer slits and good seeing, it may be useful to set
this to a number like 0.5 or larger
FIN_MASK -- Image of masked pixels (mainly cosmic rays)
MSKTRIM= -- Value to trim edge of slit by [default: 0.5]
/SKIPSKYSUB -- Skip sky subtraction
Optional OUTPUTS:
FIN_TRC= -- Final trace of spectrum
MODEL_OBJ= -- Model of the object flux
MODEL_SKY= -- Model of the sky
MODEL_PROF= -- Model of the object profile
COMMENTS:
The program extracts the orders in order of decreasing SNR. If the
SNR is lower than lowsnr (default: 2.49) then the optimal
extraction is performed using the profile parameters from the
previous order(s).
EXAMPLES:
x_extechopt
PROCEDURES/FUNCTIONS CALLED:
extract_boxcar
x_smoothmask
bspline_extract
REVISION HISTORY:
26-Aug-2003 Written by SMB
Feb-2005 Ported to XIDL by JXP
(See Spec/Extraction//x_extechopt.pro)
NAME:
x_extobjbox
Version 1.0
PURPOSE:
Given the flux and wave images and the starting position of the
object to extract (x,y), do a boxcar extraction
CALLING SEQUENCE:
x_extobjbox, fx, wv, xyguess, fin_spec, MSK=, VAR=, WVMNX=
INPUTS:
fx -- Image array
wv -- Wavelength array
xyguess -- Guess at the trace
RETURNS:
OUTPUTS:
fin_spec -- Final spectrum
OPTIONAL KEYWORDS:
WVMNX - Endpoints for extraction (default: [3200., 11000.])
COLLMNX - Endpoints for collapsing the spectrum prior to extraction
(default: [3400., 8000.])
REDBLUE - Spectrum runs from red to blue
NEWWV - Finaly 1D wavelength array desired
CRVAL1 - Starting wavelength of final 1D array
CDELT - Delta lambda (lor or linear)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_extobjbox, slitstr, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Apr-2002 Written by JXP
(See Spec/Extraction//x_extobjbox.pro)
NAME:
x_extobjopt
Version 1.0
PURPOSE:
Given the flux and wave images, extract a 1D spectrum using the
Horne optimal algorithm. Assumes a Gaussian or input profile
image for now.
CALLING SEQUENCE:
x_extobjopt, fx, wv, xyguess, fin_spec
INPUTS:
fx -- 2D Image
wv -- 2D wavlenegth array
xyguess -- One spot on the image that the object is
RETURNS:
OUTPUTS:
fin_spec -- Final 1D spectrum
OPTIONAL KEYWORDS:
WVMNX - Endpoints for extraction (default: [3200., 11000.])
COLLMNX - Endpoints for collapsing the spectrum prior to extraction
(default: [3400., 8000.])
REDBLUE - Spectrum runs from red to blue
NEWWV - Finaly 1D wavelength array desired
CRVAL1 - Starting wavelength of final 1D array
CDELT - Delta lambda (lor or linear)
DEFGAU = Value for Gaussian profile if data is insufficient
USEGAU = Use this Gaussian sigma for the profile
NCRITER = Number of iterations of CR rejection (default: 1)
OPTIONAL OUTPUTS:
QAPROF -- The object profile for QA purposes
COMMENTS:
EXAMPLES:
x_extobjopt, slitstr, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Sep-2004 Written by JXP
(See Spec/Extraction//x_extobjopt.pro)
NAME:
x_extract
Version 1.1
PURPOSE:
Extracts a 1D spectrum from a 2D image given an aperture. This
routine is superseded by x_extobjbox
CALLING SEQUENCE:
spec = x_extract(img, aper, trace, [error, sky], CAPER=, GAIN=,
RN=, /OPTIMAL)
INPUTS:
img - 2D Image
aper - Aperture to extract
trace - Trace of the spectrum
[sky] - Optional input required for error output
RETURNS:
spec - 1D Spectrum
OUTPUTS:
OPTIONAL KEYWORDS:
CAPER - Line chosen for aperture: Require with TRACE
GAIN - CCD gain
RN - Read noise
OPTIONAL OUTPUTS:
var - Error array
COMMENTS:
EXAMPLES:
spec = x_extract(img, aper)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Dec-2001 Written by JXP
(See Spec/Extraction//x_extract.pro)
NAME:
x_extractarc
Version 1.1
PURPOSE:
Straighten each order indivdiually (x_ordrectify) and then extract
a boxcar down the center of each order by taking the average flux
in two regions (each side of the center) of width 1/3 the order
width.
CALLING SEQUENCE:
flux = extract_arc( arc_img, ordr_str )
INPUTS:
arc_img - 2D Arc image
ordr_str - Order structure
RETURNS:
flux - 1D spectrum down the center of each order
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
flux = x_extractarc( arc_img, ordr_str )
PROCEDURES/FUNCTIONS CALLED:
x_ordrectify
REVISION HISTORY:
??--2004 Written by SB
(See Spec/Arcs//x_extractarc.pro)
NAME:
x_ffttrace
Version 1.1
PURPOSE:
Traces the y-distortion of a flat using FFTs. It is unlikely
this program works well. I highly recommend tracing the
'sawtooth' image of a flat instead.
CALLING SEQUENCE:
x_ffttrace, img
INPUTS:
img - Input image (flat)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_ffttrace, img, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
29-Jan-2002 Written by JXP
(See Spec/Rectify//x_ffttrace.pro)
NAME:
x_filters
Version 1.1
PURPOSE:
Grabs out a list of unique filters from a full string
array list of filters.
CALLING SEQUENCE:
x_filters, allfilt, filter, [nfilt], NOSORT=nosort
INPUTS:
allfilt - List of all images
RETURNS:
filter - Filter list
OUTPUTS:
OPTIONAL KEYWORDS:
/NOSORT -- Dont bother sorting the unique filter list
OPTIONAL OUTPUTS:
nfilt - Number of unique filters
COMMENTS:
EXAMPLES:
x_filters, img, filter, nfilt
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
27-July-2001 Written by JXP
08-Aug-2001 Revised to sort
(See IMG/General//x_filters.pro)
NAME:
x_findgauss
Version 1.0
PURPOSE:
Finds Gaussian absorption features in a spectrum (should be
normalized). The routine uses find_npeaks to find the features
and then tunes up on then with zfitmax.
CALLING SEQUENCE:
x_findgauss, y, [invvar], xarr=, sigma=, xpeak=, ypeak=, xsn=, sn=,
width=, nfind=, minsep=
INPUTS:
y -- Flux
[invvar] -- Inverse variance
RETURNS:
OUTPUTS:
xpeak -- x values of the peaks
ypeak -- y height of the peak
OPTIONAL KEYWORDS:
SIGMA= -- Width of Gaussian (pixels) [default: 1.]
WIDTH= -- FWHM of the feature [default: 2.5*sigam]
MINSEP= -- Minimum separation between lines [default: 4.1*sigma]
NFIND= -- Number of peaks to find with find_nepaks [default: 50]
XARR= -- x array (e.g. wavelength)
OPTIONAL OUTPUTS:
xsn -- x values of peaks from find_npeaks
sn -- y values of the peaks from find_npeaks
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
find_npeaks
gauss_kernel
zfitmax
REVISION HISTORY:
24-Sep-2003 Written by SB
2003 Grabbed by JXP and slightly modified
(See Spec/Analysis//x_findgauss.pro)
NAME:
x_findnpeaks
Version 1.1
PURPOSE:
Stolen from SDSS
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Apr-2003 Written by SB
(See Spec/Arcs//x_findnpeaks.pro)
NAME:
x_fit
Version 1.2
PURPOSE:
Fits a function to a set of x,y data
CALLING SEQUENCE:
fit = x_fit(xdat,ydat,func,nord,sig=,reg=)
INPUTS:
xdat - Values along one dimension
ydat - Values along the other
RETURNS:
fit - Values of the fit at each xdat value
OUTPUTS:
OPTIONAL KEYWORDS:
sig= - Errors in the yval points
IVAR= - Inverse variance of the ydat values
func= - String for Fitting function (POLY, LEGEND, BSPLIN,
GAUSS)
nord= - Order of the fit
reg= - Regions of data to fit
msk= - Mask (0 = Do NOT include)
guess= - First guess for GAUSS routine
FITSTR= - 1D Fit structure used to set many of the above
parameters (recommended)
FLG_BSP= - Flag controlling BSPLINE options (1: nord = everyn)
/NONRM - Do not normalize the xdat from -1 to 1
OPTIONAL OUTPUTS:
ffit - Functional form
NRM - Normalization numbers for xdat :: dblarr(2)
RMS - RMS of the fit
COMMENTS:
EXAMPLES:
fit = x_fit(x, y, 'POLY', nord=5)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
FUNC_FIT
; REVISION HISTORY:
20-Nov-2001 Written by JXP
31-Jan-2002 Revised significantly. Added fit structure, CHEBY
27-Feb-2002 Added ivar option, am using func_fit for legendre
(See FIT//x_fit.pro)
NAME:
x_fit2darc
Version 1.1
PURPOSE:
To fit the arc lines identified in x_fitarc as a fucntion of
their y-centroid and order number. The main routine is in
x_fit2darc. The fit is a simple least-squares with one
round of rejection.
CALLING SEQUENCE:
x_fit2darc, arcfil, ordr_str, arc_info, nycoeff=nycoeff, $
nocoeff=nocoeff, CLOBBER=clobber, SZ=sz, $
DEBUG=debug, CHKRES=chkres, out_str=out_str, $
QAFIL=qafil, YVAL=yval, ORIG=orig, SIGREJ=sigrej $
, pixrms = pixrms
INPUTS:
arc_fil -- Name of arc file
ordr_str -- Order strucure describing the echelle footprint
arc_info -- Name of file created by x_fitarc
RETURNS:
OUTPUTS:
A fits file containing the 2D solution. Named something like
'Arcs/Fits/Arc_B0010_fit2D.fits'
OPTIONAL KEYWORDS:
NOCOEFF - Number of coefficients to use in the x-direction
(default: 5)
NYCOEFF - Number of coefficients to use in the y-direction
(default: 4)
/CLOBBER - Overwrite any previous solution
/DEBUG - debug
/CHKRES - Plot the residuals
/YVAL - Use the x position on the CCD [not recommended]
/ORIG - Use wavelengths for the basis not wavelength*order#
[not recommended]
SIGREJ= - Value for sigma rejection in the fit [default: 10]
OPTIONAL OUTPUTS:
PIXRMS= -- RMS of the fit in pixels (for each echelle order)
COMMENTS:
EXAMPLES:
print, x_fit2darc(arcfil, ordr_str, arc_info)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Feb-2003 Written by SB
18-Apr-2003 Revised by JXP
Feb-2005 Ported to XIDL by JXP
(See Spec/Arcs//x_fit2darc.pro)
NAME:
x_fit2dsurf
Version 1.1
PURPOSE:
Fits a 2d surface to a set of x,y data with errors (optional).
It is recommended to set the FIT parameters with the structure
FITSTR.
CALLING SEQUENCE:
fit = x_fit2dsurf(xy, z,[sig], nx=, ny=, MSK=, FITSTR=, REJPT=,
NRM=, /NONRM, /SVDFT, LSIG=, HSIG=, NITER=, MAXREJ=, FUNC= )
INPUTS:
xy - 2d array of xy pairs: [N,2]
z - Values at each xy pair
[sig] - Variance in each data point
RETURNS:
fit - Values at each xdat
OUTPUTS:
OPTIONAL KEYWORDS:
msk - Mask (0 = Do NOT include)
func - 2d function ('POLY')
nx - Order in x
ny - Order in y
NONRM - Don't normalize data before fitting
MINPT - Minimum number of points to keep in fit
LSIG,HSIG - Lower and upper sigma rejection
/SVDFT - Use the IDL routine SVDFT for the fitting.
Otherwise use CHOLDC (recommended for speed)
OPTIONAL OUTPUTS:
ffit - Functional form
NRM - [2,2] array of Normalization coefficients
REJPT - Points rejected in the fit
COMMENTS:
EXAMPLES:
fit = x_fit2dsurf(xy,z, sig)
PROCEDURES/FUNCTIONS CALLED:
f2dpoly
CHOLDC
SVDFT
x_calc2dfit
; REVISION HISTORY:
31-Jan-2002 Written by JXP
02-Feb-2002 Added rejection
(See FIT//x_fit2dsurf.pro)
NAME:
x_fit2dtrace
Version 1.1
PURPOSE:
Fits the traced y-distortion of a flat in 2D given a set of
traces for at various spots in the image.
CALLING SEQUENCE:
map = x_fit2dtrace( trcstr, FITSTR=, RES=, NX=, NY=, /SILENT )
INPUTS:
trcstr - Trace structure
RETURNS:
map - Map of the y-distortion
OUTPUTS:
OPTIONAL KEYWORDS:
nx - Number of orders along x axis [default: 4L]
ny - Number of orders along y axis [default: 4L]
OPTIONAL OUTPUTS:
FITSTR - 2D fitting function structure of the trace
RES - Residual image of the fit
COMMENTS:
Need to watch for memory issues with 2d surfaces
EXAMPLES:
map = x_fit2dtrace( trcstr )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Feb-2002 Written by JXP
(See Spec/Rectify//x_fit2dtrace.pro)
NAME:
x_fitarc
Version 1.1
PURPOSE:
To identify and centroid arc lines in each order. There is
actually no fitting done at this stage other than to reject bad
lines. The main program does the following:
1) Input the arc image
2) Input an archived arc solution
3) Extract 1D (boxcar) spectra down each order :: extract_arc
4) Cross correlate (FFT) against the archived 1D arc spectrum,
this gives the order number and the pixel offset
5) Automatically identify a set of lines (x_templarc)
6) Perform a low order fit to these lines
7) Reidentify all lines with this fit and refit
8) Write arc solutions (one per order) to a fits file
9) If the orders extend beyond the archived solution, attempt to
extrapolate to the remaining orders. The idea is to use the
known wavelengths from the good orders to extrapolate a guess at
the solution. Then use this guess to peak up on the arc lines in
these additional orders.
CALLING SEQUENCE:
x_fitarc, arc_fil, ordr_str, out_fil
INPUTS:
arc_fil -- Name of arc file
ordr_str -- Order strucure describing the echelle footprint
out_fil -- Name of IDL file containing the 1D fits
RETURNS:
OUTPUTS:
IDL fit file (one per order) (e.g. Arcs/ArcECH_##fit.idl)
OPTIONAL KEYWORDS:
/PINTER - Perform fit for pre-identified lines using x_identify
/INTER - Identify lines interactively and then fit
LINLIST - Arc line list (default: $XIDL_DIR/Spec/Arcs/Lists/hires_thar.lst
/CHK - Manually check steps along the way
/DEBUG - Debugging
/BCKWD - Data runs from red to blue [only necessary for
interactive fitting]
SIGREJ= - Rejection sigma for outliers in arc line fitting
(default: 2.)
IORDR - Initial order for analysis
FORDR - Final order for analysis
/CLOBBER - Overwrite previous fits
/FWEIGHT - Centroid arc lines using a flux-weighting scheme
/FGAUSS - Centroid arc lines using a gaussian fitting scheme
IPSIG - Array which sets the sigma significance for arc lines
as a function of order#. This is for the initial
solution and it is recommended to use a higher value
than IFSIG. An example: [ [0,40,10],
[40,80,20]] -- This sets the significance to 10 for
orders 0 to 40 and 20 for orders 40 to
80.
IFSIG - Similar to IPSIG except this is for the final line
list. One may tend to use weaker lines (lower
significance) for this step.
/NOLOG - Indicates the template file does not have Log
wavelengths
SATUR - Saturation level for the Arc [default: 30000.]
MXSHFT= - Maximum shift allowed between initial guess and FFT
cross-correlation
/CLIP - Remove especially bad lines [obsolete?]
GUESSARC= - Name of archived solution to use as a guess to the
inputted arc frame
/ARCPAIR - Use the routine arcpairs to guess at the solution (not
well tested)
/NOEXTRAP - Do not try to extrapolate the solution
CCDSZ= - Dimensions of the arc file [native]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fitarc, aimg
PROCEDURES/FUNCTIONS CALLED:
x_crossarc
x_fitarc_ps
extract_arc
x_templarc
x_identify
x_fndpeaks
z_arcpairs
REVISION HISTORY:
12-Aug-2002 Written by JXP
21-Aug-2002 Streamlined + Added ps output
01-Feb-2003 Polished (JXP)
01-Jan-2004 Added a guess at unmatched orders (SB)
28-Jun-2005 Added arcpairs functionality (SB+JXP)
(See Spec/Arcs//x_fitarc.pro)
NAME:
x_fitdla
Version 1.11
PURPOSE:
GUI used to fit DLA profiles interactively. The user determines
the continuum at the same time.
CALLING SEQUENCE:
x_fitdla, flux_fil, [err_fil], XSIZE=, YSIZE=, TITLE=,
WAVE=, /BLOCK, FWHM=, INIFIT=, INFLG=
INPUTS:
flux_fil - FITS file (or array) containing flux
[err_fil] - FITS error array
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
wave - wavelength array
FWHM= - Resoltuion (FWHM in pixels) [default: 2]
INFLG= - Usual flag for reading the FITS file (see x_readspec)
INIFIT= - IDL file containing a saved version of the fit
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fitdla, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Oct-2002 Written by JXP
(See Spec/Voigt//x_fitdla.pro)
NAME:
x_fitline
Version 1.1
PURPOSE:
Routine used with absorption line fit GUIs
CALLING SEQUENCE:
x_fitline, state, eventch, /FLG_PLT
INPUTS:
state - Structure describing the GUI and program
eventch -- Character input by the user
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Oct-2002 Written by JXP
(See Spec/Voigt//x_fitline.pro)
NAME:
x_fitlls
Version 1.11
PURPOSE:
GUI used to fit DLA profiles interactively. The user determines
the continuum at the same time.
CALLING SEQUENCE:
x_fitlls, flux_fil, [err_fil], XSIZE=, YSIZE=, TITLE=,
WAVE=, /BLOCK, FWHM=, INIFIT=, INFLG=
INPUTS:
flux_fil - FITS file (or array) containing flux
[err_fil] - FITS error array
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
wave - wavelength array
FWHM= - Resoltuion (FWHM in pixels) [default: 2]
INFLG= - Usual flag for reading the FITS file (see x_readspec)
INIFIT= - IDL file containing a saved version of the fit
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fitlls, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Oct-2002 Written by JXP
(See Spec/Voigt//x_fitlls.pro)
NAME:
x_fitrej
Version 1.2
PURPOSE:
Fits a function to a set of x,y data with rejection!
CALLING SEQUENCE:
fit =
x_fitrej(xdat,ydat,func=,nord=,sig=,reg=,
lsigma=,hsigma=,maxrej=,niter=,minpt=)
INPUTS:
xdat - Values along one dimension
ydat - Values along the other
[func] - String for Fitting function (POLY, LEGEND, BSPLIN)
[nord] - Order of the fit
RETURNS:
fit - Values at each xdat
OUTPUTS:
OPTIONAL KEYWORDS:
sig - Errors in the points
IVAR= - Inverse variance in the points
reg - Regions of data to fit
lsigma - Lower sigma threshold
hsigma - Upper sigma threshold
maxrej - Maximum points to reject per iteration
niter - Number of iterations for rejection
minpt - Minimum # of points
FITSTR - Fit structure :: OVERIDES ALL OTHER INPUT VALUES!
MSK - Mask for input data (1 = good)
FLG_BSP= - Flag controlling BSPLINE options (1: nord = everyn)
/NONRM - Do not normalize the xdat from -1 to 1
OPTIONAL OUTPUTS:
rms - RMS of the fit
REJPT - Rejected points
GDPT - Good (unrejected) points
NRM - Normalization numbers for xdat :: dblarr(2)
COMMENTS:
EXAMPLES:
fit = x_fitrej(x, y, FITSTR=fitstr)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
DJS_REJECT
REVISION HISTORY:
20-Nov-2001 Written by JXP
31-Jan-2002 Revised significantly. Added fit structure, CHEBY
(See FIT//x_fitrej.pro)
NAME:
x_fitstrtofits
Version 1.1
PURPOSE:
Writes a fitstr as a binary fits file (or read in a fit struct
from a binary FITS file)
CALLING SEQUENCE:
x_fitstrtofits, fit_str, fits_fil, /REVERSE
INPUTS:
fit_str - Fit structure
fits_fil - Fitsfile
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/REVERSE -- Default is to write the file. If /REVERSE is set
then the FITS file is read into a FIT structure
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fitstrtofits, fit_str, fits_fil
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Apr-2002 Written by JXP
(See FIT//x_fitstrtofits.pro)
NAME:
x_fittrcarc
Version 1.1
PURPOSE:
To fit the slope of the arc lines as a function of order number
and y position on the CCD. This information is then used to
construct a 2D wavelength image. The fitting routine is the usual
least-squares algorithm with two rounds of rejection.
CALLING SEQUENCE:
x_fittrcarc, arc_fil, trc_fil, ordr_str, out_fil, [qafil]
INPUTS:
arc_fil -- Name of arc file
trc_fil -- Name of file containing the output from x_echtrcarc
ordr_str -- Order strucure describing the echelle footprint
out_fil -- Name of FITS file containing the 2D fit
[qafil] -- Filename for QA output
RETURNS:
OUTPUTS:
Fits file with the coefficients of the 2D fit. Filename like
'Arcs/TRC/Arc_mb0539_F.fits'
OPTIONAL KEYWORDS:
/CHK -- Plots residuals
/CLOBBER -- Overwrite previous solution
/ORDRCLOB -- Overwrite arc_m in the order structure
ORDR_FIL= -- Filename containing the order sturcture. Necessary
for overwriting (e.g. MIKE spectrometer).
NOCOEFF - Number of coefficients to use in the x-direction
[default: 3]
NYCOEFF - Number of coefficients to use in the y-direction
[default: 2]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Apr-2003 Written by SB
Feb-2005 Ported to XIDL by JXP
(See Spec/Arcs//x_fittrcarc.pro)
NAME:
x_fitzpalav
Version 1.0
PURPOSE:
Report A_lambda/A(V) given lambda for a Fitzpatrick & Massa
parameterized extinction law.
CALLING SEQUENCE:
AlAV = x_alav(lambda, RV=, c3=, c4=)
INPUTS:
lambda -- Wavelengths to evaluate A at (angstroms)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
RV= -- Value of R_V
/SMC -- Use the SMC law
/CALZ -- Use the Calzetti law
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Written W. Landsman Raytheon STX October, 1998
2008 Revised by JXP
(See Dust//x_fitzpalav.pro)
NAME:
x_fluxcalib
Version 1.1
PURPOSE:
Given a spectrum and a flux calib solution, calibrate
CALLING SEQUENCE:
fx_fnu = x_fluxcalib(wv, fx, fitstr, [var, newvar], /FLAMBDA, DLMB=, TRUCONV=)
INPUTS:
wv - Wavelength array
fx - Stellar flux (e- per pixel)
fitstr - Calibration fitting function (assumes alog10 for flux)
[var] - Variance array
RETURNS:
fx_fnu - Flux in fnu (or flambda)
OUTPUTS:
OPTIONAL KEYWORDS:
/FLAMBDA - Return flambda instead of fnu
DLMB -- Delta lambda (or km/s if negative) of wavelength array
OPTIONAL OUTPUTS:
newsig -- Fluxed variance array
COMMENTS:
EXAMPLES:
fx_fnu = x_fluxcalib(wv, fx, fitstr)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Apr-2002 Written by JXP
(See Spec/Flux//x_fluxcalib.pro)
NAME:
x_fluxjohnson
Version 1.1
PURPOSE:
Calculates conversion factor for Johnson magnitudes to physical
flux by interpolation
CALLING SEQUENCE:
flux_conv = x_fluxjohnson(wave)
INPUTS:
wave= -- Wavelength array
RETURNS:
flux_conv -- Conversion factor from mag to flux
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Aug-2005 Written by JXP based on HIRES S2N code
(See Obs//x_fluxjohnson.pro)
NAME:
x_fmidx
Version 1.1
PURPOSE:
Converts frame number to index -- Useful for ccd###
CALLING SEQUENCE:
indx = x_fmidx(struct, frameno)
INPUTS:
frameno - Frameno [array] of the CCD image
RETURNS:
indx -- Index of the frame
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
idx = x_fmidx(n1, 203)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Nov-2001 Written by JXP
(See IMG/General//x_fmidx.pro)
NAME:
x_fndchrt
Version 1.1
PURPOSE:
Given an array of Obj name, RA, and DEC create a set of postscript
finding charts.
CALLING SEQUENCE:
x_fndchrt, targlist, OUTDIR=, IMSIZE=, SURVEY=, /ESO
INPUTS:
targlist -- ASCII file containing (QSO, RA, DEC)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
imsize - Arcmin of image [default is 5']
circ -- Radius of green to draw about the target [default: 5"]
/ESO -- Use the DSS at ESO
/radec -- Input is ['Name', 'RA:RA', 'DEC:DEC']
EPOCH= -- Epoch of RA/DEC [default: 2000]
SKIP= -- Skip lines at the start of the file
TWOCIRC = (x,y) offset in arcmin from field center
OPTIONAL OUTPUTS:
OUTDIR= -- Name of output directory
COMMENTS:
EXAMPLES:
x_fndchrt, 'targets.list'
PROCEDURES/FUNCTIONS CALLED:
showfits
querydss
sdss_queryimage
REVISION HISTORY:
21-Nov-2003 Written by JXP
(See Obs//x_fndchrt.pro)
NAME:
x_fndchrt
Version 1.1
PURPOSE:
Precess RA and DEC
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
imsize - Arcmin of image (default is 5')
OPTIONAL OUTPUTS:
OUTDIR= -- Name of output directory
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
precess
REVISION HISTORY:
21-Nov-2003 Written by JXP
(See Obs//x_precess.pro)
NAME:
x_fndfitval
Version 1.1
PURPOSE:
Solves for x in y = f(x) given a fitted function f(x) and y
CALLING SEQUENCE:
xsolv = x_fndfitval(val, fitstr, xval,[fit], NITER=, IPX=,
TOLER=, NEG=, FITSTR=)
INPUTS:
val - Value to match
fitstr - FIT structure
xval - Values where fit was pre-evaluated
[fit] - Values of the fit at xval (calculated if not input)
RETURNS:
xsolv - x position where the fit = val
OUTPUTS:
OPTIONAL KEYWORDS:
NORD - Required for LEGEND
TOLER - Tolerance for match [default: 10^-4]
IPIX - Starting pixel in xval
NEG - Proceed in the negative direction
NITER - Max number of iterations [default: 50]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xsolv = x_fndfitval(0.2, fitstr, xval)
PROCEDURES/FUNCTIONS CALLED:
POLY_FIT
POLY
SVDFIT
SVLEG
BSPLIN
GAUSS
; REVISION HISTORY:
23-Nov-2001 Written by JXP
13-Feb-2002 Requires fit structure
(See FIT//x_fndfitval.pro)
NAME:
x_fndflux
Version 1.1
PURPOSE:
OBSOLETE: Use x_calibstd
CALLING SEQUENCE:
x_fndflux, wv, fx, star, fitstr
INPUTS:
wv - Wavelength array
fx - Stellar flux
star - Specphot standard ('LTT7379')
fitstr - Fit of the star
RETURNS:
OUTPUTS:
fitstr - Fit structure
OPTIONAL KEYWORDS:
INTER - Interactive
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fndflux, wv, fx, star, fitstr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Apr-2002 Written by JXP
(See Spec/Flux//x_fndflux.pro)
NAME:
x_fndpeaks
Version 1.1
PURPOSE:
Finds a set of peaks in a spectrum. Generally used with arc line
spectra, but valueable in many other areas.
CALLING SEQUENCE:
x_fndpeaks, spec, center, NSIG=, PEAK=, /ALL, /SILENT, $
PKWDTH=, /THIN, /NORECENT, /FORCE, $
FRACPK=, EDGES=, NORDB=, NEDG=, AFUNC=,$
MSK=, AUTOFIT=, ICLSE=
INPUTS:
spec - Input spectrum (1D)
RETURNS:
center - Array of peak centers
OUTPUTS:
OPTIONAL KEYWORDS:
PKWDTH - Width of peak to center on (pixels) [default: 3L]
NORDB - Order for b-spline fit to the continuum of the
spectrum [default: 31L]
NSIG= - Number of sigma signifcance for the peak [default: 5.]
NEDG= - Number of pixels peak must be from the edge of the
spectrum [default: 5L]
AFUNC= - Name of function to fit to continuum [default: 'BSPLIN']
MSK= - Mask of good peaks
ICLSE= - Minimum separation between peaks [default: 4L]
/ALL - Pass back all peaks, not just the good ones
/THIN - Allow peaks to be 3 pixel thin [default: 5 pixel]
/FORCE - Force centering in x_centspln
/NORECNT - Do not bother to try to recenter the peaks
FRACPK= - Fraction of peak to calculate centroid [default: 0.33]
/FWEIGHT - Centroid using flux weighting
/FGAUSS - Centroid arc lines using a gaussian fitting scheme
OPTIONAL OUTPUTS:
PEAK= - Integer values of centeroids of the peaks
EDGES= - Positions of the edges of each peak (usually 0.33 of
COMMENTS:
EXAMPLES:
x_fndpeaks, spec, center
PROCEDURES/FUNCTIONS CALLED:
x_centspln
REVISION HISTORY:
14-Feb-2002 Written by JXP
(See Spec/Arcs//x_fndpeaks.pro)
NAME:
x_fndreg
Version 1.1
PURPOSE:
Finds data points within a number of regions.
[This is a rather difficult routine to use]
CALLING SEQUENCE:
pts = x_fndreg(xdat, reg)
INPUTS:
xdat - Data
reg - Regions: fltarr(N,2)
RETURNS:
pts - Points in the regions
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
NPNT - Number of points within the regions
COMMENTS:
EXAMPLES:
pts = x_fndreg( findgen(1000), [15., 25.])
PROCEDURES CALLED:
REVISION HISTORY:
21-Nov-2001 Written by JXP
(See General//x_fndreg.pro)
NAME:
x_fndslitobj
Version 1.0
PURPOSE:
Given the slitstr and the map, find slit positions in the
original image and create object structure. Used for the WFCCD
CALLING SEQUENCE:
x_fndslitobj, img, wvimg, slitstr
INPUTS:
img - Flux image
slitstr - Slit structure
RETURNS:
OUTPUTS:
Updates slitstr for original positions
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_fndslitobj, slitstr, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Feb-2002 Written by JXP
(See Spec/Slits//x_fndslitobj.pro)
NAME:
x_fndspln
Version 1.0
PURPOSE:
Solves for x in y = f(x) given a splined function f(x) and y
CALLING SEQUENCE:
xsolv = x_fndsplin(sx,sy,val,[splin] IPX=, TOLER=, /NEG=)
INPUTS:
sx - Values where spline was pre-evaluated
sy - Values of the spline at sx
val - Value to match
[splin] - Spline (calculated if necessary)
RETURNS:
xsolv - x position where the fit = val
OUTPUTS:
OPTIONAL KEYWORDS:
TOLER - Tolerance for match (default: 10^-4)
IPIX - Starting pixel in sx
/NEG - Proceed in the negative direction from IPIX
/SILENT - Turn off warning messages
NITER - Max number of iterations [default: 50L]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xsolv = x_fndspln(sx, sy, val)
PROCEDURES/FUNCTIONS CALLED:
SPLIN
REVISION HISTORY:
02-Feb-2002 Written by JXP
(See FIT//x_fndspln.pro)
NAME:
x_fweight
Version 1.1
PURPOSE:
Recenter a x using flux-weighted algorithm.
CALLING SEQUENCE:
xnew = x_fweight( img, xcen, ycen, [radius=radius, xerr=xerr,
invvar=invvar] )
INPUTS:
img - Image
xcen - Initial guesses for X centers
ycen - Y positions corresponding to "xcen" (expected as integers)
OPTIONAL KEYWORDS:
radius - Radius for centroiding; default to 3.0
invvar - Inverse variance of image used only in computing errors XERR.
If not set, then INVVAR=1 is used.
ninter - Number of iterations to perform
OUTPUTS:
xnew - New X centers
OPTIONAL OUTPUTS:
xerr - Formal errors for XNEW; set equal to 999.0 if there are any
masked pixels in a centroiding region (e.g., if INVVAR=0)
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
trace_fweight
REVISION HISTORY:
2004 Written by SB
(See Spec/Arcs//x_fweight.pro)
NAME:
x_gaussslit
Version 1.1
PURPOSE:
Calcualte the slit lost assuming a Gaussian object and a box slit
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
27-Oct-2005 Written by JXP based on HIRES S2N code
(See Obs//x_gaussslit.pro)
NAME:
x_getlst
Version 1.0
PURPOSE:
Calculate twilight in LST given a lat+long+date
CALLING SEQUENCE:
INPUTS:
jdin - Julian Date
Allowed formats: DDmmmYY (e.g. 22Oct99)
DD-MM-YY (e.g. 20-12-99)
YYYY-MM-DD (e.g. 1999-12-20)
DDMMMYYYY (e.g. 20JAN2004)
longit - Longitude on Earth [decimal hours]
RETURNS: twlight in LST strarr(2)
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
x_getlst
REVISION HISTORY:
Based on code in skycalendar v5 written by John Thorstensen
Dartmouth College
10-Dec-2009 Written by JXP
(See Obs//x_getlst.pro)
NAME:
x_getmonth
PURPOSE:
Converts a number into a month
CALLING SEQUENCE:
month = x_setmonth(ival)
INPUTS:
ival - Long value of the month
RETURNS:
month - String
OUTPUTS:
OPTIONAL KEYWORDS:
/REVERSE -- Turn a month into a number
/SSMALL -- Use lowercase
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
month = x_getmonth(10)
PROCEDURES CALLED:
REVISION HISTORY:
04-Jan-2002 Written by JXP
(See General//x_getmonth.pro)
NAME:
x_getobjnm
Version 1.1
PURPOSE:
Get the index of the object name OR return the list of obj_nm.
This is a pretty specific routine. If obj_nm is not specified the
routine launches a GUI to have the user choose.
CALLING SEQUENCE:
indx = x_getobjnm(objstr, [obj_nm], LST=)
INPUTS:
objstr -- Object structure
[obj_nm] -- Name of object for which the index is desired
RETURNS:
indx - Index of the object name OR list of obj_nm
OUTPUTS:
OPTIONAL KEYWORDS:
/LST - Return the list instead of the index
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
indx = x_getobjnm(objstr)
list = x_getobjnm(objstr, /LST)
PROCEDURES/FUNCTIONS CALLED:
x_guilist
REVISION HISTORY:
30-Jul-2002 Written by JXP
(See Spec/Analysis//x_getobjnm.pro)
NAME:
x_getrainbow
Version 1.1
PURPOSE:
Passes back a structure defining a rainbow
CALLING SEQUENCE:
colm = ew_to_colm([lambda], [EW], /RVRS)
INPUTS:
lambda - Rest Wavelength (Ang)
EW - EW (mA) [or column density (linear)]
RETURNS:
colm - Column density (linear)
OUTPUTS:
OPTIONAL KEYWORDS:
/SILENT -- Suppress written output
/RVRS -- Take a column density input and output the EW assuming
the linear COG
TOLER= -- Tolerance on wavelength [default: 0.1]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
colm = ew_to_colm([1215.6701],[50.])
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-May-2008 Written by JXP
(See Color//x_getrainbow.pro)
NAME: x_getxpmnx PURPOSE: Find the pixels corresponding to xymnx in state CALLING SEQUENCE: pxmnx = x_getxpmnx(state) INPUTS: state -- Structure with TAGS wave, xymnx RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: pxmnx = x_getxpmnx(state) PROCEDURES CALLED: REVISION HISTORY: 24-Oct-2002 Written by JXP
(See Spec/General//x_getxpmnx.pro)
NAME:
x_golden
Version 1.1
PURPOSE:
Uses the NR routine 'golden' to find the x-value where
the function has a minimum
CALLING SEQUENCE:
min = x_golden(func,a,b,c TOL=)
INPUTS:
func - String name of the IDL function
a,c - Values bracketing the minimum
b - Best guess at minimum
RETURNS:
min - x-value of function minimum
OUTPUTS:
OPTIONAL KEYWORDS:
TOL - Fractional Tolerance
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
num = x_golden('func', 0.0, 1.0)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
25-Jan-2002 Written by JXP
(See General//x_golden.pro)
NAME:
x_guilist
Version 1.1
PURPOSE:
Launches a cw_field, waits for the user to make a choice and
then returns the index and value of the choice. Routine will
block any other GUI.
CALLING SEQUENCE:
value = x_guilist(list, title)
INPUTS:
list - String array
title - Title
RETURNS:
value - String
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
value = x_guilist( ['a', 'b', 'c'], INDX=indx )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2002 Written by JXP
(See General//x_guilist.pro)
NAME:
x_guinum
Version 1.0
PURPOSE:
Launches a cw_field and grabs a number from the user
CALLING SEQUENCE:
num = x_guinum(flg)
INPUTS:
flg = Return (0: float, 1: double, 2: Long)
RETURNS:
num - Number
OUTPUTS:
OPTIONAL KEYWORDS:
TITLE= -- Title for the GUI [default: 'Num']
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
num = x_guinum( 0 )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Dec-2001 Written by JXP
(See General//x_guinum.pro)
NAME:
x_guistring
Version 1.0
PURPOSE:
Launches a cw_field and grabs a string from the user
CALLING SEQUENCE:
value = x_guistring(title)
INPUTS:
title - Title
RETURNS:
value - String
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
string = x_guistring( 'Enter filename: ')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2002 Written by JXP
(See General//x_guistring.pro)
NAME:
x_haalt
Version 1.0
PURPOSE:
Returns hour angle at which object at dec is at altitude alt */
CALLING SEQUENCE:
INPUTS:
dec - deg
lat - Latitude on Earth [deg]
alt - Altitude relative to the horizon
RETURNS: HA of the object
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
x_haalt
REVISION HISTORY:
Based on code in skycalendar v5 written by John Thorstensen
Dartmouth College
10-Dec-2009 Written by JXP
(See Obs//x_haalt.pro)
NAME:
x_helpwidg
Version 1.1
PURPOSE:
Creates a widget to display a help list which is simply an
array of strings that describe a GUI [or anything].
CALLING SEQUENCE:
x_helpwidg, help
INPUTS:
help - String array of help statements
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_helpwidg, ['Help', 'h: Show this']
PROCEDURES/FUNCTIONS CALLED:
; REVISION HISTORY:
28-Nov-2001 Written by JXP
(See General//x_helpwidg.pro)
NAME:
x_hstflux
Version 1.1
PURPOSE:
Given a spectrum and a flux calib solution, calibrate
CALLING SEQUENCE:
fx_fnu = x_fluxcalib(wv, fx, fitstr, [var, newvar], /FLAMBDA, DLMB=, TRUCONV=)
INPUTS:
wv - Wavelength array
fx - Stellar flux (e- per pixel)
fitstr - Calibration fitting function (assumes alog10 for flux)
[var] - Variance array
RETURNS:
fx_fnu - Flux in fnu (or flambda)
OUTPUTS:
OPTIONAL KEYWORDS:
/FLAMBDA - Return flambda instead of fnu
DLMB -- Delta lambda (or km/s if negative) of wavelength array
OPTIONAL OUTPUTS:
newsig -- Fluxed variance array
COMMENTS:
EXAMPLES:
fx_fnu = x_fluxcalib(wv, fx, fitstr)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Apr-2002 Written by JXP
(See Spec/Flux//x_hstflux.pro)
NAME:
x_identify
Version 1.1
PURPOSE:
GUI used to create a wavelength solution to an arc line
spectrum. Similar to IRAFs identify
CALLING SEQUENCE:
x_identify, spec, calib, XSIZE=, YSIZE=, LINELIST=, $
DISP=, LINEROOT=, INCALIB=,
/DEBUG, MSK=, OUTLIN=, /REDBLUE=, WAVE=, FLUX=, INLIN=
INPUTS:
spec - 1D flux spectrum (array)
RETURNS:
calib - FIT Structure describing the wavelength solution
OUTPUTS:
OPTIONAL KEYWORDS:
LINELIST - Reference list (user can set interactively)
LINEROOT - Path to a set of line lists [default:
/Spec/Arcs/Lists]
DISP - Guess at dispersion (A or km/s per pix [pos/neg
value])
/FLUX - Assumes wide slit and therefore wide arc lines
XSIZE,YSIZE -- Size of GUI in pixels
/REDBLUE - Spectrum runs from red to blue (not blue to red)
INCALIB - A input fit structure that can be used to identify lines.
MSPEC - An input arc that can be used to shift and stretch arc
MFITSTR - A structure that goes along with mspec which is the fit
for that arc. Note that incalib will be set with this as the
fit.
OPTIONAL OUTPUTS:
WAVE= -- Wavelength array for the arc line spectrum
MSK= -- ??
OUTLIN= -- Lines structure which shows the lines used in the fit
COMMENTS:
EXAMPLES:
x_identify, arc, calib
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Dec-2001 Written by JXP
19-Dec-2001 Added fitting
01-Feb-2003 Added input
01-Nov-2006 JFH added incalib option
(See Spec/Arcs//x_identify.pro)
NAME:
x_imarith
Version 1.1
PURPOSE:
Performs arithmetic on two fits images (akin to IRAF)
CALLING SEQUENCE:
x_imarith, img1, oper, img2, outimg, FITS=
INPUTS:
img1 -- Image 1
img2 -- Image 2
oper -- String math operation (+,*,/,-)
RETURNS:
OUTPUTS:
fimg -- Output image
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
/FITS - fimg is a fits file (string)
COMMENTS:
EXAMPLES:
x_imarith, 'f1.fits', '+', 'f2.fits', fimg
x_imarith, 'f1.fits', '+', 'f2.fits', 's12.fits', /FITS
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Aug-2001 Written by JXP
29-Dec-2001 Modified
(See IMG/General//x_imarith.pro)
NAME:
x_intphotcal
Version 1.2
PURPOSE:
Allows the user to interactively perform a photometric solution.
At its fullest, the code will calculate a zeropoint, an airmass
term and a color term.
The routine launches a GUI which allows the deletion
of specific stars.
CALLING SEQUENCE:
x_intphotcal, obs, landolt, outfil, XSIZE=, YSIZE=, /NCLR,
MIN_NOBS=, MIN_MOBS=, SETAM=
INPUTS:
obs - Standard star observations (stdstruct)
landolt - Landolt info (lndltstr)
RETURNS:
OUTPUTS:
OUTFIL -- ASCII file summary of the photometric solution.
OPTIONAL KEYWORDS:
XSIZE = size of gui
YSIZE = size of gui
MIN_NOBS= Min n value for Landolt star
MIN_MOBS= Min m value for Landolt star
/NCLR = Solve without color terms
SETAM = Value taken for AM term
(Note: You cannot choose a value of 0. exactly!)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_intphotcal, obs, landolt, outfil
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
07-Jan-2002 Revised by JXP
14-Oct-2002 Revised by JXP [setup no AM, no CLR terms]
(See IMG/Photometry//x_intphotcal.pro)
NAME:
x_invertarc
Version 1.1
PURPOSE:
Converts an Arc image in the flat frame to the original
Uses a C program, is a memory hog
CALLING SEQUENCE:
newarc = x_invertarc( arcimg, map )
INPUTS:
arcimg - Arc image in the flat frame (data or fits file)
map - Map image (data or fits file)
RETURNS:
newarc - Arc image in the Original frame
OUTPUTS:
OPTIONAL KEYWORDS:
/DBL - Use double precision
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
newarc = x_invertarc( arcimg, map, /DBL)
PROCEDURES/FUNCTIONS CALLED:
C code: invert_arc
REVISION HISTORY:
18-Feb-2002 Written by JXP
(See Spec/Arcs//x_invertarc.pro)
NAME:
x_keckhelio
Version 1.1
PURPOSE:
Compute correction term to add to velocities to convert to heliocentric.
This code also does the VLT and MMT. Note, it is the *NEGATIVE* of the
the number that one applies to a wavelength solution.
CALLING SEQUENCE:
vcorr = x_keckhelio( ra, dec, [epoch], jd=, tai=, $
longitude=, latitude=, altitude= )
INPUTS:
ra - Right ascension [degrees]
dec - Declination [degrees]
[epoch] - Epoch of observation for RA, DEC; default to 2000.
RETURNS:
vcorr - Velocity correction term, in km/s, to add to measured
radial velocity to convert it to the heliocentric frame.
OPTIONAL KEYWORDS:
jd - Decimal Julian date. Note this should probably be
type DOUBLE.
tai - Number of seconds since Nov 17 1858; either JD or TAI
must be specified. Note this should probably either
be type DOUBLE or LONG64.
longitude - Longitude of observatory;
default to (360-155.47220) deg for APO
latitute - Latitude of observatory; default to 32.780361 deg for APO
altitude - Altitude of observatory; default to 4000 m for
Keck
OBS= - Observatory (default: 'keck')
OUTPUTS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
helio_shift = -1. * x_keckhelio(RA, DEC, 2000.0)
BUGS:
PROCEDURES CALLED:
baryvel
ct2lst
REVISION HISTORY:
09-May-2000 Written by S. Burles & D. Schlegel
30-Aug-2002 Revised by JXP for Keck
22-Dec-2007 Revised to use observatory function by JFH.
(See Spec/General//x_keckhelio.pro)
NAME:
x_lndltcat
Version 1.1
PURPOSE:
Creates a fits file of the Landolt table. Probably needs
to be run only once unless a typo is corrected.
CALLING SEQUENCE:
x_lndltcat, fil, fitsfil
INPUTS:
fil - Name of the landolt file
RETURNS:
OUTPUTS:
fitsfil - Name of fits file to create
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
STRCT - Structre of the landolt file
COMMENTS:
EXAMPLES:
x_lndltcat, '/u/xavier/idl/xidl/IMG/Photometry/Lists/nlandolt.dat',
'Landolt.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_lndltcat.pro)
NAME:
x_lndltclr
Version 1.1
PURPOSE:
Returns the Landolt color of a star
CALLING SEQUENCE:
clr = x_lndltclr(color, lndltstr)
INPUTS:
color - String name of the color (e.g. 'BV')
lndlstr - Structure of the landolt star
RETURNS:
clr - Color of the Landolt star
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
clr = x_lndltclr('BR', landolt)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_lndltclr.pro)
NAME:
x_lndltmag
Version 1.1
PURPOSE:
Returns the Landolt magnitude for a given filter
CALLING SEQUENCE:
mag = x_lndltmag(filter, lndltstr, SIGMAG=)
INPUTS:
filter - String name of the filter
lndlstr - Structure of the landolt star
RETURNS:
mag - magnitude
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
SIGMAG = Error in the magnitude
COMMENTS:
EXAMPLES:
mag = x_lndltmag('R', landolt, SIGMAG=sig)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_lndltmag.pro)
NAME:
x_magtolum
Version 1.1
PURPOSE:
Convert AB mag to flux
CALLING SEQUENCE:
INPUTS:
inmag -- Magnitude
H0 -- Hubble constant
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Aug-2005 Written by JXP
(See Obs//x_magtolum.pro)
NAME:
x_maxspln
Version 1.1
PURPOSE:
Finds the maximum in a set of data using a spline. The program
simply splines the data and then finds the max.
CALLING SEQUENCE:
maxsp = x_maxspln( xval, yval, EDGES=, EDGVAL=, SPMX=)
INPUTS:
xval - x pos
yval - y pos (values to be maximized)
RETURNS:
maxsp - Maximum of the values
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
EDGES -- x-value Edges of peak corresponding to 0.333
EDGVAL -- y-value Edges of peak corresponding to 0.333
SPMX -- Maximum in the spline
COMMENTS:
EXAMPLES:
maxsp = x_maxspln(x, y)
PROCEDURES/FUNCTIONS CALLED:
x_golden
REVISION HISTORY:
29-Jan-2002 Written by JXP
(See FIT//x_maxspln.pro)
NAME:
x_medsigclip
PURPOSE:
Median multiple images with sigma-rejection. Akin to avsigclip
but does median analysis instead of averaging. This is my favorite
combine routine.
CALLING SEQUENCE:
result = x_medsigclip( array, [ dimension, siglo=, sighi=, maxiter=, $
inmask=, ] )
INPUTS:
array - N-dimensional array
OPTIONAL INPUTS:
dimension - The dimension over which to collapse the data. If ommitted,
assume that the last dimension is the one to collapse.
siglo - Low Sigma for rejection; default to 3.0.
sighi - High Sigma for rejection; default to 3.0.
maxiter - Maximum number of sigma rejection iterations. One iteration
does no sigma rejection; default to 10 iterations.
inmask - Input mask, setting =0 for good elements
gain - Gain; Crucial for calculating sigma; default to 1.0
rn - Readnoise; Crucial for calculating sigma; default to 7.0
OUTPUTS:
result - The output array.
outmask - Output mask, setting =0 for good elements, =1 for bad.
Any pixels masked in INMASK are also masked in OUTMASK.
OPTIONAL OUTPUTS:
COMMENTS:
The DIMENSION input is analogous to that used by the IDL built-in
function TOTAL.
EXAMPLES:
Create a data cube of 10 random-valued 100x200 images. At each pixel in
the image, compute the median of the 10 values, but rejecting 3-sigma
outliers:
> array = randomu(123,100,200,10)
> med = x_medsigclip(array, siglo=3., sighi=4.)
If all points are masked in any given vector or array, a mean and
dispersion are computed for all the points. Is this the behaviour we want?
If you want to replace those values with zeros instead, look at OUTMASK:
> array = randomu(123,100,200)
> inmask = bytarr(100,200)
> inmask[*,8] = 1 ; mask all of row #8
> ave = x_avsigclip(array, 1, inmask=inmask, outmask=outmask)
> ibad = where( total(1-outmask, 1) EQ 0)
> if (ibad[0] NE -1) then ave[ibad] = 0 ; zero-out bad rows
BUGS:
PROCEDURES CALLED:
Dynamic link to arravsigclip.c
REVISION HISTORY:
07-Jul-1999 Based on djs_avsigclip; Written by David Schlegel, Princeton.
28-Jul-2001 Modfied by JXP (Added lo/hi sigrej, does median)
(See IMG/Reduction//x_medsigclip.pro)
NAME:
x_mkabslin
PURPOSE:
Creates a FITS file from the standard line lists. Used
for voigt stuff.
CALLING SEQUENCE:
x_mkabslin
INPUTS:
wave - ionic transition
RETURNS:
f - oscillator strength
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
nam - Name of transition
COMMENTS:
EXAMPLES:
x_mkabslin, 1215.6701, fval, name
PROCEDURES CALLED:
REVISION HISTORY:
16-Oct-2002 Written by JXP
(See Spec/Lines//x_mkabslin.pro)
NAME:
x_mkaimg
Version 1.1
PURPOSE:
Given the 2D solution for the slope of the lines as a function of
position this code creates a wavelength image (i.e. assigns a
unique wavelength to each pixel in each order). The xoffset is
input in order to properly determine the edges of each order. A
simple spline interpolation is used to determine the values.
Note, you should have shifted the order structure as necessary
prior to calling this routine.
CALLING SEQUENCE:
x_mkaimg, arc_fil, ordr_str, arc2d_fil, fil_fittrc, $
out_fil, /CHK, /CLOBBER, BAD_ANLY=
INPUTS:
arc_fil -- Name of arc file
ordr_str -- Order strucure describing the echelle footprint
arc2d_fil -- Name of 2D wavelength solution
fil_fittrc -- Name of FITS file containing the 2D fit to the
tilted arc lines
RETURNS:
OUTPUTS:
2D wavelength image with name like 'Arcs/Arc_mb0439I.fits'
OPTIONAL KEYWORDS:
/CLOBBER - Overwrite previous image
/CHK - Display the final image
OPTIONAL OUTPUTS:
BAD_ANLY= - Set to 1 if the code finds double valued solutions.
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-May-2003 Written by SB
(See Spec/Arcs//x_mkaimg.pro)
NAME:
x_mode
Version 1.1
PURPOSE:
Calcualtes the mode after one inputs an array (default: nearest integer)
CALLING SEQUENCE:
INPUTS:
arr -- Array of values
RETURNS:
mode
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mode = x_mode(array)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
25-Aug-2004 Written by JXP
(See General//x_mode.pro)
NAME:
x_msklayout
Version 1.1
PURPOSE:
Allows the user to interactively place slitmasks on a field of
targets and write out their positions and PA values
CALLING SEQUENCE:
x_msklayout, targ, instr
INPUTS:
img - Image(s) for Masking
instr - Name of instrument (LRIS, DEIMOS)
RETURNS:
OUTPUTS:
mask - Creates a fits table of pixel values to mask
OPTIONAL KEYWORDS:
SECTRG -- 2nd set of targets to plot (in alternate point style)
ASTAR -- File containing the positions of Alignment stars
PVOBJ -- File of objects previously observed
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_msklayout, img, 'SITe1', 'LCO-40'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 Written by JXP
(See Obs//x_msklayout.pro)
NAME:
x_normflat
Version 1.0
PURPOSE:
Normalizes a multi-slit flat given the slit structure
CALLING SEQUENCE:
nrmflat = x_normflat( flat, slitstr, [var, nrmvar] )
INPUTS:
flat - Flat image or fits file
slistr - Slit structure
[var] - Variance array
RETURNS:
nrmflat - Normalized flat
nrmvar - Normalized variance
OUTPUTS:
OPTIONAL KEYWORDS:
YMED - Number of pixel offset from yedg to take median of
YNRM - Number of pixels outside yedg to normalize
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
nrmflat = x_normflat( flat, slitstr )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
11-Feb-2002 Written by JXP
15-Feb-2002 Revised to allow normalization of original
27-Mar-2004 Revised by MRB to not analyze flg_anly==0 slits
(See Spec/Slits//x_normflat.pro)
NAME:
x_normspec
Version 1.0
PURPOSE:
Normalizes a multi-slit image given a normalized flat
CALLING SEQUENCE:
nrmspec = x_normspec( img, flat, [var, nrmvar])
INPUTS:
flat - Flat image or fits file
slistr - Slit structure
RETURNS:
nrmspec - Normalized flat
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
nrmspec = x_normspec( img, flat)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
20-Feb-2002 Written by JXP
(See Spec/Slits//x_normspec.pro)
NAME:
x_nrmspec
Version 1.1
PURPOSE:
Applies the continuum to unnormalized data
CALLING SEQUENCE:
x_nrmspec, fluxfil, contfil, outfil, EFIL=, OUTE=
INPUTS:
fluxfil -- Name of fluxed spectrum (or non-normalized)
contfil -- Name of file containing the continuum
outfil -- Name of output file to contain normalized spectrum
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
INFLG= -- Keyword for x_readspec for reading the spectrum [default:
0]
EFIL= -- Filename of sigma array
OUTE= -- Filename for normalized sigma array
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
Fall-2005 Written by JXP
(See Spec/Analysis//x_nrmspec.pro)
NAME:
x_objnumid
Version 1.1
PURPOSE:
Turns an integer into a letter for Obj identification
CALLING SEQUENCE:
idval = x_objnumid( num )
INPUTS:
num - An integer
RETURNS:
idval -- A letter (0='a', 1='b', etc.)
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
idval = x_objnumid( 1 )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Mar-2002 Written by JXP
(See Spec/Slits//x_objnumid.pro)
NAME:
x_obsinit
Version 1.1
PURPOSE:
Initialize observing structures for an observatory
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/MAUNAKEA -- Use values for MK
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
showfits
querydss
REVISION HISTORY:
27-Oct-2005 Written by JXP
(See Obs//x_obsinit.pro)
NAME: x_oplotcirc PURPOSE: Overplot a circle on a current plot given center and radius CALLING SEQUENCE: x_oplotcirc, rad, x0=, y0=, NPT=, _EXTRA= INPUTS: rad -- Radius of the circle (plot units) RETURNS: OUTPUTS: OPTIONAL KEYWORDS: x0 -- x-center of the circle [default: 0.] y0 -- y-center of the circle [default: 0.] NPT -- Number of points to discretize the circle [default: 1000L] OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: x_oplotcirc, 2., x0=3., y0=4. PROCEDURES CALLED: REVISION HISTORY: 22-Nov-2003 Written by JXP
(See General//x_oplotcirc.pro)
NAME:
x_ordrectify
Version 1.1
PURPOSE:
Return an image of a single order, which is rectified,
has a width of 2*long(min(rhedg-lhedg)/2) + 1
and conserves counts in each row.
lhedg maps to the first column, rhedg to last column
and center of order to central column
CALLING SEQUENCE:
rect_image = x_ordrectify(arc_img, lhedg, rhedg, /NOCORRECT)
INPUTS:
img - Raw image
lhedg - Left hand edge of the order
rhedg - Right hand edge of the order
RETURNS:
rect_img - Rectified 2D image
OUTPUTS:
OPTIONAL KEYWORDS:
/NOCORRECT - ??
HALFW - Half width of the order (default: Minimum half width)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
rect_image = x_ordrectify(arc_img, lhedg, rhedg, /NOCORRECT)
PROCEDURES/FUNCTIONS CALLED:
x_ordrectify
REVISION HISTORY:
??--2004 Written by SB
(See Spec/Rectify//x_ordrectify.pro)
NAME:
x_origslit
Version 1.0
PURPOSE:
Given the slitstr and the map, find slit positions in the
original image. The values are filled into the slit structure.
CALLING SEQUENCE:
x_origslit, slitstr, map, /INVERSE
INPUTS:
slitstr - Slit structure
map - y-distortion map (fits is ok)
RETURNS:
OUTPUTS:
Updates slitstr for original positions
OPTIONAL KEYWORDS:
/INVERSE -- The map is the inverse!
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_origslit, slitstr, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Feb-2002 Written by JXP
(See Spec/Slits//x_origslit.pro)
NAME:
x_padstr
PURPOSE:
Pads an input string to a input length
CALLING SEQUENCE:
padstr = x_padstr(instr, len, /TRIM)
INPUTS:
instr -- Input string
len -- Desired length of string
[PAD_CHAR] -- Input charcater for padding
RETURNS:
padstr -- Padded string. Default is the back
OUTPUTS:
OPTIONAL KEYWORDS:
/TRIM -- First trim the string of extraneous blank spaces
/REVERSE -- Pad from the front
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
pad = x_padstr('Blah', 15L)
PROCEDURES CALLED:
REVISION HISTORY:
11-Nov-2004 Written by JXP
(See General//x_padstr.pro)
NAME:
x_photcal
Version 1.1
PURPOSE:
Derives a photometric solution for standard stars
CALLING SEQUENCE:
x_photcal, obs, landolt, ans, sig, MINSIG=, SETAM=, NCORR=, CHISQ=
INPUTS:
obs - Standard star observations (stdstruct)
landolt - Landolt info (lndltstr)
RETURNS:
ans - Fit
sig - Error on the fit parameters
OUTPUTS:
OPTIONAL KEYWORDS:
MINSIG - Minimum error for obs+landolt (default = 0.01)
MAXSIG - Maximum error to include in analysis (default = 0.1)
SETAM - Value to assume for the airmass term
/NOCLR - No color term (e.g. only one filter solution)
MIN_NOBS - Minimum number of n epochs to include (default = 4)
MIN_MOBS - Minimum number of m epochs to include (default = 2)
OPTIONAL OUTPUTS:
NCORR - Normalized correlation matrix
CHISQ - Chisq of the calibrated fit
COMMENTS:
EXAMPLES:
x_photcal, obs, landolt, ans, sig
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_photcal.pro)
NAME:
x_photsol1
Version 1.1
PURPOSE:
Performs the linear algebra on a set of obs with 1 free
parameters, i.e., Airmass fixed and NO color term
CALLING SEQUENCE:
x_photsol1, mo0, mT, sig, airmass, setam, coeffs, sigma_coeff,
COLOR=
INPUTS:
mo0 - Observed magnitudes
mT - True magnitudes
sig - Combined Error
airmass - Airmass values
SETAM - Value to set air mass coefficient to [Assumed positive!]
RETURNS:
coeffs - Fit
sigma_coeffs - Error on the fit
OUTPUTS:
OPTIONAL KEYWORDS:
color - Color values
OPTIONAL OUTPUTS:
CHISQ - chisq
COMMENTS:
EXAMPLES:
x_photsol1, blah
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
09-Aug-2001 Written by JXP
(See IMG/Photometry//x_photsol1.pro)
NAME:
x_photsol2
Version 1.1
PURPOSE:
Performs the linear algebra on a set of obs with 2 free
parameters, i.e., either Airmass fixed or NO color term
CALLING SEQUENCE:
x_photsol2, mo0, mT, sig, airmass, coeffs, sigma_coeff,
SETAM=, COLOR=, CHISQ=
INPUTS:
mo0 - Observed magnitudes
mT - True magnitudes
sig - Combined Error
airmass - Airmass values
RETURNS:
coeffs - Fit
sigma_coeffs - Error on the fit
OUTPUTS:
OPTIONAL KEYWORDS:
SETAM - Value to set air mass coefficient to [Assumed positive!]
color - Color values
OPTIONAL OUTPUTS:
CHISQ - chisq
COMMENTS:
EXAMPLES:
x_photsol2, blah
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_photsol2.pro)
NAME:
x_photsol3
Version 1.1
PURPOSE:
Performs the linear algebra on a set of obs. Fits for three
free parameters: zero point, airmass term, color term
CALLING SEQUENCE:
x_photsol3, mo0, mT, sig, airmass, color, coeffs, sigma,
CHISQ=, NCORR=
INPUTS:
mo0 - Observed magnitudes
mT - True magnitudes
sig - Combined Error
airmass - Airmass values
color - Color values
RETURNS:
coeffs - Fit
sigma_coeffs - Error on the fit
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
NCORR - Normalized correlation matrix
CHISQ - chisq
COMMENTS:
EXAMPLES:
x_photsol3, blah
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
08-Aug-2001 Written by JXP
(See IMG/Photometry//x_photsol3.pro)
NAME: x_pixminmax Version 1.1 PURPOSE: Find pixels in the wavelength array corresponding to the redshift and rest wavelength. CALLING SEQUENCE: x_pixminmax, wave, wrest, zabs, [vmin, vmax], PIXMIN=, PIXMAX=, VELO= INPUTS: wave -- Wavlength array wrest -- Rest wavelength of transition zabs -- Absorption redshift [vmin,vmax] -- Velocity minimum and maximum RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: PIXMIN= -- Pixel value corresponding to VMIN PIXMAX= -- Pixel value corresponding to VMAX VELO= -- Velocity array COMMENTS: EXAMPLES: x_pixminmax, wave, 1808.0126d, 1.5, -100., 50., PIXMIN=pixmn PROCEDURES CALLED: REVISION HISTORY: 10-Jun-2002 Written by JXP
(See General//x_pixminmax.pro)
NAME:
x_pltarc
Version 1.1
PURPOSE:
CALLING SEQUENCE:
x_templarc, spec, lines, guessfit, /FFT, MSK=, MXSHFT=, $
MOCK_FFT=, SHFT=, ALL_PK=, PKWDTH=, $
/THIN, FORDR=, PKSIG=, SKIPLIN=, $
MXOFF=, /LOG
INPUTS:
spec - Input arc image or spectrum
lines - Arc line structure
guessfit - FIT to archived arc
RETURNS:
OUTPUTS:
lines - Sets flg_plt to 1 those lines which are ID'd
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
ALL_PK= -- Pix values of the arc line peaks
COMMENTS:
EXAMPLES:
x_templarc, spec, lines, guessfit, SHFT=shft
PROCEDURES/FUNCTIONS CALLED:
x_fndpeaks
REVISION HISTORY:
26-Aug-2002 Written by JXP
(See Spec/Arcs//x_pltarc.pro)
NAME:
x_pltobj
Version 1.1
PURPOSE:
Sophisticated GUI for plotting 1D and 2D spectra together.
CALLING SEQUENCE:
x_pltobj, wave, fx, sig, infx, inwv, [imgwv], YSIZE=
XSIZE=, PMNX=, YSIZE=, OBJNM=, ZIN=, XMAX=, LLIST=
INPUTS:
wave -- 1D Wavelength array
fx -- 1D flux array
sig -- 1D sigma array
infx -- 2D flux image
inwv -- 2D wavelength image
[imgwv] -- 1D wavelength array giving approximate wave of the 2D
image
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE= -- Size of gui in screen x-pixels [default = ssz-300]
YSIZE= -- Size of gui in screen y-pixels [default = ssz-400]
PMNX= -- Plot range of the 1D spectrum
ZIN= -- Input redshift for the object
LLIST= -- Line list to use upon initialization (1: QAL, 2: GAL, 3:
QSO)
OBJNM= -- Title for the plot
XMAX= -- Maximum x value for the 1D plot
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_pltobj, x, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Apr-2002 Written by JXP
(See Spec/Analysis//x_pltobj.pro)
NAME:
x_pltvpfit
V1.2
PURPOSE:
Given a ISM structre write the files out
CALLING SEQUENCE:
flux = x_pltvpfit(wrest, wv, vpfils, FWHM=)
INPUTS:
wrest -- Rest wavelength [Ang]
wv -- Wavelength array
vpfils -- Structure with VPFIT info
RETURNS:
OUTPUTS:
Ion structure. Column densities have linear values
OPTIONAL KEYWORDS:
FWHM= -- FWHM in pixels of the spectral resolution
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
REVISION HISTORY:
05-Apr-2007 Written by JXP
(See Spec/Lines//x_pltvpfit.pro)
NAME:
x_prspeaks
Version 1.1
PURPOSE:
Launches a GUI to enable the user to fiddle with peaks by hand
CALLING SEQUENCE:
x_prspeaks, [xdat], ydat, XSIZE=, YSIZE=, TITLE=, XTWO=, YTWO=, PSYM_Y2=,
/BLOCK
INPUTS:
[xdat] - x values (optional)
ydat - Values
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
TITLE
YTWO
PSYM_y2
BLOCK
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_prspeaks, y
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Nov-2001 Written by JXP (modified from x1dfit)
24-Nov-2001 Added ytwo
(See Spec/Arcs//x_prspeaks.pro)
NAME:
x_psclose
Version 1.1
PURPOSE:
Call ps_close and reset a number of default values. Point window
at X-windows.
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
ps_close
set_plot
REVISION HISTORY:
09-Feb-2004 Written by JXP
(See General//x_psclose.pro)
NAME: x_psopen Version 1.1 PURPOSE: Calls ps_open and sets a number of default plotting values. CALLING SEQUENCE: x_psopen, fil, /MAXS, /PORTRAIT INPUTS: img - Fits file or data RETURNS: dat - Data in fits file or the input data OUTPUTS: OPTIONAL KEYWORDS: FSCALE - Data is float OPTIONAL OUTPUTS: HEAD - Header COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 09-Feb-2004 Written by JXP
(See General//x_psopen.pro)
NAME:
x_radec
PURPOSE:
Turns RA, DEC in XX:XX:XX.X -DD:DD:DD.D format to decimal deg
or VICE VERSA
CALLING SEQUENCE:
x_radec, ra, dec, rad, decd, /ARCS, /FLIP
INPUTS:
ra, dec - RA and DEC in in RR:RR:RR.R -DD:DD:DD.D format
Colons are required as separators
rad, decd - RA and DEC in decimal degrees (double)
RETURNS:
OUTPUTS:
ra, dec - RA and DEC in in RR:RR:RR.R -DD:DD:DD.D format
Colons are required as separators
rad, decd - RA and DEC in decimal degrees (double)
OPTIONAL KEYWORDS:
ARCS - Outputs in arcseconds
/FLIP - Gives RA and DEC from decimal RA,DEC
/LONG -- Passes back a longer form (string only)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_radec, '21:12:23.1', '-13:13:22.2', rad, decd
PROCEDURES CALLED:
REVISION HISTORY:
04-Aug-2001 Written by JXP
20-Nov-2003 Added + sign for /flip
(See General//x_radec.pro)
NAME:
x_readimg
Version 1.1
PURPOSE:
Convert input to data whether it is a fits file or an image array
CALLING SEQUENCE:
dat = x_readimg(img)
INPUTS:
img - Fits file or data
RETURNS:
dat - Data in fits file or the input data
OUTPUTS:
OPTIONAL KEYWORDS:
/FSCALE - Data is float
/DSCALE - Data is double
OPTIONAL OUTPUTS:
HEAD= - Header
COMMENTS:
EXAMPLES:
dat = x_readimg('spec.fits')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Dec-2001 Written by JXP
(See General//x_readimg.pro)
NAME: x_readmhdufits.pro
PURPOSE:
Given a multi-HDU FITS file, this routine will assemble the
various components into a single array based on the header
keywords describing the layout.
CALLING SEQUENCE:
array = readmhdufits(filename)
INPUTS:
filename = name of the multi-HDU FITS file to read
OPTIONAL INPUT KEYWORD PARAMETERS:
NOTRIM - if set, do not trim pre- and post-scan columns
NOBIAS - if set, do not perform overscan subtraction
LINEBIAS - if set, remove overscan line by line [default = use
scalar value]
GAINDATA - if set to a structure with gain for each amp, make
gain correction
VERBOSE - if set, give feedback
OPTIONAL OUTPUT KEYWORD PARAMETERS:
HEADER - retrieve the header from the primary HDU and return
it as a string array
OUTPUTS:
This function will return a 2-D floating-point array
representing the assembled image.
REQUIREMENTS:
- Requires the IDL Astronomy User's Library routines
(http://idlastro.gsfc.nasa.gov/)
EXAMPLES:
1) Read in a FITS file, with trimming and bias removal,
returning the data as "array" and the header as "header":
array = readmhdufits( 'lred0001.fits', header=header)
2) Read in a FITS file, without trimming or bias removal,
returning the data as "array" and the header as "header":
array = readmhdufits( 'lred0001.fits', /notrim,
/nobias, header=header)
3) Perform gain correction and use line-by-line bias
determination:
gain = [1.,2.,3.,4] ; for vidInp1,2,3,4
gaindata = build_gaindata(gain)
array = readmhdufits( 'lred0001.fits', /linebias,
gaindata=gaindata)
PROCEDURE:
- Uses the fits keyword in the header extentions
DETSEC = '[4096:3073,1:4096]' / NOAO mosaic detector section for ds9
to piece the mosiac together.
AUTHOR:
Marc Kassis, W. M. Keck Obseravtory
MODIFICATION HISTORY:
2009-May-27 MKassis v0.0 Original version
2009-Jun-02 GWirth v0.1 - added secparse routine
- now returns type FLOAT array
- added optional baseline removal
2009-Jun-16 GDW v0.2 - fix problem with NOTRIM mode
- use MRDFITS instead of FITSREAD
2009-Jun-19 GDW v0.3 - adapt for binned data
- write lris_read_amp function
2009-Jun-19 GDW v0.5 - fix bug with PRELINE
2009-Jun-24 JMS v0.6 - fix bug with BZERO
2009-Jul-02 GDW v0.7 - add LINEBIAS option
- add GAINDATA option
(See Keck/LRIS/General/x_readmhdufits.pro)
NAME:
x_rebin2dspec
Version 1.1
PURPOSE:
Rebin a single data set to a new wavlength scale
Simple adding (no weighting by S/N)
CALLING SEQUENCE:
x_rebin2dspec, wv, fx, nwwv, nwfx, VAR=, NWVAR=, GDPIX=,
/SILENT, /REDBLUE, /CR, /REBINC
INPUTS:
wv -- Wavelength array
fx -- Flux array
newwv -- New wavelength array to rebin to
RETURNS:
OUTPUTS:
newfx -- New flux array
OPTIONAL KEYWORDS:
VAR= -- Data is float
/REBINC -- Rebin using a C program
/REDBLUE -- Data runs from red to blue
OPTIONAL OUTPUTS:
NEWVAR= - New variance array
/CR - VAR = -1 flag CR and eliminate the pix
COMMENTS:
EXAMPLES:
x_rebin2dspec, gdpix, orig_wv, orig_fx, newwv, newfx
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Apr-2002 Written by JXP
24-Aug-2002 Added C program
(See Spec/General//x_rebin2dspec.pro)
NAME:
x_rectify
Version 1.1
PURPOSE:
Takes the y-distortion map and rectifies an image
CALLING SEQUENCE:
rect = x_rectify(img, map, /TRANSP, /SILENT, /DBL, /FIDL)
INPUTS:
img - Input image
map - y-distortion map
RETURNS:
rect - Rectified image
OUTPUTS:
OPTIONAL KEYWORDS:
/FIDL -- Do this using IDL as opposed to a fast C program
/TRANSP -- Transpose the image first
/DBL -- Return the rectified image in double precision
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
rect = x_rectify(flat, map)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
29-Jan-2002 Written by JXP
13-Aug-2002 Added transpose option (JXP)
(See Spec/Rectify//x_rectify.pro)
NAME:
x_register
Version 1.1
PURPOSE:
Given a set of offsets between images, this routine will
create final images that are registered.
CALLING SEQUENCE:
x_register, img, offsets, GOODREG=, OUTPTH=
INPUTS:
img -- String array of image names (assumes _sig extensions for sig
files)
offsets -- Integer offsets between images
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
goodreg -- Region of each image (4 int array) defining good data
Formatted (x0,x1,y0,y1)
OUTPTH -- Output path for the images
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_regsiter, img, off, GOODREG=good
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-Aug-2001 Written by JXP
(See IMG/Reduction//x_register.pro)
NAME:
x_relvel
Version 1.1
PURPOSE:
Calculate redshifts [default] or velocties using special rel
All velocities are km/s and positive means lower redshift
CALLING SEQUENCE:
[z2 or v] = x_relvel( z1, [v or z2], /REVERSE)
INPUTS:
z1 -- Redshift of 'rest'
RETURNS:
v or z2 -- z2 is default given a velocity (km/s)
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
AMIN -- Mpc per arcmin at z
COMMENTS:
EXAMPLES:
print, x_relvel(3., 3000.) [Answer = 2.9601706]
PROCEDURES CALLED:
REVISION HISTORY:
10-Aug-2006 Written by JXP
(See Cosm//x_relvel.pro)
NAME:
x_setaper
Version 1.1
PURPOSE:
Determine an aperture for an object automatically
CALLING SEQUENCE:
x_setaper, spec, center, [frac], RADIUS=, /SKYSUB
INPUTS:
spec - Spectrum (fits file ok)
center - center of aperture (guess, actual center not essential)
frac - Fraction of profile to extract [default: 0.05 off each side]
RETURNS:
aperture - Aperture: float(2) array around center
OUTPUTS:
OPTIONAL KEYWORDS:
RADIUS= -- Region of object profile to consider
/SKYSUB -- Calculate a median sky at outer regions of slit and
subtract off
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_setaper, 'spec.fits', 200.
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Apr-2001 Written by JXP
02-May-2002 Revised sky level
(See Spec/Extraction//x_setaper.pro)
NAME:
x_setapergui
Version 1.1
PURPOSE:
Sets objects and apertures interactively using a GUI
CALLING SEQUENCE:
x_setapergui, img, XSIZE=, YSIZE=, CLINE=, PEAKFRAC=, OBJSTR=
INPUTS:
img - 1D or 2D image
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
CLINE - Center line for 2D image to 'extract' 1D [default: sz[1]/2]
PEAKFRAC= - Fraction of peak
OPTIONAL OUTPUTS:
OBJSTR= -- Object structure with the aperture filled in. This will
include multiple objects if they are identified.
COMMENTS:
EXAMPLES:
x_setapergui, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
GETCOLOR (Coyote)
DJS_MEDIAN
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See Spec/Extraction//x_setapergui.pro)
NAME:
x_setbwclr
PURPOSE:
Creates an array of B&W shades useful for converting index
numbers into 'color'
CALLING SEQUENCE:
xcolors = x_setclrs()
INPUTS:
[nclr] - Optional input setting the array size (Default is 12)
RETURNS:
xcolors - String Array of B&W shades
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xcolors = x_setbwclr()
PROCEDURES CALLED:
getcolor (Coyote package)
REVISION HISTORY:
25-Nov-2001 Written by JXP
(See Color//x_setbwclr.pro)
NAME:
x_setclrs
PURPOSE:
Creates an array of colors useful for converting index
numbers into color
CALLING SEQUENCE:
xcolors = x_setclrs()
INPUTS:
[nclr] - Optional input setting the array size (Default is 12)
RETURNS:
xcolors - String Array of colors
OUTPUTS:
OPTIONAL KEYWORDS:
/WHITE - Assumes a black background
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
xcolors = x_setclrs()
PROCEDURES CALLED:
getcolor (Coyote package)
REVISION HISTORY:
25-Nov-2001 Written by JXP
(See Color//x_setclrs.pro)
NAME:
x_setddate
Version 1.1
PURPOSE:
Converts a string date into decimal date
CALLING SEQUENCE:
ddate = x_setddate(date)
INPUTS:
date - String name of the date
Allowed formats: DDmmmYY (e.g. 22Oct99)
DD-MM-YY (e.g. 20-12-99)
YYYY-MM-DD (e.g. 1999-12-20)
RETURNS:
ddate - Decimal date
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
If Year is < 50, then the year 2000 is presumed
EXAMPLES:
ddate = x_setddate('29Oct00')
PROCEDURES CALLED:
REVISION HISTORY:
07-Aug-2001 Written by JXP
(See General//x_setddate.pro)
NAME:
x_setfitstrct
Version 1.1
PURPOSE:
Initizlies a 1D FIT structure.
CALLING SEQUENCE:
fitstr = x_setfitstrct(NITER=, MINPT=, MAXREJ=, FUNC=, NORD=,
HSIG=, lSIG=, FLGREJ=)
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
NITER -- Number of iterations for FIT [default: 1L]
MINPT -- Number of points to keep in FIT [default: 1L]
MAXREJ -- Max Number of points to reject [default: 100L]
FUNC -- Max Number of points to reject [default: 'POLY']
NORD -- Order of the fit [default: 3L]
HSIG -- Upper sigma for rejection [default: 3.]
LSIG -- Lower sigma for rejection [default: 3.]
/FLGREJ -- Turn on rejection [default: NONE]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
fitstr= x_setfitstrct(/FLGREJ)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Jul-2002 Written by JXP
(See FIT//x_setfitstrct.pro)
NAME:
x_setjdate
Version 1.1
PURPOSE:
Converts a string date into Julian date
CALLING SEQUENCE:
jdate = x_setjdate(date, [UTTIME])
INPUTS:
date - String name of the date
Allowed formats: DDmmmYY (e.g. 22Oct99)
DD-MM-YY (e.g. 20-12-99)
YYYY-MM-DD (e.g. 1999-12-20)
DDMMMYYYY (e.g. 20JAN2004)
[UTTIME] -- To create JD with hr, min, sec (e.g. 12:11:29)
RETURNS:
jdate - Decimal date
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
If Year is < 50, then the year 2000 is presumed
EXAMPLES:
jdate = x_setjdate('29Oct00')
PROCEDURES CALLED:
julday (IDL package)
REVISION HISTORY:
31-Aug-2002 Written by JXP
(See General//x_setjdate.pro)
NAME:
x_setline
PURPOSE:
Given an atomic wavelength, return the fvalue and name in the
absorption line structure.
CALLING SEQUENCE:
linstr = x_setline(wave, LINFIL=)
INPUTS:
wave - rest wavelength
RETURNS:
linstr - Abslinstrct of the relevant line
OUTPUTS:
OPTIONAL KEYWORDS:
LINFIL= -- FITS file containing a set of ABSLINSTRCT entries
/OVERRIDE -- Bust through the stop sign for lines not in the
database
/CLOSE -- Return the closest line (not exact)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
linstr = x_setline( 1215.6701 )
PROCEDURES CALLED:
REVISION HISTORY:
17-Oct-2002 Written by JXP
(See Spec/Lines//x_setline.pro)
NAME:
x_setllst
Version 1.1
PURPOSE:
Returns a line list sturcture gven a file and a flag
CALLING SEQUENCE:
llist = x_setllst(file, fmt)
INPUTS:
file - Line list filename
fmt - Format of line file
0='lin.dat', 1=Gal or QSO line list
RETURNS:
llist - Structure of linelists
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
llist = x_setllst('/u/xavier/bin/junk/lin.dat', 0)
PROCEDURES CALLED:
REVISION HISTORY:
17-Sat-2001 Written by JXP
(See Spec/Lines//x_setllst.pro)
NAME:
x_setobjgui
Version 1.1
PURPOSE:
Interactive display of slit mask and slit positions and object
traces to allow verificaiton of the identificaitons and
traces. Largely based on ATV
CATEGORY:
Image display.
CALLING SEQUENCE:
x_setobjgui img, slitstr, objstr, [,min = min_value]
[,max=max_value]
[,/linear] [,/log] [,/histeq] [,/block]
[,/align] [,/stretch] [,header = header]
REQUIRED INPUTS:
img -- FITS file
slitstr -- Slit structure
objstr -- Object sturcture
OPTIONAL INPUTS:
array_name: a 2-D data array to display
OR
fits_file: a fits file name, enclosed in single quotes
KEYWORDS:
min: minimum data value to be mapped to the color table
max: maximum data value to be mapped to the color table
linear: use linear stretch
log: use log stretch
histeq: use histogram equalization
block: block IDL command line until ATV terminates
align: align image with previously displayed image
stretch: keep same min and max as previous image
header: FITS image header (string array) for use with data array
OUTPUTS:
None.
COMMON BLOCKS:
x_setobjgui_state: contains variables describing the display state
x_setobjgui_images: contains the internal copies of the display image
x_setobjgui_color: contains colormap vectors
x_setobjgui_pdata: contains plot and text annotation information
RESTRICTIONS:
Requires IDL version 5.1 or greater.
Requires Craig Markwardt's cmps_form.pro routine.
Requires the GSFC IDL astronomy user's library routines.
Some features may not work under all operating systems.
SIDE EFFECTS:
Modifies the color table.
EXAMPLE:
To start x_setobjgui running, just enter the command 'x_setobjgui' at the idl
prompt, either with or without an array name or fits file name
as an input. Only one x_setobjgui window will be created at a time,
so if one already exists and another image is passed to x_setobjgui
from the idl command line, the new image will be displayed in
the pre-existing x_setobjgui window.
MODIFICATION HISTORY:
Written by Aaron J. Barth, with contributions by
Douglas Finkbeiner, Michael Liu, David Schlegel, and
Wesley Colley. First released 17 December 1998.
This version is 1.3, last modified 28 November 2000.
For the most current version, revision history, instructions,
list of known bugs, and further information, go to:
http://cfa-www.harvard.edu/~abarth/x_setobjgui/x_setobjgui.html
Revised by JXP Aug-2001
(See Spec/Slits//x_setobjgui.pro)
NAME:
x_setslits
PURPOSE:
Finds slit edges on the 'flattened' flat in the presence of rotation
CALLING SEQUENCE:
slackers_setslits, flatimg, slitstr
INPUTS:
flat - Flat image or fits file
slitstr - Slit structure
COMMENTS:
This piece of code allows for a slight rotation (-2 to 2 deg) of
the mask, which can cause overlapping slits and other annoying
things.
REVISION HISTORY:
14-Feb-2002 Written by JXPj
6-Apr-2004 Revised by MRB
(See Spec/Slits//x_setslits.pro)
NAME:
x_setwave
Version 1.1
PURPOSE:
Sets a wavelength array given a header from a FITS file
CALLING SEQUENCE:
wave = x_setwave(head, ntot)
INPUTS:
head - Header
ntot - number of pixels
RETURNS:
wave - Wavelength array
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
wave = x_setwave(head, 1000L)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See Spec/General//x_setwave.pro)
NAME:
x_slctline
Version 1.1
PURPOSE:
Launches a GUI and allows the user to select a line. The code
then returns the rest wavelength of that line.
CALLING SEQUENCE:
line = x_slctline, lines, /ISM, NLIN=, ILIN=, XOFFSET=, YOFFSET=, /GAL,
PDMENU=
INPUTS:
lines - Line list structure
RETURNS:
line - Wavelength (double)
OUTPUTS:
line = unit number of line
OPTIONAL KEYWORDS:
/ISM - ISM style
/GAL - Use the Galaxy style
YOFFSET= - Placement of the GUI [default: 200]
XOFFSET= - Placement of the GUI [default: 200]
PDMENU= - String array formatted for cw_pdmenu
NLIN= - Grab only the first NLIN lines (only for non-ISM or
GAL)
OPTIONAL OUTPUTS:
ILIN= - Index of the selected line in the line list structure
COMMENTS:
EXAMPLES:
line = x_slctline( lines )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
29-Nov-2001 Significantly revised
08-Dec-2001 Allows ism or name+wave
(See Spec/Lines//x_slctline.pro)
NAME:
x_slittoobj
Version 1.0
PURPOSE:
Simple program to move some tags from the slit structure into the
object structure
CALLING SEQUENCE:
x_slittoobj, objstr, nobj, slitstr, clm
INPUTS:
objstr - Object sturcture
nobj - Index of the object
slitstr - Slit structure
clm - Column where the object was identified
RETURNS:
OUTPUTS:
Updates slitstr for original positions
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_slittoobj, objstr, nobj, slitstr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Mar-2002 Written by JXP
(See Spec/Slits//x_slittoobj.pro)
NAME: x_specbin Version 1.1 PURPOSE: Bins up 1D spectra in integer pixels. The routine returns a structure of flux and wavelength and variance that has been rebinned. CALLING SEQUENCE: bin = x_specbin(fx, nbin, VAR=, WAV=) INPUTS: fx - Flux nbin - Number of pixels to bin on RETURNS: bin - Structure of data OUTPUTS: OPTIONAL KEYWORDS: VAR= -- Input variance array WAV= -- Input wavelength array OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: bin = x_specbin(fx, 3) PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 04-Mar-2002 Written by JXP
(See Spec/Analysis//x_specbin.pro)
NAME:
x_speccoadd
Version 1.1
PURPOSE:
Routine written to coadd spectra. I highly recommend using
x_combspec instead. The routine here is old and not recently
tested!
CALLING SEQUENCE:
dat = x_speccoadd(spec)
INPUTS:
spec - Fits file or data
RETURNS:
dat - Data in fits file or the input data
OUTPUTS:
OPTIONAL KEYWORDS:
FSCALE - Data is float
DSCALE - Data is float
OPTIONAL OUTPUTS:
HEAD - Header
COMMENTS:
EXAMPLES:
dat = x_speccoadd('spec.fits')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
27-Feb-2002 Written by JXP
(See Spec/Analysis//x_speccoadd.pro)
NAME:
x_specpan
Version 1.1
PURPOSE:
Moves about a spectrum to left or right in a GUI. The
state structure must have TAGS: xymnx and wave
CALLING SEQUENCE:
x_specpan, state, /LEFT, /NOY
INPUTS:
state -- GUI state structure with TAGS: xymnx, wave
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/LEFT -- Pan left (default is right)
/NOY -- Do not rescale in y (default is to rescale)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_specpan, state, /LEFT
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See Spec/Display//x_specpan.pro)
NAME:
x_specplot
Version 1.1
PURPOSE:
GUI for plotting a spectrum and doing quick analysis
CALLING SEQUENCE:
x_specplot, flux, [ysin], XSIZE=, YSIZE=, TITLE=, WAVE=, LLIST=,
/QAL, /GAL, ZIN=, /BLOCK, /NRM, /LLS, /QSO, /LBG
INPUTS:
flux - Flux array (or FITS file)
[ysin] - Sigma array (or FITS file)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
wave= - wavelength array
dunit= - Extension in the FITS file
INFLG= - Specifies the type of input files (or arrays)
/LLS - Use Lyman limit line list
/QSO - Use Quasar line list
/GAL - Use galaxy line list
/QAL - Use quasar absorption line list
/LBG - use the Lyman Break Galaxy line list (Shapley et al '03)
XRANGE= - Opening plot x-axis (and default)
YRANGE= - Opening plot y-axis (and default)
/GUI - Choose from a list of FITS files (current directory)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_specplot, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Nov-2001 Written by JXP
19-Dec-2001 Added Error array, Colm
21-May-2008 Added XRANGE option, KLC
16-Oct-2008 Enable flux, ysin to be arrays, KLC
; 29-Apr-2010 Added Shapley et al (2003) LBG composite, fixed 'g',
; updated Help table, KLC
(See Spec/General//x_specplot.pro)
NAME:
x_specrebin
Version 1.1
PURPOSE:
Rebin a single data set to a new wavlength scale
Simple linear interpolation.
CALLING SEQUENCE:
x_specrebin, wv, fx, nwwv, nwfx, VAR=, NWVAR=, /SILENT, /REDBLUE
INPUTS:
wv -- Original wavelength array
fx -- Orignal flux array
newwv -- New (desired) wavelength array
RETURNS:
nwfx -- New flux array
OUTPUTS:
OPTIONAL KEYWORDS:
VAR= -- Original variance array
/REDBLUE -- Data runs from red to blue (not blue to red)
/SILENT
SMOOTH= -- Number of pixels to smooth over
OPTIONAL OUTPUTS:
NWVAR= -- New variance array
COMMENTS:
EXAMPLES:
x_specrebin, gdpix, orig_wv, orig_fx, newwv, newfx
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Apr-2002 Written by JXP
(See Spec/Analysis//x_specrebin.pro)
NAME:
x_speczoom
Version 1.1
PURPOSE:
Zooms in or out on a spectrum in a GUI
CALLING SEQUENCE:
x_speczoom, state, flg
INPUTS:
state - GUI state structure (needs TAG xymnx)
flg - 0-In, 1-Out
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_speczoom, state, flg
PROCEDURES/FUNCTIONS CALLED:
xgetx_plt
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See Spec/Display//x_speczoom.pro)
NAME:
x_speczoomreg
Version 1.1
PURPOSE:
Sets region to zoom in on in a GUI
CALLING SEQUENCE:
x_speczoom, state
INPUTS:
state -- GUI state (requires TAGS xymnx tmpxy, flg_zoom)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_speczoom, state
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See Spec/Display//x_speczoomreg.pro)
NAME:
x_splncogmax
Version 1.0
PURPOSE:
Create a table of COG values and fit a spline to it. The routine
then writes the output to a FITS file for future usage.
CALLING SEQUENCE:
x_splncogmax, tmax, tval, tabul, NSTP=, OUTFIL=, TMIN=, STRCT=
INPUTS:
tmax -- Maximum optical depth to consider
RETURNS:
tval -- Array of optical depth values
tabul -- Array of COG values (reduced EW)
OUTPUTS:
STRCT= -- Structure containing tval, tabul, and the SPLINE
OUTFIL= -- FITS file where the spline is written (as a structure)
OPTIONAL KEYWORDS:
TMIN= -- Minimum optical depth to consider [default: 1e-4]
NSTP= -- Number of points to evaluate at between TMIN and tmax
[default: 1000L]
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
15-Sep-2003 Written by JXP
(See Spec/Analysis//x_splncogmax.pro)
NAME:
x_splot
Version 1.1
PURPOSE:
Plots any array interactively
CALLING SEQUENCE:
x_splot, [xdat], ydat, XSIZE=, YSIZE=, TITLE=, XTWO=, YTWO=, PSYM2=,
/BLOCK, PSYM1=, YMNX=, XTHR=, YTHR=, PSYM3=
INPUTS:
[xdat] - x values (optional)
ydat - Values
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
TITLE
YTWO -- 2nd array to plot [If without XTWO, must have same dimension
as xdat]
XTWO -- 2nd array of x values to plot [requires YTWO]
PSYM2 -- Plot symbol for array 2 [default: 10]
YTHR -- 3nd array to plot [If without XTWO, must have same dimension
as xdat]
XTHR -- 3nd array of x values to plot [requires YTHR]
PSYM3 -- Plot symbol for array 3 [default: 10]
/BLOCK
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_splot, y
PROCEDURES/FUNCTIONS CALLED:
XGETX_PLT
XGETY_PLT
XGETXPIX_PLT
XGETYPIX_PLT
REVISION HISTORY:
17-Nov-2001 Written by JXP (modified from x1dfit)
24-Nov-2001 Added ytwo
9-Aug-2007 Added xmnx keyword JFH
(See General//x_splot.pro)
NAME:
x_starid
Version 1.1
PURPOSE:
Allows the user to interactively identify standard stars in a
field using lists and the like. This is a rather quick way of
doing the calibrations.
CALLING SEQUENCE:
x_starid, img, date, ccd, tel, LST_PATH=, OBJ=, XSIZE=, YSIZE=
INPUTS:
img - Image(s) for Masking
date - EPOCH of the obs (decimal years)
ccd - Name of the CCD (Tek5, SITe1, LRISR, SITe3)
tel - Name of telescope
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OBJ - Object names
XSIZE - Size of gui in screen x-pixels (default = 800)
YSIZE - Size of gui in screen y-pixels (default = 800)
OUT_PATH - Output name for id files (default: 'Photo/')
LST_PATH - Path name for Lists [default: $XIDL_DIR/IMG/Photometry/Lists/]
INORIENT - Number in range [-4,4] to change orientation of
standards plotted on image.
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_starid, img, 2004.2, 'SITe1', 'LCO-40'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Aug-2001 Written by JXP
04-Jan-2002 Updated and revised by JXP
(See IMG/Photometry//x_starid.pro)
NAME:
x_statarray
Version 1.1
PURPOSE:
This set of routines takes a series of flats observed through the
diffuser and creates a normalized Flat used to correct
pixel-to-pixel response variations. A principal challenge with
MIKE in its current state (April 2004) is that it is difficult to
get sufficient counts on the blue side.
mike_mkmflat :: The main routine simply does some basic
accounting, organizes bias subtraction and performs I/O.
mike_mkflat_work :: Accepts the name(s) of a series of OV
subtracted milky flats. It then:
1. Opens the file and creates an inverse variance array
2. Takes out the low order variation in the image (lo_interp)
3. Performs a series of medians along the columns rejecting bad
pixels (replace by local mean).
4. If multiple images were input, they are stacked with
rejection and the final image is returned
CALLING SEQUENCE:
mike_mkmflat, mike, setup, [side]
INPUTS:
mike - MIKE structure
setup - Setup identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
One normalized flat per setup per side with names like
'Flats/Flat_B_01_M.fits.gz'
OPTIONAL KEYWORDS:
/CLOBBER - Overwrite Output MilkyFlat
/OVCLOB - Overwrite OV files if they exist for the flats
/SVOV - Save the OV files created during this step
/USEBIAS - Use bias frame in OV subtraction
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
9-May-2005 Adapted by JXP from existing programs by SB
(See IMG/Reduction//x_statarray.pro)
NAME:
x_stdcalibfil
Version 1.1
PURPOSE:
Given an ra and dec, returns calib file and standard star name
CALLING SEQUENCE:
x_stdcalibfil, ra, dec, calibfil, std_name
INPUTS:
ra - RA in : format (12:11:23.3)
dec - DEC in : format (+13:32:21.2)
RETURNS:
calibfil -- Name of calib file in $XIDL_DIR/Spec/calibs/standards
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
12-Jan-2008 Written by JXP
(See Spec/Flux//x_stdcalibfil.pro)
NAME:
x_stdmag
Version 1.1
PURPOSE:
Does aperture photometry on the objects in the std_* list files
CALLING SEQUENCE:
xdimg_stdmag, struct, SKYR=
INPUTS:
img -- Image
strfil -- Star list file
outfil -- Output file
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
SKYR = 2 float array describing sky annulus in arcsec
(default=15,30)
ARCPIX= Arcseconds per pixel
SATUR= Saturation level
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_stdmag, 'Final/f_ccd003.fits', 'Photometry/star.list', 'outfil'
PROCEDURES/FUNCTIONS CALLED:
X_APER
X_CCDINF
REVISION HISTORY:
03-Apr-2003 Written by JXP
(See IMG/Photometry//x_stdmag.pro)
NAME:
x_stsltgui
Version 1.0
PURPOSE:
Allows the user to interactively (GUI) identify edges of
inidividual slits in the undistorted image
CALLING SEQUENCE:
x_stsltgui, img, slitstr, XSIZE=, YSIZE=
INPUTS:
img - Undistorted image
slitstr - Slit structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (default = 700)
YSIZE - Size of gui in screen y-pixels (default = 700)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_stsltgui, img, slitstr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
07-Feb-2002 Written by JXP
(See Spec/Slits//x_stsltgui.pro)
NAME:
x_suboscan
Version 1.1
PURPOSE:
Called by x_mkbias and x_subbias.
This routine does the overscan subtraction using the col and row
sections at the right and top, respectively. The code averages
the overscan region (with clipping), identifies bad rows
(SVBAD), and then uses SAVGOL to create a smoothed
representation of the overscan. This is then subtracted from
the columns in the image. Finally, the bias row (written at the
top of the image) is subtracted from each row after a SAVGOL
processing.
CALLING SEQUENCE:
x_suboscan, raw, head, ovimg, rbin, cbin, [imtype], /NOBIASROW,
/DEBUG, SVBAD=
INPUTS:
raw -- 2D image
head -- Header for the image (only used to update the card)
fincol -- Last column of data section
imtype= -- Image type:: 'ZRO' (only used for debugging)
RETURNS:
OUTPUTS:
ovimg -- Bias subtracted image
OPTIONAL KEYWORDS:
BIASROW - if set, bias row is used.
SKIPOV - If set, skip overscan subtraction (bias only)
DEBUG -- Turn debug mode on
OPTIONAL OUTPUTS:
SVBAD -- Rows with anomolous behavior, most likely related to a
transient occurance within the CCD electronics.
COMMENTS:
REVISION HISTORY:
18-July-2003 RAB
16-Feb-2004 JXP -- added kludge for bad rows
(See IMG/Reduction//x_suboscan.pro)
NAME:
x_sunradec
Version 1.0
PURPOSE:
CALLING SEQUENCE:
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
x_calclst
REVISION HISTORY:
Based on code in skycalendar v5 written by John Thorstensen
Dartmouth College
10-Dec-2009 Written by JXP
(See Obs//x_sunradec.pro)
NAME:
x_templarc
Version 1.1
PURPOSE:
Given an archived Arc spectrum and solution and a new arc
spectrum, find the pixel offset and auto-id the arc lines in new
arc spectrum. One must turn /FFT on to calculate the shift.
CALLING SEQUENCE:
x_templarc, spec, lines, guessfit, /FFT, MSK=, MXSHFT=, $
MOCK_FFT=, SHFT=, ALL_PK=, PKWDTH=, $
/THIN, FORDR=, PKSIG=, SKIPLIN=, $
MXOFF=, /LOG
INPUTS:
spec - Input arc image or spectrum
lines - Arc line structure
guessfit - FIT to archived arc
RETURNS:
OUTPUTS:
lines - Sets flg_plt to 1 those lines which are ID'd
OPTIONAL KEYWORDS:
/FFT -- Calculate the most likely offset between the archived
arc and the new one using the FFT procedure
MOCKFFT -- Archived FFT [default: create one from the line list]
MXOFF= -- Maximum offset between ID line and a line in the
linelist [default: 3 pixels]
SHFT= -- Shift between archived and new arc (Input and/or Output)
PKSIG= -- Sigma significant of arc lines (as found by x_fndpeak)
[default: 7.]
MSK= -- Mask of the lines
MXSHFT= -- Maximum shift between archived and new solution
/THIN -- Allow for very narrow arc lines
/LOG -- Do the algorithm with logarithmic wavelengths
FORDR -- Order for the fit for the continuum of the arc
/SKIPLIN -- Do not bother to identify good lines for subsequent
fitting (algorithm has only calucated the shift)
OPTIONAL OUTPUTS:
ALL_PK= -- Pix values of the arc line peaks
COMMENTS:
EXAMPLES:
x_templarc, spec, lines, guessfit, SHFT=shft
PROCEDURES/FUNCTIONS CALLED:
x_fndpeaks
REVISION HISTORY:
26-Aug-2002 Written by JXP
(See Spec/Arcs//x_templarc.pro)
NAME: x_tiffset Version 1.1 PURPOSE: Sets (or unsets) plotting variables for nice looking screen plots to then be used in laptop presentations. CALLING SEQUENCE: x_tiffset, /UNSET INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: /UNSET -- Unset the plotting values OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 02-Jun-2004 Written by JXP
(See General//x_tiffset.pro)
NAME:
x_trace
Version 1.2
PURPOSE:
Trace a spectrum. Ok for quick reductions
CALLING SEQUENCE:
fit = x_trace(img, aper, cline, PHSIG=, PLSIG=, TFFIT=,
NTRC=, PFUNC=, PNORD=, PHSIG=, PLSIG=, NOINTER=, YBUFF=, /PINTER)
INPUTS:
img - 2D spectral image
aper - Aperture defining the object
cline - Column to begin trace at
RETURNS:
FIT - Trace at each column
OUTPUTS:
OPTIONAL KEYWORDS:
NTRC - Number of columns to median for the trace
TFITSTR - Structure for the fitting the trace
PFUNC- Profile fitting function
PNORD- Profile fitting order
PHSIG
PLSIG
INTER - Interactive fitting for trace
OPTIONAL OUTPUTS:
TFFIT - Output fit info for the trace
COMMENTS:
EXAMPLES:
x_trace, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Nov-2001 Written by JXP
02-Feb-2002 JXP -- Added trace_crude option via CRUDE
(See Spec/Extraction//x_trace.pro)
NAME:
x_tracearc
Version 1.1
PURPOSE:
Given an arc image (or a slit from a multi-slit or one order from
an echelle), arc lines and trace them across the image. The
program returns a trace structure which can be used to create a
wavelength image. See x_echtrcarc for an Echelle version.
CALLING SEQUENCE:
tracestr = x_tracearc( img, [ymnx], YSTRT=, /ROT, GAIN=, RN=, NSIG=, RADIUS=,
MIN_XERR=, /SILENT, NORD=, VAR= )
INPUTS:
img - Input arc image
[ymnx] - Used to define edges of a slit or an order [default: image edges]
RETURNS:
tracestr - Trace structure describing the traces and fits to the
traces of the arc lines
OUTPUTS:
OPTIONAL KEYWORDS:
VAR= - Variance image of the Arc
GAIN= - Set this if you want the program to create the VAR image
RN= - Read noise (set this if you want the program to create the
VAR image) [default: 6]
RADIUS= - Radius input parameter to trace_crude [default: 1.5]
NSIG= - Number of sigma significance for arc linews [default: 5.]
YSTRT - COLUMN/ROW to start at
/ROT - Rotate the iamge by 90deg in those cases where the Arc
lines run side-to-side (trace_crude requries this)
MIN_XERR= -- Minimum xerr for fitting [default: 0.01]
NORD= - Order for fit to arc line curvature [default: 2L]
YSTRT= - Offset to account for sub images
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
trcstr = x_tracearc( img )
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Jan-2002 Written by JXP
(See Spec/Arcs//x_tracearc.pro)
NAME:
x_traceflat
Version 1.1
PURPOSE:
Traces the y-distortion of a flat of a number of slits
CALLING SEQUENCE:
x_traceflat, img, tracestrct, VAR=, GAIN=, RN=, SAW=, $
ystrt=, /NOTRANS
INPUTS:
img - Input image
RETURNS:
trcstr -- A trace structure describing the curvature of individual
slits or orders
OUTPUTS:
OPTIONAL KEYWORDS:
YSTRT -- COLUMN/ROW to start at
/NOTRANS -- Do not transpose original image
VAR= -- Variance image input
GAIN,RN= -- Values to create a VAR array
OPTIONAL OUTPUTS:
SAW= -- The sawtooth image
COMMENTS:
EXAMPLES:
x_traceflat, img, map
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Jan-2002 Written by JXP
(See Spec/Rectify//x_traceflat.pro)
NAME:
x_traceslit
Version 1.0
PURPOSE:
This is a failed attempt at a tracing program. Do not use!
CALLING SEQUENCE:
x_traceslit, img, pos, top, bottom
FFIT=, /INTER)
INPUTS:
img - Input image
pos - [x,y] position on the CCD
(default=1/3 max + min)
RETURNS:
OUTPUTS:
top - Trace of the top of the slit
bottom - Trace of the bottom of the slit
OPTIONAL KEYWORDS:
GAIN - Gain of the CCD
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_traceslit, img, [252.3, 235.5], top, bottom
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
16-Jan-2002 Written by JXP
(See Spec/Rectify//x_traceslit.pro)
NAME:
x_tstoff
Version 1.1
PURPOSE:
Does a quick check on the offset between a flat
and object frame. Uses FFT correlation
CALLING SEQUENCE:
x_tstoff, flat_in, obj_in, offset, CLINE=
INPUTS:
flat_in - Flat image (array or string)
obj_in - Flat image (array or string)
RETURNS:
offset - Vertical pixel offset
OUTPUTS:
OPTIONAL KEYWORDS:
ELINE - End line of data (routine takes 1/3, 1/2, 2/3)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_tstoff, flat, obj, offset
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
25-Jan-2002 Written by JXP
(See Spec/Rectify//x_tstoff.pro)
NAME:
x_tweakarc
Version 1.1
PURPOSE:
Allow the user to interactively (with a GUI) fiddle with the 1D
wavelength solution of a arc-line spectrum. This is designed for
Echelle observations only.
CALLING SEQUENCE:
x_tweakarc, twkfil, ordrs, templfil, _EXTRA=extra, $
LINLIST=linlist, QAFIL=qafil, OSTR_FIL=ostr_fil
INPUTS:
twkfil -- File containing the 1D arc-line fits
ordrs -- Orders to tweak [physical order numbers]
[templfil] -- name of archived wavelength solution to use as at
template
RETURNS:
OUTPUTS:
IDL fit file (one per order) (e.g. Arcs/ArcECH_##fit.idl)
OPTIONAL KEYWORDS:
LINLIST= -- Name of spectral line list
OSTR_FIL= -- Name of file containing the order structure. Required
for QA
OPTIONAL OUTPUTS:
QAFIL= -- Name of file to write QA info
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
x_fitarc
REVISION HISTORY:
Summer-2005 Created by JXP
(See Spec/Arcs//x_tweakarc.pro)
NAME:
x_uniqstr
Version 1.1
PURPOSE:
Obsolote: Superseded by UNIQ
CALLING SEQUENCE:
uniq = x_uniqstr(strings, COUNT=count)
INPUTS:
strings - Array of strings
RETURNS:
uniq - Array of unique members
OUTPUTS:
OPTIONAL KEYWORDS:
sort - Sort the output
OPTIONAL OUTPUTS:
COUNT - number of unique strings
COMMENTS:
EXAMPLES:
uniq = x_uniqstr( lbls, count=count)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
17-Nov-2001 Written by JXP
(See General//x_uniqstr.pro)
NAME:
x_velplt
Version 1.1
PURPOSE:
GUI used to display velocity profiles for absorption line system.
The user can control a number of options for the plot, output ps
files and PG plot input files, etc.
CALLING SEQUENCE:
x_velplt, flux_fil, zin, VMNX=vmnx, INFLG=inflg, $
TITLE=title, NPLT=nplt, NRM=nrm, XSIZE=xsize, YSIZE=ysize, $
SIG_FIL=, /ESIDLA, SVSTATE=, /LLS
INPUTS:
flux_fil -- Input FITS file for the flux (header includes
wavelength info)
zin -- Redshift of absorption lines
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
VMNX= -- Velocity range to plot [default [-300, 300]]
NPLT= -- Number of plots to show [default: 15L]
TITLE= -- Title to give GUI
XSIZE - Size of gui in screen x-pixels [default = 700]
YSIZE - Size of gui in screen y-pixels [default = ssz -200]
/LLS -- Use LLS line list
/SUBLLS -- Use smaller LLS line list
/ESIDLA -- Use ESI DLA line list
/CII - subset of the ESIDLA line list for measuring CII
SIG_FIL= -- Sigma file
INFLG= -- Flag for flux_fil data (see x_readspec)
SVSTATE= -- Input IDL file that saved the state of the GUI
previously
WAVE -- wavelength array (flux_fil should be array)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_velplt, wfccd, maskid, expsr
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
29-Oct-2002 Written by JXP
13-Jan-2006 Add wave keyword and enable passing of arrays, KLC
(See Spec/Analysis//x_velplt.pro)
NAME:
x_voigt
Version 1.1
PURPOSE:
Calculate a single voigt profile, given wavelength, absorber, and
an array of lines. This can be a very expensive routine to run.
CALLING SEQUENCE:
tau = x_voigt(wave, lines, FWHM=)
INPUTS:
wave - Array of wavelengths to realize voigt profile
lines - line(s) structure to compute voigt profile. If mutliple,
the entire list will be looped through.
RETURNS:
Normalized flux array with Voigt profile super-posed
OPTIONAL INPUTS:
FWHM - Resolution of instrument in PIXELS of input array
OUTPUTS:
tau - Optical depth at each wavelength
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES CALLED:
x_gsmooth
REVISION HISTORY:
25-May-2000 Created by S. Burles, FNAL/IAP
2003 Modified by JXP to give 'exact' answer
21-Jun-2007 Modified by KLC to opt out of 'exact' answer with /nosmooth
(See Spec/Voigt//x_voigt.pro)
NAME:
x_wavecal
Version 1.1
PURPOSE:
Wavelength calibrate a given input Arc img (or spectrum). This
routine simply extracts the Arc spectrum (if necessary) and then
calls x_identify
CALLING SEQUENCE:
wave = x_wavecal( arc, [extrct], LINELIST=, /DEBUG, $
/REDBLUE, DISP=, CALIB=, FLUX=)
INPUTS:
img/spec - 2D image or 1D spectrum
[extrct] - Extraction structure (required for an input 2D image)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
LINELIST - Reference list (user can set interactively)
DISP - Guess at dispersion (A or km/s per pix [pos/neg
value])
/FLUX - Assumes wide slit and therefore wide arc lines
/REDBLUE - Spectrum runs from red to blue (not blue to red)
/DEBUG
/ROT - Transpose the Arc image (code requires orders
parallel to rows)
OPTIONAL OUTPUTS:
CALIB= - Structure defining the fit
SPEC= - 1D extracted spectrum
COMMENTS:
EXAMPLES:
wave = x_wavecal(spec)
PROCEDURES/FUNCTIONS CALLED:
x_readimg
x_identify
REVISION HISTORY:
07-Dec-2001 Written by JXP
(See Spec/Arcs//x_wavecal.pro)
NAME:
x_wrechfspec
Version 1.0
PURPOSE:
Reads and writes the echfspec structure
CALLING SEQUENCE:
x_wrechfspec, echfspec, outfil, /READ
INPUTS:
echfspec -- IDL structure
outfil -- Name of FITS file
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/READ -- Read instead of write the structure
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_wrechfspec, echfspec, 'Extract/2015+657_ech.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Sep-2002 Written by JXP
(See Spec/Analysis//x_wrechfspec.pro)
NAME:
x_wrlwdfspec
Version 1.0
PURPOSE:
Reads and writes the lwdfspec structure
CALLING SEQUENCE:
x_wrlwdfspec, lwdfspec, outfil, /READ
INPUTS:
lwdfspec -- IDL structure
outfil -- Name of FITS file
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/READ -- Read instead of write the structure
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_wrlwdfspec, lwdfspec, 'Extract/2015+657_lwd.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-Aug-2002 Written by JXP
(See Spec/Analysis//x_wrlwdfspec.pro)
NAME:
x_xy2traceset
PURPOSE:
Convert from an array of x,y positions to a trace set
CALLING SEQUENCE:
xy2traceset, xpos, ypos, tset, [ invvar=, func=func, ncoeff=ncoeff, $
xmin=xmin, xmax=xmax, maxiter=maxiter, inputfunc=inputfunc, $
inmask=inmask, outmask=outmask, yfit=yfit, inputans=inputans, $
_EXTRA=EXTRA ]
INPUTS:
xpos - X positions corresponding to YPOS as an [nx,Ntrace] array
ypos - Y centers as an [nx,ntrace] array
OPTIONAL KEYWORDS:
invvar - Inverse variance for weighted fits.
func - Function for trace set; options are:
'poly'
'legendre'
'chebyshev'
'chebyshev_split'
Default to 'legendre'
ncoeff - Number of coefficients in fit; default to 3
xmin - Explicitly set XMIN for trace set rather than using minimum
in XPOS
xmax - Explicitly set XMAX for trace set rather than using maximum
in XPOS
maxiter - Maximum number of rejection iterations; set to 0 for no
rejection; default to 10.
inmask - Mask set to 1 for good points and 0 for rejected points;
same dimensions as XPOS, YPOS. Points rejected by INMASK
are always rejected from the fits (the rejection is "sticky"),
and will also be marked as rejected in OUTMASK.
inputans - ???
inputfunc - An array which matches the size of ypos, which is multiplied
to the normal function before SVD decomposition
silent - Set to suppress print and splog outputs
EXTRA - Keywords passed to either the function FUNC, or DJS_REJECT().
Note that keywords like MAXREJ relate to each individual trace.
OUTPUTS:
tset - Structure containing trace set
OPTIONAL OUTPUTS:
outmask - Mask set to 1 for good points and 0 for rejected points;
same dimensions as XPOS, YPOS.
yfit - Fit values at each XPOS.
COMMENTS:
The fits are done to one trace at a time, where each trace is treated
completely independently.
Note that both MAXDEV and MAXSIG can be set for applying both rejection
schemes at once.
Additional keywords can be passed to the fitting functions with _EXTRA.
By not setting any of these rejection keywords, no rejection is performed.
EXAMPLES:
BUGS:
PROCEDURES CALLED:
djs_reject()
fchebyshev()
fchebyshev_split()
flegendre()
fpoly()
func_fit()
REVISION HISTORY:
19-May-1999 Written by David Schlegel, Princeton.
04-Aug-1999 Added chebyshev option (DJS).
02-Sep-2000 Modify to use rejection schemes in DJS_REJECT() (DJS).
07-Dec-2000 Added /silent keyword (DPF)
10-Jul-2001 Add polynomial option
10-Apr-2005 Modified by SB
2006 Stolen by JXP
(See FIT//x_xy2traceset.pro)
NAME:
x_ydtortgui
Version 1.1
PURPOSE:
Allows the user to interactively examine the trace to slit
edges used to trace the y-distortion.
CALLING SEQUENCE:
x_ydtortgui, img, tracestrct, [newmnx], XSIZE=, YSIZE=
INPUTS:
img - Traced Image
trace - x,y positions of traces fltarr(N,M,2)
flgs - Flags describing the traces
RETURNS:
OUTPUTS:
newmnx - The new min and max values
OPTIONAL KEYWORDS:
XSIZE - Size of gui in screen x-pixels (Default = 1000)
YSIZE - Size of gui in screen y-pixels (Default = 500)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_ydtortgui, img, tracestrct
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Feb-2002 Written by JXP
(See Spec/Rectify//x_ydtortgui.pro)
NAME:
x_zfind
PURPOSE:
Find possible redshift matches for a set of spectra using a set of
eigen-templates. This is just a version I grabbed and slightly
modified from the SDSS distribution. The main modification was to
allow for more free paramters in fitting the continuum of the
galaxies due to poor fluxing with the WFCCD.
CALLING SEQUENCE:
result = x_zfind( objflux, objivar, hdr=hdr, $
[ starflux=, starloglam0=, stardloglam=, $
eigenfile=, eigendir=, columns=, npoly=, $
zmin=, zmax=, zguess=, pwidth=, nfind=, width=, _EXTRA= ]
INPUTS:
objflux - Object fluxes [NPIXOBJ,NOBJ]
objivar - Object inverse variances [NPIXOBJ,NOBJ]
REQUIRED KEYWORDS:
hdr - FITS header for objects, used to construct the wavelengths
from the following keywords: COEFF0, COEFF1.
OPTIONAL KEYWORDS:
starflux - Eigenspectra [NPIXSTAR,NSTAR].
starloglam0- Zero-point of log-10(Angstrom) wavelength mapping of STARFLUX.
stardloglam- Wavelength spacing for STARFLUX in log-10(Angstroms)
eigenfile - Input FITS file with an [NPIXSTAR,NSTAR] image with
either templates or eigenspectra. If a wildcard appears
in the file name, then the file that appears last in a sort
is used.
The header keywords COEFF0, COEFF1 are used to specify
the wavelength mapping in log-10 Angstroms.
This must be set if STARFLUX,STARLOGLAM0 are not set.
eigendir - Directory for EIGENFILE; default to $IDLSPEC2D/templates.
columns - Column numbers of the eigenspectra image to use in the
PCA fit; default to all columns.
npoly - Number of polynomial terms to append to eigenspectra;
default to none.
zmin - Minimum redshift to consider; default to no lower bound.
zmax - Maximum redshift to consider; default to no upper bound.
zguess - Initial guess for redshift; search for a solution about
this value. If specified with PWIDTH, then ZMIN and ZMAX
are ignoreed.
pwidth - Search width in pixels about the intial guess redshift ZGUESS.
If specified with ZGUESS, then ZMIN and ZMAX are ignored.
nfind - Keyword for ZCOMPUTE().
width - Keyword for ZCOMPUTE().
_EXTRA - Keywords for ZCOMPUTE(), such as PSPACE, DOPLOT, DEBUG.
OUTPUTS:
result - Structure with redshift-fit information. Structure
elements are left blank if fewer than NFIND peaks are found.
OPTIONAL OUTPUTS:
COMMENTS:
One can specify a search domain for the redshift with ZMIN and ZMAX, or
with ZGUESS and PWIDTH. If none of those parameters are set, then all
possible redshifts that overlap the object and star (template) are tested.
EXAMPLES:
BUGS:
PROCEDURES CALLED:
concat_dir()
djs_filepath()
fileandpath()
readfits()
splog
sxpar()
zcompute()
INTERNAL SUPPORT ROUTINES:
x_sp1d_struct()
REVISION HISTORY:
28-Jun-2000 Written by D. Schlegel, Princeton
(See Spec/Analysis//x_zfind.pro)
NAME:
z_arcpairs
Version 1.1
PURPOSE:
To identify the wavelength solution given arc lines and a list
CALLING SEQUENCE:
good = z_arcpairs(peaks, l, disp0, [dr1, NCOEFF=, INC=, TAN_BLAZE=])
INPUTS:
peaks : arc line positions in pixel space
l : possible arc line wavelengths
disp0 : guess at central dispersion per pixel, needs to be within dr
of the correct dispersion
RETURNS:
good : An index list of the best meatched wavelengths based on the
number of unique hits
OUTPUTS:
OPTIONAL KEYWORDS:
dr1 : range of dispersion to search, 10% is default [0.9,1.1]
tan_blaze For high dispersion gratings, the tangent of the blaze
angle, usually referred to a R. (like the R=2 grating in HIRES)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
May-2005 Written by SB
(See Spec/Arcs//z_arcpairs.pro)