This example demonstrates how to use the command-line version of MOPEX to make a mosaic of a portion of the Galactic First Look Survey. It focusses on IRAC channels 1 and 2.

Here we use AOR 4958976, one of several which together comprise the galactic First Look Survey (FLS). AOR 4958976 contains data taken in IRAC's high dynamic range (HDR) mode. This means the even (odd) numbered images have exposure times of 0.4 (10.4) seconds i.e. nominal 0.6 (12) seconds. We illustrate how to make a ch1 [3.6 micron] 10.4s mosaic. See also this example of how to make the corresponding ch3 [5.8 micron] 10.4s mosaic. The examples are very similar but the overlap correction (a constant offset to compensate for the varying bias level) is more dramatic for ch3.


Requirements:

You must have both LEOPARD and MOPEX installed in order to follow along with this cookbook.

LEOPARD can be downloaded here.

MOPEX can be downloaded here

You will need to use these namelists:

A namelist file contains a list of modules and parameters expected by MOPEX. The modules may be set either to 0 or to 1. If set to 0, they are ignored and no operation is performed.


Outline:

  1. Download the example data set
  2. Have a quick look at the data
  3. Set up lists of filenames and namelist files in preparation to remosaic data
  4. Remosaic data

I. Download the example data set:

[forward to "II. Have a quick look at the data"]
[forward to "III. Set up lists of filenames and namelist files in preparation to remosaic data"]
[forward to "IV. Remosaic data"]

Download AOR 4958976 using the AORID option under "File" from the LEOPARD main menu.

Select IRAC channel 1 (or all four IRAC channels if you prefer).

Choose BCD and PBCD data. BCD stands for "basic calibrated data", or single images which have been run through the Spitzer online pipeline, and had some rough clean-ups applied (orientation flipping, dark subtraction, flatfield correction, conversion into units of MJy/sr). PBCD stands for "post-basic calibrated data". These are generated by MOPEX, which has been run automatically on the BCDs with "best-guess" default parameters.

To download click on the yellow disk in the center at the bottom of the LEOPARD main window.

Unzip the files that LEOPARD puts on your disk. Here's a script that'll do it for you:


unix% foreach i (`ls *.zip`)
unix% foreach? unzip $i
unix% foreach? end


II. Have a quick look at the data:

[back to "I. Download the example data set"]
[forward to "III. Set up lists of filenames and namelist files in preparation to remosaic data"]
[forward to "IV. Remosaic data"]

  1. cd into the "pbcd" area of your new data.
    cd /where/you/unpacked_data/gflsirac/r4958976/ch1/pbcd/

  2. Look at the ch1 mosaics. (ds9 or any other viewer of choice, even SPOT)
    ds9 SPITZER_I1_4958976_0000_6_A10742802_maics.fits (the mosaicked 10.4s image)
    You should see this image:

  3. Repeat for ch2-4 if desired.

III. Set up lists of filenames and namelist files in preparation to remosaic data:

