### POL2IPCOR

Create an IP model from a set of POL2 observations of a bright extended source

#### Description:

This routine determines a correction for Instrumental Polarisation (IP) from a set of I, Q and U maps for a single field. At least nine POL2 observations of the same field at the same wavelength must be supplied, covering as wide a range in elevation as possible and all using the same pixel grid. The maps must NOT have been produced using smurf:skyloop. The correction may then be applied to the supplied Q and U maps to create a set of IP-corrected output maps. The parameters of the IP correction are reported.

IP correction may already have been applied to the supplied Q and U map (for instance, within makemap or pol2map), in which case this routine will in effect determine a secondary IP correction that aims to remove any residual elevation-dependence left over by the earlier primary IP correction.

The IP model measured and applied by this routine can take one of two forms (selected using the MODELTYPE parameter). Firstly, the " single component" form:

p = A $+$ B$\ast$el $+$ C$\ast$el$\ast$el Qn_fp = p$\ast$cos( -2$\ast$( el - D ) ) Un_fp = p$\ast$sin( -2$\ast$( el - D ) )

where " el" is elevation (in radians), " p" is the fractional polarisation due to IP, (Qn_fp,Un_fp) are normalised Q and U corrections with respect to the focal plane Y axis, and (A,B,C,D) are the parameters of the model determined from the supplied input maps as described below.

Secondly, the " double component" form:

Qn_fp = A $+$ B$\ast$cos( -2$\ast$( el - C ) ) $+$ D$\ast$cos( -2$\ast$( el - E ) ) Un_fp = F $+$ B$\ast$sin( -2$\ast$( el - C ) ) $+$ D$\ast$sin( -2$\ast$( el - E ) )

This form has two extra free parameters (E and F) compared to the single component model.

For both model forms, the corrected output Q and U values are then given by:

Q_out = Q_in - Qn_tr$\ast$I_in U_out = U_in - Un_tr$\ast$I_in

where (I_in,Q_in,U_in) are the input I, Q and U values with respect to tracking north (e.g. Declination) and (Qn_tr,Un_tr) are the normalised Q and U corrections with respect to tracking north. These are determined by rotating the (Qn_fp,Un_fp) vector as follows:

Qn_tr = cos( 2$\ast$alpha )$\ast$Qn_fp - sin( 2$\ast$alpha )$\ast$Un_fp Un_tr = sin( 2$\ast$alpha )$\ast$Qn_fp $+$ cos( 2$\ast$alpha )$\ast$Un_fp

where alpha is the angle from tracking north to the focal plane Y axis, in sense of North through East, at the central epoch of the observation.

The (Q,U) values in the input maps are given with respect to tracking north. So if these maps had already been correct for IP with a pefect IP model, then in the absence of noise the (Q,U) of an astronomical source should be constant for all observations regardless of elevation (assuming the source is not variable). If the IP correction is not perfect, the (Q,U) measured in each observation will be offset away from the ’ true’ values by offsets that vary with elevation and azimuth. Thus if the (Q,U) values at a single point on the sky are plotted as a scatter plot, any imperfection in the IP model will be revealed by the points for different observations being distributed along an arc of some centro-symetric shape centred on the true (Q,U), with azimuth varying with distance along the arc. The above argument relies on the input (Q,U) values using tracking north as the reference direction. For instance, if they were instead to use the focal plane Y axis as the reference direction, then the true astronomical (Q,U) would not be constant (due to sky rotation) but would itself form some arc of a circle centred on the origin of the (Q,U) plane.

In practice, a separate circle is fitted to the input data at every point on the sky that is within both the AST and PCA masks. At a single point, each observation defines one position in the (Q,U) plane, and the best fitting circle passing through the (Q,U) positions for all observations is found. The centre of the circle defines the best estimate of the true astronomical (Q,U), and the offsets from the centre to each observation’ s (Q,U) position is a measure of the IP. Note, all reference to (Q,U) above refer to normalised (Q,U). The IP defined by each measured (Q,U) position is then rotated to use focal plane Y axis as the polarimetric reference direction instead of tracking north.

