This page was created by the IDL library routine
make_html_help
. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? make_html_help
at the IDL command line prompt.
Last modified: Fri May 11 14:12:39 2007.
NAME: bspline_longslit PURPOSE: Calculate a B-spline in the least squares sense with rejection, using a model profile. CALLING SEQUENCE: sset = bspline_longslit(xdata, ydata, invvar, profile_basis, $ 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. profile_basis - spatial profiles of each independent b-spline fit Should have dimensions [NPIX, NBSPLINES] 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_workit() create_bsplineset() djs_reject() REVISION HISTORY:
(See pro/Flat/bspline_longslit.pro)
NAME: bspline_magfit PURPOSE: Correct a calibrated quasar with known photometry CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/Spec/bspline_magfit.pro)
NAME: calculate_resolution PURPOSE: calculate_resolution, s, anamorph=anamorph CALLING SEQUENCE: long_superbias, filenames, outfile, [ sigrej=, maxiter=, /verbose ] INPUTS: s -- Spectral structure which contains all the key quantities OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by J. Hennawi (UCB), D. Schlegel (LBL)
(See pro/Extract/calculate_resolution.pro)
NAME: find_nminima PURPOSE: Find one or several minima in a vector of chi^2 values. CALLING SEQUENCE: xpeak = find_nminima( yflux, [ xvec, dofarr=, nfind=, minsep=, $ width=, ypeak=, xerr=, errcode=, npeak=, plottitle=, /doplot, /debug ] INPUTS: yflux - Y values OPTIONAL INPUTS: xvec - X values, which must either be sorted in ascending or descending order; default to 0-indexed integers. dofarr - If set, then fit to the minima in the function YFLUX/DOFARR, but avoiding any points where DOFARR is set to zero. nfind - Number of minima to find; default to 1. It is possible to find fewer than NFIND minima. minsep - Minimum separation between local minima. If a peak is found closer than MINSEP to an existing peak, then the latter peak is discarded. width - Width to use when selecting the points used in the fit. Only use points where XVEC is within WIDTH of the the lowest-values point (which is used as the initial guess); default to using all points. OUTPUTS: ypeak - Fit value for either chi^2 or chi^2/DOF at the minima. If the fit value is less than zero, then change it to zero. OPTIONAL OUTPUTS: xerr - Formal errors of XPEAK. errcode - Error codes for each minima; 0 for no errors in the fit. npeak - The number of peaks found, between [0,NFIND]. plottitle - Title of plot (if /DOPLOT is set). doplot - If set, then make plots. Discarded peaks are not plotted. debug - If set, then wait for keystroke after plot. COMMENTS: This routine calls SVDFIT for fitting quadratics, or MPFIT for fitting gaussians. EXAMPLES: BUGS: PROCEDURES CALLED: djs_icolor() djs_oplot djs_plot mpfitpeak mpfitpeak_gauss textoidl INTERNAL SUPPORT ROUTINES: long_zfitmin() REVISION HISTORY: 22-Aug-2001 Written by D. Schlegel, Princeton 30-Jul-2002 Fixed bug - yrange passed twice to djs_plot
(See pro/General/long_find_nminima.pro)
NAME: kast_tstlong Version 1.1 PURPOSE: Tests the Longslit routines on the Kast spectrometer CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 11-May-2007 Written by JXP
(See pro/KAST/kast_tstlong.pro)
NAME: knpo_skyillum PURPOSE: Algorithm to generate an illumination flat, ideally from a twilight flat. This routine is tuned to observations taken at KPNO. CALLING SEQUENCE: kpno_skyillum, filenames, illumflatfile, pixflatfile $ INPUTS: filenames -- List of sky flat frames pixflatfile -- Filename of the pixel flat. Presumably created from internal or dome exposures. OPTIONAL INPUTS: OUTPUTS: illumflatfile -- Filename for the illumination flat OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/MMT/kpno_skyillum.pro)
NAME: longslit_version PURPOSE: Return the version name for the product Longslit CALLING SEQUENCE: vers = longslit_version() INPUTS: OUTPUTS: vers - Version name for the product Longslit COMMENTS: If this version is not tagged by CVS, then we return 'NOCVS:TOPLEVEL' where TOPLEVEL is the last directory in the environment variable $LONGSLIT_DIR. For example, if you are using a version of the code in the directory '/u/schlegel/Longslit/v0_0', then this returns 'NOCVS:v0_0'. BUGS: PROCEDURES CALLED: REVISION HISTORY: 25-Apr-2005 Written by D. Schlegel, Princeton.
(See pro/General/longslit_version.pro)
NAME: long_arc_fw PURPOSE: Compute the full width of an arcline in an arc image corresponding to a given fraction of the peak flux CALLING SEQUENCE: fw_frac=arc_fw(profile, xpeak, maxsep, frac) INPUTS: profile - 1-d arc spectrum xpeak - location of the arc line peak in pixels maxsep - separation to look for full width on either side frac - Fraction of peak flux to use for full width OUTPUTS: fw_frac - Full width at fraction frac of peak flux OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 27-May-2005 Written by J. Hennawi (UCB)
(See pro/Wave/long_arc_fw.pro)
NAME: long_coadd Version 1.1 PURPOSE: Combine the spectra from multiple exposures taken through the same mask or longslit. CALLING SEQUENCE: LONG_COADD, infiles, objid, OUTFIL = INPUTS: infiles -- Names of files to coadd objid -- Object ID number for the spectrum to coadd. This could be an array if the objid changes from exposure to expsr. OPTIONAL INPUTS: iwave -- Index corresponding to an exposure that defines the 'template' wavelength array [default: 0] OUTPUTS: OUTFIL= -- Name of the file to record coadded spectrum SIGREJ= -- Value for rejecting bad pixels [default: 2.] /IRAF -- Read wavelengths from the tag WAVE_IRAF [GMOS data] EXTEN= -- Extension in input file where the spectra structure is stored [default: 5] OPTIONAL OUTPUTS: FLUX= -- Coadded flux WAVE= -- Coadded wave IVAR= -- Coadded inverse variance COMMENTS: EXAMPLES: PROCEDURES CALLED: x_gsmooth REVISION HISTORY: 25-May-2000 Created by JH
(See pro/Spec/long_coadd.pro)
NAME: long_deimossplit PURPOSE: Split a DEIMOS FITS file into the frame of interest that covers the longslit footprint CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 2006 Written by JXP
(See pro/DEIMOS/long_deimossplit.pro)
NAME: long_extinct Version 1.1 PURPOSE: Return the extinction as a function of wavelength as a function of observatory. Also pass back the AIRMASS parsed from the header CALLING SEQUENCE: LONG_EXTINCT, scihdr, WAVE_EXT = , MAG_EXT = INPUTS: OPTIONAL INPUTS: OUTPUTS: WAVE_EXT= -- Array of wavelengths where the extinction is evaluated MAG_EXT= -- Array of extinction values in magnitudes. 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
(See pro/Spec/long_extinct.pro)
NAME: long_extract_optimal PURPOSE: Perform an optical extraction of the spectra using profile fitting techinques. CALLING SEQUENCE: spec = long_extract_optimal(wave, image, ivar, oprof, mask, skyimage, trace) INPUTS: wave -- Wavelength image image -- Data image ivar -- Inverse variance oprof -- Object profile mask -- Image which defines the useful data regions RETURNS: spec -- A comprehensive structure containing the extracted spectra, trace, wavelength array, etc. OPTIONAL INPUTS: BOX_RAD= -- Radius for boxcar extraction OUTPUTS: OPTIONAL OUTPUTS: MODELIVAR= -- Model of the inverse variance COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: traceset2xy REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_extract_optimal.pro)
NAME: long_findfwhm PURPOSE: Calculate the spatial FWHM of all the objects in the slit. The routine assumes a simple algorithm. CALLING SEQUENCE: long_findfwhm, model, x, peak, peak_x, lwhm, rwhm INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: traceset2xy REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_findfwhm.pro)
NAME: long_flatfield_specillum PURPOSE: Determine the illumination function from a flat field exposure let's consider x to be the spectral dependence with well sampled (2-pixel) variations y should represent slit-position, and the sampling should be sufficient to resolve slit variations poly_terms will be added to test for possible polynomial variations in x and y. xmin, xmax & ymin, ymax should be added to normalize both parameters to -1 to 1. Assume image represents electrons, and bad pixels are set to negative counts. We need to mask negative values anyway. There is still a issue with scattered light, and how to account for it in the slit illumination response. Assume that scattered light has already been removed. CALLING SEQUENCE: long_flatfield_specillum, x, y, image, invvar=, $ INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by D. Schlegel, LBL
(See pro/Flat/long_flatfield_specillum.pro)
NAME: long_flexure PURPOSE: Calculate the flexure shift from a sky-line spectrum and then shift the spectrum onto the sky spectrum. CALLING SEQUENCE: long_flexure, struct, skyfile, QAFILE = QAFILE INPUTS: struct -- Structure containing the extracted spectrum skyfile -- File containing the sky spectrum OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: QAFILE= -- Filename for QA output COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_flexure.pro)
NAME: long_flex_qa PURPOSE: Generate QA for the flexure correction CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/QA/long_flex_qa.pro)
NAME: long_fluxcal PURPOSE: Given an extracted spectrum (in units of counts/pixel) and the response function of the spectrograph, flux calibrate the spectrum CALLING SEQUENCE: long_fluxcal INPUTS: final_struct - object structure containing the uncalibrated extracted spectra sensfunc - structure containing the sensitivity function exptime - exposure time for the spectra (in s) airmass - mean airmass over the course of the observations OPTIONAL INPUTS: OUTPUTS: outfil - Filename to contain the fluxed spectrum OPTIONAL OUTPUTS: COMMENTS: If the wavelength range of the observed spectrum differs from the wavelength range of the sensitivity function (which is likely), then the output calibrated spectrum will cover a smaller wavelength range than the input spectrum EXAMPLES: BUGS: PROCEDURES CALLED: create_struct (Goddard) struct_addtage (idlutils) INTERNAL SUPPORT ROUTINES: REVISION HISTORY: 03-Sep-2005 Written by J. Hennawi UC Berkeley
(See pro/Spec/long_fluxcal.pro)
NAME: long_gprofile PURPOSE: Fit a non-parameteric object profile to the data unless the S/N is poor (less than 3) in which case fit a simple Gaussian. CALLING SEQUENCE: profile = long_gprofile(image, ivar, trace_in, flux, fluxivar, objstruct) INPUTS: OPTIONAL INPUTS: /GAUSS -- Calculate a Gaussian profile OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_gprofile.pro)
NAME: long_localskysub PURPOSE: Perform sky subtraction in a given slit. Subtraction is limited to a relatively narrow region near the object. CALLING SEQUENCE: struct = long_localskysub( sciimg, sciivar, skyimage, piximg, waveimg, objstruct, thismask, skymask, objmask) INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_localskysub.pro)
NAME: long_look PURPOSE: Script for viewing data CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH
(See pro/General/long_look.pro)
NAME: long_MULTIPANEL PURPOSE: This routine provides an easy-to-use interface to IDL's !p.multi mechanism and it can be used to retrieve the position vector of the next plot in line (even if !p.multi is not set). You can specify plot margins and a page margin in normalized coordinates. For multi-panel plots, multipanel works in three stages (somewhat similar to XInterAnimate): 1) set up a multi-panel page by specifying the number of rows and columns or the maximum number of plots on the page. 2) advance to the next plot position and return that position. If the page was filled (i.e. the maximum number of plots (advance steps) has been made, it will be erased (unless /NOERASE is set). 3) turn the multi-panel environment off and reset margin values. Subsequent PLOT, MAP_SET, etc. commands should use the POSITION vector returned from this routine and they should use the /NOERASE keyword. CATEGORY: Plotting tools CALLING SEQUENCE: Get position of next plot MULTIPANEL,position=p Setting up multi-panel pots MULTIPANEL,[rows=r,cols=c | nplots=n] [,options] Advance to the next panel (and get its position) MULTIPANEL,/advance [,position=p] [,options] Reset multi-panel environment to start over at the first panel MULTIPANEL,/reset [,options] Turn multi-panel environment off (reset !p.multi and some other parameters) MULTIPANEL,/OFF INPUTS: Optionally you can give the number of plots (keyword NPLOTS) as a parameter instead. Th euse of a parameter will override the keyword. KEYWORD PARAMETERS: General keywords (honored under all circumstances) ------------------------------------------------------------------- POSITION -> Returns a 4-element vector with the position of the next plot in the line. As always this vector contains [X0,Y0,X1,Y1]. MARGIN -> specify a margin around the plot in normalized coordinates. This keyword does not change any IDL system variables and will thus only become "visible" if you use the POSITION returned by MULTIPANEL in subsequent plot commands. MARGIN can either be one value which will be applied to all four margins, or a 2-element vector which results in equal values for the left and right and equal values for the bottom and top margins, or a 4-element vector with [left,bottom,right,top]. OMARGIN -> specify a page margin around all panels in normalized coordinates. Works like MARGIN. Note that you can change the values of MARGIN and OMARGIN after you set up your plot page. The values given with MARGIN and OMARGIN remain active until you specify a new one or use the /OFF keyword. /NOERASE -> This keyword prevents erasing the screen (or page) when setting a multi-panel environment or after a page was filled. NOERASE is automatically turned ON when the /OFF keyword is given. Informational keywords: ------------------------------------------------------------------- FIRSTPANEL -> returns 1 if the current plotting panel is the first one on a page LASTPANEL -> returns 1 if the current plotting panel is the last on a page Setting up a multi-panel page: ------------------------------------------------------------------- ROWS, COLS -> specify the number of rows and columns you want on your page. If one is specified, the other one must be given as well. Alternatively, you can use the NPLOTS keyword. NPLOTS -> maximum number of plots on one page. The number of rows and columns is automatically computed so that the plots "approach a square" and they are returned in the ROWS and COLS keywords. Setting NPLOTS to a ROWS*COLS value is equivalent to using ROWS and COLS. If you specify an "uneven" number (e.g. 5), multipanel,/advance will erase the page after 5 plots instead of 6. /PORTRAIT -> Normally, ROWS tends to be larger than COLS when NPLOTS is used (e.g. 12 gives 4 rows and 3 cols). Use this keyword to revert this behaviour. /LANDSCAPE -> Make ROWS larger than COLS if necessary. Thi4s is the default. Thi skeyword is actually unnecessary and was introduced for purely aesthetic reasons (symmetry). Advance to the next plot: ------------------------------------------------------------------- /ADVANCE -> this keyword issues a hidden plot command to find out the position of the next plot to be made. The position is then returned in the POSITION keyword. The value of !P.MULTI[0] is increased afterwards so that you can issue your plot command without explicitely specifying the position or /NOERASE. When the maximum number of plots set with NPLOTS is reached, MULTIPANEL,/ADVANCE will erase the screen and reset the plot position to the upper left corner. CURPLOT -> use this keyword to advance to a specific plot position on the page. If you specify 0, the screen will be erased. CURPLOT also returns the current plot number. If you don't want to set the plot number but just query it, you must pass an undefined variable (see procedure UNDEFINE.PRO). Reset the plot position (and erase the screen) ------------------------------------------------------------------- /RESET -> does just this. Turn multi-panel environment off ------------------------------------------------------------------- /OFF -> Overrides all other keywords. Resets !p.multi to 0. OUTPUTS: none. SUBROUTINES: function GET__PLOTPOSITION() issues a dummy plot command and returns the plot position from the ![xy].window variables. REQUIREMENTS: none. (example uses RECTANGLE.PRO) NOTES: Side effect: Opens a window in standard size if none was open before. This happens because the next plot position is determined by issuing a hidden (or dummy) plot command with no visible output. Make sure to use POSITION=P,/NOERASE with all your PLOT, MAP_SET CONTOUR, etc. commands. In fact, you don't _need_ /NOERASE for PLOT, but it guarantees consistent behaviour with MAP_SET etc.) A PLOT command without /NOERASE will advance to the next panel and thereby interfere with MULTIPANEL's plot counter. If you don't use MARGIN and OMARGIN, the values in ![XY].margin ![XY].omargin will take effect. A common block is used to store the current plot number and margin information. This limits the use to one window at a time (although you can save all parameters elsewhere and supply them to the routine on a window-by-window basis). EXAMPLES: ; just retrieve the position of the next plot ; --------------------------------------------------------------- MULTIPANEL,position=p PLOT,findgen(10),color=1,position=p,/noerase ; same thing but use a specific margin (2-element form) ; --------------------------------------------------------------- MULTIPANEL,margin=[0.1,0.05],position=p PLOT,findgen(10),color=1,position=p,/noerase ; (if you want to see both previous plots together use ' /NOERASE with MULTIPANEL) ; multi-panel use: ; --------------------------------------------------------------- MULTIPANEL,NPlots=5 ; set up for 5 plots for i=0,4 do begin MULTIPANEL,Position=p,margin=0.04 ; get current plot position plot,findgen(10),color=1,position=p,/noerase ; plot MULTIPANEL,/Advance,/NoErase ; go to next panel ; note that the screen would be erased after the last plot ; without the /NoErase keyword. endfor ; now let's draw a frame around everything MULTIPANEL,/OFF,omargin=0.01,margin=0.,position=p,/noerase Rectangle,p,xvec,yvec ; <<< uses RECTANGLE.PRO !! plots,xvec,yvec,color=1,/norm MODIFICATION HISTORY: mgs, 19 Mar 1999: VERSION 1.00 mgs, 22 Mar 1999: - improved documentation, changed OMARGIN to accept normalized coordinates. - position now also returned if turned OFF - added FIRSTPANEL and LASTPANEL keywords - allow NPLOTS to be specified as parameter mgs, 02 Jun 1999: - now saves old values of !X, !Y, and !P and restores them when turned OFF. mgs, 03 Jun 1999: - save !X, !Y, and !P only if !p.multi was really off mgs, 26 Aug 2000: - changed copyright to open source
(See pro/QA/long_multipanel.pro)
NAME: long_objfind PURPOSE: Find the location of objects within each slit mask CALLING SEQUENCE: objstruct = long_objfind( image, tset_slits=, $ [fwhm=, nperslit=, peakthresh=, skymask=, objmask= ] ) INPUTS: image - Image for finding the slits, which would typically be a flat-field image, an arc image, or a sum of those tset_slits - Trace sets with slit start/end positions OPTIONAL INPUTS: fwhm - FWHM for convolving flux along the slit before peak-finding; default to 3.0 pix. (Also, do not allow peaks closer to each other than FWHM pix.) nperslit - Do not find more than this many objects per slit; default to 10 peakthresh - Flux threshhold for finding objects; the flux must be at least this fraction of the brightest object in each slit; default to 0. absthresh - Absolute flux threshold for finding objects; the peakflux must be at least htis large; default to 0. If both peakthresh and absthresh are set, absthresh overrides peakthresh. OUTPUTS: objstruct - Structure with object parameters OPTIONAL OUTPUTS: skymask - Image of the cleanest sky pixels, =1 for good sky pixels COMMENTS: Each slit is smashed to a single vector in the spatial direction, taking care to align each wavelength in the spatial direction first. On this smashed flux vector, we then search for significant peaks. We then compute the expected position of each object at each wavelength, by assuming that each object always falls in the same position within the slit. EXAMPLES: BUGS: PROCEDURES CALLED: extract_asymbox2() find_npeaks() gaussian() long_slits2mask() long_slits2x() splog traceset2xy INTERNAL SUPPORT ROUTINES: long_obj_create() REVISION HISTORY: 10-Mar-2005 Written by D. Schlegel, LBL
(See pro/Extract/long_objfind.pro)
NAME: long_plan PURPOSE: Create plan file(s) for running the low-redux pipeline. This code parses headers, does image stats, etc. CALLING SEQUENCE: long_plan, [ fileexpr, indir, planfile= ] INPUTS: OPTIONAL INPUTS: fileexpr - File names in the input directory; default to '*.fits*' indir - Input directory(s) for reading files; default to current directory planfile - Output plan file; default to 'plan.par'. This file is put in the same directory as the raw data files. OUTPUT: COMMENTS: One plan file is made for each input directory. The following flavors of images are listed: bias domeflat iflat (internal flat) twiflat arc science EXAMPLES: BUGS: PROCEDURES CALLED: fileandpath() headfits() idlutils_version() splog sxpar() yanny_write INTERNAL SUPPORT ROUTINES: long_plan_struct() REVISION HISTORY: 13-Mar-2005 Written by David Schlegel, LBL.
(See pro/General/long_plan.pro)
NAME: long_plotsci PURPOSE: Generate QA for the science extractions CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/QA/long_plotsci.pro)
NAME: long_pltobj PURPOSE: Simple routine which plots a spectrum after reading in the standard science file generated by long_reduce CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: x_specplot (XIDL) INTERNAL SUPPORT ROUTINES: REVISION HISTORY: 01-Oct-2005 Written by J. Hennawi UC Berkeley
(See pro/Spec/long_pltobj.pro)
NAME: long_proc PURPOSE: Overscan subtract, bias subtract, and flat field a CCD image. The routine calls long_oscan and flat fields. CALLING SEQUENCE: long_proc, filename, [ flux, invvar, hdr=, $ biasfile=, pixflatfile=, adderr=, /verbose ] INPUTS: filename - name of a image file OPTIONAL INPUTS: biasfile - File with average bias pixflatfile- File with pixel flat adderr - Additional error to add to the formal errors, as a fraction of the flux; default to 0.01 (1 per cent). OUTPUTS: OPTIONAL OUTPUTS: flux - Image invvar - Inverse variance image hdr - FITS header COMMENTS: EXAMPLES: BUGS: Need to add cosmic ray zapping. PROCEDURES CALLED: divideflat headfits() mrdfits() long_oscan REVISION HISTORY: 10-Mar-2005 Written by J. Hennawi (UCB), D. Schlegel (LBL)
(See pro/General/long_proc.pro)
NAME: long_reduce PURPOSE: Main program for the Low-redux pipeline. This set of algorithms runs mainly as a black box. CALLING SEQUENCE: long_reduce, planfile, /clobber, /NOZAP, /NOFLEX, /NOHELIO INPUTS: planfile -- File created by long_plan which guides the reduction process OPTIONAL INPUTS: /NOFLEX -- Do not apply flexure correction [necessary if your setup has not been calibrated. Contact JH or JXP for help if this is the case.] HAND_FWHM -- Set the FWHM of the object profile to this value (in pixels) /NOHELIO -- Do not correct to heliocentric velocities /NOZAP -- Do not flag CRs OUTPUTS: (1) Various calibration files (2) One multi-extension FITS file in Science per exposure containing the extracted data and processed images OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/General/long_reduce.pro)
NAME: long_reidentify Version 1.1 PURPOSE: Given an initial guess at the wavelength solution, reidentify a new arc spectrum. CALLING SEQUENCE: LONG_REIDENTIFY, arc_obj, lines, wstruct INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES CALLED: REVISION HISTORY: 25-May-2000 Created by JH
(See pro/Wave/long_reidentify.pro)
NAME: long_sensfunc PURPOSE: Use a standard star spectrum to determine the spectroscopic response function. CALLING SEQUENCE: INPUTS: scifile - file containing object structure which has spectrum for standard star standard_name - name of the standard star sensfuncfile - File to write the sensitivity function out to OPTIONAL INPUTS: OBJID - object id of standar star in the object structure. Default is to the first object. nresln - Break point spacing in resolution elemnets (default=20) /MSK_BALM - Mask Balmer lines (recommended but not default) OUTPUTS: mag_set - structure containing b-spline info for sensitivity function OPTIONAL OUTPUTS: sensfunc - sensitivity function evaluated COMMENTS: See README file in /apps2/iraf211/iraf/noao/lib/onedstds/ for list of standard stars and the names of the associated files EXAMPLES: BUGS: Does not take into account atmospheric extinction!!! Leaves out first and last wavelength bins of sensitivity function PROCEDURES CALLED: traceset2xy (idlutils) xy2traceset (idlutils) splog (idlutils) INTERNAL SUPPORT ROUTINES: REVISION HISTORY: 01-Oct-2005 Written by J. Hennawi UC Berkeley
(See pro/Spec/long_sensfunc.pro)
NAME: long_skyoptimal PURPOSE: Fit a non-parameteric object profile to the data unless the S/N is poor (less than 3) in which case fit a simple Gaussian. CALLING SEQUENCE: struct = long_skyoptimal(wave, data, ivar, oprof, sortpix, sigrej =) INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by JH + SB
(See pro/Extract/long_skyoptimal.pro)
NAME: long_slitillum PURPOSE: Generate an illumination image for all the slits in a mask CALLING SEQUENCE: image = long_slitillum( illumflatfile, slitmask, ximg ) INPUTS: illumflatfile -- Name of illumination flat image slitmask -- Image describing the slits ximg -- x positions of the slits OUTPUTS: image -- Illumination image COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/Slits/long_slitillum.pro)
NAME: long_slitmask PURPOSE: Determine the positions of the slits on the image, and return tracesets CALLING SEQUENCE: long_slitmask, filename, outfile, $ [minslit=,biasfile=, y1=, y2=, nmed=, ksize=, peakthresh=, $ radius=, nave=, maxshifte=, maxshift0=, func=, ncoeff=, tset_slits= ] INPUTS: filename - Image for finding the slits, which would typically be a flat-field image, an arc image, or a sum of those outfile - Output file name with slit mask positions OPTIONAL INPUTS: mislit - Minimum slit width. Default is to return all slits. biasfile - Bias file to apply to raw images y1 - Starting row number for smashing image to initially identify slits; default to 0.40*NY y2 - Ending row number for smashing image to initially identify slits; default to 0.60*NY nmed - Width for median-filtering the image first in the wavelength direction (to remove cosmics) ksize - Half-kernel size for sharpness filter; default to 5 pix peakthresh - Flux threshhold for finding slits; the flux must be at least this fraction of the brightest slit; default to 0.02 radius - Keyword for TRACE_CRUDE; default to same value as KSIZE nave - Keyword for TRACE_CRUDE; default to 3 maxshifte - Keyword for TRACE_CRUDE; default to 0.1 maxshift0 - Keyword for TRACE_CRUDE; default to 1.0 func - Keyword for XY2TRACESET; default to 'legendre' ncoeff - Keyword for XY2TRACESET; default to 3 verbose - Verbose if set /SNGL - Forces the code to assume one (very long) long slit OUTPUTS: OPTIONAL OUTPUTS: tset_slits - 2-element array of trace sets, where the first defines the starting slit positions, and the second one defines the ending slit positions COMMENTS: EXAMPLES: BUGS: Need to deal with cases where slits appear to overlap, or if a slit position goes crazy. At a minimum, we should toss such cases??? Allow several input files, like a dome and an arc, and then align those images and add them??? I think peakthresh should be much lower like 0.02, especially if slitwidths are widely varying SMB, 3-25-05 PROCEDURES CALLED: long_proc long_slits2mask() mwrfits splog trace_crude() xy2traceset REVISION HISTORY: 10-Mar-2005 Written by D. Schlegel, LBL 13-Oct-2005 Edited by J. Simon, Caltech to assume that solo starting and ending slit positions are real, and need a complementary ending or starting position generated for them
(See pro/Slits/long_slitmask.pro)
NAME: long_slits PURPOSE: Simple code to find slit edges. Obsolete? CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/Slits/long_slits.pro)
NAME: long_slits2mask PURPOSE: Convert trace sets that describe slit positions into a mask with the slit number for each pixel CALLING SEQUENCE: slitmask = long_slits2mask(tset_slits, [ xshift=, nslit= ] ) INPUTS: tset_slits - 2-element array of trace sets, where the first defines the starting slit positions, and the second one defines the ending slit positions OPTIONAL INPUTS: xshift - Number of pixels to shift the traces in the output image; this can bbe a fractional number OUTPUTS: slitmask - Mask image, with values of zero where there is no slit, and the slit number (starting at 1) for each object OPTIONAL OUTPUTS: nslit - Number of slits COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by D. Schlegel, LBL
(See pro/Slits/long_slits2mask.pro)
NAME: long_slits2x PURPOSE: Find the location of objects within each slit mask CALLING SEQUENCE: ximg = long_slits2x( tset_slits, [ slitid=, xshift=, nslit= ] ) INPUTS: tset_slits - Trace sets with slit start/end positions slitid - Slit ID number(s) (1-indexed); default to all slit IDs xshift - Number of pixels to shift the traces in the output image; this can bbe a fractional number OPTIONAL INPUTS: OUTPUTS: ximg - Image with the fractional X (spatial) position along the specified slit for each pixel OPTIONAL OUTPUTS: nslit - Number of slits COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: traceset2xy REVISION HISTORY: 11-Mar-2005 Written by D. Schlegel, LBL
(See pro/Slits/long_slits2x.pro)
NAME: long_stdslits PURPOSE: Find slits for a standard star? CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/Slits/long_stdslits.pro)
NAME: long_surf_trace2d PURPOSE: Fit a 2D surface to the output from trace_crude. Useful for tracing arc lines among other things. CALLING SEQUENCE: long_surf_trace2d, t, y, xcen, xerr, surffit INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 27-May-2005 Written by J. Hennawi (UCB)
(See pro/General/long_surf_trace2d.pro)
NAME: long_waveimg PURPOSE: Determine the positions of the slits on the image, and return tracesets CALLING SEQUENCE: waveimg = long_waveimg(arcimg, INPUTS: arcimg - 2D arc image arcivar - inverse variance of arc image tset_slits - slit trace set structure linlist - LRIS line list archive_file - save file for archived arc for this setup OPTIONAL INPUTS: mxshift - Maximum shift for cross correlation of arc default to 200 (grism spectra?) sigrej - Sigma for rejection of arc lines in polynomial fitting; default is 2 box_rad - boxcar radius for extracting 1-d arc (default is 5) qafile - QA file for diagnostics OUTPUTS: waveimg - 2-d wavelength map. OPTIONAL OUTPUTS: piximg - Pixel wavelength solution. fwhmset - Fit to fwhm from arc lines for each slit as an array of traceset structures fwqmset - Fit to fwqm from arc lines for each slit as an array of traceset structures COMMENTS: The algorithm for determining the wavelength solution is in ARC_PAIRS(). EXAMPLES: BUGS: PROCEDURES CALLED: arc_pairs() copy_struct_inx djs_median() long_slits2mask() long_xcorr() splog trace_crude() trace_fweight() traceset2xy xy2traceset REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/Wave/long_waveimg.pro)
NAME: long_wavepix PURPOSE: Find and trace arc lines CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 11-Mar-2005 Written by D. Schlegel, LBL
(See pro/Wave/long_wavepix.pro)
NAME: long_waveqa PURPOSE: Generate QA for the wavelength solution. CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/QA/long_waveqa.pro)
NAME: long_witerfit PURPOSE: Iterate on wavelength solution CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/Wave/long_witerfit.pro)
NAME: long_wpix2image PURPOSE: Convert a wavelength solution to a wavelength image ?? CALLING SEQUENCE: wvimg = long_wpix2image( tset2d, tset_slits, wset = , xshift = $ waveimg = , XFIT = ) INPUTS: tset2d= -- Trace set describing the arc line curvature OUTPUTS: OPTIIONAL OUTPUTS: waveimg= COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/Slits/long_wpix2image.pro)
NAME: long_wstruct PURPOSE: Create a structure which guides the data reduction process. Parts of the structure are initialized according to the instrument and its configuration. CALLING SEQUENCE: INPUTS: hdr -- Image header OPTIONAL INPUTS: OUTPUTS: Returns a structure describing the instrument configuration which is used to guide the reduction steps. OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/General/long_wstruct.pro)
NAME: lris_tstlong Version 1.1 PURPOSE: Tests the Longslit routines on LRIS CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 11-May-2007 Written by JXP
(See pro/LRIS/lris_tstlong.pro)
NAME: mmt_blue_setflex PURPOSE: This script takes a sky spectrum for the MMT-B 300 line grating setup and shifts it into the Paranal sky frame. It cretes an archived reference sky spectrum. The MMT spectrum should have been reduced with long_reduce with the flags nohelio and noflexure set to 1. CALLING SEQUENCE: INPUTS: OPTIONAL INPUTS: OUTPUTS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 10-Mar-2005 Written by S. Burles (MIT), David Schlegel (LBL), and Joe Hennawi (UC Berkeley)
(See pro/MMT/mmt_blue_setflex.pro)
NAME: mmt_fixhead PURPOSE: Fix a minor 'bug' in the MMT BCS header CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/MMT/mmt_fixhead.pro)
NAME: mmt_slitmask PURPOSE: Generate slitmask structure for the BCS CCD CALLING SEQUENCE: tset_slit = mmt_slitset( nx,ny ) INPUTS: OUTPUTS: tset_slits - 2-element array of trace sets, where the first defines the starting slit positions, and the second one defines the ending slit positions COMMENTS: EXAMPLES: BUGS: This will break if the binning is not 2x4 PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/MMT/mmt_slitset.pro)
NAME: mmt_slitmask PURPOSE: Combines multiple arcs. One generally observes the He separately from the Hg exposures (the latter take longer). The code requires that you combine these exposures prior to running long_reduce. CALLING SEQUENCE: mmt_waveblue, hgfile, hefile, outfil INPUTS: hgfile -- Filename of Raw image of the Hg arc exposure hefile -- Filename of Raw image of the He arc exposure OUTPUTS: outfil -- Output filename for the combined arc COMMENTS: EXAMPLES: BUGS: This will break if the binning is not 2x4 PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/MMT/mmt_waveblue.pro)
NAME: mmt_tstlong Version 1.1 PURPOSE: Tests the Longslit routines on the BCS spectrometer on the MMT CALLING SEQUENCE: INPUTS: RETURNS: OUTPUTS: OPTIONAL KEYWORDS: OPTIONAL OUTPUTS: COMMENTS: EXAMPLES: PROCEDURES/FUNCTIONS CALLED: REVISION HISTORY: 11-May-2007 Written by JXP
(See pro/MMT/mmt_tstlong.pro)
NAME: qa_longslit_profile PURPOSE: Generate QA for the object profile fitting CALLING SEQUENCE: INPUTS: OUTPUTS: COMMENTS: EXAMPLES: BUGS: PROCEDURES CALLED: REVISION HISTORY: 20-Apr-2005 Written by J. Hennawi Berkeley
(See pro/QA/qa_longslit_profile.pro)