Spitzer Documentation & Tools
Spitzer Data Analysis Cookbook

 

Recipe 6.   MOPEX:  Making an IRAC Array Location Dependent Correction Mosaic

This is a recipe for making an IRAC array location dependent correction mosaic for a data mosaic made out of an IRAC dark field observation. We concentrate on the steps required to make the array correction mosaic and on how to use it on the fluxes, as the mosaicking steps are covered in Recipes 3-5 in this Cookbook, and the use of APEX is covered in other recipes.

 

Before starting it is a good idea to browse through the IRAC Instrument Handbook

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/iracinstrumenthandbook/,

 

especially Section 4.5, which discusses the array location dependent effect, and the web pages at

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/locationcolor/

 

which summarize the discussion of this effect and provide the per BCD correction files. In short, if you measure flux densities of blue sources (such as most  stars), you should apply this correction to your measured fluxes, since the IRAC flatfield calibration is based on red sources (zodiacal light). You may want to apply this correction to individual (C)BCDs, especially when performing measurements on the individual frames, e.g., with PRF fitting. However, if you are performing aperture photometry on a well-dithered mosaic, you may want to make a correction mosaic from the individual correction images, built up exactly as your science mosaic, including outlier rejection. Then you can read off the correction for your targets from this mosaic. The dark field observation used in this recipe has a coverage of up to 18 per spatial position, although it is highly non-uniform (unlike a typical science observation would be). We use this dark field observation (from AORKEY 29841152) as a demonstration.

6.1  Requirements

You need to have MOPEX (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/mopex/) installed to follow the instructions in this recipe.

 

If your data have been processed by version S18.0 or later of the IRAC pipeline, you may not need to run the artifact mitigation preprocessing, as explained in previous recipes, because corrected BCD (CBCD) data will be provided. However, it is always a good idea to look at the individual CBCD frames and see if there are any obvious remaining artifacts that could affect the data analysis down the line. In our case, although we see a couple of artifacts in a few frames, we proceed with mosaicking the CBCD frames.

6.2  Organizing Files and Directories

Before starting with this recipe, you should download the example data set using the Spitzer archive interface at

 

http://irsa.ipac.caltech.edu/applications/Spitzer/SHA/

 

The IRAC dark field AORKEY used in this recipe is 29841152. When downloading the data from the Spitzer archive, specify that you need the Level 1 data (Basic Calibrated Data; BCD). Since we are going to only demonstrate channel 1, you may just want to download channel 1 data. The BCDs are single images which have been run through the Spitzer online data reduction and calibration pipeline and the CBCDs have further gone through artifact mitigation. Create input files for the *cbcd.fits, *cbunc.fits, and *bimsk.fits files. Ignore the first taken frame (SPITZER_I1_29841152_0000_0000_4_cbcd.fits) since this was taken in the HDR mode and the exposure time is different from the rest of the frames, which were 30-second exposures. Include the rest of the CBCD file names in this list and call this file, e.g., "dark1_bcd.txt." In an analogous way, list the corresponding *cbunc.fits files in a file called, e.g., "dark1_unc.txt", and the *bimsk.fits files in a file called, e.g., "dark1_imask.txt". Each one of these three created files should list 18 file names, one per line.

 

Finally, you need to download the permanently bad pixel map (pmask):

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/pmask/.

 

We use the pmask that was valid when our observations were made, as seen in the pmask fits file header keywords STRTDATE and ENDDATE. In our case it is "sep07_ch1_bcd_pmask.fits."

6.3  Initial Setup

The first step is to specify which data you want reduced. You should edit the path to where you downloaded your data in the provided namelist file

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/dark_mosaic1.nl

 

in the following manner:

 

IMAGE_STACK_FILE_NAME = /my/data/directory/dark1_bcd.txt

SIGMALIST_FILE_NAME = /my/data/directory/dark1_unc.txt

DCE_STATUS_MASK_LIST = /my/data/directory/dark1_imask.txt

PMASK_FILE_NAME = /my/data/directory/sep07_ch1_bcd_pmask.fits

