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: Mon Jun 20 22:47:01 2005.
NAME:
bspline_extract
PURPOSE:
Calculate a B-spline in the least squares sense with rejection,
using a model profile.
CALLING SEQUENCE:
sset = bspline_extract(xdata, ydata, invvar, slit_profile, obj_profile, $
yfit=yfit, numiter=iiter, bkpt=bkpt, maxiter=maxiter,relative=relative, $
upper=upper, lower=lower, outmask=outmask, fullbkpt=fullbkpt, $
inmask=inmask, _EXTRA=EXTRA, RED_CHI=reduced_chi)
INPUTS:
xdata - Data x values
ydata - Data y values
OPTIONAL KEYWORDS:
invvar - Inverse variance of y; if not set, then set to be
consistent with the standard deviation. This only matters
if rejection is being done.
slit_profile - spatial profile of the background at each pixel
obj_profile - spatial profile of the object at each pixel
nord - Order for spline fit; default to 4.
x2 - 2nd dependent variable for 2-D spline fitting.
npoly - Polynomial order to fit over 2nd variable (X2); default to 2.
xmin - Normalization minimum for X2; default to MIN(XDATA).
xmax - Normalization maximum for X2; default to MAX(XDATA).
oldset - If set, then use values of FULLBKPT, NORD, XMIN, XMAX, NPOLY
from this structure.
funcname - If OLDSET is not specified and this is a 2-D B-spline,
then the function for the second variable may be passed.
The default is 'legendre' in the call to CREATE_BSPLINESET().
maxiter - Maximum number of rejection iterations; default to 10;
set to 0 to disable rejection.
upper - Upper rejection threshhold; default to 5 sigma.
lower - Lower rejection threshhold; default to 5 sigma.
_EXTRA - Keywords for BSPLINE_BKPTS() and/or DJS_REJECT().
OUTPUTS:
sset - Structure describing spline fit.
Return 0 if too few good (INVVAR NE 0) points are passed.
OPTIONAL OUTPUTS:
outmask - Output mask, set =1 for good points, =0 for bad points.
fullbkpt - If OLDSET is not specified, then the break points are
chosen with a call to BSPLINE_BKPTS() which can be returned
with this keyword.
yfit - B-spline fit evaluated at each data point.
numiter - Last iteration (0-indexed)
COMMENTS:
Wavelengths must be sorted!
Data points can be masked either by setting their weights to zero
(INVVAR[]=0), or by using INMASK and setting bad elements to zero.
INMASK is passed to DJS_REJECT().
If OLDSET is used, then the output structure SSET will be a structure
with the same name as OLDSET. This will allow the two structures to
be concatented, i.e.
> junk = [oldset, sset]
Although I'm not sure how to treat data points which fall outside
minmax(bkpt), now I will set them equal to minmax with invvar = 0
EXAMPLES:
PROCEDURES CALLED:
bspline_bkpts()
bspline_fit()
create_bsplineset()
djs_reject()
REVISION HISTORY:
(See pro/Object/bspline_extract.pro)
NAME:
bspline_indsky
PURPOSE:
Bspline extraction with independent breakpoints for OBJ/SKY
need a clever way to keep track of sky versus obj coefficients.
CALLING SEQUENCE:
sset = bspline_iterfit( )
INPUTS:
xdata - Data x values
ydata - Data y values
OPTIONAL KEYWORDS:
invvar - Inverse variance of y; if not set, then set to be
consistent with the standard deviation. This only matters
if rejection is being done.
nord - Order for spline fit; default to 4.
x2 - 2nd dependent variable for 2-D spline fitting.
npoly - Polynomial order to fit over 2nd variable (X2); default to 2.
xmin - Normalization minimum for X2; default to MIN(XDATA).
xmax - Normalization maximum for X2; default to MAX(XDATA).
oldset - If set, then use values of FULLBKPT, NORD, XMIN, XMAX, NPOLY
from this structure.
funcname - If OLDSET is not specified and this is a 2-D B-spline,
then the function for the second variable may be passed.
The default is 'legendre' in the call to CREATE_BSPLINESET().
maxiter - Maximum number of rejection iterations; default to 10;
set to 0 to disable rejection.
upper - Upper rejection threshhold; default to 5 sigma.
lower - Lower rejection threshhold; default to 5 sigma.
_EXTRA - Keywords for BSPLINE_BKPTS() and/or DJS_REJECT().
OUTPUTS:
sset - Structure describing spline fit.
Return 0 if too few good (INVVAR NE 0) points are passed.
OPTIONAL OUTPUTS:
outmask - Output mask, set =1 for good points, =0 for bad points.
fullbkpt - If OLDSET is not specified, then the break points are
chosen with a call to BSPLINE_BKPTS() which can be returned
with this keyword.
yfit - B-spline fit evaluated at each data point.
numiter - Last iteration (0-indexed)
COMMENTS:
Wavelengths must be sorted!
Data points can be masked either by setting their weights to zero
(INVVAR[]=0), or by using INMASK and setting bad elements to zero.
INMASK is passed to DJS_REJECT().
If OLDSET is used, then the output structure SSET will be a structure
with the same name as OLDSET. This will allow the two structures to
be concatented, i.e.
> junk = [oldset, sset]
Although I'm not sure how to treat data points which fall outside
minmax(bkpt), now I will set them equal to minmax with invvar = 0
EXAMPLES:
PROCEDURES CALLED:
bspline_workit()
bspline_fit()
create_bsplineset()
djs_reject()
REVISION HISTORY:
(See pro/Object/bspline_indsky.pro)
NAME: bspline_workit PURPOSE: Internal matrix manipulation for bspline extraction
(See pro/Object/bspline_workind.pro)
NAME: bspline_workit PURPOSE: Internal matrix manipulation for bspline extraction
(See pro/Object/bspline_workit.pro)
NAME:
dierfc
PURPOSE:
Inverse of the Complementary Error Function "erfc^{-1}(x)"
CALLING SEQUENCE:
result = dierfc( input )
INPUTS:
input - Arbitrary array of values from 0 to 2.
(positive values returned for inputs between 0 and 1)
exact 0 return NaN,
OUTPUTS:
result - The output array of type double, with range from
-infinity to +infinity.
OPTIONAL OUTPUTS:
COMMENTS:
The results outside of -20 < results < +20 may lack desired accuracy
EXAMPLES:
inverse = dierfc([0.0,0.0027,0.0456,1.0d,1.6827,1.9])
sigma = -sqrt(2.0) * inverse*sqrt(2.0)
print, sigma, format='(6f10.4)'
-Infinity -3.0000 -1.9991 0.0000 1.0000 1.6449
COPYRIGHT:
Copyright(C) 1996 Takuya OOURA (email: ooura@mmm.t.u-tokyo.ac.jp).
You may use, copy, modify this code for any purpose and
without fee. You may distribute this ORIGINAL package.
REVISION HISTORY:
11-Jun-2002 Adapted by S. Burles, MIT
(See pro/Object/dierfc.pro)
NAME:
extract_arc
Version 1.1
PURPOSE:
Straighten each order indivdiually (mike_rectify) 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 = extract_arc( arc_img, ordr_str )
PROCEDURES/FUNCTIONS CALLED:
mike_rectify
REVISION HISTORY:
??--2004 Written by SB
(See pro/Arcs/extract_arc.pro)
NAME:
FCHEBYSHEV
PURPOSE:
Compute the first M terms in a CHEBYSHEV polynomial expansion.
EXPLANATION:
Meant to be used as a supplied function to SVDFIT.
CALLING SEQUENCE:
result = FCHEBYSHEV( X, M )
INPUTS:
X - the value of the independent variable, scalar or vector
M - number of term of the CHEBYSHEV expansion to compute, integer scalar
OUTPUTS:
result - (N,M) array, where N is the number of elements in X and M
is the order. Contains the value of each CHEBYSHEV term for
each value of X
EXAMPLE:
(1) If x = 2.88 and M = 3 then
IDL> print, fchebyshev(x,3) ==> [1.00, 2.88, 15.5888]
(2) Find the coefficients to an M term Chebyshev polynomial that gives
the best least-squares fit to a dataset (x,y)
IDL> coeff = SVDFIT( x,y,M,func='fchebyshev')
METHOD:
REVISION HISTORY:
04-Aug-1999 Written by Scott Burles by hacking FLEGENDRE code
by Landsman in the Goddard libraries.
(See pro/Flat/fchebyshev_deriv1.pro)
NAME:
mike_1dspec
Version 1.1
PURPOSE:
Combines orders of a echfspec structure into a 1d spectrum.
Outputs flux and error arrays into separate files (_F.fits, _E.fits)
CALLING SEQUENCE:
mike_1dspec, mike, setup, obj_id, side
INPUTS:
mike - MIKE structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp_id] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
1d flux - (fits file; FSpec/name_ech_F.fits)
1d error - (fits file; FSpec/name_ech_E.fits)
OPTIONAL KEYWORDS:
/SILENT - No text output
OBJ_NM= - Name of object in slit (a = science)
/STD - Run on a standard star
OUTNM= - Alternative output name for FSpec file
ENDTRM= - Trim order edges by this when calculating ratios
MINPIX1= - Minimum 'good' pixels to calculate fitting profile
ORDNM= - 0th or 1st order fitting (1 = 1st, 2 = 0th (default))
SNRMIN= - Minimum S/N per pixel for consideration in fitting
MINPIX2= - Minimum 'good' pixels to calculate simple 0th order fit
OPTIONAL OUTPUTS:
COMMENTS: ;
EXAMPLES:
mike_1dspec, mike, setup, obj_id, side
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Jun-2004 Written by GEP
(See pro/Spec/mike_1dspec.pro)
NAME:
mike_addtwo
Version 1.0
PURPOSE:
Combines two flats, rejecting Cosmic Rays
CALLING SEQUENCE:
img = mike_addtwo(mike, indx, VAR=var)
INPUTS:
mike
indx
RETURNS:
img - Combine image
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
IVAR - Variance
COMMENTS:
EXAMPLES:
img = mike_addtwo(mike, indx)
PROCEDURES CALLED:
REVISION HISTORY:
30-Apr-2002 Written by JXP
(See pro/General/mike_addtwo.pro)
NAME:
mike_allarc
Version 1.1
PURPOSE:
Runs through all of the Arc processing steps in one go.
Can be used to process a set of arcs for a given object or all
of the arcs from a given night.
This file also contains mike_allarc_sngl which can be used to
fully process a single arc image. In fact, if the keyword /ALL is
used, then mike_allarc simply loops through all of the arcs calling
mike_allarc_sngl for each one.
CALLING SEQUENCE:
mike_allarc, mike, setup, [side], /CHK, /CLOBBER, /INDX
INPUTS:
mike - MIKE structure
setup - Integer defining setup OR an array of index values to
process
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
A series of files related to Arc calibration
OPTIONAL KEYWORDS:
/CLOBBER - Overwite any previous files
/CHK - Present GUIs to show results of fitting, etc.
/PINTER - Perform fit for pre-identified lines
/INDX - Treat setup as an array of index values to process
OPTIONAL OUTPUTS:
FITS= - File to write mike structure to (default: 'strct.fits')
ADDITIONAL KEYWORDS TO MIKE_ALLARC_SNGL:
/NOIMG - Do not create arc image
/NOWAV - Do not fit the arc lines (ie. only do tracing)
COMMENTS:
EXAMPLES:
mike_allarc, mike, 1L, 1L, /CHK, /CLOBBER
mike_allarc, mike, [104L, 107L], /INDX
rslt = mike_allarc_sngl('Raw/mb0539.fits', 1, 1, /PINTER)
PROCEDURES/FUNCTIONS CALLED:
mike_fitarc
mike_fit2darc
mike_tracearc
mike_fittrcarc
mike_mkaimg
REVISION HISTORY:
15-Aug-2003 Written by JXP
Usage:
(See pro/Arcs/mike_allarc.pro)
NAME:
mike_allflat
Version 1.1
PURPOSE:
Identifies flats, processes them. Creates one flat file
per slit width. Takes TFLAT as the default
CALLING SEQUENCE:
mike_mktflat, mike
INPUTS:
mike - ESI structure
[slit] - Slit size (e.g. 0.5, 0.75, 1.0)
RETURNS:
OUTPUTS:
One normalized flat per slit width
OPTIONAL KEYWORDS:
/REDOOV - Overwrite OV files if they exist for the flats
/SVOV - Save the OV files created during this step
/TFCHK - Perform careful checking of the trace flat
/CHK - Check the 2D residuals
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_allflat, mike, 1.0
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
14-Aug-2003 Written by JXP
(See pro/Flat/mike_allflat.pro)
NAME: mike_allobj
Version 1.1
PURPOSE:
Run all of the processing steps on a single object. This
includes processing, CR rejection, tracing, sky subtraction and
extraction. Future version will allow multiple (or all objects)
and also fluxing.
CALLING SEQUENCE:
mike_allobj, mike, setup, obj_id, side, [exp], /PROCALL
INPUTS:
mike - MIKE structure
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) or Red (2) side
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/ALLPROC - Perform all steps
/SKYCHK - Check Final sky image
/RESCHK - Check Final extracted image
/DOPROC - Do image processing
/DOFNT - Do object tracing
/DOSKY - Do sky sub
/DOBOX - Do extraction
/NOCR - Turn off CR rejection routine (mike_objcr)
/CLOBBER - Overwrite previous images (mainly the processed image)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_allobj, mike, 1L, 1L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-Apr-2004 Written by JXP
(See pro/Object/mike_allobj.pro)
NAME:
mike_ar
Version 1.1
PURPOSE:
Reads in the first fits file in the directory with name
'mike_*.fits' and passes back the mike structure.
CALLING SEQUENCE:
mike = mike_ar(file)
INPUTS:
[file] - Filename (default: first file in list ./mike_*fits*)
RETURNS:
mike - MIKE structure
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike = mike_ar()
PROCEDURES/FUNCTIONS CALLED:
mike_rslvall
REVISION HISTORY:
13-Nov-2001 Written by JXP
03-Feb-2003 Polished (JXP)
(See pro/General/mike_ar.pro)
NAME:
mike_arcalign
Version 1.1
PURPOSE:
Finds the offset between the center of arc lines and the trace to
the trace flats. The program is largely based on the routines
called in mike_slitflat.
CALLING SEQUENCE:
mike_arcalign, mike, setup, side, [/chk, TEMPL=]
INPUTS:
mike - MIKE structure
setup - Setup identifier
side - Blue (1), or Red (2)
RETURNS:
OUTPUTS:
Updates the arc_xyoff tag in the mike structure
OPTIONAL KEYWORDS:
/CHK - Show the profiles and fits order by order
TEMPL= -- Template arc file (assumed to be the first good one of
the night)
/CLOBBER -- Overwrite any previous solution
NSMPL= -- Number of orders to sample (x2)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_arcalign, mike, 1, 1, /CHK
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
01-Jun-2004 Written by JXP (based on mike_slitflat by SB)
(See pro/Arcs/mike_arcalign.pro)
NAME:
mike_arcxyoff
Version 1.2
PURPOSE:
This program is nearly obsolete. Use mike_arcalign
Determine the pixel offset between a pair of Arc images
(typically the Template Arc and a different Arc) due to thermal
expansion of the instrument.
The program calls mike_arcxyoff_work which resamples a sub-region
of each Arc and then cross-correlates the images in 2D using a 2D
FFT. Optionally, one can 'brute-force' the cross-correlation
analysis. We have found both approaches give the same answer.
CALLING SEQUENCE:
mike_arcxyoff, mike, side,
INPUTS:
mike - MIKE structure
side - Blue (1) or Red (2)
id1 - Index of the first Arc image (e.g. Template Arc)
id2 - Index of the second Arc image
RETURNS:
xyoff -- The xy offsets
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK -- Shows a visual assessment of the cross-correlation
REGION -- Image sub-region for preforming the cross-correlation
MAGF -- Level of resampling (default: 8L corresponding to 0.125
pixels)
/SLOW -- Turns on brute-force mode (NOT recommended)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_arcxyoff, mike, 1, 45L, 48L, xyoff
PROCEDURES/FUNCTIONS CALLED:
mike_arcxyoff_work
REVISION HISTORY:
13-Aug-2003 Written by JXP
(See pro/Arcs/mike_arcxyoff.pro)
NAME:
mike_autoid
Version 1.1
PURPOSE:
Guess the type of MIKE image based on exposure time, counts,
and other characteristics of the image.
CALLING SEQUENCE:
guess = mike_autoid(data, xbinguess, ybinguess, $
filename=img[q], hdr=head, /silent)
INPUTS:
data - 2D image (generally set to 0 and read from filename)
RETURNS:
Image type:: 'UNK', 'BAD', 'ZRO', 'ARC', 'IFLT', 'TFLT', 'STD',
'OBJ', 'MFLT', IFLT', 'TWI'
OUTPUTS:
OPTIONAL KEYWORDS:
FILENAME - Name of the image to be considered
XBIN - x binning
YBIN - y binning
SILENT - Suppress print statements
SATURATED - Saturation level (default = 50000.)
OPTIONAL OUTPUTS:
HDR - Image header if filename specified
GUESS_EXPTIME -- Guess of exposure time based on CR hits
COMMENTS:
Need to do some consistency checks between red and blue side,
i.e. they should be the same type
EXAMPLES:
guess = mike_autoid(data, xbin, ybin, filename='file')
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
??-??-2003 Written by SB
(See pro/General/mike_autoid.pro)
NAME:
mike_box
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
mike_box_sngl. 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:
mike_box, mike, setup, obj_id, side, [exp], /RESCHK, /CHK
INPUTS:
mike - MIKE structure
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) or Red (2) side
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
Fills up the 1D spectral tags in the Object structure.
OPTIONAL KEYWORDS:
/OCHK - Plot the extracted flux (optimal) for each order
/CHK - Live plots of the profile and trace
/RESCHK - Check the residuals of the 2D, fully extracted image
/STD - Extraction should be set for a standard star
/DEBUG - Stop within extraction routine to check stuff
/SKIPSKYSUB - Perform extraction on the processed but NOT sky
subtracted image.
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
aasdf
Optional OUTPUTS:
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:
mike_box, mike, 1L, [0L]
PROCEDURES/FUNCTIONS CALLED:
mike_box_sngl
extract_boxcar
smooth_mask
bspline_extract
REVISION HISTORY:
26-Aug-2003 Written by SMB
(See pro/Object/mike_box.pro)
NAME:
mike_boxeasy
Version 1.1
PURPOSE:
Extract flux from 2D image to create ten 1D spectra (1 per order)
Output is written to the object structure (e.g. Extract/Obj_mike0024.fits)
The code only does boxcar extraction for now.
CALLING SEQUENCE:
mike_boxeasy, mike, obj_id, [exp], /DEBUG, /CHK, /STD, APER=,
RADIUS=
INPUTS:
mike - ESI structure
indx - Indices of objects to process
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK - Show final trace
/STD - Extraction should be set for a standard star
/DEBUG - Stop within extraction routine to check stuff
APER= - Set aperture by hand (e.g. [5., 7.] )
RADIUS= - Size of window for setting aperture size (default: 20L)
ORDRS= - Orders to extract (default: [0L,9L])
OPTIONAL OUTPUTS:
COMMENTS:
1) The program begins extracting in order 9L (physical 6) and will
automatically calculate an aperture for that order. If there is
insufficient flux in the following orders, it will adopt the value
from the next higher order.
EXAMPLES:
mike_boxextrct, mike, 1L, [0L]
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-May-2003 Written by JXP
(See pro/ZObsolete/mike_boxeasy.pro)
NAME:
mike_boxextrct
Version 1.1
PURPOSE:
Extract flux from 2D image to create ten 1D spectra (1 per order)
Output is written to the object structure (e.g. Extract/Obj_mike0024.fits)
The code only does boxcar extraction for now.
CALLING SEQUENCE:
mike_boxextrct, mike, obj_id, [exp], /DEBUG, /CHK, /STD, APER=,
RADIUS=
INPUTS:
mike - ESI structure
indx - Indices of objects to process
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK - Show final trace
/STD - Extraction should be set for a standard star
/DEBUG - Stop within extraction routine to check stuff
APER= - Set aperture by hand (e.g. [5., 7.] )
RADIUS= - Size of window for setting aperture size (default: 20L)
ORDRS= - Orders to extract (default: [0L,9L])
OPTIONAL OUTPUTS:
COMMENTS:
1) The program begins extracting in order 9L (physical 6) and will
automatically calculate an aperture for that order. If there is
insufficient flux in the following orders, it will adopt the value
from the next higher order.
EXAMPLES:
mike_boxextrct, mike, 1L, [0L]
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-May-2003 Written by JXP
(See pro/ZObsolete/mike_boxextrct.pro)
NAME:
mike_calibstd
Version 1.1
PURPOSE:
Create a sensitivity function given a standard star and its
appropriate calibration file.
CALLING SEQUENCE:
mike_calibstd, mike, indx, HSTFIL=, CHKFIT=, ESOFIL=
INPUTS:
mike - MIKE structure
indx - Index of the Standard star in the MIKE structure to process
RETURNS:
OUTPUTS:
Sensitivity file in the 'Extract/' directory
OPTIONAL KEYWORDS:
OUTFIL - Name of the output file (default:
'Extract/Sens_{mikeroot}.fits' )
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_calibstd, mike, 1, ESOFIL='fhr4469.dat'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 Written by JXP
(See pro/Std/mike_calibstd.pro)
NAME:
mike_chksky
Version 1.1
PURPOSE:
Sky Subtract image and add sky subtracted frame to the final
image (e.g. Final/f_mike0020.fits). The program also outputs
information related to the sky fit in the Sky directory. The
user has control over which order to subtract (ORDR=), the
wavelength image to use (AIMG=) and can input a break point file
for detailed sky line subtraction (SKLFIL=).
CALLING SEQUENCE:
mike_chksky, mike, setup, side, obj_id, [exp], /CHK, /STD, ORDR=, /NOVAC,
SKLFIL=, BORDR=, AIMG=
INPUTS:
mike - ESI structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/STD - Sky subtract standard star
/CHK - Show steps along the way
AIMG= - Use alternate Wavelength map for sky subtraction
(string filename)
ORDR= - Sky subtract a single order only (e.g. [5L,5L])
/NOVAC - Do not perform vacuum wavelength correction
BORDR= - Order to begin bspline fitting (default: 5L)
SKLFIL= - ASCII file setting breakpoints around sky lines (string)
/CLOBBER - Overwrite any previos sky image
/USEOLD - Overwrite only the new orders into the old sky sub image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_chksky, mike, 1L, [0L], /CHK, ORDR=7L
{Sky sub exposure 0 and order 7 only}
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
06-Nov-2003 Written by JXP
(See pro/Skysub/mike_chksky.pro)
NAME:
mike_chktrc
Version 1.0
PURPOSE:
Finds all objects and traces them
CALLING SEQUENCE:
mike_chktrc, mike, setup, obj_id, side, [exp]
INPUTS:
mike - ESI structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp] - Exposure frames (e.g. [0L, 1L]); Default = 0L
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/STD - Find object for standard star
/CHK - Show overall trace
FITFIL= - Map of pinholes (default: Maps/hole_fit.idl )
REFWV= - Reference wavelength region (default: [5600., 5610.] )
REFORDR= - Reference order (default: 4L)
/INTER - Interactively identify objects and set apertures
(recommended)
MAXOFF= - Minimum offset between max obj and center of slit
(default: 20.)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fndobj, mike, 0L, [0L, 1L], /CHK, /INTER,
REFWV=[6500., 6520.], REFORDR=5L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
05-Nov-2003 Written by JXP
(See pro/Object/mike_chktrc.pro)
NAME:
mike_coadd
Version 1.1
PURPOSE:
Combine the individual 1D spectra from each order to create 1
continuous spectrum. The code attempts to match flux at the order
ends and it is recommended that you have fluxed the obj prior to
this step.
CALLING SEQUENCE:
mike_coadd, mike, obj_id, CRVAL1=, CDELT=, NPIX=, SPECFIL=, /STD
INPUTS:
mike - MIKE structure
obj_id - Object ID (e.g. 0L, 1L, etc)
RETURNS:
OUTPUTS:
One flux and one error array in 1D
OPTIONAL KEYWORDS:
ORDRS= - Orders to coadd (default: [0L,9L])
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_coadd, mike, 2, CRVAL1=4000.0d, NPIX=50000, specfil='file.fits.gz'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Oct-2002 Written by JXP
04-Feb-2003 Polished (JXP)
12-Apr-2004 Updated for MIKE (RAS)
(See pro/Spec/mike_coadd.pro)
NAME:
mike_combimg
Version 1.0
PURPOSE:
Process a data frame
CALLING SEQUENCE:
mike_combimg, mike, indx, /DFLAT, /REDDOV
INPUTS:
mike - ESI structure
indx - Index values
RETURNS:
OUTPUTS:
Fully combimgessed image
OPTIONAL KEYWORDS:
DFLAT - Use Dome flats where possible
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_combimg, mike, indx
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Aug-2002 Written by JXP
(See pro/General/mike_combimg.pro)
NAME:
mike_combspec
Version 1.1
PURPOSE:
Combines multiple exposures of the same obj
Must be run even on an object with a single exposure
CALLING SEQUENCE:
mike_combspec, mike, setup, obj_id, side, exp_id
INPUTS:
mike - MIKE structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp_id] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
echfspec - ESI fspec structure (fits file; FSpec/name_ech.fits)
OPTIONAL KEYWORDS:
/SILENT - No text output
LIST= - Use an input list to combine (required for multiple
night obs). Output is in 'FSpec/tmp_ech.fits'.
OBJ_NM= - Name of object in slit (a = science)
/STD - Run on a standard star
OUTNM= - Alternative output name for FSpec file
/NOFLUX - Fill echfspec structure with fx, rather than flux array
ENDTRM= - Trim order edges by this when calculating ratios
MINPIX1= - Minimum 'good' pixels to calculate fitting profile
ORDNM= - Fitting profile order (default: 1)
SNRMIN= - Minimum S/N per pixel for consideration in fitting
OPTIONAL OUTPUTS:
COMMENTS: ;
EXAMPLES:
mike_combspec, mike, setup, obj_id, side
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 Written by JXP
10-Jun-2004 Revisited by GEP
(See pro/Spec/mike_combspec.pro)
NAME:
mike_crossarc
Version 1.1
PURPOSE:
Finds shift between saved template and current arc spectra.
CALLING SEQUENCE:
mike_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 pro/Arcs/mike_crossarc.pro)
NAME:
mike_delfin
Version 1.0
PURPOSE:
Deletes Final images
CALLING SEQUENCE:
mike_delfin, mike, indx
INPUTS:
mike - ESI structure
indx - Index numbers of frames to delete
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_delfin, mike, indx
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Apr-2003 Written by JXP
(See pro/General/mike_delfin.pro)
NAME:
mike_delov
Version 1.0
PURPOSE:
Deletes OV images
CALLING SEQUENCE:
mike_delov, mike, indx
INPUTS:
mike - ESI structure
indx - Index numbers of frames to delete
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_delov, mike, indx
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-Jul-2002 Written by JXP
(See pro/General/mike_delov.pro)
NAME: mike_doall
Version 1.1
PURPOSE:
Run all of the steps for a single night of data. You had better
know what you are doing!!
CALLING SEQUENCE:
mike_doall, setup, MIKE=, /NOCR, /CLOBBER, EXTRA=
INPUTS:
mike - MIKE structure
setup - Setup ID
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/NOCR - Turn off CR rejection routine (mike_objcr)
/CLOBBER - Overwrite previous images (mainly the processed image)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_doall, mike, 1L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
23-Sep-2004 Written by JXP
(See pro/General/mike_doall.pro)
NAME:
mike_edgeflat
Version 1.1
PURPOSE:
To trace the order edges of the individual orders. And the results are
fit (which replaces mike_fittflat). The fit is a low order fit to the slit
width, and then a higher order fit to the order centers.
1. Identify the order edges (interactive is recommended).
2. Performs an order by order tracing of the order edges using
trace_crude.
3. Perform (iteratively) a PCA analysis on the coefficients of the
individual traces.
4. Create and write to disk a structure summarizing the fits.
5. Do a 2-part fit that replaces the fittflat call.
CALLING SEQUENCE:
mike_edgeflat, mike, setup, [side], /CHK,
INPUTS:
mike - MIKE structure
setup - Setup identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
A structure containing the information for the order by order
fits. This structure is then fed to mike_fittflat to create a 2D
solution. Typical name: 'Flats/TStr_B_01.fits'
OPTIONAL KEYWORDS:
/CHK -- Check the order edges interactively (similar to INTER)
/INTER -- Determine the order edges interactively
THRESH -- Threshold for an order edge on the red side
(default: 100.)
/CLOBBER -- Overwrite the output structure
P_NSIG -- Number of sigma significance that an order edge should
have for the red side (default: 50.)
NSIG -- Number of sigma significance that an order edge should
have fo the blue side (default: 2.0)
MINFLAT -- Mininum counts in flat on blue side to use orders (100)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_edgeflat, mike, 1, 1, /clobber
PROCEDURES/FUNCTIONS CALLED:
mike_getfil
mike_trcflat_edges
REVISION HISTORY:
1-Nov-2004 Written by SB, replaces mike_trcflat and mike_fittflat
QA file is still in mike_trcflat
(See pro/Flat/mike_edgeflat.pro)
NAME:
mike_editstrct
Version 1.1
PURPOSE:
Launches a gui to edit the MIKE structure
CALLING SEQUENCE:
mike_editstrct, mike
INPUTS:
mike -- ESI structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_editstrct, mike
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2002 Written by JXP
29-Jan-2003 Polished by JXP
(See pro/General/mike_editstrct.pro)
NAME:
mike_fit2darc
Version 1.1
PURPOSE:
To fit the arc lines identified in mike_fitarc as a fucntion of
their y-centroid and order number. The main routine is in
mike_fit2darc_work. The fit is a simple least-squares with one
round of rejection.
CALLING SEQUENCE:
mike_fit2darc, mike
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
A fits file containing the 2D solution. Named something like
'Arcs/Fits/Arc_mb0539_fit2D.fits'
OPTIONAL KEYWORDS:
NOCOEFF - Number of coefficients to use in the x-direction
(default: 6 for blue, 7 for red)
NYCOEFF - Number of coefficients to use in the y-direction
(default: 4)
/CLOBBER - Overwrite any previous solution
/DEBUG - debug
/CHKRES - Plot the residuals
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fit2darc, mike, 1.0
PROCEDURES/FUNCTIONS CALLED:
mike_fit2darc_work
REVISION HISTORY:
28-Feb-2003 Written by SB
18-Apr-2003 Revised by JXP
(See pro/Arcs/mike_fit2darc.pro)
NAME:
mike_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 calls mike_fitarc_work as its driver.
The algorithm mike_fitarc_work does the following:
1) Input the arc image from mike_mkarc
2) Input an archived arc solution appropriate to the side
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:
mike_fitarc, mike, setup, obj_id, [side], /INTER, LINLIST=, /CHK, /CLOBBER,
SIGREJ=, /DEBUG, IORDR=, /PINTER
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
IDL fit file (one per order) (e.g. Arcs/ArcECH_##fit.idl)
OPTIONAL KEYWORDS:
/PINTER - Perform fit for pre-identified lines
/INTER - Identify lines interactively and then fit
LINLIST - Arc line list (default: $XIDL_DIR/Spec/Arcs/Lists/mike_thar.lst
/CHK - Manually check steps along the way
/DEBUG - Debugging
SIGREJ= - Rejection sigma for outliers in arc line fitting
(default: 2.)
IORDR - Initial order for analysis
/CLOBBER - Overwrite previous fits
SHFTPRM= - Fit structure for shifting the orders of the arc
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fitarc, mike, 1, 1
PROCEDURES/FUNCTIONS CALLED:
mike_crossarc
mike_fitarc_ps
mike_fitarc_work
extract_arc
x_templarc
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)
Apr-2005 Ported to XIDL (JXP)
(See pro/Arcs/mike_fitarc.pro)
NAME:
mike_fittflat
Version 1.1
PURPOSE:
To create a 2D solution which describes the order curvature. This
solution is derived from the individual traces created by
mike_trcflat and saved within the Trace structure. The 2D fitting
algorithm is a simple least-squares algorithm. The code then
attempts to extrapolate the solution for orders which are partially
on the CCD. The code then makes a guess for the physical order
number which is not particularly accurate right now. Finally, the
order structure (a key input for the MIKE pipeline) is written to
disk.
CALLING SEQUENCE:
mike_fittflat, mike, setup, [side], /DEBUG, INNY=, INNT=, LHEDGE=,
/CLOBBER
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 slit width
OPTIONAL KEYWORDS:
INNY -- Number of coefficients for fitting in vertical
direction. (Default: 7)
INNT -- Number of coefficients for fitting in horizontal
direction. (Default: 6)
/DEBUG -- Turn debugging on
LHEDG -- Used primarily for debugging
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fittflat, mike, 1, 1
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Feb-2003 Written by SB
18-Apr-2003 Revised by JXP
(See pro/Flat/mike_fittflat.pro)
NAME:
mike_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:
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
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
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
mike_fittrcarc_work -- Main driver
mike_getfil
REVISION HISTORY:
28-Apr-2003 Written by SB
(See pro/Arcs/mike_fittrcarc.pro)
NAME:
mike_flux
Version 1.1
PURPOSE:
Fluxes the spectrum using a standard star calibration. Default
is to use the one in CALIBS which is probably good enough for
relative fluxing. Definitely not good enough for absolute.
CALLING SEQUENCE:
mike_flux, mike, setup, obj_id, side, FLUXFIL=, /CLOBBER, /STD
INPUTS:
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) or Red (2) side
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
FLUXFIL - File name of standard star for fluxing (default:
$MIKE_DIR/pro/Std/Archive/sens_blue#.fits)
/STD - Extraction should be set for a standard star
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_flux, mike, obj_id, /CLOBBER
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 JXP
(See pro/Spec/mike_flux.pro)
NAME:
mike_fndobj (Retired)
Version 1.0
PURPOSE:
Finds all objects and traces them
CALLING SEQUENCE:
mike_fndobj, mike, obj_id, [exp], REFWV=, SCICLM=,
REFORDR=, /INTER, /STD, /CHK, MAXOFF=, /NOCLOB
INPUTS:
mike - ESI structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/STD - Find object for standard star
/CHK - Show overall trace
FITFIL= - Map of pinholes (default: Maps/hole_fit.idl )
REFWV= - Reference wavelength region (default: [5600., 5610.] )
REFORDR= - Reference order (default: 4L)
/INTER - Interactively identify objects and set apertures
(recommended)
MAXOFF= - Minimum offset between max obj and center of slit
(default: 20.)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fndobj, mike, 0L, [0L, 1L], /CHK, /INTER,
REFWV=[6500., 6520.], REFORDR=5L
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
22-May-2003 Written by JXP
(See pro/ZObsolete/mike_fndobj.pro)
NAME:
mike_fntobj
Version 1.1
PURPOSE:
Identify the object within the slit (single object) and trace it
along each order. The code rectifies each order, collapses it
and looks for the object. IF it finds it in >7 orders then it
peaks up on the object. Otherwise, it guesses the object is at
the center of the order. It then uses xy2tracset (trace_crude)
to trace the object along each order individually. Finally, it
performs a PCA analysis on the trace_crude coefficients to create
a smoothed (pseudo-2D) solution for the trace. The code outputs
an object structure which includes the trace and other info.
CALLING SEQUENCE:
mike_fntobj, mike, setup, obj_id, side, [exp], /STD, /CHK [v1.0]'
INPUTS:
mike - MIKE structure
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) or Red (2) side
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
Object structure (MIKEOBJSTRCT) including the trace and other information
regarding the object. This structure is then filled up with the 1D
spectrum, etc.
OPTIONAL KEYWORDS:
/STD - Find object for standard star
/CHK - Show diagnostics of the code performance
/NOCLOB - Do not clobber existing files (default: clobber)
/DEBUG - Debug
OBJAPER - Set aperture to mask for sky subtraction (default: 20
unbinned pixels for obj, 26 for STD)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fntobj, mike, 1L, 1L, /CHK,
PROCEDURES/FUNCTIONS CALLED:
mike_rectify
find_npeaks
mike_fweight
mike_fntobj_off
trace_crude
mike_basis
REVISION HISTORY:
23-Sep-2003 Written by JXP (combined aspects of fndobj with trcobj)
10-Nov-2003 Changed fntobj_off, SMB
(See pro/Object/mike_fntobj.pro)
NAME:
mike_gain
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 = mike_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:
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 = mike_gain(image1, image2)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
16-Jul-2003 Written by SMB
(See pro/Flat/mike_gain.pro)
NAME:
mike_getfil
Version 1.1
PURPOSE:
Pass back a structure and/or filename for a specified file type in
the MIKE code.
CALLING SEQUENCE:
rslt = mike_getfil('type', [setup], SIDE=, /NAME, SUBFIL=, CHKFIL=,
SZ=, INDX=, FIL_NM=, HEAD=)
INPUTS:
[setup] - Setup identifier
RETURNS:
Structure, image, name, etc.
OUTPUTS:
OPTIONAL KEYWORDS:
/name -- Only return resolved name (string)
CHKFIL -- Value equal to the number of files matching name
SZ -- Image size
SUBFIL -- Image name generally used to parse the root name of the
image (e.g. 'Arcs/arc_mb0539.fits'). Required in
many cases.
SIDE -- Specify camera: Blue (1) or Red (2)
INDX -- Image extension in the fits file (generally 0, 1, or 2)
OPTIONAL OUTPUTS:
FIL_NM -- Filename of the file
HEAD -- Image header
COMMENTS:
EXAMPLES:
ordr_str = mike_getfil('ordr_str', 1, SIDE=1)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
18-Aug-2003 Written by JXP
(See pro/General/mike_getfil.pro)
NAME:
mike_getwvarr
Version 1.1
PURPOSE:
Extract flux from 2D image to create ten 1D spectra (1 per order)
Output is written to the object structure (e.g. Extract/Obj_mike0024.fits)
The code only does boxcar extraction for now.
CALLING SEQUENCE:
mike_boxextrct, mike, obj_id, [exp], /DEBUG, /CHK, /STD, APER=,
RADIUS=
INPUTS:
mike - ESI structure
indx - Indices of objects to process
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK - Show final trace
/STD - Extraction should be set for a standard star
/DEBUG - Stop within extraction routine to check stuff
APER= - Set aperture by hand (e.g. [5., 7.] )
RADIUS= - Size of window for setting aperture size (default: 20L)
ORDRS= - Orders to extract (default: [0L,9L])
OPTIONAL OUTPUTS:
COMMENTS:
1) The program begins extracting in order 9L (physical 6) and will
automatically calculate an aperture for that order. If there is
insufficient flux in the following orders, it will adopt the value
from the next higher order.
EXAMPLES:
mike_getwvarr, mike, 1L, [0L]
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-Jan-2004 Written by JXP
(See pro/Object/mike_getwvarr.pro)
NAME:
mike_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.
CALLING SEQUENCE:
mike_mkaimg, mike, setup, [side], /CHK, /CLOBBER
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
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:
COMMENTS:
EXAMPLES:
mike_mkaimg, mike, setup, obj_id
PROCEDURES/FUNCTIONS CALLED:
mike_getfil
mike_ordermask
mike_mkaimg_work
REVISION HISTORY:
15-May-2003 Written by SB
(See pro/Arcs/mike_mkaimg.pro)
NAME:
mike_mkarc
Version 1.1
PURPOSE:
Process and combine arc files
CALLING SEQUENCE:
mike_mkarc, mike, slit, /CLOBBER
INPUTS:
mike - MIKE structure
setup - Integer defining setup
RETURNS:
OUTPUTS:
One processed, combined Arc Image (e.g. Arcs/Arc_ECH##.fits)
OPTIONAL KEYWORDS:
/CLOBBER - Overwrite exisiting arc image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_mkarc, mike, 0.5
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
30-Apr-2003 Written by JXP
(See pro/ZObsolete/mike_mkarc.pro)
NAME:
mike_mkbias
Version 1.1
PURPOSE:
Create bias frames from zero exposures.
This program is not really necessary as it is VERY unlikely that
a bias frame will be used in future reductions. Overscan on
top and right of frames is sufficient. Combined bias frames
created here can be used to verify that this is the case.
CALLING SEQUENCE:
mike_mkbias, mike, /NOBIASROW, /CLOBBER, /DEBUG, /SVOV
INPUTS:
mike - MIKE structure
RETURNS:
OUTPUTS:
Creates bias frames in 'Bias/Bias[NxN][B,R].fits'
where [NxN] indicates binning.
OPTIONAL KEYWORDS:
CLOBBER = Overwrite old bias frames if set
NOBIASROW - if set, bias row is ***NOT*** used.
I.E, default is to use the bias row.
SVOV -- Save the bias subtracted frames of the individual files
DEBUG -- Turn on debug flag
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_mkbias, mike, /CLOBBER
PROCEDURES/FUNCTIONS CALLED:
mike_oscansub
REVISION HISTORY:
28-Feb-2002 Written by JXP
July-2003 Method for bias subtraction changed by RAB.
Now:
Overscan subtract both red and blue 0 second exposures.
Combine to make a bias frames.
(See pro/Bias/mike_mkbias.pro)
NAME:
mike_mkmap
Version 1.0
PURPOSE:
Process arc file
CALLING SEQUENCE:
mike_mkmap, mike, slit
INPUTS:
mike - ESI structure
RETURNS:
OUTPUTS:
One normalized flat per slit width
OPTIONAL KEYWORDS:
DFLAT - Use Dome flats where possible
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_mkmap, mike
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Apr-2003 Written by JXP
(See pro/Maps/mike_mkmap.pro)
NAME:
mike_mkmflat
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:
mike_mkmflat, mike, 1
PROCEDURES/FUNCTIONS CALLED:
mike_getfil
mike_subbias
mike_mkflat_work
REVISION HISTORY:
16-May-2003 Adapted by JXP from existing programs by SB
24-Feb-2004 Switched to a series of median/linear interpolations (SB)
(See pro/Flat/mike_mkmflat.pro)
NAME:
mike_mktflat
Version 1.1
PURPOSE:
Combines all trace flats for a given setup into one final image.
The images are first bias subtracted using mike_subbias.
The images are median combined after scaling by the median after
iteratively rejecting bad pixels. The image and its inverse
variance array are written to one fits file. Because of the
thermal gradients, it is highly recommended that one use
only a coeval set of trace flats.
CALLING SEQUENCE:
mike_mktflat, mike, setup, [side], /SVOV, /REDOOV, /CLOBBER
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 and side
(e.g. 'Flats/Flat/_B_01_T.fits.gz')
OPTIONAL KEYWORDS:
/REDOOV - Overwrite OV files if they exist for the flats
/SVOV - Save the OV files created during this step
/CLOBBER - Overwrite the final fits file
/USEBIAS - Use the bias frame in bias subtraction
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_mktflat, mike, 1.0
PROCEDURES/FUNCTIONS CALLED:
mike_subbias
xcombine
mike_delov
REVISION HISTORY:
17-Apr-2003 Written by JXP
(See pro/Flat/mike_mktflat.pro)
NAME:
mike_objcr
Version 1.1
PURPOSE:
Flags CRs given 2 or more object images.
CALLING SEQUENCE:
mike_objcr, mike, setup, obj_id, side, [iexp]
INPUTS:
mike - MIKE structure
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) and/or Red (2) side (Default: [1L,2L])
[iexp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
flat - fits file in the dir Flats named 'Flat_##.fits'
where ## is the mask_id value
VAR - Variance in the flat (in electrons)
OPTIONAL KEYWORDS:
SVOV - save ov files
/NOFITS - No FITS output
RTIO - Ratio CR must exceed to be flagged (default: 9)
OPTIONAL OUTPUTS:
COMMENTS:
Algorithm for 3 or more images is not well tested.
It would be nice to add a GROW option.
EXAMPLES:
mike_objcr, mike, setup, obj_id, side,
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Aug-2003 Written by JXP
(See pro/Object/mike_objcr.pro)
NAME:
mike_ordermask
Version 0.1
PURPOSE:
Returns a integer image which identifies each pixel with a given order
or inter-order gap.
CALLING SEQUENCE:
maskimage = mike_ordermask(ncol, nrow, ordr_str, trim=trim)
(note: it's a little silly to pass ncol and nrow, but had no better
idea at the time. I should have just passed mike structure,
but it doesn't really need it to run.)
INPUTS:
ncol - number of columns in image
nrow - number of rows
ordr_str - Structure array describing order format
RETURNS:
OUTPUTS:
An [NCOL,NROW] image with each pixel exclusively assigned to an order or gap
OPTIONAL KEYWORDS:
trim - The buffer included in each order (default 0. pixels).
Increasing trim increases the width of each order!
OPTIONAL OUTPUTS:
COMMENTS:
Crude routine to make a map of order placement
Orders fall at positive Maps [1...nord]
Gaps are marked with [-1 ... -NGAP]
Pixel leftward of 1st order or rightward of last order in
ordr_str are set to 0
EXAMPLES:
maskimage = mike_ordermask(ncol, nrow, ordr_str, trim=trim)
PROCEDURES/FUNCTIONS CALLED:
gap_index (internal routine to find those gaps!)
REVISION HISTORY:
15-Jul-2003 Checked in by SB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gap_index jumps through hoops to find the list of image indices which
lie between lhedg <= column <= rhedg
(See pro/Flat/mike_ordermask.pro)
NAME:
mike_oscansub
Version 1.0
PURPOSE:
Called by mike_mkbias and mike_subbias.
This routine does the overscan subtraction using the col and row
sections at the right and top, respectively.
INPUTS:
mike - MIKE structure
NoBIASROW - if set, bias row is ***NOT*** used.
I.E, default is to use the bias row.
CLOBBER - overwrite
ARC - if it's an arc, you might not want to do the colums for
the red side.
RETURNS:
OUTPUTS:
overscan subtracted images into desired directory
OPTIONAL KEYWORDS:
CLOBBER = overwrite old bias frames if set
OPTIONAL OUTPUTS:
COMMENTS:
REVISION HISTORY:
18-July-2003 RAB
(See pro/Bias/mike_oscansub.pro)
NAME:
mike_pca (replica of em_pca)
PURPOSE: (one line)
Perform E-M PCA to get first k principal components
DESCRIPTION:
Uses Sam Roweis' Expectation Maximization version of PCA to
efficiently find the first k principal components for a
distribution in p (>k) dimensions. The procedure guesses an
initial set of eigenvectors (stored the in [p,k] dimensional
matrix "eigenvec") and applies the following iteration to the
[p,N] dimensional "data":
hidden= ( eigenvec^T . eigenvec )^{-1} . eigenvec^T . data
eigenvec= data . hidden^T . (hidden . hidden^T)^{-1}
From:
Neural Information Processing Systems 10 (NIPS'97) pp.626-632
available at:
http://www.cs.toronto.edu/~roweis/papers/empca.ps.gz
CATEGORY:
Mathematical
CALLING SEQUENCE:
mike_pca, data, k, eigenvec, hidden [, tol=, maxiter=, niter=, /verbose]
INPUTS:
data - [p,N] data to be PCAed
k - number of eigenvectors desired (<p)
OPTIONAL INPUT PARAMETERS:
tol - tolerance of convergence (default 0.)
maxiter - maximum number of iterations (default 20)
KEYWORD PARAMETERS:
/verbose - verbose output
/nofix - don't do the final real PCA
OUTPUTS:
eigenvec - [p,k] matrix of k leading eigenvectors
hidden - [k] matrix of "hidden" variables (the lower dimensional
representation of the data)
OPTIONAL OUTPUTS:
niter - number of iterations used
COMMON BLOCKS:
SIDE EFFECTS:
BUGS:
Somewhat untested.
RESTRICTIONS:
Does not implement Sam's Sensible-PCA procedure
PROCEDURE:
MODIFICATION HISTORY:
2003-01-26 - Written by Michael Blanton (NYU)
(See pro/ZObsolete/mike_pca.pro)
NAME:
mike_proc
Version 1.0
PURPOSE:
Process a raw data frame. Bias subtract and flatten. Output is
written in Final/ and is a mutli-extension fits file.
Extension-0 is the processed image, Extension-1 is the inverse
variance.
CALLING SEQUENCE:
There are several ways to call mike_proc
mike_proc, mike, indx [processes the image with index=indx]
mike_proc, mike, SETUP=1, OBJ=4 [processes images with setup=1 and
obj_id=4]
rslt = mike_proc_sngl('Rawfil') [process a single image]
INPUTS:
mike - MIKE structure
[indx] - Index (or indices) of the image(s) in the MIKE
structure to process
RETURNS:
OUTPUTS:
Fully processed image
OPTIONAL KEYWORDS:
/CLOBBER - Clobber existing image
SETUP - Setup number
EXP - Exposure numbers
OBJ - Obj_id value
/ARC - Identifies the image as an Arc explicitly. This is
important for bias subtraction on the red side.
/NOFLAT - Do not flatten
FLATFIL - Name of flat file to use.
/SVOV - Save the OV subtracted image
/REDOOV - Overwrite any existing OV images
IOUTFIL - Name for output file (array for mult
/STD - Processes standard stars corresponding to an input SETUP
OPTIONAL OUTPUTS:
COMMENTS:
The inverse variance is given this set of values in an attempt to
deal with the Poisson limit
ivar = 1.0/(abs(img * gain - sqrt(2.0)*readno) + readno^2 )
EXAMPLES:
mike_proc, mike, [20L,21L], /CLOBBER
PROCEDURES/FUNCTIONS CALLED:
mike_proc_work
mike_subbias_sngl
mike_getfil
mike_delov
REVISION HISTORY:
30-Apr-2002 Written by JXP
19-Aug-2003 Added work routine
(See pro/General/mike_proc.pro)
NAME:
mike_procarc
Version 1.1
PURPOSE:
Process (bias subtract, flatten) the arc files. In addition, the
code first calls mike_arcxyoff which uses a 2D FFT to determine
the offset between the Template Arc and the current arc due to
thermal expansion in the instrument.
This file also includes the routine mike_procarc_sngl which
allows the processing of a single Arc image given the filename of
the Raw image.
CALLING SEQUENCE:
mike_procarc, mike, setup, obj_id, [side], ATEMPL=, /CLOBBER,
FLATFIL=
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
One processed, combined Arc Image (e.g. Arcs/Arc_mb0539.fits)
OPTIONAL KEYWORDS:
/CLOBBER - Overwrite exisiting arc image
ATEMPL -- Index of the Template Arc image (default: 0L)
FLATFIL -- Filename of the milky flat (pixel to pixel correction)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_procarc, mike, 1, 1, 1, /CLOBBER
PROCEDURES/FUNCTIONS CALLED:
mike_getfil
mike_arcxyoff
mike_proc
REVISION HISTORY:
13-Aug-2003 Written by JXP
(See pro/Arcs/mike_procarc.pro)
NAME:
mike_rectify
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 = mike_rectify(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 = mike_rectify(arc_img, lhedg, rhedg, /NOCORRECT)
PROCEDURES/FUNCTIONS CALLED:
mike_rectify
REVISION HISTORY:
??--2004 Written by SB
(See pro/General/mike_rectify.pro)
NAME:
mike_redux
Version 1.0
PURPOSE:
Calls various routines to analyse the data
CALLING SEQUENCE:
mike_redux, wfccd, maskid, expsr, XSIZE=, YSIZE=
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_redux, mike
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
02-May-2005 Written by JXP
(See pro/General/mike_redux.pro)
NAME:
mike_rslvall
Version 1.1
PURPOSE:
Resolves a number of key codes for MIKE redux
CALLING SEQUENCE:
mike_rslvall
INPUTS:
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_rslvall
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
19-Aug-2003 Written by JXP
(See pro/General/mike_rslvall.pro)
NAME:
mike_setarcm
Version 1.1
PURPOSE:
Run through the necessary steps to set the arc_m values in the
order structure. This seperate routine was created to avoid the
high level of confusion occuring in mike_allarc.
CALLING SEQUENCE:
mike_setarcm, arc_fil, setup, side
INPUTS:
arc_fil - Raw arc file used to set the arc_m values
setup - Integer defining setup
side - Blue (1) or Red (2)
RETURNS:
OUTPUTS:
A series of files related to Arc calibration
OPTIONAL KEYWORDS:
/PINTER - Perform fit for pre-identified lines
OPTIONAL OUTPUTS:
ARC_FIL= - Name of processed arc
XYOFF= - Offset fit info
ADDITIONAL KEYWORDS TO MIKE_ALLARC_SNGL:
COMMENTS:
EXAMPLES:
mike_setarcm, 'Raw/mike_mb0032', 1, 1
PROCEDURES/FUNCTIONS CALLED:
mike_procarc
mike_alignarc
mike_fitarc
mike_fit2darc
mike_tracearc
mike_fittrcarc
REVISION HISTORY:
18-Aug-2004 Written by JXP
Usage:
(See pro/Arcs/mike_setarcm.pro)
NAME:
mike_setgain
Version 1.1
PURPOSE:
Calculate the inverse gain using the routine mike_gain and the Milky Flats.
The value of the gain is then saved into mike.gain
CALLING SEQUENCE:
mike_setgain, mike, setup, [side]
INPUTS:
setup - Setup ID
[side] - Blue (1) and/or Red (2) side [default: [1,2] ]
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-Jun-2004 Written by SMB
04-Apr-2005 Replaced mike_gain with x_calcgain
(See pro/Flat/mike_setgain.pro)
NAME:
mike_setup
Version 1.1
PURPOSE:
Examine the mike structure to determine if a given setup has the
requisite calibration files. It then sets a number of tag names
accordingly. Finally, it gives the object frames a running index
based on the object name.
It is recommended to rerun this program if: (1) you have bombed out of
IDL without saving the MIKE structure, (2) you have changed the
setup values or calibration files. I doubt it will ever hurt to
rerun.
CALLING SEQUENCE:
mike_setup, mike
INPUTS:
mike -- MIKE structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
OUTFIL -- Name for the ASCII file output (default:
'mike_summ.txt')
COMMENTS:
EXAMPLES:
mike_setup, mike, OUTFIL=
PROCEDURES/FUNCTIONS CALLED:
mike_getfil
REVISION HISTORY:
17-Jul-2002 Written by JXP
29-Jan-2003 Polished by JXP
(See pro/General/mike_setup.pro)
NAME:
mike_setwav
Version 1.1
PURPOSE:
Process and combine arc files
CALLING SEQUENCE:
mike_setwav, mike, slit, /CLOBBER
INPUTS:
mike - MIKE structure
setup - Integer defining setup
RETURNS:
OUTPUTS:
One processed, combined Arc Image (e.g. Arcs/Arc_ECH##.fits)
OPTIONAL KEYWORDS:
/CLOBBER - Overwrite exisiting arc image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_setwav, mike, 0.5
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-May-2003 Written by JXP
(See pro/ZObsolete/mike_setwav.pro)
NAME:
mike_shifti
Version 1.1
PURPOSE:
Shift the order position given the values of mike.arc_xyoff
This is used to deal with the thermal variations within MIKE.
CALLING SEQUENCE:
shft = mike_shifti(arc_xyoff, OSTR=ostr, ORDRS=ordrs)
INPUTS:
arc_xyoff - 2 parameter fit to the shift (linear fit)
RETURNS:
shft - The shift for the set of orders
OUTPUTS:
OPTIONAL KEYWORDS:
ORDRS -- Physical order numbers
OSTR= -- If provided, the routine will update lhedge, rhedge
tags
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
shft = mike_shifti(75L, mike[23].arc_xyoff)
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
26-Jun-2004 Written by JXP
(See pro/General/mike_shifti.pro)
NAME:
mike_skyshift
Version 1.1
PURPOSE:
Identify a shift in the sky spectrum between the one extracted by
MIKE for a given frame and the UVES archived spectrum.
CALLING SEQUENCE:
mike_skyshift, bset_prof, uveslog, uvesflux, xwave, THRESH=thresh
INPUTS:
bset_prof - The bspline info from the sky fit
uveslog - alog10(sky wavelengths) from UVES line list
uvesflux - Flux of the sky lines
xwave - Wavelengths of the sky
RETURNS:
The sky shift in fractional pixels
OUTPUTS:
A sky subtracted image added as extension #2 to the fits file.
A file in the directory Sky/ describing the fit
OPTIONAL KEYWORDS:
THRESH - Minimum threshold to include line in the analysis
(Default: 0.4)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
sky_shift = mike_skyshift(bset_prof, uveslog, uvesflux, $
objstr[mm].sky_wv[0:nrow-1] )
PROCEDURES/FUNCTIONS CALLED:
ladfit
bspline_valu()
REVISION HISTORY:
??-2003 Written by SMB
(See pro/Skysub/mike_skyshift.pro)
NAME:
mike_skysub
Version 1.2
PURPOSE:
Sky Subtract image and add sky subtracted frame to the final
image (e.g. Final/f_mike0020.fits). The program also outputs
information related to the sky fit in the Sky directory. The
user has control over which order to subtract (ORDR=), the
wavelength image to use (AIMG=). The program preforms the
following steps:
1. Offset the Order structure by the appropriate shift
2. Subtract scattered light (mike_fitgap)
-- LOOP ON ORDERS --
3. After masking the object, the code finds the sky pixels and
normalizes them by the slit profile.
4. It bspline fit to the sky
5. It assesses the fit and adds in breakpoints in a somewhat
smart way.
6. It performs a second bspline fit
7. The coefficients of the fit are saved and the image is
subtracted
8. The code compares the extracted sky spectrum against the UVES
sky spectrum to guess at a shift. This is saved to the Object
structure.
-- END OF LOOP
9. The final sky subtracted image is written to the fits file
(extension #2)
CALLING SEQUENCE:
mike_skysub, mike, setup, obj_id, side, [exp], /CHK, /STD, ORDR=,
AIMG=, /USEOLD, /FCHK
INPUTS:
mike - MIKE structure
setup - Setup ID
obj_id - Object ID (e.g. 1L) (or STD index if /STD set)
side - Blue (1) or Red (2) side
[exp] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
A sky subtracted image added as extension #2 to the fits file.
A file in the directory Sky/ describing the fit
OPTIONAL KEYWORDS:
/STD - Sky subtract standard star
/CHK - Show steps along the way
AIMG= - Use alternate Wavelength map for sky subtraction
(string filename)
ORDR= - Sky subtract a single order only (e.g. [5L,5L])
/CLOBBER - Overwrite any previos sky image
/USEOLD - Overwrite only the new orders into the old sky sub image
/FCHK - Show the final sky subtracted image
/DOALL - ??
OPTIONAL OUTPUTS:
SCATTERED_LIGHT= -- Scattered light image. It may be useful to
save and use this if you are subtracting individual
orders
COMMENTS:
EXAMPLES:
mike_skysub, mike, 1L, 1L, 1L, /FCHK
PROCEDURES/FUNCTIONS CALLED:
mike_fitgap
mike_ordermask
bspline_iterfit
mike_getfil
mike_skyshift
mike_skysub_write
REVISION HISTORY:
16-May-2003 Written by JXP
??-2003 Modified extensively by SMB
26-Jun-2004 Update arc shifting
(See pro/Skysub/mike_skysub.pro)
NAME:
mike_slitflat
Version 1.1
PURPOSE:
Stores slit profile and gradient along each order from twilight flats.
This routine is critical for performing ideal sky subtraction,
especially given the short slit length. The following steps are
performed in mike_slitflat_work:
1. Fit and subtract the scattered light in the twilight flat
2. Extract a boxcar profile down the center of the flat
3. Loop on orders
4. Calculate the slit angle at each pixel in the order
5. Calculate the Jacobian (DEPRECATED)
6. Fit a bspline to the profile
7. Run diagnsotics on the fit
8. Save the good ones to profile0 and profile1 tags
CALLING SEQUENCE:
mike_slitflat, mike, setup, side, [/chk, /clobber]
INPUTS:
mike - MIKE structure
setup - Setup identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
Fills in the profile0 and profile1 tags in the Order structure
OPTIONAL KEYWORDS:
/CHK - Show the profiles and fits order by order
/CLOBBER - Clobber an previous work
TFLAT_FIL - Name for TFLAT file
RESIDUAL_FIL - Output name for Jacobian matrix
PROFILE_FIL - Output name for profile fits
NODETILT - Do not remove a linear tilt from the Cross-section fit
NXBKT - Number of x breakpoints for scattered light fit
NYBKT - Number of x breakpoints for scattered light fit
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_slitflat, mike, 1
PROCEDURES/FUNCTIONS CALLED:
mike_ordermask
mike_fitgap
mike_qw
mike_slitflat_work
REVISION HISTORY:
??-??-2003 Written by SB
(See pro/Flat/mike_slitflat.pro)
NAME:
mike_slitflat4x2
Version 1.0
PURPOSE:
Stores slit profile and gradient along each order from twilight flats.
Takes TFLAT as the default
CALLING SEQUENCE:
mike_mktflat, mike, setup, side
INPUTS:
mike - ESI structure
RETURNS:
OUTPUTS:
A new ordr_struct stored in "Flats/OStr_R_01wP.fits'
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_mktflat, mike, 1
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
28-Feb-2003 Written by SB
18-Apr-2003 Revised by JXP
30-Apr-2003 Polished by JXP
(See pro/Flat/mike_slitflat4x2.pro)
NAME:
mike_specplt
Version 1.0
PURPOSE:
Plots any array interactively
CALLING SEQUENCE:
mike_specplt, ydat, [head], XSIZE=, YSIZE=, TITLE=, WAVE=, LLIST=,
QAL=, ERR=, /GAL
INPUTS:
ydat - Values
[head] - Header
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
xsize - Draw window xsize (pixels)
ysize - Draw window ysize (pixels)
wave - wavelength array
ERR - Error array (fits or image)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_specplt, 'spec.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
23-Aug-2002 Written by JXP
(See pro/Spec/mike_specplt.pro)
NAME:
mike_strct
Version 1.1
PURPOSE:
Creates and outputs a structure for a series of MIKE images.
This structure organizes the data for the night and is used
to run most of the programs in the MIKE package. It will
attempt to identify the type of object using the algorithm
(mike_autoid). It also parses the header for information related
to exposure time, RA,DEC, etc. Finally, the code calculates the
gain for pairs of Milky flat exposures with the routine
mike_gain. At present these gain values are not used.
Use mike_setgain to set the values [highly recommended].
See mikestrct__define.pro for all of the tags of the mike structure.
CALLING SEQUENCE:
mike_strct, struct, LIST=, /NOMKDIR, /NOFILE, OUTFIL=, /NOEDIT, FILE_LIST=
INPUTS:
By default the program examines all of the files with the form
*b####.fits in the Raw/ directory.
RETURNS:
OUTPUTS:
struct - IDL structure based on the MIKE images
OPTIONAL KEYWORDS:
LIST - Image list: e.g. 'gd_files.lst'
NOMKDIR - Suppress the creation of sub directories (not
recommended)
NOEDIT - Do not edit the final structure
OUTFIL - Name of fits output file (default = mikestrct.fits)
FILE_LIST - String Array of all input filenames
OPTIONAL OUTPUTS:
COMMENTS:
Need to do some consistency checks between red and blue side,
i.e. they should be the same type
EXAMPLES:
mike_strct, nght1_strct
PROCEDURES/FUNCTIONS CALLED:
mike_rslvall
mike_autoid
mike_gain
mike_wrstrct
mike_editstrct
REVISION HISTORY:
27-Feb-2003 Written by JXP
(See pro/General/mike_strct.pro)
NAME:
mike_subbias
Version 1.2
PURPOSE:
Remove bias from all exposures listed in the "mike" structure.
The main driver is mike_suboscan which strips the image of the
overscan and bias regions (see that program for a full
description). The mike_subbias routine will also remove an
archived bias image if requested.
CALLING SEQUENCE:
mike_subbias, mike, indx, /usebias, /nobiasrow, /clobber, /ARC,
/debug, BADROW=
INPUTS:
mike - MIKE structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/NOBIASROW= if set, bias row is not used (normally, you should not use it)
/USEBIAS = use the bias image in addition to subtracting a fit to the
overscan columns (at right). The code first generates a
smoothed version of the bias image.
If you do this, you want to be sure the same options
were used in mike_mkbias (i.e. /nobiasrow )
Presently, this step is not recommended.
/ARC - We found there is significant bleeding into the OV region
because of the very bright Arc lines. Setting /REDARC turns
off the fitting in the OV region for the red side. This may
be removed when the neutral density filter is introduced.
/CLOBBER = Overwrite existing OV files
/DEBUG -- Turn debug mode on
BADROW -- Rows identified as anomolous in the overscan region.
Generally the result of an electronics 'hiccup'.
OUTPUTS TO SNGL:
/NOFITS -- Do not write a fits file
OVIMG= -- Bias subtracted image
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_subbias, mike, indx
PROCEDURES/FUNCTIONS CALLED:
mike_subbias_sngl -- Subroutine under mike_subbias. Uses most of
the keywords described above. Example:
rslt = mike_subbias_sngl('Raw/mb0020.fits', side)
mike_suboscan
REVISION HISTORY:
17-Apr-2003 Written by JXP
29-Apr-2003 Modified by GP
24-Jun-2003 Modified by JXP (dealt with Blue side)
18-Jul-2003 Modified by RAB - changed bias subtraction method.
Now as follows: fit oscan cols (left), subtract
fit oscan rows (top) IF REQUESTED, subtract
subtract bias image IF REQUESTED
19-Aug-2003 Added single file mode
26-Jun-2004 Allowed retrieval of image only (no writing)
04-Apr-2005 Replaced mike_suboscan with x_suboscan
(See pro/Bias/mike_subbias.pro)
NAME:
mike_suboscan
Version 1.1
PURPOSE:
Called by mike_mkbias and mike_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:
mike_suboscan, raw, head, ovimg, rbin, cbin, [imtype], /NOBIASROW,
/DEBUG, /REDARC, SVBAD=
INPUTS:
raw -- 2D image
head -- Header for the image (only used to update the card)
rbin -- Binning of the rows (1,2,3,4)
cbin -- Binning of the columns (1,2,3,4)
[imtype] -- Image type:: 'ZRO' (only used for debugging)
RETURNS:
OUTPUTS:
ovimg -- Bias subtracted image
OPTIONAL KEYWORDS:
NoBIASROW - if set, bias row is ***NOT*** used.
I.E, default is to use the bias row.
REDARC -- Because of charge bleeding, the red arcs tend to have
improper overscan regions. Setting this keyword will
stop the code from using the overscan for bias
subtraction.
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 pro/Bias/mike_suboscan.pro)
NAME:
mike_teststd
Version 1.1
PURPOSE:
Create a sensitivity function given a standard star and its
appropriate calibration file.
CALLING SEQUENCE:
mike_calibstd, mike, indx, HSTFIL=, CHKFIT=, ESOFIL=
INPUTS:
mike - MIKE structure
indx - Index of the Standard star in the MIKE structure to process
RETURNS:
OUTPUTS:
Sensitivity file in the 'Extract/' directory
OPTIONAL KEYWORDS:
OUTFIL - Name of the output file (default:
'Extract/Sens_{mikeroot}.fits' )
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_calibstd, mike, 1, ESOFIL='fhr4469.dat'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
04-Jan-2004 Written by JXP
(See pro/Std/mike_teststd.pro)
NAME:
mike_tracearc
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:
mike_tracearc, mike, setup, obj_id, [side], /CLOBBER, INIO=
INPUTS:
mike - MIKE structure
setup - Integer defining setup
obj_id - Object identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
all_xset -- A structure describing the fits to the arc lines
OUTPUTS:
OPTIONAL KEYWORDS:
INIO - Initial order (for debugging)
/CLOBBER - Overwrite previous fits
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_tracearc, mike, setup, obj_id
PROCEDURES/FUNCTIONS CALLED:
trace_crude
xy2traceset
mike_tracearc_work
REVISION HISTORY:
28-Apr-2003 Written by SB
(See pro/Arcs/mike_tracearc.pro)
NAME:
mike_trcflat
Version 1.1
PURPOSE:
To trace the order edges of the individual orders. The results are
then fed to mike_fittflat to calculate a 2D solution. The
following steps are performed:
1. Identify the order edges (interactive is recommended).
2. Performs an order by order tracing of the order edges using
trace_crude.
3. Perform (iteratively) a PCA analysis on the coefficients of the
individual traces.
4. Create and write to disk a structure summarizing the fits.
CALLING SEQUENCE:
mike_trcflat, mike, setup, [side], /CHK,
INPUTS:
mike - MIKE structure
setup - Setup identifier
[side] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
A structure containing the information for the order by order
fits. This structure is then fed to mike_fittflat to create a 2D
solution. Typical name: 'Flats/TStr_B_01.fits'
OPTIONAL KEYWORDS:
/CHK -- Check the order edges interactively (similar to INTER)
/INTER -- Determine the order edges interactively
SMSHROW -- Row where order edges are determined (default: 1/2 way
up the image)
THRESH -- Threshold for an order edge on the red side
(default: 100.)
/CLOBBER -- Overwrite the output structure
P_NSIG -- Number of sigma significance that an order edge should
have for the red side (default: 50.)
NSIG -- Number of sigma significance that an order edge should
have fo the blue side (default: 2.0)
MINFLAT -- Mininum counts in flat on blue side to use orders (100)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_trcflat, mike, 1.0
PROCEDURES/FUNCTIONS CALLED:
mike_trcflat_clean
mike_getfil
REVISION HISTORY:
17-Apr-2003 Written by JXP
30-Apr-2003 Updated by JXP
04-Aug-2003 Updated by JXP :: Added robust peak cleaning routine
15-Mar-2004 Updated by JXP :: Added interactive mode
(See pro/Flat/mike_trcflat.pro)
NAME:
mike_trcobj
Version 1.0
PURPOSE:
Trace the object through each order of the image. The program
uses a standard star as a crutch (/STD) through regions where the object
has very low flux. The trace is written into the object
structure (e.g. Extract/Obj_mike0024.fits)
CALLING SEQUENCE:
mike_trcobj, mike, obj_id, [exp_id], /STD, /FAINT, /CHK, NCOLL=
INPUTS:
mike - ESI structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp_id] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK - Show final trace
/STD - Use standard star as a crutch
/FAINT - Faint object; sum up more rows (40) to search for flux
NCOLL= - Set number of rows to sum by hand (default: 25)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_trcobj, mike, 1L, [0L], /CHK, /STD
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
23-Sep-2003 Added mike_trcobj_sngl
(See pro/Object/mike_trcobj.pro)
NAME:
mike_trcstd
Version 1.0
PURPOSE:
Trace the std through each order of the image. The program
uses a standard star as a crutch (/STD) through regions where the object
has very low flux. The trace is written into the object
structure (e.g. Extract/Obj_mike0024.fits)
CALLING SEQUENCE:
mike_trcstd, mike, setup, side
INPUTS:
mike - ESI structure
obj_id - Object ID (e.g. 0L, 1L, etc)
[exp_id] - Exposure frames (e.g. [0L, 1L])
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
/CHK - Show final trace
/STD - Use standard star as a crutch
/FAINT - Faint object; sum up more rows (40) to search for flux
NCOLL= - Set number of rows to sum by hand (default: 25)
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_trcstd, mike, 1L, [0L], /CHK, /STD
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
22-Sep-2003 Written by JXP
(See pro/Std/mike_trcstd.pro)
NAME:
mike_tweakarc
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 calls x_fitarc as its driver.
The algorithm x_fitarc does the following:
1) Input the arc image from mike_mkarc
2) Input an archived arc solution appropriate to the chip
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:
mike_fitarc, mike, setup, obj_id, [chip], /INTER, LINLIST=, /CHK, /CLOBBER,
SIGREJ=, /DEBUG, IORDR=, /PINTER
INPUTS:
mike - HIRES structure
setup - Integer defining setup
obj_id - Object identifier
[chip] - Blue (1), Red (2), or both [1,2L] (Default: [1,2L])
RETURNS:
OUTPUTS:
IDL fit file (one per order) (e.g. Arcs/ArcECH_##fit.idl)
OPTIONAL KEYWORDS:
/PINTER - Perform fit for pre-identified lines
/INTER - Identify lines interactively and then fit
LINLIST - Arc line list (default: $XIDL_DIR/Spec/Arcs/Lists/mike_thar.lst
/CHK - Manually check steps along the way
/DEBUG - Debugging
SIGREJ= - Rejection sigma for outliers in arc line fitting
(default: 2.)
IORDR - Initial order for analysis
/CLOBBER - Overwrite previous fits
SHFTPRM= - Fit structure for shifting the orders of the arc
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_fitarc, mike, 1, 1
PROCEDURES/FUNCTIONS CALLED:
x_fitarc
REVISION HISTORY:
11-May-2005 Created by JXP (based on mike_fitarc)
(See pro/Arcs/mike_tweakarc.pro)
NAME:
mike_twisky
Version 1.0
PURPOSE:
Stores slit profile and gradient along each order from twilight flats.
Takes TFLAT as the default
CALLING SEQUENCE:
mike_twisky, mike, setup, side
INPUTS:
mike - ESI structure
RETURNS:
OUTPUTS:
nothing currently, it's just a test
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_twisky, mike, 1
PROCEDURES/FUNCTIONS CALLED:
mike_profile_return
REVISION HISTORY:
12-Aug-2003 Written by SB
(See pro/Flat/mike_twisky.pro)
NAME:
mike_updstrct
Version 1.0
PURPOSE:
Updates the MIKE structure with new images. Currently requires
that the new images are all in the 'Raw/' subdirectory.
CALLING SEQUENCE:
mike_updstrct, struct, LIST=list, EDIT=edit
INPUTS:
struct -- Original structure
RETURNS:
OUTPUTS:
struct - Updated structure list
OPTIONAL KEYWORDS:
LIST= - Image list
/EDIT - Launch mike_editstrct
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
mike_updstrct, mike
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
23-Sep-2004 Written by JXP
(See pro/General/mike_updstrct.pro)
NAME:
mike_wrstrct
Version 1.1
PURPOSE:
Write the mike structure to a FITS file and write an ASCII summary
CALLING SEQUENCE:
mike_wrstrct, mike, /ANONLY, OUTFIL=, FITS=
INPUTS:
mike - An ESI structure
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
ANONLY - Only print files with flg_anly NE 0
OPTIONAL OUTPUTS:
OUTFIL= - Output file (default: 'mike.list')
FITS= - Name of fits output file (default: 'strct.fits')
COMMENTS:
EXAMPLES:
mike_wrstrct, mike, FITS='mike_13oct02.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
13-Jul-2002 Written by JXP
29-Jan-2003 Polished (JXP)
(See pro/General/mike_wrstrct.pro)
NAME:
qa_profile
Version 1.1
PURPOSE:
Creates the QA files for the mike_slitflat routine
CALLING SEQUENCE:
qa_profile, qastr, qafil
INPUTS:
qastr -- The QA structure
qafil -- The name of the QA file
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2004 Written by SB
(See pro/ZObsolete/qa_profile.pro)
NAME:
slitflat_qa
Version 1.1
PURPOSE:
Creates the QA structure used to save info from the slitflat
routine for final printing via qa_profile
CALLING SEQUENCE:
qa = slitflat_qa( x, z, mask, ordr, lower=, upper= )
INPUTS:
x -- slit_frac
z -- Profile
mask -- Profile mask
ordr -- Order structure (parsed to include only one order)
RETURNS:
OUTPUTS:
OPTIONAL KEYWORDS:
LOWER=
UPPER=
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
temp_qa = slitflat_qa(slit_frac[xsort], profile[xsort], profile_mask, $
ordr_str[q])
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
2004 Written by SB
(See pro/ZObsolete/slitflat_qa.pro)
NAME:
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
(See pro/General/mike2traceset.pro)
NAME:
x_wrechfspec
Version 1.0
PURPOSE:
Reads and writes the echfspec structure
CALLING SEQUENCE:
x_wrechfspec, echfspec, outfil, /READ
INPUTS:
wfstrct - WFCCD structure
RETURNS:
OUTPUTS:
wfarc - WFCCD arc structure (fits file)
OPTIONAL KEYWORDS:
OPTIONAL OUTPUTS:
COMMENTS:
EXAMPLES:
x_wrechfspec, echfspec, 'Extract/2015+657_ech.fits'
PROCEDURES/FUNCTIONS CALLED:
REVISION HISTORY:
03-Sep-2002 Written by JXP
(See pro/Spec/mike_wrfspec.pro)