Spitzer Documentation & Tools
Spitzer Data Analysis Cookbook

 

Recipe 11. Dark_Settle: Correct Dark Currents for HR 6606

Data taken with the Long-High (LH) module of Spitzer's IRS sometimes exhibit time-dependent dark currents. Because this dark current is not uniform on the array, it can lead to order tilting or scalloping, as well as order mismatch. (Please see the IRS Instrument Handbook for more information on LH Order Tilts). In this recipe, we demonstrate how to recognize this effect in your data, as well as how to correct your Basic Calibrated Data files (BCDs) using the contributed IDL software dark_settle. In addition, we introduce the user to the batch mode option in SPICE. This mode allows the user to run multiple input BCDs (and associated mask and uncertainty files) through a single SPICE flow.

11.1            Requirements

You will need a licensed version of IDL; dark_settle works only with IDL versions 6.2 and greater. Also, download the IDL software package dark_settle (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/darksettle/) and the IRS spectral extraction software SPICE (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/spice/), or you may also use SMART (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/contributed/irs/smart/).

 

To follow along with this example, you will need to use the Spitzer archive to download the example data set. See Recipe 1 for details on how to do that. You will need the BCD and Calibration data for the AOR 20072448. The target is HR 6606 and it is part of an IRS calibration program. There should be eight BCD FITS files associated with this Long-High IRS observation.

11.2            First-pass extraction

The first step is to perform a simple extraction on your eight BCD files. Ideally, one would first perform background subtraction on the BCD files, as well as use IRSCLEAN (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/irsclean/) to remove rogue pixels in the background-subtracted BCD data. However, for this example, we wish to focus on the effect of running dark_settle alone. Therefore, we use SPICE to extract 1D spectra from the BCD files directly. Since this is a bright point source, we can use the regular point source extraction flow in SPICE. To start, we will use all the default parameters.

 

We must perform this extraction on several BCDs. Therefore, we can choose to run SPICE multiple times, or we can use the batch mode option in SPICE to run several input BCDs through the same extraction process all at once. Below, we outline the steps for both approaches.

11.2.1    Running SPICE on several BCDs, one at a time:

1. Start SPICE.

 

2. "File"-->"Open SPICE Generic Template"-->"Point Source with Regular Extract"-->"OK"

 

3. For the input Image File, select the first of the BCDs, SPITZER_S3_20072448_0012_0000_4_bcd.fits. SPICE will automatically select the correct mask and uncertainty files.

 

4. Choose your output directory, e.g. first_pass_output.

 

5. Run Spice. Simply click on the green button near the top.

 

6. Rewind the SPICE flow to the beginning by scrolling up to the beginning of the flow and clicking on the left-pointing arrow. It should look like this:

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_spicerewind.gif

7. Repeat steps 3 (substituting names), 5, and 6 for the remaining spectra. Your extracted spectra will be written out as:

/darksettle/r20072448/ch3/bcd/first_pass_output/SPITZER_S3_20072448_0012_000*_4_bcd.spect.tbl.

11.2.2    Running SPICE on several BCDs, using batch mode:

1. Start SPICE.

 

2. "File"-->"Open Batch SPICE Generic Template"-->"Point Source - Regular Extract - Hi Res Option"-->"OK".

 

3. Set "Current Output Directory" to first_pass_output.

 

4. Make your batch input list. This can be done in two ways:

 

  1. Choosing and Clicking. Set "Image File" to SPITZER_S3_20072448_0012_0000_4_bcd.fits. SPICE will automatically find the corresponding entries for "Mask File" and "Uncertainty File". Click on "Add to List", and watch these three files appear in the "Batch List" inset. Repeat this step for the remaining BCD files.

 

  1. Uploading a file. Create a file that contains all the input BCD, mask file, and uncertainty files. Each triplet should occupy a single line of the file. In each line, the BCD file should appear first, followed by the mask file and the uncertainty file, respectively. These files should be separated by commas.

 

5. Once all of your input files appear in the "Batch List" inset, click on the green arrow at the top of the SPICE window to run your batch flow. The extracted spectra will have the same filenames as they would if you ran the BCDs through SPICE one at a time, but they will appear in numerical subdirectories ('1', '2', '3', etc.) of your chosen output directory.

11.3            Time-Dependent Darks: Recognizing the Problem

In the last section we demonstrated how to extract 1D spectra from your 2D BCDs. Below we show the spectra corresponding to the 1st and the 4th DCEs:

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_recognize.gif

 

You can see that the first DCE has scalloped orders, which look like the letter "U". The scalloping subsides with each DCE, and one can see that they are significantly diminished by the 4th DCE. Note that the large spikes are due to bad pixels that could be removed with the software package IRSCLEAN. However, for the purposes of this demonstration, we are more interested in the correcting the continua of the spectra in each order.

 