[back to "I. Download the example data set"]
[back to "II. Have a quick look at the data"]
[forward to "IV. Remosaic data"]

  1. In /where/you/unpacked_data/gflsirac, you will want to make directories "cal" and "cdf". (MOPEX expects certain files to be in certain places in the directory tree). Download the pmask calibration file provided by the IRAC team to your "cal" directory (Gunzip and untar the pmask file and identify the appropriate pmasks. The AOR 4958976 data was taken in 2003, so copy the march04_pmasks to your "cal" directory). Also download the above namelist files (see "Requirements") into your "cdf" directory.

  2. For simplicity we recommend copying all the bcd, bunc (uncertainty), and bdmsk (bad pixel mask) fits images to one directory. For now we'll use the top directory ie gflsirac although this is messy and clutters it up. It would probably be better to put them into eg an images directory and edit the various required list files appropriately. If you leave them where they are, some steps may overwrite them - this may or may not be a problem for you. The bcd, bunc and bdmsk images are channel and AOR dependent and sit in eg /where/you/unpacked_data/r4958976/ch1/bcd. So you'll want to type something like:

    cp /where/you/unpacked_data/r4958976/ch1/bcd/*bcd.fits .
    cp /where/you/unpacked_data/r4958976/ch1/bcd/*bunc.fits .
    cp /where/you/unpacked_data/r4958976/ch1/bcd/*bdmsk.fits .

  3. MOPEX's various namelist files require lists of images to process. We'll make these now. Separate lists of the bcd (IMAGE_STACK_FILE_NAME), bunc ie the uncertainty images (SIGMALIST_FILE_NAME), and the bdmsk ie mask images (DCE_STATUS_MASK_LIST) are required, one per line.

    Make these three files for each channel and exposure time eg ch1_10.4_bcd.lst, ch1_10.4_bunc.lst, ch1_10.4_bdmsk.lst.

    Also make a a master list containing the names of all images in the four channels or whichever subset of these you think you will want to mosaic. eg masterch1.lst

    cat masterch1.lst  masterch2.lst  masterch3.lst  masterch4.lst  >  master.lst 


    This list is used to make the fiducial image frame (FIF) - see section IV.2. Since you probably want the mosaics for the various channels to be registered to one fiducial frame of reference i.e to be aligned with each other, you need to include the names of all the BCDs for channels 1, 2, 3 & 4.


IV. Remosaic the data

[back to "I. Download the example data set"]
[back to "II. Have a quick look at the data"]
[back to "III. Set up lists of filenames and namelist files in preparation to remosaic data"]

NOTE - MOPEX expects all the nl (namelist) files to be in the cdf directory.

  1. Source the MOPEX script. In the window where you will be working, once per session, do this:

    source /your/path/here/mopex_030106/mopex.csh 

  2. Make a reference frame (fif) to include all 4 IRAC channels. You need to simply run one module, run_fiducial_image_frame, in the mosaic.pl script and make sure to include data from all 4 channels. If you run the same module in overlap.pl, only one channel will be used to create the fif and some images from an alternate channel might extend beyond the fif region and cause the mosaicker to fail.

    /path/to/your/mopex/mopex_030106/bin/mosaic.pl -n mosaic_10.4_fif.nl > & mosaic_fif.log

    Note that in this example the namelist file, cdf/mosaic_10.4_fif.nl, is set to run only the run_fiducial_image_frame module. All this step does is make a fiducial reference table, fif/FIF.tbl, based on all the bcd images which will comprise the mosaic. Note the following lines in cdf/mosaic_10.4_fif.nl - IMAGE_STACK_FILE_NAME uses the master.lst we just made, OUTPUT_DIR chooses to have the output written to a directory called "fif", and "Edge_Padding = 100" ensures that 100 arcsec of NaN-valued pixels on each edge to avoid any errors caused by projection "slop".

    IMAGE_STACK_FILE_NAME = master.lst
    OUTPUT_DIR = fif
    Edge_Padding = 100
    


    The log file is not necessary but is useful for debugging.

  3. Run the overlap corrector. The overlap corrector tries to add a constant offset to each BCD so that it will be consistent with its neighbors on either side. The goal is to ensure that real large-scale gradients in the background level are preserved.

    /path/to/your/mopex/mopex_101504/bin/overlap.pl -n overlap_10.4_ch1.nl -F fif/FIF.tbl > & overlap_10.4_ch1.log

    The main parameters in the namelist file, in this case cdf/overlap_10.4_ch1.nl that you may need to edit are: (my options are shown)

    OUTPUT_DIR = overlap_10.4_ch1
    
    IMAGE_STACK_FILE_NAME = ch1_10.4_bcd.lst
    PMASK_FILE_NAME = cal/chan1_mar04_pmask.fits
    DCE_STATUS_MASK_LIST = ch1_10.4_bdmsk.lst
    SIGMALIST_FILE_NAME = ch1_10.4_bunc.lst 


    This produces fits images in the OUTPUT_DIR specified ie overlap_10.4_ch1/Overlap_Corr/ called "correct_SPITZER_I1_4958976_0001_0000_6_bcd.fits". Copy these overlap-corrected files to your top (eg gflsirac) directory or edit the IMAGE_STACK_FILE_NAME in your mosaicking namelist file (mosaic_10.4_ch1.nl) to point to them.

  4. Run the mosaicker on the ch1 10.4s frames.

    /path/to/your/mopex/mopex_030106/bin/mosaic.pl -n mosaic_10.4_ch1.nl -F fif/FIF.tbl > & mosaic_10.4_ch1.log

    Here the namelist cdf/mosaic_10.4_ch1.nl uses an IMAGE_STACK_FILE_NAME called ch1_10.4_bcd_corr.lst. You can make this quickly by typing eg

    cp ch1_10.4_bcd.lst ch1_10.4_bcd_corr.lst 

    and prefixing the entries with "corrected"

    The main parameters in the mosaic namelist file are:

    OUTPUT_DIR = mosaic_10.4_ch1
    
    IMAGE_STACK_FILE_NAME = ch1_10.4_bcd_corr.lst
    PMASK_FILE_NAME = cal/chan1_mar04_pmask.fits
    DCE_STATUS_MASK_LIST = ch1_10.4_bdmsk.lst
    SIGMALIST_FILE_NAME = ch1_10.4_bunc.lst 
    

    The mosaic produced by MOPEX is always entitled mosaic.fits and is created in the OUTPUT_DIR specified ie gflsirac/mosaic_10.4_ch1/Combine. (Also useful is the coverage map, mosaic_cov.fits created in the same directory). Here is the image we just made:



    And the post-bcd version which was created automatically by the pipeline:

    The image we made is a little cleaner especially near the bright star. (A minor point to note is that you may notice some distortion between the online mosaicker version and the mosaics we made here - this is because we chose to create precisely square pixels for this example - using the MOSAIC_PIXEL_RATIO parameters in the namelist cdf/mosaic_10.4_ch1.nl).

    Here are the fits images if you want to grab them and view them with ds9 or any other viewer of your choice.

    mosaic_10.4_ch1.fits (example version )

    bcd_mosaic_10.4_ch1.fits (automatically generated version)


Return to the Data Analysis Cookbooks page.



SPITZER HOME || SPITZER SCIENCE || INSTRUMENTS || SCIENCE USER SUPPORT || SEARCH

help@spitzer.caltech.edu

This file was last modified on Fri Aug 29 14:15:31 PDT 2008.

California Institute of Technology Jet Propulsion Laboratory NASA