The above process, taken over all pixels in the AST and PCA masks, will typically produce many estimates of (Qn_fp,Un_fp) over a range of elevations. The parameters of the IP model (A,B,C,D) are then found by doing a weighted least squares fit to these (Qn_fp,Un_fp) values. The weighting function gives greater weight to pixels for which the residuals of the actual (Q,U) values from the fitted circle are smaller. It also favours circles in which the azimuth of each (Q,U) position is more closely correlated with its position around the circle.

#### Parameters:

A group of input NDFs, each holding a 2-D map of I, Q or U for a single observation. All maps must hold data for the same object at the same wavelength (850 or 450), and must be aligned in pixel coordinates. A complete trio of I, Q and U maps must be supplied for each observation. The maps must NOT have been created by smurf:skyloop. This parameter is only used if a null (!) value is supplied for parameter MAPDIR. If null (!) is also supplied for IN, then the fit is based solely on any data supplied via parameter INLOGS. [!]
A group of existing log files created by previous runs of this application. If supplied, the data in these log files is included in the IP model fit. This allows the fit to be based on data from multiple objects. Note, this data is NOT included in the output log file specified by parameter LOGFILE. [!]
##### LOGFILE = LITERAL (Write)
The name of an output text file to create holding a table of the values that were generated from the data supplied by parameter IN or MAPDIR. These values, together with any specified by parameter INLOGS, is used in the fit to determine the values of model parameters (A,B,C,D). The values are stored in the form of a TOPCAT " ascii" table. So if LOGFILE is set to " table.asc" , you can view the table using the command " topcat -f ascii table.asc" . [!]
##### MAPDIR = LITERAL (Write)
The path to a directory holding existing observation maps created by the POL2MAP command (i.e. via the MAPDIR parameter). If supplied, the maps in this directory are used as the input maps and parameter IN is ignored. The naming convenions of the POL2MAP command are assumed (i.e. auto-masked maps in " $\ast$_imap.sdf" , externally masked maps in "$\ast$_Imap.sdf" , $\ast$_Qmap.sdf" and "$\ast$_Umap.sdf" ). The externally masked maps are used as the input maps (see parameter IN). If a null (!) value is supplied for MAPDIR, all input maps are instead obtained using parameter IN.
##### MODELFILE = LITERAL (Write)
The name of an output text file to create holding a table of values evaluated from the fitted IP model. The file uses the TOPCAT " ascii" format, and holds the fitted model parameters in the header. [!]
##### MODELTYPE = LITERAL (Write)
Selects the mathematical form of the IP model. Can be " SINGLE" (for the single component model) or " DOUBLE" (for the double component model). [" SINGLE" ]
##### OUT = NDF (Write)
An optional group of output NDFs. If null (!) is supplied, no IP corrected output maps are created. If a non-null value is supplied, the number of NDFs supplied must be equal to the number of input NDFs supplied for parameter " IN" . Each output NDF corresponding to an input Q or U map receives an IP-corrected copy of the corresponding input map. Output NDFs corresponding to input I maps are ignored (i.e. no total intensity output NDFs are created). Thus, if the value " $\setminus$$\ast$_C" is supplied for parameter OUT, output Q and U maps will be created with names of the form " $<$in$>$_C.sdf" , where $<$in$>$ is the name of the corresponding input Q or U map, but no output I maps will be formed (the output maps will be placed in the same directory as the input maps). [!]

#### Notes:

• Single observation maps produced by skyloop can sometimes show IP that seems to vary with total intensity. In such cases, using a modified single component model in which:

p = A $+$ B$\ast$el $+$ C$\ast$el$\ast$el $+$ E$\ast$total_intensity q = p$\ast$cos( -2( el - D ) ) u = p$\ast$sin( -2( el - D ) )

results in corrected maps that show lower variation with elevation.