Compare with Previous | Blame | View Log
\chapter{Weighting}
\label{chap:weight}
The noise level in astronomical \index{image} images is often fairly constant, that
is, constant values for the \index{gain} gain, the background noise and the
detection \index{threshold} thresholds can be used over the whole frame. Unfortunately,
in some cases, like strongly vignetted or composited \index{image} images, this
approximation is no longer good enough. This leads to detecting
clusters of detected noise peaks in the noisiest parts of the \index{image} image,
or missing obvious objects in the most sensitive ones. {\sc
SExtractor} is able to handle \index{image} images with variable noise. It does so
through {\em \index{weight map} \index{weight maps} weight maps}, which are frames having the same size as
the \index{image} images where objects are detected or measured, and which describe
the noise intensity at each pixel. These maps are internally stored in
units of {\em absolute variance} (in ADU$^2$). We employ the generic
term ``weight map'' because these maps can also be interpreted as
quality index maps: infinite variance ($\ge 10^{30}$ by definition in
{\sc SExtractor}) \index{mean} means that the related pixel in the science frame is
totally unreliable and should be ignored. The variance format was
adopted as it linearizes most of the operations done over \index{weight map} \index{weight maps} weight maps
(see below).
This \index{mean} means that the noise \index{covariance} \index{covariances} covariances between pixels are ignored.
Although raw \index{CCD} CCD \index{image} images have essentially white noise, this is not the
case for warped \index{image} images, for which resampling may induce a strong
correlation between \index{neighbour} neighbouring pixels. In theory, all non-zero
\index{covariance} \index{covariances} covariances within the geometrical limits of the analysed patterns
should be taken into account to derive \index{threshold} thresholds or error estimates.
Fortunately, the correlation length of the noise is often smaller than
the patterns to be detected or measured, and constant over the \index{image} image.
In that case one can apply a simple ``fudge factor'' to the estimated
variance to account for correlations on small scales. This proves to
be a good approximation in general, although it certainly leads to
underestimations for the smallest patterns.
\section{Weight map formats}
\label{chap:weighttype}
{\sc SExtractor} accepts in input, and converts to its internal
variance format, several types of \index{weight map} \index{weight maps} weight maps. This is controlled
through the {\tt WEIGHT\_TYPE} configuration keyword. These
\index{weight map} \index{weight maps} weight maps can either be read from a FITS file, whose name is
specified by the {\tt WEIGHT\_IMAGE} keyword, or computed internally.
Valid {\tt WEIGHT\_TYPE}s are:
\begin{itemize}
\item{\tt NONE}: No weighting is applied. The related {\tt
WEIGHT\_IMAGE} and {\tt WEIGHT\_THRESH} (see below) parameters are
ignored.
\item {\tt BACKGROUND}: the science \index{image} image itself is used to compute
internally a \index{variance map} variance map (the related {\tt WEIGHT\_IMAGE} parameter
is ignored). Robust ($3\sigma$-clipped) variance estimates are first
computed within the same background meshes as those described in
\S\ref{chap:backest}\footnote{The mesh-filtering procedures act on the
\index{variance map} variance map, too.}. The resulting low-resolution \index{variance map} variance map is then
bicubic-spline-interpolated on the fly to produce the actual full-size
\index{variance map} variance map. A \index{check-image} check-image with {\tt CHECKIMAGE\_TYPE} {\tt
MINIBACK\_RMS} can be requested to examine the low-resolution variance
map.
\item {\tt MAP\_RMS}: the FITS \index{image} image specified by the {\tt
WEIGHT\_IMAGE} file name must contain a \index{weight map} weight map in units of
absolute \index{standard deviation} standard deviations (in ADUs per pixel).
\item {\tt MAP\_VAR}: the FITS \index{image} image specified by the {\tt
WEIGHT\_IMAGE} file name must contain a \index{weight map} weight map in units of
relative variance. A robust scaling to the appropriate absolute level
is then performed by comparing this \index{variance map} variance map to an internal,
low-resolution, absolute \index{variance map} variance map built from the science \index{image} image
itself.
\item {\tt MAP\_WEIGHT}: the FITS \index{image} image specified by the {\tt
WEIGHT\_IMAGE} file name must contain a \index{weight map} weight map in units of
relative weights. The data are converted to variance units (by
definition ${\rm variance} \propto 1/{\rm weight}$), and scaled as for
{\tt MAP\_VAR}. {\tt MAP\_WEIGHT} is the most commonly used type of
\index{weight map} weight map: a \index{flat-field} flat-field, for example, is generally a good
approximation to a perfect \index{weight map} weight map.
\end{itemize}
\section{Weight \index{threshold} threshold}
It may happen, that some weights are too low (or variances too high) to be of any interest: it is then more appropriate
to discard such pixels than to include them in unweighted measurements such as {\tt FLUX\_APER}. To allow discarding these
very \index{bad pixel} \index{bad pixels} bad pixels, a \index{threshold} threshold can be set with the {\tt WEIGHT\_THRESH} parameter. The unit in which this threshold
should be expressed is that of input data: ADUs for
BACKGROUND and MAP\_RMS maps, uncalibrated ADUs$^2$ for MAP\_VAR, and uncalibrated weight-values for MAP\_WEIGHT maps.
Depending on the \index{weight map} weight map type, the \index{threshold} threshold will set a lower or a higher limit for ``bad pixel'' values: higher for
weights, and lower for variances and \index{standard deviation} standard deviations. The default value is 0 for weights, and $10^{30}$ for variance and
\index{standard deviation} standard deviation maps.
\section{Effects of weighting}
Weight maps modify the working of {\sc SExtractor} in the following respects:
\begin{enumerate}
\item Bad pixels are discarded from the background statistics. If more than 50\% of the pixels in a background mesh are bad, the \index{local background} local background
value and its \index{standard deviation} standard deviation are replaced by \index{interpolation} interpolation of the
nearest valid meshes.
\item The detection \index{threshold} threshold $t$ above the local sky background is
adjusted for each pixel $i$ with variance $\sigma^2_i$: $t_i = {\tt
DETECT\_THRESH}\times\sqrt{\sigma^2_i}$, where {\tt DETECT\_THRESH} is
expressed in units of \index{standard deviation} standard deviations of the background noise.
Pixels with variance above the \index{threshold} threshold set with the {\tt
WEIGHT\_THRESH} parameter are therefore simply not detected. This may
result in splitting objects crossed by a group of \index{bad pixel} \index{bad pixels} bad pixels.
Interpolation (see \S\ref{chap:interp}) should be used to avoid this
problem. If \index{convolution} convolution filtering (\S\ref{filter-conv}) is applied for detection, the
\index{variance map} variance map is convolved too. This yields optimum scaling of the
detection \index{threshold} threshold in the case where noise is uncorrelated from pixel
to pixel. Non-linear filtering operations (like those offered by
artificial retinae, \S\ref{filter-non-linear}) are not affected.
\item The {\tt CLEAN}ing process (\S\ref{chap:clean}) takes into
account the exact individual \index{threshold} thresholds assigned to each pixel for
deciding about the fate of faint detections.
\item Error estimates like {\tt FLUXISO\_ERR}, {\tt ERRA\_IMAGE}, ...
make use of individual variances too. The \index{local background} local background noise standard
deviation is simply set to $\sqrt{\sigma^2_i}$. In addition, if the
{\tt WEIGHT\_GAIN} parameter is set to {\tt Y} --- which is the
default ---, it is assumed that the local pixel \index{gain} gain (i.e., the
conversion factor from photo-electrons to ADUs) is inversely
proportional to $\sigma^2_i$, its \index{median} median value over the \index{image} image being
set by the {\tt GAIN} configuration parameter. In other words,
the changes in noise intensities seen over the
\index{image} images are assumed to be caused by spatial variations in the \index{gain} gain. This is the most common case:
correction for \index{vignetting} vignetting, or coverage depth. When this is not the
case, for instance when changes are purely dominated by those of the
read-out noise, {\tt WEIGHT\_GAIN} shall be set to {\tt N}.
\item Finally, pixels with weights beyond {\tt WEIGHT\_THRESH} are
treated just like pixels discarded by the {\tt MASK}ing process
(\S\ref{chap:mask}). \end{enumerate}
\section{Combining \index{weight map} \index{weight maps} weight maps}
All the weighting options listed in \S\ref{chap:weighttype} can be
applied separately to detection and measurement \index{image} images
(\S\ref{chap:using}), --- even if some combinations may not always
make sense. For instance, the following set of configuration lines:
\begin{verbatim}
WEIGHT_IMAGE rms.fits,weight.fits
WEIGHT_TYPE MAP_RMS,MAP_WEIGHT
\end{verbatim}
will load the FITS file {\tt rms.fits} and use it as an RMS map for
adjusting the detection \index{threshold} threshold and CLEANing, while the {\tt
weight.fits} \index{weight map} weight map will only be used for scaling the error
estimates on measurements. This can be done in single- as well as in
dual-image \index{mode} mode (\S\ref{chap:using}). {\tt WEIGHT\_IMAGE}s can be
ignored for {\tt BACKGROUND} {\tt WEIGHT\_TYPE}s. It is of course
possible to use \index{weight map} \index{weight maps} weight maps for detection or for measurement only. The
following configuration:
\begin{verbatim}
WEIGHT_IMAGE weight.fits
WEIGHT_TYPE NONE,MAP_WEIGHT
\end{verbatim}
will apply weighting only for measurements; detection and CLEANing
operations will remain unaffected.
\section{Interpolation}
\label{chap:interp}
{\bf TO BE WRITTEN}