### 6 Processing and analysis details

6.5 Error beam

This section covers some aspects of the SCUBA-2 pipeline in detail.

#### 6.1 Matched filter

The standard matched filter used by the SCUBA-2 pipeline is based on a compensated PSF or Mexican-Hat wavelet technique (e.g. [1]). The filter employs a two-component gaussian based on the telescope beam determined in [3] to determine the detection scale of the PSF. Both the map and PSF are smoothed using a single, larger gaussian to remove a local background, and the smoothed versions subtracted from each. The smoothing gaussian has a FWHM of 30${}^{″}$ at 850 $\mu$m, 20${}^{″}$ at 450 $\mu$m. (For the relevant Picard recipes, the FWHM of the smoothing gaussian may be given as a recipe parameter.) The smoothed-and-subtracted input image is convolved with the identically processed PSF to produce the output image.

For those recipes that assess the point-source response as part of the processing (e.g. the jack-knife-based recipes), the matched filter will use a PSF derived from the images that include the artificial source. In these cases, the map (and PSF) will not be smoothed by a larger gaussian before the convolution.

#### 6.2 NEFD image calculation

For image data, the pipeline calculates a corresponding image of the noise equivalent flux density (NEFD), defined as the square-root of the product of the exposure time and variance components. Thus each pixel, $i$, in the NEFD image is given by:

 ${NEFD}_{i}=\sqrt{\left({t}_{exp,i}{\sigma }_{i}^{2}\right)}$ (1)

Since this image is calculated from components internal to the image, the NEFD image is written as an additional NDF component under the same extension as the exposure time and weights, i.e. MORE.SMURF.NEFD. Note that the calculation will overwrite any existing component of the same name.

#### 6.3 Source-fitting

Kappa beamfit is the main task used for fitting sources in order to calculate beam size, pointing offsets and flux conversion factors (FCFs). The facility exists (within Picard) to attempt to fit a realistic beam using two (circular) gaussian components as determined in [3]. The criterion is that the peak signal-to-noise ratio (SNR) must exceed 100. See the documentation for SCUBA2_CHECK_CAL in SUN/265 for further details.

When estimating the beam size, beamfit always assumes a gaussian profile whether or not it is fitting two components. Fits to the beam are always carried out in an Az-El coordinate frame so that fits may be analyzed for systematic elongations.

For calculating pointing offsets, the peak position is most important and the choice of profile has no effect on the result. FCF calculations will use a single-component fit and the profile is left as a free parameter.

#### 6.4 FCF calculations

The pipeline calculates three FCFs to convert the uncalibrated data in pW to astronomically-meaningful units:

• ARCSEC – calibrate maps in surface brightness units, Jy arcsec${}^{-2}$;
• BEAM – calibrate maps in Jy beam${}^{-1}$;
• BEAMMATCH – calibrate maps processed with the matched filter in Jy.

All three of these FCFs are calculated in the _FIND_CALIBRATION_MAP_ primitive with the detailed calculation of each carried out in the primitives specified below.

The combination of these FCFs can be used to assess telescope performance. The ratio of the BEAM FCF to the ARCSEC FCF provides an estimate of the effective solid angle of the telescope beam which can be compared with the standard value derived in [3]. If the telescope is well focussed, the two should agree to within the calibration uncertainty. However, if the focus is not optimal, the BEAM/ARCSEC ratio will yield a larger value.

Maps of calibrators are made with 1${}^{″}$ pixels at both 850- and 450 $\mu$m which allows the fitting areas to be defined in terms of pixels.

##### 6.4.1 ARCSEC

The ARCSEC FCF is calculated using aperture photometry (autophotom) on a calibrator (using the _APERTURE_PHOTOMETRY_ primitive). The primary aperture is 30${}^{″}$ in radius (at both wavelengths) with a sky annulus defined within 1.25–2.0 times the aperture radius. The known total flux of the source is divided by the measured background-corrected flux to yield the ARCSEC FCF in Jy arcsec${}^{-2}$ pW${}^{-1}$.

The autophotom task is called with the following parameters:

The input file defining the source position and aperture properties contains the following lines:

$x$ $y$ 0.0 0.0 0.0 0.0 OK ${r}_{ap}$ 0.0 0.0 annulus circle
#ANN 1 1.25 2.0

where $x$ and $y$ are the RA and Dec of the source (obtained from the skyref WCS attribute) and ${r}_{ap}$ is the radius of the aperture in pixels.

The signal sum, $S$, is obtained from the SIGNAL entry (column 7) in the output file, which is converted to a total flux (pW arcsec${}^{2}$) using the pixel area, $F=S{A}_{pix}$. The uncertainty in this flux is derived from the MAG and MAGERR entries (columns 4 and 5 respectively). With the nousemags parameter, these values are counts, rather than magnitudes and are thus a mean count ($\mu$) and uncertainty in that value ($\delta \mu$). Then $\delta F=F\mu /\delta \mu$ (also in pW arcsec${}^{2}$).

##### 6.4.2 BEAM

The BEAM FCF is obtained from the ratio of the known peak flux to the fitted source peak to give the FCF in units of Jy beam${}^{-1}$ pW${}^{-1}$. The fitted peak is derived from Kappa beamfit called from the _FIT_SOURCE_ primitive. If the source has a SNR exceeding 100 the map is fitted by two superposed gaussians to mimic the realistic telescope beam. The fallback position is that a single (non-gaussian) component is fitted if the SNR is less than 100.

The arguments to beamfit for a single component fit are:

gauss=false mode=interface variance=false fitarea=15 fixback=0

The pos parameter is set to either (0,0) for planets or the RA and Dec of the reference position for stationary sources. (For a two-component fit, the pos2 parameter is the same as pos.)

The peak of the fit and its uncertainty are used to estimate the FCF and the corresponding uncertainty directly. beamfit also returns an estimate of the RMS deviation between the map and the fit; however, since the FCF is derived from the peak of the fit, the uncertainty in that value is preferred for estimating the uncertainty in the FCF (although in practice the two tend to be similar).

##### 6.4.3 BEAMMATCH

The BEAMMATCH FCF is obtained from the ratio of the known total flux to the fitted source peak in an image processed by the matched filter, to give the FCF in units of Jy pW${}^{-1}$. Kappa beamfit is used to fit a single component, though the fit is not constrained to be a gaussian in order to estimate the peak as accurately as possible. For point sources it should yield the same value as the BEAM FCF. However, it is rarely used to calibrate data directly; the application of a matched filter is usually carried out on images calibrated with the BEAM FCF.

The beamfit arguments for deriving the BEAMMATCH FCF are:

gauss=false mode=interface variance=false fitarea=15 fixback=0

where fitarea is the smaller of 1.5$×$FWHM or 15 pixels. A smaller fit area is used in order to limit the influence on the fit of the negative dip associated with the matched filter. The pos parameter is the same as that used for the BEAM FCF.

As with the BEAM FCF, the uncertainty in the peak of the fit is used to directly estimate the uncertainty in this FCF.

#### 6.5 Error beam

The SCUBA-2 error beam is defined as the fraction of the total power that lies outside of an aperture defined by the FWHM, i.e.: $E=1-\left({S}_{main}/{S}_{total}\right)$. For the model JCMT beam, these values are 0.57 and 0.67 at 850- and 450 $\mu$m respectively.

The fluxes are calculated within apertures of radii equal to half the FWHM and the standard radius for calculating the ARCSEC FCF above (i.e. 30 arcsec). The annulus used for the background estimate is kept the same in both cases at 1.25 and 2.0 times the standard aperture radius.