#-----------------------------------------------------------------------------
# IRACproc: IRAC Post-BCD Processing v4.3 PROCESSING QUICK REFERENCE SUB
#-----------------------------------------------------------------------------
(c) 2005 Mike Schuster, Massimo Marengo (mmarengo@cfa.harvard.edu)
(c) 2005 SAO - Smithsonian Astrophysical Observatory

Harvard-Smithsonian Center for Astrophysics
Smithsonian Astrophysical Observatory

25 JUL 2007

Quick reference for IRAC sub-array data. See HOWTO_PROC for more detailed 
instructions.

#-----------------------------------------------------------------------------
# Processing Step #1 - Data Initialization
#-----------------------------------------------------------------------------
Run the script fixup to create the proc_dir directory structure and prepare 
files for IRACproc. "proc_dir" is where you will process your data. Your 
working directory will be: /<data_path>/proc_dir/reduce/.

user_name][ cd /<data_path>/

List related AORs to be processed (aor.lis - absolute or relative paths OK). 
To view options type 'fixup -h' at the command prompt.

user_name][ fixup -subarray -pmasks mmmyy -aorlist aor.lis proc_dir

-or- List related AORs to be processed on the command line

user_name][ fixup -subarray -pmasks mmmyy proc_dir aor1 aor2 ... aorN

#-----------------------------------------------------------------------------
# Additional Processing Step For IRAC Sub-Array Data
#-----------------------------------------------------------------------------
Coadds each image pack. To view options type 'subcoadd_bcd()' at the perlDL 
prompt. To view information file type 'help subcoadd_bcd' at the perlDL 
prompt, or see IRACproc/docs/subcoadd_bcd.html for additional information.

user_name][ cd proc_dir/reduce/
user_name]reduce[ perldl

perldl> subcoadd_bcd({CH=>1})
perldl> subcoadd_bcd({CH=>2})
perldl> subcoadd_bcd({CH=>3})
perldl> subcoadd_bcd({CH=>4})

* PMASKS Specifies Pmasks, as distributed by the SSC, by month and year, 
   available options: jun06, dec05, jun05, feb05, jan05, oct04, jun04, mar04
* SIGMA is the number of sigmas for outlier rejection (default 5)

#-----------------------------------------------------------------------------
# Wrapper/Log For Batch Processing Steps 2 and 3
#-----------------------------------------------------------------------------

Use a text editor to modify the 'my_iracproc.pdl' file located in reduce/. 
Then, 'cd' into reduce/, start perlDL and type 'my_iracproc()' at the prompt. 
A duplicate of the original, un-modified file is also placed in the Lists/ 
sub-directory.

#-----------------------------------------------------------------------------
# Processing Step #2 - Make Master Image Lists
#-----------------------------------------------------------------------------
Make the initial list of images to be processed. To view options type 
'mkmopex_bcd()' at the perlDL prompt. To view information file type 
'help mkmopex_bcd' at the perlDL prompt, or see 
IRACproc/docs/mkmopex_bcd.html for additional information.

perldl> mkmopex_bcd('../Lists/list.par',{FOV=>'sub',CH=>1})
perldl> mkmopex_bcd('../Lists/list.par',{FOV=>'sub',CH=>2})
perldl> mkmopex_bcd('../Lists/list.par',{FOV=>'sub',CH=>3})
perldl> mkmopex_bcd('../Lists/list.par',{FOV=>'sub',CH=>4})

* CH is the IRAC channel: '1' (default), '2', '3', '4'
* FT is the frametime of the images (check header keyword FRAMTIME)
* FOV selects only frames that are on target

#-----------------------------------------------------------------------------
# Processing Step #3 - Make Mosaic Images w/ Outlier Rejection
#-----------------------------------------------------------------------------
Create a mosaic of the images in Lists/bcd_I<CH>.lis. To view options type 
'mkmosaic_bcd()' at the perlDL prompt. To view information file type 
'help mkmosaic_bcd' at the perlDL prompt, or see 
IRACproc/docs/mkmosaic_bcd.html for additional information.

perldl> mkmosaic_bcd({NAME=>'',STEPS=>[1,1,1,1,1,1],CH=>1})
perldl> mkmosaic_bcd({NAME=>'',STEPS=>[1,1,1,1,1,1],CH=>2})
perldl> mkmosaic_bcd({NAME=>'',STEPS=>[1,1,1,1,1,1],CH=>3})
perldl> mkmosaic_bcd({NAME=>'',STEPS=>[1,1,1,1,1,1],CH=>4})

Quit PDL - you will need to restart for the next target.

perldl> quit

By default, copies of the final mosaics and coverage maps are placed in 
analysis/ with the filenames: I<CH>_<NAME>_mosaic.fits and 
I<CH>_<NAME>_mosaic_cov.fits.

* NAME is the string placed in the default output image filenames
* CH is the IRAC channel: '1' (default), '2', '3', '4'
* STEPS is a set of six logical flags to turn on/off stages of processing
* CROTA2 is the position angle of N in final mosaic, CCW from +y-axis
         'A' (average, default), '0.' for North up
* PIXEL_SIZE is the mosaic pixel size in arcseconds (default is 0.86267016)