Spitzer Documentation & Tools
Spitzer Data Analysis Cookbook

 

Recipe 24.             MOPEX: MIPS 24 micron data from MIPSGAL

MIPSGAL (http://mipsgal.ipac.caltech.edu) is a survey of the inner 248 square degrees of the Galactic plane at 24 and 70 microns using the MIPS instrument aboard the Spitzer Space Telescope. The survey covers Galactic latitudes of -1 < b < +1 for Galactic longitudes of l < 62 and l > 298. In this recipe, we go through the steps required to extract photometry from a single MIPSGAL mosaic of size 1 degree on a side. We start with a mosaic that has been cleaned of artifacts such as jailbars (see the MIPS Instrument Handbook). We then outline the steps necessary to perform aperture photometry on the MIPS 24 microns MIPSGAL data, which is characterized by a complicated Galactic background.

24.1            Requirements

You must have MOPEX installed (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/mopex/).

 

You will need approximately 900Mb to go through this entire example, keeping all intermediate data products. To follow along with this demo, you should download this gzipped tar file: http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/cookbook/files/mipsgal24_cookbook_data.tar.gz The tarfile will unpack into a new directory called mipsgal24_cookbook_data/. Unless otherwise stated, you should issue all command-line arguments from this directory.

 

This tarfile includes:

 

1. mosaic.fits - The artifact-corrected MIPSGAL mosaic you will start with.

2. cal/prf.fits - The PRF that goes with mosaic.fits.

3. cal/prf_bgsub.fits - The filtered (background-subtracted) PRF

4. cdf/apex_bri.nl - The APEX namelist to detect and extract photometry for bright sources in the MIPSGAL mosaic

5. cdf/apex_qa_ringless.nl - The APEX_QA namelist to subtract 1st and 2nd Airy rings from around bright point sources found in the MIPSGAL mosaic.

6. cdf/fit_radius.nl - The APEX namelist to determine the radius around each source over which to fit the PRF during point-source detection.

7. cdf/apex_det_fai.nl - The APEX namelist to detect faint sources in the Airy-ring-subtracted MIPSGAL mosaic.

8. cdf/apex_ext.nl - The APEX namelist to extract photometry for sources that were previously detected in the MIPSGAL mosaic.

24.2            Examine the MIPSGAL mosaic.

Below is an example of a typical MIPSGAL field, after it has been corrected for artifacts such as jailbars. A FITS version (mosaic.fits) of this field is provided to you in the data tarball for this recipe.

MIPSGAL surveys low galactic latitude fields characterized by high source densities. The strong interstellar dust emission along these lines of sight leads to spatially varying backgrounds, as seen below. These complicated backgrounds represent the primary challenge for extracting accurate photometry in these fields.

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/mipsgal_startingimage.jpg

24.3            Derive the PRF.

In order to detect sources in a field with a complicated background, accurate knowledge of the Point Response Function (PRF; http://irsa.ipac.caltech.edu/data/SPITZER/docs/mips/calibrationfiles/) is critical. The better you know the shape of the sources you are interested in, the easier it is to differentiate them from the background. However, the presence of a complicated background can make measuring an accurate PRF from the data itself difficult. In particular, a spatially varying background can make the wings of the PRF difficult to estimate.

 

One solution is to measure the bright cores from the data, and join these to a theoretical shape for the wings. Using this method, we have created a PRF that is suitable for the MIPSGAL mosaic above. It is provided in the data tarball for this recipe. It is called cal/prf.fits. With a log stretch, it looks like this:

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/combined_mips24_45_prf_n.jpg

 

Note that the PRF was created from the above mosaic, but resampled by a factor of 4 in x and y. As a result, the PRF has a pixel scale of 0.3125 arcsec/pixel, while the mosaic above has a pixel scale of 1.25 arcsec/pixel.

24.4            Subtract the background from the PRF.

Because the background is very complicated, it can be difficult to subtract. The main issue is the size scale on which the background should be subtracted. A constant background is clearly not indicated by visual inspection of the MIPSGAL mosaic, since the background clearly contains a fair amount of structure. However, fitting a background over very small scales (on the order of the size of the sources), can result in subtracting some of the source flux.

 

After experimenting with the data, we found that the best results are achieved when the background is computed by taking a median filter of the image with an 11 pixel by 11 pixel filter, and this is reflected in all of the namelists included in this recipe. This is a rather small filter size, so we expect that some source flux will be subtracted. In a later step, we will add this source flux back in.

 

To properly extract sources from the background-subtracted mosaic, we need to use a background-subtracted PRF. We have provided the background-subtracted PRF in the data tarball for this recipe. It is called cal/prf_bgsub.fits.

 

If you would like to reproduce this result, keep in mind that the PRF is oversampled relative to the MIPSGAL mosaic.

24.5            Detect and extract bright sources in the background-subtracted mosaic.

We perform object detection and extraction in two steps: First we search for bright sources and remove them from the image. During a second pass, we search for fainter sources. The reason is that bright sources are often surrounded by Airy rings. If not removed, these Airy rings are often detected as separate, faint objects.

 

In this step, we describe how to carry out the first step of this two-stage process. This is done with MOPEX and the following namelist:

 

cdf/apex_bri.nl

 

First, edit the above namelist to reflect the paths on your system.

 

Now, create an output directory: bright_sources/

 

After starting up the MOPEX GUI, you can load this namelist by clicking on File-->Read Name List. Then choose 'APEX single frame'. Finally, click on the green arrow on the top of the screen to run the namelist.

 

The primary outputs from this are:

 

bright_sources/mosaic_detect.tbl - list of detections

bright_sources/mosaic_extract.tbl - list of extractions

bright_sources/mosaic_minus_median_extract.fits - background-subtracted image upon which extraction was performed.

 

In MacOSX (Tiger), the above namelist may fail on select. To execute this module on the command line, type:

cd bright_sources

 

csh

 

source /Applications/mopex/mopex-script-env.csh (substitute the path to your MOPEX installation directory)

 

select with complete_header from mosaic_extract_raw.tbl into mosaic_extract.tbl col "srcid,detid,RA,Dec,x,y,flux,delta_flux,SNR,chi2/dof,aperture1,

aperture2,aperture3,aperture4,FitX,FitY"

 

cd ..

 

Both the detection and extraction tables may contain multiple detections of what is just a single true source. This can result if you set Detection_Threshold too low. In that case, the Airy rings around bright point sources will be detected as faint objects. Duplicates can also result from the shredding of soft saturated sources.

 

You will have to decide, based on your science goals, which sources qualify as duplications. MOPEX will not do this, so you will have to remove any potential duplicates from the above lists by hand, or with a simple piece of external code.

24.6            Remove Airy rings around bright sources in the background-subtracted mosaic.

Here we describe how to remove the Airy rings from around bright sources. This will prevent these rings from being detected as faint sources in the next step.

 

In the MOPEX GUI, simply read in the namelist apex_qa_ringless.nl, which is an APEX QA single-frame flow, and run as before.

 

The results are shown below. In the left image, we zoom in on a bright source in the MIPSGAL mosaic (mosaic.fits.) The Airy ring is prominent.

 

On the right, we show the same source with the Airy ring subtracted (apex_qa_noring/Mosaic/residual_mosaic.fits). The colorbars and scales are matched in both images. The Airy ring has been subtracted.

 

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

24.7            Detect faint sources in the background-subtracted, Airy-ring-subtracted mosaic.

Now that the Airy rings around bright sources have been removed, we can safely use MOPEX to detect faint sources.

 

To do this, we will use MOPEX and the following namelist:

 

apex_det_fai.nl

 

This namelist differs from the one you used to detect and extract bright sources (apex_bri.nl) in two ways:

  1. We are only trying to detect sources in this step, whereas the previous namelist included modules to both detect AND extract sources.
  2. The value of Detection_Threshold is much lower, since we are interested in finding faint sources now. Previously we were just looking for the brightest sources so we could subtract obvious Airy rings.

First edit apex_det_fai.nl so that the paths are appropriate for your system.

 

Now create an output directory called detect_faint_sources/. This is where the output from this run of MOPEX will go.

 

Now start the MOPEX GUI and load the namelist using the same procedure as before. MOPEX will ask you what type of flow this namelist contains. Click on APEX single frame.

 

The list of faint sources detected in this step can be found in detect_faint_sources/residual_mosaic_detect.tbl.

24.8            Extract photometry from the background-subtracted mosaic.

Now you should have a list of bright and faint sources in the image. First, you will have to concatenate these detection lists and remove any duplicates. Then you can use MOPEX to extract the resulting list of sources from the background-subtracted image. Unfortunately, the MOPEX GUI cannot be used to accomplish this task. Instead, we will use the command-line version of MOPEX. For the purposes of this example, we will just extract the faint detection list.

 

Make a directory called extract_sources/. This namelist includes only extraction modules. This is because we will use the detection lists we created in the last step.

 

To do this,

cp detect_faint_sources/residual_mosaic_detect.tbl extract_sources/mosaic_detect.tbl

 

cp detect_faint_sources/residual_mosaic_minus_median_detect.fits extract_sources/mosaic_minus_median_detect.fits

 

cp bright_sources/mosaic_minus_median_extract.fits extract_sources/mosaic_minus_median_extract.fits

 

csh

 

source /Applications/mopex/mopex-script-env.csh

(substitute the path to your MOPEX installation directory)

cd extract_sources

 

select with complete_header from mosaic_detect.tbl into mosaic_detect_sel.tbl for "blend_size < 10" col "srcid,x,y,flux,blendid,blend_size"

 

cp mosaic_detect_sel.tbl mosaic_detect.tbl

 

cd ..

 

apex_1frame.pl -n fit_radius.nl

 

This step appends two columns to extract_sources/mosaic_detect.tbl: FitX and FitY. However, the headers for these two columns are in the wrong position. Make sure that there are 15 spaces between each pipe (|) before running the next step, or you will encounter an error in source estimate.

apex_1frame.pl -n apex_ext.nl

The primary output of this is extract_sources/mosaic_extract.tbl.

24.9            Apply scaling to photometry to correct for aggressive background subtraction

We now have flux densities computed using background-subtracted PRFs on our background-subtracted images. Because we used a relatively small background filtering scale, this photometry represents an underestimate of the real flux in each source. In order to account for this lost flux, we can calculate what fraction of the light within the PRF is lost during the filtering procedure.

 

MIPS routinely observes calibration stars. The 24 microns flux densities for these sources are well known, so they can be used to determine how much light is lost from a point source by using a background-subtracted PRF. The MIPSGAL team has run through the entire procedure above using these calibration numbers as input, and they have determined that the photometry needs to be scaled by a factor of 1.46.

 

For information on how to retrieve calibration observations to perform an analogous calculation for your own observations, please see the MIPS Instrument Handbook.

24.10       Quality Control

Finally, we must assess how well the above procedure has extracted the sources in our image. For this purpose, we can use apex_qa.pl. We used this module above in order to subtract Airy rings from around bright sources. It can also be used to subtract entire sources from our mosaic. We can then analyze the residuals to see if any of our detection, extraction, or duplicate removal procedures need to be revised. Below we show an example of the mosaic once all of the sources with good PRF fits have been subtracted.

 

http://irsa.ipac.caltech.edu/data/SPITZER/docs/postbcd/cookbooks/images/residual_mipsgal_mosaic.jpg