ARRAY_CORR_IMAGE = /my/data/directory/ch1_photcorr_rj.fits

ARRAY_PIXAREA_IMAGE = /my/data/directory/ch1relpixarea.fits

OUTPUT_DIR = /my/data/directory/output_dark1

 

Replace /my/data/directory/ with your local directory path where the files are located. For “Array Correction Frame” the correct file in ch 1 is “ch1_photcorr_rj.fits” for the cryogenic mission, as is the case for the data used in this example, and “ch1_photcorr_ap_5.fits” for warm mission data.

 

You may edit the supplied namelist file first, and then read it into MOPEX GUI by clicking "File->Read Name List...". Or you may just read the namelist file into the MOPEX GUI and then edit the input files. Do this by clicking "Add..." under "Image Stack File" and specifying the path to the file containing the list of IRAC Channel 1 CBCD image files that you created earlier ("dark1_bcd.txt"). Then click "Add..." under  "Output Directory" and specify where the intermediate and final data products  should be saved, e.g., "output_dark1." Next, click "Optional Input & Mask Files, and then click "Add..." under "Sigma List File" and specify the list of cbunc files created earlier ("dark1_unc.txt"). Then click "Add..." under "DCE Status Mask List" and specify the list of bad pixel map files created earlier ("dark1_imask.txt").

 

Specify the Fatal Mask Bit Pattern (32520 is recommended as of March 2010, it uses bits 3, 8-14 of the imasks). Specify Rmask fatal bit pattern (15, we use all the outlier rejection methods for demonstration purposes in this recipe, but you may be OK by using just one or two of them for your data, as discussed in other recipes in this Cookbook). Specify also the Fatal Mask Bit Pattern for pmask, which is 32767, so using all the bits. The FIF file does not need to be specified. Once you are finished specifying the input parameters click "OK" to return to the pipeline view.

 

 

Initial mosaic settings.

6.4  Channel 1 Mosaicking Settings

The "Mosaic Settings" dialog box sets several global parameters related to image combination and temporary files. First, the pixel size is set, to make mosaics with 0.6 arcsec x 0.6 arcsec pixels (which is now the default for IRAC pipeline mosaics as well).

 

Next you need to set the array location correction images and pixel area images for channel 1. The array location dependent photometric correction image corrects the photometry for the fact that the flat-fielding was made with the help of a red source (zodiacal light) and is thus not correct for blue sources, such as most stars. The pixel area images are simply images of the pixel solid angles relative to the center pixel, which are used for image distortion correction (or its canceling, as the case is here). Download these from

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/locationcolor/

 

and

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/solidangles/

 

Specify the channel 1 images (for "Array Correction Frame" the correct file is "ch1_photcorr_rj.fits" and for "PixArea Frame" it is "ch1relpixarea.fits"). Because the correction images already take IRAC image distortion into account, MOPEX will need to divide the array correction images by the Pixel Solid Angle images, because MOPEX corrects for the image distortion. Otherwise the image distortion would be corrected twice.

 

You may leave the rest of the options unselected in the "Mosaic Settings" dialog and just click "OK".

 

 

Mosaic Settings dialog.

6.5  Mosaicking

The various modules for mosaicking have been discussed in other recipes in this Cookbook, specifically recipes 4, 5, and 6. Here we just use the template values in the MOPEX GUI for them.

6.6  Array Location Correction in MOPEX

To make the array location correction images, you need to add two modules to the end of the mosaicking pipeline, "Make Array Correction Files" and "Make Array Correction Mosaic". If you use the provided namelist, they are already added. If you are creating your own namelist in GUI, you  can click on the


mosaic module list that is displayed in a separate window (to the right of the module flow depiction). Just click on the "Make Array Correction Files" and "Make Array Correction Mosaic" to add them into the flow. There are no parameters to be specified for these two modules (but make sure you specified the input array correction frame file and the pixel solid angle image, as discussed above).

 

Mosaic module list window from which new modules can be inserted into the processing flow.

 

