We now want to merge the individual segments for each order of the grism into a single spectrum. The echellogram produced by the cross-dispersed grisms is such that there is considerable overlap in wavelength from one order to the next, but the instrumental sensitivity at a particular wavelength in different orders can be quite different due to the shape of the blaze profile. These differences lead to different noise levels in the flux calibrated spectra, even though the absolute levels of the individual flux calibrated segments should match. Optimal combination of the segments is performed using weighting functions for each order that are proportional to the wavelength-dependent instrumental sensitivity. The FLAT frame is a suitable origin for these weighting functions.
Weighting functions are derived from the FLAT frame using the cspweights task which has the parameters listed below. The flatfile parameter defines the flatfield frame to use. The weights parameter specifies the base name of the output weighting function. The weighting function will have .wfn appended to this name. The FLAT frame is first combined as a comparison image, then the known bad pixels are fixed and you are given the opportunity to interactively clean remaining bad pixels. The cleaned image is geometrically transformed and a one dimensional spectrum is extracted from each order by averaging the columns specified by the range parameter. These spectra are normalized by dividing by the median value of the spectrum of the first order, and the normalized weighting functions are stored in the IRAF multispec format output file and are plotted in the graphics display.
I R A F
Image Reduction and Analysis Facility
PACKAGE = caspir
TASK = cspweights
flatfile= flat_jh Flatfield frame to use
weights = wt_jh Base name of weighting function
(range = 15:35) Range of columns to average
(zerosec= [190:195,10:90]) Zero level image section
(verbose= yes) Verbose output?
(mode = ql)
Once the weighting functions for a grism have been formed, the individual object, sky, and comparison spectra for each order can be merged into single spectra using the redxspec task by setting the merge flag and using the weights parameter to define the base name of the weighting function file. Flux calibrated object and sky spectra (.fos and .fss file extensions) will be merged if they exist. Otherwise, the extracted object and sky spectra (.osp and .ssp file extensions) will be merged. The individual segments for each object order are first overplotted in the graphics display so that the user can assess how well they are matched. The weighted average is then formed, and the process is repeated first for the sky spectra and then for any comparison spectra having the specified base spectrum name and .csp file extension. The merged object spectra are stored in a file with .mos appended to the base spectrum name. The merged sky spectra are stored in a file with .mss appended to the base spectrum name. The merged comparison spectra are stored in a file with .mcs appended to the base spectrum name.