1. Examine the data. Identify the pipeline product that you should start with, and examine the data before proceeding with any custom reduction. For example, if you are interested in low resolution spectroscopy of point sources in relatively empty fields, the sky-subtracted extracted spectrum bksub.tbl may be sufficient for your purposes. However, many users interested in IRS spectroscopic data will need to re-extract the spectra. In particular, the default pipeline does not perform optimal extraction of faint point sources or extended source extraction. Users who wish to use these extraction algorithms will need to start with one of the 2D products, such as bksub.fits. Other users will need to create new 2D products before extracting 1D spectra. For instance, the pipeline does not automatically perform sky subtraction for the high resolution modules. Therefore, users interested in high-resolution data should start with coa2d.fits files. In some cases, users will observe one object over several AORs. The pipeline will not co-add BCDs across AORs, so these users should start with the bcd.fits files. Users interested in spectral maps should also start with the bcd.fits files. Regardless of which pipeline product you start with, you should examine the 2D spectral products for a better understanding of your data. For completeness, the following steps assume that you have decided to start with the bcd.fits files.
2. Co-add 2D on-source spectra. Create sigma-clipped averages or medians of all of the 2D files taken at the same position. Be sure to combine the associated uncertainty (by adding in quadrature) and mask (by using the bitwise OR operator) frames. When combining any images, it is important to retain header information from the original BCDs, or they will not be usable in the spectral extraction software. For Staring Mode observations you can use the software of your choice (e.g. IDL, IRAF). You may wish to examine the software COAD for an example in IDL. For Mapping Mode observations, this is done automatically in CUBISM when you build a cube.
3. Co-add 2D background spectra. Create sigma-clipped medians of all 2D background files. As with the on-source spectra, be sure to combine the associated uncertainty and mask files, and to retain the original header information. The result will be subtracted from the on-source spectrum in the next step. The sky observations help to mitigate the effects of rogue pixels, which are especially numerous in Long-High data. (See Section 7.2.2.) If you are interested in line emission only you may not need to subtract the sky, as the general background does not have strong line features.
Low-Resolution Point-Source Staring Mode: If you have low-resolution observations taken in IRS Staring mode, you have observations of each target in two nods. Calling one nod position A and the other position B, you can co-add all nod B images to obtain a 2D background spectrum for nod A. Similarly, you can co-add all nod A images to obtain a background spectrum for nod B. This is an option for point sources if the slit does not have other sources in it. It is the method used in the pipeline to create the bksub.fits files. Alternately, you can construct a background frame from the off-source subslit. This method works for both point sources and extended sources on scales less than about 60 arcseconds. For example, if you are observing a source with both SL1 and SL2 in your AOR, when the source is in SL2, you can construct a sky from SL1 and vice-versa. Be sure to check that the off-source subslit does not contain serendipitous sources before using it to estimate the background. The selected background frames may be co-added using the software of your choice (e.g. IDL, IRAF).
Low-Resolution Extended Source Staring Mode: For extended sources observed with the low resolution modules, there would ideally be sky observations taken close in time to the science observations. If dedicated sky observations do not exist, search the archive for blank sky observations taken within 24 hours of your target data. Sky measurements taken several days before or after your source observations may introduce artifacts into your spectra due to (for example) changing darks and onset of rogue pixels (see Section 7.2.2.) For these and other reasons (e.g. changing pointing modes, aperture positions, bias voltages), it is highly recommended that appropriate sky measurements are selected from the same IRS campaign as the source observations. If these sky observations are not at similar ecliptic coordinates as your targets, you will have to apply a background scaling factor to be able to use these as a sky for your data. Also, to avoid adding noise to your data in the sky subtraction phase, choose archival data which have comparable or longer integration times than your data frames. If your source is extended on scales less than 60 arcseconds, you should consider using the off-source subslit (see the description in the preceding paragraph). The selected background frames may be co-added using the software of your choice (e.g. IDL, IRAF).
High Resolution Staring Mode: For high-resolutions observations, there would ideally be sky observations taken close in time to the science observations. If dedicated sky observations do not exist, search the archive for blank sky observations taken within 24 hours of your target data. If these sky observations are not at similar ecliptic coordinates as your targets, you will have to apply a background scaling factor to be able to use these as a sky for your data. Also, to avoid adding noise to your data in the sky subtraction phase, choose archival data which have comparable or longer integration times than your data frames.
Mapping Mode: The primary and recommended technique for assembling a background frame is to use dedicated background observations that were scheduled along with the mapping AOR, or to use data obtained as part of the mapping observations which went far enough off the source to remove all source flux from the slit. Once identified, the background observations may be co-added within CUBISM.
4. Subtract the background. The co-added 2D sky frame should be subtracted from the co-added 2D on-source frame using the software of your choice (e.g. IDL, IRAF). Be sure to combine the uncertainty and mask files and retain the original header information.
5. Extract 1D spectra. Run SPICE on your 2D spectral files, performing the basic steps of Profile, Ridge, Extract and Tune. Users may choose from three templates. “Point Source with Regular Extract” should be used for bright point sources where the trace is clearly visible in the 2D image. “Point Source with Optimal Extract” may improve the signal-to-noise ratio for faint point sources. “Extended Source with Regular Extract” should be used for extended sources. The SPICE extended source calibration assumes that the source has a uniform surface brightness. It calculates the slit loss correction factor based on that assumption. The user also has the option to manually select the extraction width. Please note that if you choose a custom width, your flux calibration will need to be redone as described in Section 8.2.2.
6. Examine your results. After completing a basic extraction as described in the previous four steps, examine the results. If you see spikes in your data, away from the order edges, you may wish to clean out rogue pixels (see Section 7.2.2). If you see mismatches between the orders or scalloping of the orders, you might investigate the presence of time-dependent dark current (see Section 7.4.1). If you see fringes, you will likely want to remove them using IRSFRINGE (which is recommended for high-resolution data only). Please see Chapter 7 and Section 8.2.2 for a list of additional steps you may wish to incorporate into your procedure. We highly recommend going through the basic procedure first, and only performing the optional steps if they are indicated by an examination of the results.