Spitzer Documentation & Tools
Spitzer Data Analysis Cookbook


Recipe 23.            MOPEX: PRF Estimation and Point-Source Extraction

This recipe demonstrates how to select point sources for Point Response Function (PRF) estimation, run the PRF estimate tool, and then use the real PRF for point source extraction. Special care is taken in removing Airy rings of bright point sources, as they create false detections. The final products are a table of point source fluxes and a point source subtracted mosaic image. This recipe starts where Recipe 21 ends after making the science quality mosaic of a z=0.7 galaxy cluster using MOPEX.

23.1            Requirements

You will need to download MOPEX (http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/mopex) in order to access the following scripts:

  • prf_estimate.pl
  • apex_1frame.pl
  • apex_qa.pl

You will need to use these namelists:

You will need the 24 microns data from AOR 13810432 as in the recipe in Recipe 21.

23.2            Step-by-Step Guide

1.      Extract sources from the mosaic image that will be used to estimate the PRF:

unix% apex_1frame.pl -n apex_1frame_step1.nl


Use the PSP image to detect (set use_psp_to_detect = 1) and set the detection threshold to a large value to only include high SNR point sources (Detection_Threshold = 20). Use the MIPS 24 microns PRF found in the cal/ directory of the MOPEX package.


The table of extracted sources is apex_1frame_step1/mosaic_extract.tbl.


2.      Select the brightest point sources with the best fit:

unix% cd apex_1frame_step1

unix% select col all from mosaic_extract.tbl for "deblend = N and chi2/dof < 30 and flux > 5000" into mosaic_extract_clean.tbl with header

The new table of extracted sources is mosaic_extract_clean.tbl.

3.      Visualize which sources you will use for PRF estimate with your favorite image viewer.

If using skyview, you can do:

unix% cd ..

unix% skyview

> pa data/main/mosaic.fits

> table apex_1frame_step1/mosaic_extract_clean.tbl mark $RA $Dec circle red 1


4.      Run PRF estimate. Use the input point source list mosaic_extract_clean.tbl:

unix% prf_estimate.pl -n prf_estimate.nl

Set the size of the PRF postage stamp image (PostStamp_Xsize = 35, PostStamp_Ysize = 35) and the sampling factor (PRF_ResampleX_Factor = 4, PRF_ResampleY_Factor = 4). If the PRF fluctuates a lot at the edge of the postage stamp image, set a region around the edge to zero (for an edge measuring 5 original pixels, set Zero_Edge = 5).


5.      Copy the new PRF image to the cal directory:

unix% cp prf_estimate/PRF.fits cal/PRF_estimate.fits

6.      Remove the first (and brightest) Airy ring. The Airy rings of the bright point sources create false detections.

unix% apex_1frame.pl -n apex_1frame_noring.nl

Use the PSP image to detect (set use_psp_to_detect = 1) and set the detection threshold to a large value to only include bright sources (Detection_Threshold = 20). Use the new PRF image. Set the detection threshold type to 'combo' (Threshold_Type = 'combo').


7.      Create a ring-subtracted image:

unix% apex_qa.pl -n apex_qa_noring.nl

Do not subtract the circular region of the PSF within the first minimum (HoleRadius = 21). This means that only the first Airy ring and beyond will be subtracted from the image. Set the radius for PRF subtraction (Radius = 44).


8.      Run detect on the ringless image to create a list of sources:

unix% apex_1frame.pl -n apex_1frame_step2a.nl

Run the modules run_medfilter, run_gaussnoise, run_pointsourceprob, and run_detect (set them all = 1). Do not run the run_sourcestimate module at this point (set run_sourcestimate = 0). Use the PSP image to detect (set use_psp_to_detect = 1) and set the detection threshold to a low value (Detection_Threshold = 5).

9.      Copy files to correct names for flux estimation (next step).

unix% cd apex_1frame_step2

unix% cp residual_mosaic_detect.tbl mosaic_detect.tbl

unix% cp residual_mosaic_minus_median.fits mosaic_minus_median.fits

unix% cp residual_mosaic_noise.fits mosaic_noise.fits

unix% cp residual_mosaic_PSP.fits mosaic_PSP.fits

Because we detected sources on the ringless image (residual_mosaic.fits), the output file names from step 7 have the root residual_mosaic_. However, we wish to measure the source fluxes on the original image (mosaic.fits). If we use an input mosaic called mosaic.fits, the extraction software will look for detection lists like mosaic_detect.tbl. Since we want the extraction software to use files like residual_mosaic_detect.tbl, we had to change some file names to trick APEX.


10.  Run flux estimation using the original image:

unix% cd ..

unix% apex_1frame.pl -n apex_1frame_step2b.nl

Use the new PRF image for flux estimation. Select the fitting area (Fitting_Area_X = 9, Fitting_Area_Y = 9) and the active deblending parameters (Max_Number_PS = 3, Chi_Threshold = 10). Set the normalization radius for aperture correction (Normalization_Radius = 44).


11.  Produce point source subtracted image to gauge how well the detection/extraction went:

unix% apex_qa.pl -n apex_qa.nl

12.  Apply aperture correction