The image below zooms in on orders 11 and 12 of the 1st DCE above. The "U"-shaped orders are very clear.

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_recognize_zoom.gif

 

Scalloping like this can be due to a time-dependent dark current (see the IRS Instrument Handbook). Excess flux is not distributed evenly across the array, causing the scalloping. Below we show the 2D spectra of the first DCE and the fourth DCE. It is easy to see how non-uniform the background is in the first DCE, compared to that in the fourth DCE.

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_first.jpghttp://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_fourth.jpg

Left is the first DCE and the right image is the fouth DCE.

 

11.4            Mitigation: Running dark_settle

The dark_settle software operates on a set of IRS BCD and calibration images (cal) from a particular AOR. First, the software uses the cal files to undo the flatfield correction that has been applied to the BCD data by the SSC IRS pipeline. This is because the unilluminated interorder regions, from which the dark_settle correction is derived, have not been flatfielded, so the correction needs to be applied to the un-flatfielded data. Next, the correction is applied: For a given row of a given BCD, dark_settle computes an interorder mean, smoothed along the column. It then subtracts this mean from all the data in the row. In this way, the interorder region for each row is set to zero. The algorithm is based on the assumption that, in the absence of settling, each BCD would have an interorder flux of zero. Finally, the flatfied correction is re-applied.

 

For more documentation on dark_settle, see the header at the top of the file dark_settle.pro. You can see this header by typing dark_settle, /help at the IDL prompt.

 

To run dark_settle, you need to make a list of BCD files in your AOR. This list can be in any order. For the purposes of this example, we will call this list r20072448/ch3/bcd/bcdlist.txt. It should look like this:

SPITZER_S3_20072448_0012_0000_4_bcd.fits

SPITZER_S3_20072448_0012_0001_4_bcd.fits

SPITZER_S3_20072448_0012_0002_4_bcd.fits

SPITZER_S3_20072448_0012_0003_4_bcd.fits

SPITZER_S3_20072448_0013_0000_4_bcd.fits

SPITZER_S3_20072448_0013_0001_4_bcd.fits

SPITZER_S3_20072448_0013_0002_4_bcd.fits

SPITZER_S3_20072448_0013_0003_4_bcd.fits

 

Note that unless you wish to run dark_settle from the bcd directory, you must include the full path in bcdlist.txt.

IDL> dark_settle

 

A window will pop up directing you to select a set of images or list files to process. Select the list you made before (r20072448/ch3/bcd/bcdlist.txt). For additional input options, such as using unix-style wildcards, please see the documentation in the dark_settle.pro file header, which you can also access by typing dark_settle, /help at the IDL prompt.

 

The following window will pop up:

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_window2.gif

The yellow line represents the first DCE (0) and the blue line represents the last DCE (7). In the first panel, we can see that the dark signal depends strongly on the row number, consistent with what we see in the 2D spectrum above. The second panel shows the correction required to remove this variation, while the third panel shows the corrected dark signal.

 

You are finished running dark_settle, and can dismiss the window at your leisure.

11.5            The outputs of dark_settle

The corrected file names will have the string "dks" appended to the front of the file type. If the file is

[...]_bcd.fits

 

the corrected version will be

 

[...]_dks_bcd.fits.

 

In our example, the outputs are:

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0012_0000_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0012_0001_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0012_0002_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0012_0003_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0013_0000_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0013_0001_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0013_0002_4_dks_bcd.fits

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0013_0003_4_dks_bcd.fits

11.6            Is our problem solved?

Now we must test whether dark_settle mitigated our problem. First, let's compare the uncorrected and corrected 2D spectra for the first DCE (the one with the largest correction).

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_first.jpghttp://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_corrected_first_DCE.jpg

Left is the uncorrected first DCE and to the right is the corrected first DCE. The corrected DCE clearly has a more uniform background.

 

We can also use SPICE to do a simple point-source extraction, as before. Ideally, one would first perform background subtraction on the dks_bcd files, as well as use IRSCLEAN to remove rogue pixels in the background-subtracted dks data. However, for this example, we wish to illustrate the effect of running dark_settle alone. Therefore, we use SPICE to extract 1D spectra from the dks files directly. In the following plot, we show the uncorrected spectrum from the 1st DCE in the top panel (same as the top panel in the first figure in Section 8.3) and the corrected spectrum in the bottom panel. You can see that the scalloping is significantly reduced in the bottom panel. Based on the previous figure, and on the next figure, dark_settle has successfully mitigated our problem with time-dependent dark current.

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/darksettle_results.gif

 

 

A table file for the 1D spectrum can be found here: http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/SPITZER_S3_20072448_0012_0000_4_dks_bcd.spect.tbl.