irac_aphot_corr
Purpose:
Correct IRAC observed aperture photometryderived fluxes for the
pixel phase and array location dependent response functions. ***NOTE: the pixel phase response
is unity (zero variation across a pixel) for channels 3 and 4 (Cryogenic mission only).
The correction is of the following form:
CORRECTED_FLUX = Q * Observed_Flux(x,y) / R_al(i,j) * R_pp(xphase,yphase)
Here the corrected flux is in Jy or proportional units,
Q is the cal factor converting observed units to Jy (or
whatever you have chosen), Observed_Flux(x,y) is the measured
aperture flux at centroid position (x,y), R_al(i,j) is
the Array Location response function (depends on the integer
pixel i,j), and R_pp(xphase,yphase) is the Pixel Phase
response function (depends on pixel phase xphase,yphase).
Q and the input parameters of R_al and R_pp are hardcoded in this
program to the values used in deriving the flux conversion factor
in the IRAC cryogenic (S18.24, keyword /CRYO) and warm (S19.2, keyword /WARM)
pipelines.
You can override these defaults using the PARAMS keyword. See description of keyword
PARAMS for more information on these functions.
Optional keywords /REACH and /HORA allow you to correct data using previously determined cryogenic
functions for pixel phase and array location dependent response (Reach et al. 2005; Hora et al. 2008).
Author: Jim Ingalls (SSC/Caltech)
Date Contributed: 06 Oct 2015
System Requirements: IDL; astrolib IDL library
Download
irac_aphot_corr.pro
Category
Photometry, corrections
Calling Sequence
corrected_flux = IRAC_APHOT_CORR ( OBSERVED_FLUX, X, Y, CHANNEL $
[,PARAMS=PARAMS] [,/PP_ONLY] [,/AL_ONLY] [,/CRYO] [,/WARM]$
[,/REACH] [,/HORA] $
[,/SUBARRAY])
Inputs
OBSERVED_FLUX:  array of observed aperture fluxes
corresponding to (X,Y) 
X:  array of X centroids (float), defined such
that the center of the bottom left pixel is
(0,0). The bottom left corner of the array is
therefore (0.5,0.5) and the top right corner is
(255.5,255.5). Same number of elements as
OBSERVED_FLUX. 
Y:  array of Y centroids (float). Same number of
elements as OBSERVED_FLUX. 
CHANNEL:  IRAC channel number (14). Same number of elements
as OBSERVED_FLUX, or a singleelement array or scalar
(if only one element, the program assumes all elements of
OBSERVED_FLUX are for the same channel). 
If CHANNEL is 3 or 4 and none of /CRYO, /REACH, or /HORA is
set, then the input data will be returned unchanged.
Optional Inputs
None.
Keyword Parameters
PARAMS:  a 14 x 4 element matrix, where PARAMS[*,i] gives the
parameter array for the model, for the ith
IRAC channel. NOTE: Normally you should not have to change
the default values of these parameters.
Entries for the ith channel of PARAMS
(i goes from 0 to 3, corresponding to
channels 14) are as follows:
PARAMS[0:5,i]:  (A,B,C,D,E,F), the coefficients
of the quadratic array
location dependence:
R_al(i,j) = A + B*(i127) + C*(j127) +
D*(i127)*(j127) + E*(i127)^2 +
F*(j127)^2
Here, i = FIX(X) and j = FIX(Y) 

PARAMS[6:12,i]:  the coefficients of the
double gaussian pixel phase
dependence:
R_pp(xphase,yphase) =
deltaF_x*exp(WRAP(x_{phase}X0,0.5)^2/(2*sigma_x^2))
+ deltaF_y * exp(WRAP(y_{phase}Y0,0.5)^2/(2*sigma_y^2))
+ F0
PARAMS[6,i] = deltaF_x
PARAMS[7,i] = deltaF_y
PARAMS[8,i] = X0
PARAMS[9,i] = Y0
PARAMS[10,i] = sigma_x
PARAMS[11,i] = sigma_y
PARAMS[12,i] = F0_pp
Here, x_{phase} and y_{phase} are the observed pixel
phase (xROUND(x) and yROUND(y)),
deltaF_x and deltaF_y are the peak to baseline
offsets of the x and y gaussians, X0 and Y0 are
the central x and y pixel phases of the gaussians,
sigma_x and sigma_y are the gaussian sigmas, and
F0_pp is the baseline relative flux (relative flux at
infinity). The function WRAP(z,0.5) wraps the
pixel phase offset so that it is periodic at ±0.5 pixels (z=+0.5 becomes z=0.5, continuing to
0, and vice versa). The center of the wrap (z=0)
is the phase function peak.
The pixel phase response is normalized so that the
function's average, integrated over a pixel,
equals 1. 

PARAMS[13,i]:  the calibration factor converting observed
units to Jy. (In most cases, aperturephotometry
measurements will already be in Jy, so PARAMS[13,*] = 1.0.) 

/WARM:  Apply the pixel phase and array location corrections appropriate to the postcryogenic
(S19.2) pipeline. This is the default when neither /CRYO, /REACH, or /HORA are set. 
/CRYO:  Apply the pixel phase and array location corrections appropriate to the cryogenic
(S18.24) pipeline. 
/PP_ONLY:  Only correct the data using the pixel phase
function. 
/AL_ONLY:  Only correct the data using the array location
dependent function. 
/REACH:  Apply the pixel phase and array location corrections of Reach et al. 2005, PASP, 117, 975 
/HORA:  Apply the pixel phase and array location corrections of Hora et al. 2008, PASP, 120, 1233 
/SUBARRAY:  Interpret (X,Y) as relative to the appropriate subarray frame. 
Outputs
This function returns the corrected flux, which will be either a scalar or
array, depending on the number of elements of OBSERVED_FLUX.
Restrictions
The pixel phase response was derived from aperture photometry performed with a 3 pixel
aperture (37 pixel background annulus), and so is best used to correct data from the
same aperture. (A larger aperture will give a less pronounced variation in pixel phase
response, in which case this program may overcorrect your data.)
This correction will give valid results only when applied to appropriate data. The default
(/WARM) correction is based on S19.2 data from the postcryogenic mission. The /CRYO correction is based on S18.18 cryogenic data.
The /REACH and /HORA corrections are relevant to S18.7 and earlier data.
Procedure
 Measure X and Y pixel centroid position(s) for stellar image(s) (recommended method: first moment
for example: http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/pixelphase/box_centroid.pro).
X and Y are decimal values defined such that the center of the bottom left pixel of the image has (X,Y) = (0.0,0.0).
 Perform aperture photometry on the observation(s) to derive flux(es) (recommended routine: aper.pro from the IDL Astronomy User's Library)
NOTE: This correction is optimized for the 3 pixel radius aperture, and 37 pixel sky background annulus.
 Correct measured flux(es) using this function.
Example
IDL> corrected_flux = IRAC_APHOT_CORR( OBSERVED_FLUX, X, Y, CHANNEL )
