Memo on creating mosaics of subarray data -- 15 May 2007
Updated: 15 Feb 2011

This memo is based on a report by Sergio Fajardo-Acosta of the Spitzer 
Science Center with edits by the IRAC instrument support team.

GENERAL INTRODUCTION:

Data in IRAC subarray mode are not processed through the online
post-BCD  pipeline. The post-BCD pipeline was not designed to
work with the three-dimensional data cubes that are the
subarray BCDs. When the software was developed it was deemed
unlikely that subarray observations would be used for anything
other than photometry of single bright objects and mosaics would
not be a desired product. As a result, post-BCD products (e.g.,
mosaics and source lists) are not available from the pipeline. 
In addition, pointing refinement of any type is not performed
on subarray data as the number of astrometric truth sources
visible in most subarray observations is too low for the
refinement to work.    

Observers can generate their own mosaics and source lists from
subarray BCDs using the MOPEX software by first preprocessing
the subarray data cubes into two dimensional images (please 
note that the IRAC pipeline now produces two dimensional collapsed 
subarray images, one per dither position, with the correponding
uncertainty and imask images). The method is straightforward: 
For each BCD, collapse each pixel stack to a single representative 
data value and adjust the header information appropriately to 
reflect the two-dimensional nature of the resulting images; 
that is, set NAXIS = 2.   

Corresponding uncertainty images can be generated by calculating
the variance of the pixels used in collapsing each pixel
stack. The IRAC IST recommends calculating a filtered mean
value (3-sigma clipping is appropriate) for each pixel. The use
of a filtered mean results in an radhit-rejected final BCD
image, while preserving the enhanced signal-to-noise of the 
entire cube.

A single plane imask file can be created by OR'ing all the mask
values corresponding to the pixel stack used to construct each
final pixel. This  step is not strictly necessary as the
resulting image will be clean of most artifacts.

A piece of IRAC contributed software, irac_subcube_collapse, can
be used to perform the above steps.

The 2D versions of the BCDs can now be mosaiced using
mosaic.pl. Supply files containing the filenames of the 2D
images, uncertainties and optionally, imasks as you would for
normal BCDs. As the collapsed subarray BCDs already have
outlier rejection performed, that can be turned off in the
mosaicing. To turn off outlier rejection, the following modules
should be turned off:

run_detect_radhit = 0
run_detect_outlier = 0
run_mosaic_proj = 0
run_mosaic_dual_outlier = 0
run_level = 0
run_mosaic_outlier = 0
run_mosaic_rmask = 0
run_mosaic_reinterp = 0
create_rmask_mosaic = 0

and the following parameters set to zero: 

USE_OUTLIER_FOR_RMASK = 0
USE_DUAL_OUTLIER_FOR_RMASK = 0

also the pointing-refined keywords will not exist (unless
pointing refinement is run by hand) and 

USE_REFINED_POINTING = 0

mosaic_subarray_basic.nl can be used as a template namelist. 
This namelist is linked to from the

http://irsa.ipac.caltech.edu/data/SPITZER/docs/dataanalysistools/tools/contributed/irac/subcubecollapse/

web page.