6.7  Making the Array Location Correction Mosaic

Now when you press the green "play" button at the top of MOPEX GUI, it will create both the science image mosaic and the array location correction mosaic for you. Both will be placed under the output directory in a subdirectory called "Combine-mosaic". The name of the science mosaic is "mosaic.fits" and the name of the array location correction mosaic is "mosaic_arraycorr.fits". Images are shown below.

 

 

Science mosaic for the darkfield observation.

 

 

Array location dependent correction image mosaic for the dark field.

6.8  Performing Photometry on the Bright Point Sources

We use APEX to perform photometry on some of the brightest point sources in the created science mosaic "mosaic.fits". We use the template file for performing user list single file frame aperture photometry in MOPEX GUI, and edit this file slightly. See the

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/dark_apex1.nl

 

namelist. You can load this namelist into MOPEX GUI by selecting “File->Read Name List…” and then selecting “Apex User List single frame.” Edit the input file paths and names. The INPUT_FILE_NAME should be the mosaic created above ("mosaic.fits"), the SIGMAFILE should be the mosaic uncertainty image, to be found in the subdirectory "Combine-mosaic" ("mosaic_unc.fits") and the COVERAGE_MAP should be in the same subdirectory ("mosaic_cov.fits"). The INPUT_USER_LIST specifies the positions of the centroids of the

bright stars, and you can use the supplied file

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/dark1_star_list.txt

 

 or create one for yourself by measuring the centers of star positions with your favorite software (remember that APEX uses the convention where the center of the lower left pixel is 1.0, 1.0). Convert the pixel coordinates into RA and Dec coordinates using the header information in the mosaic (CRVAL,CRPIX, CD matrix values).

 

Please check the settings under the Aperture Photometry (or under &APERTURE in the provided "dark_apex1.nl" file) parameters as well, as we use the 10.0 pixel radius and the 12.0 - 20.0 pixel background annulus, the same as those that are used for IRAC calibration stars, so no aperture correction is needed. We only use this one radius setting, so N_Apertures = 1. These are set in the given namelist "dark_apex1.nl", but if you are building your own namelist, you will need to change these values by hand. After all these are set, you should be able to run APEX by pressing the green "Go" button on the top pane of MOPEX GUI. The results will be in the specified output directory (in the case of the template, "output_apex", in the file named "dark1_mosaic_aperture.tbl", if we used "dark1_mosaic.fits" as the name of the input mosaic file, otherwise the resulting file will be called the “name_of_your_input_mosaic file_aperture.tbl"). At the bottom of this file are the aperture measurements. The columns are the source id, x and y coordinates in pixels, aperture flux density in micro-Jy, bad pixel number (if any), uncertainty for aperture flux density, and background/pixel estimate that was subtracted, and the RA and Dec decimal coordinates).

 

 

Aperture photometry settings window in MOPEX GUI.

6.9  Correcting Flux Densities with the Array Location Correction Mosaic

Now the corrections for flux densities can be looked up in the array location correction mosaic at the coordinates of the sources mentioned in the *aperture.tbl file. Display the correction mosaic fits file, and place the cursor on the coordinates of the source mentioned in the *aperture.tbl file, and read off the pixel value at that location. Then multiply the source flux by this value. For this recipe, we get the following corrections:

 

X-coord

Y-coord

Original Flux

(mJy)

Correction

Corrected Flux

(mJy)

522.05

506.83

1.8767

0.999475

1.8757

545.12

639.61

1.9935

1.00141

1.9963

526.55

774.00

1.0234

0.997992

1.0214

633.37

870.34

1.6323

0.995319

1.6247

167.46

481.66

3.3302

0.985843

3.2831

885.00

358.66

1.7004

1.00293

1.7054

782.90

170.20

1.4806

0.997420

1.4768

 

 

Remember that for your science targets, you may need to apply other corrections, such as the color correction (IRAC Instrument Handbook 4.4), or aperture corrections if you are not using the IRAC calibration star aperture and background annulus.