This page is a very brief introduction to the UCB DEIMOS spec2d reduction pipeline. This IDL code is under CVS control, and you can download a stamped version of the code — see our website for more details. The spec2d pipeline is modeled on the SDSS spectral pipeline of David Schlegel and Scott Burles. Most of the DEIMOS spec2d code was written by Doug Finkbeiner, Marc Davis, Jeff Newman, and Michael Cooper with important contributions from Brian Gerke regarding the implementation of non-local sky subtraction. The pipeline operates in 5 separate stages, each of which produces its own output files. The code operates without supervision and usually does an excellent job of wavelength fitting, sky subtraction, and object fitting. If you want to understand what the code is actually doing, start with the routine domask.pro (in ~/cvs/spec2d/pro/) which is a simple script to run through the full reduction for a given slitmask. Below we will briefly discuss the 5 stages of the spec2d code and its outputs.
0 — The zeroth step in the reduction of a slitmask is the generation of a plan file. Creation of a plan file is NOT handled by the routine domask.pro. It needs to be generated prior to running the domask script. The plan file can be generated, in an automated fashion, by analysis of the FITS headers for all files in a given raw data directory. The plan file is ascii in format and can be edited to tailor the reduction plan for a given mask. Listed in the file is the mask name, the raw data directory, the names of flats, arcs, and science frames, as well as a few optional keywords. Refer to the routine read_planfile.pro for more details and see the example plan file. Also, the spec2d cookbook includes far more details regarding the construction of a plan file.
1 — The first stage of the data reduction is the processing of the flats and arc files to determine where the slitlets fall on the CCD array and to find the 2-d lambda solution for each slitlet. deimos_mask_calibrate.pro is the main routine for this stage of the pipeline. This processing of the flats and arcs is done chip by chip, with information for each slitlet written to a separate FITS file, in the form of a BINTABLE extension. The blue side and red side of each slitlet lead to different files, calibSlit.xxxx.sssB.fits and calibSlit.xxxx.sssR.fits, where sss is the slit number and xxxx is the mask name. First the flats are read and edges are detected; these edges are compared to the bluslits BINTABLE stored with the DEIMOS data files which describes where each slitlet should appear (in units of millimeters). Next a smooth curve is fit to the edges of each curving slitlet, (X0 and X1). The multiple flats are then processed to reject CRs and to measure the SLITFN, the ‘throughput’ of the slitlet as function of row number (since the DEIMOS data is transposed, row is the spatial direction and column is the spectral direction). Next the curved slitlets are mapped into rectangular arrays by shifts and interpolation in the SPATIAL direction; this rectification greatly simplifies further processing. The flats are also used to generate a 2-d normalizing function for fringing corrections.
The next step is solving for the wavelength of each pixel in the 2-d data array of each rectified slitlet. Basic information on the grating and grating tilt is drawn from the FITS headers of the raw data files and at this stage we employ the DEIMOS optical model as designed by Drew Phillips to assist in the initial lambda fitting. The fitting is done in multiple stages and leads to a fit that is typically precise at the 0.005 Angstrom level over the entire 2-d slitlet. deimos_arcfit.pro is the routine that produces the final fits. (Two alternative wavelength fitting schemes are possible, selectable by flags within the plan file. These are the POLYFLAG and the TRACESET methods. The first is DEIMOS specific while the second is taken from SDSS routines. Note that the POLYFLAG method is the default fitting scheme, and should be employed by all users. The TRACESET scheme has not been maintained and should not be used.)
At this stage, the results are output to calibSlit files by means of the mwrfits command, which saves the data in the form of a FITS BINTABLE. Reading the file can be done via the mrdfits command (both routines are part of the GODDARD IDL/FITS library and contained in the SDSS IDLUTILS package). These routines write and read IDL structures (same as C structures). For example, the command
IDL> cc = mrdfits(‘calibSlit.2200.004B.fits’, 1)
reads the first HDU extension of this calibSlit file into the variable cc. To find out what cc contains, execute
IDL> help, cc, /str
which will list the IDL structure ‘tags’ showing the type and the size of each tag (note that the number of rows, here 229, is specific to each slitlet):
IDL> help, cc, /str
** Structure <81e73ac>, 11 tags, length=15980400, data length=15980400, refs=1: