Spitzer Documentation & Tools
Spitzer Data Analysis Cookbook

 

Recipe 21. MOPEX: Mosaic of MIPS data for HII 173

In this recipe, we will use MOPEX to create a mosaic of the MIPS small-field 24 microns photometry observation of the Pleiades star HII 173. An APEX source extraction recipe follows that uses the same dataset.

21.1            Requirements

21.1.1    You will need to use this namelist:

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

21.2            Step-by-Step Guide

1.      The online (=automatically produced) 24 microns mosaics are very good, often good enough to start analyzing right away, depending on your science. For an initial look at your data, use ds9 or your favorite image viewer to examine the on-line mosaics that came with your data.

unix% cd /where/you/unpacked_data/r5315584/ch1/pbcd/

unix% ds9 SPITZER_M1_5315584_0000_1_E429953_msaic.fits &

 

Note that there are two mosaics in this directory. The first is the one where the 24 microns array is "prime", and the other is where it is not, e.g., the ancillary data. Those non-prime data are not what we are interested in here. There are lots of sources here!

2.      Set up things to run, part 1.

Personally, I like to have just one copy of the cal/ directory into which I can put the latest pmasks and the PRF I want to start from (check the SSC web site for the latest versions of these files: http://irsa.ipac.caltech.edu/data/SPITZER/docs/mips/calibrationfiles/). Also copy the cdf namelist files for this example into a cdf/ subdirectory.

unix% cd r5315584/ch1/bcd/

unix% ln -s /where/you/unpacked_data/cal ./cal

unix% mkdir cdf

unix% mv /where/you/downloaded/mosaic_24um.nl ./cdf/

 

3.      Set up things to run, part 2.

unix% cd r5315584/ch1/bcd/

unix% ls *bcd.fits > InputImageList.txt

unix% ls *bbmsk.fits > DmaskList.txt

unix% ls *bunc.fits > SigmaList.txt

unix% nedit InputImageList.txt DmaskList.txt SigmaList.txt

unix% wc *.txt

unix% nedit cdf/mosaic_24um.nl

       

The *.txt files are needed as input to the mosaic.pl script. These lists will contain all of the bcds, masks, and uncertainty files.

 

You don't want to list every single file here, because (i) there are serendipitous data (e.g., data obtained using the 24 microns array when the spacecraft and scan mirror motions are optimized for the 70 and 160 microns arrays), and (ii) the first frame effect means that you want to drop the DCENUM=0 frames. (Note: if you really want to keep the first frames, those data can be corrected and included, but we have plenty of data, so we have the luxury of simply dropping them. See the MIPS Instrument Handbook for more details on this.) Delete the files from the lists starting with the following roots to remove the first frames:

    SPITZER_M1_5315584_0000_0000_1_*
    SPITZER_M1_5315584_0001_0000_1_*
    SPITZER_M1_5315584_0002_0000_1_*

       To figure out which files are serendipitous data, the easiest way to do this is to look in the header for the keyword PRIMEARR. You can examine each header separately, but this is how I do it in a more automated fashion. I use the tool "imhead" (available from the unix command line), which is part of the WCS tools package (http://tdc-www.harvard.edu/software/wcstools/index.html). Type "which imhead" at the unix command line to see if you have that package installed (if it says "command not found," you don't have it) and go install it if necessary.

unix% which imhead

/SciApps/bin/imhead

unix% imhead *bcd.fits | grep PRIMEARR > aaa

unix% ls *bcd.fits > bbb

unix% paste aaa bbb > ccc

 

The file "ccc" then has a listing of the PRIMEARR keyword for each file followed by the corresponding filename. In this fashion, you can figure out which files are prime and which are not. For this set, the files starting with the following roots are the serendipitous data. Edit the *.txt files correspondingly to remove them:

   SPITZER_M1_5315584_0003_*
   SPITZER_M1_5315584_0004_*
   SPITZER_M1_5315584_0005_*

     Then check the length of each file ("wc *.txt") to be sure that you deleted the same number of files from each list. The "wc" step counts the number of lines, words, and characters in the files; the total number of lines should be the same in each of the *.txt files. If they're not, fix it so that they are...

Finally, edit the namelist to reflect where your cal files are located -- be sure to use the right pathnames!

 

4.      Make the mosaic!

unix% mosaic.pl -n mosaic_24um.nl

 OR

unix% mkdir pbcd24

unix% mosaic.pl -n mosaic_24um.nl > pbcd24/mosaic.log

 

Note that the namelist is assumed to be in the cdf/ subdir, not in your current directory. If  desired, redirect the output to a log file for your records. (actual mosaic log file:  http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/mosaic24.log)

 

        Common errors:

  • "mosaic.pl: Command not found." means you have not sourced the csh when setting up the mopex package in your current shell (window).

 

  • other "files not found" -- make sure you set all the paths correctly in the namelist, and that you're sitting in the correct directory when you call mosaic.pl.

 

5.      Check the mosaic.

unix% ds9 pbcd24/Combine/mosaic.fits &

 

Check the mosaic for anything that looks 'odd.' It should look pretty much like the online mosaic (which came with your data, in the pbcd directory). See figure below and FITS file http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/my24mosaic.fits.

      

Common errors:

  • If you didn't remove all of the ancillary data, you'll wind up with what looks like two separate mosaic pieces in the same FITS file. Go back and be sure you removed all the ancillary data.
  • If you didn't remove the first frames, you'll get sharp gradients across the frame; see the MIPS Instrument Handbook. A slow gradient across is fine, and may even be real zodiacal light variations.