# public documents.sextractor_doc

## [/] [detect_background.tex] - Diff between revs 19 and 25

Rev 19 Rev 25
Line 1... Line 1...
\section{Background estimation}
\section{Background estimation}
\label{chap:backest}
\label{chap:backest}
The value measured at each pixel is a function of the sum of a background''
The value measured at each pixel is a function of the sum of a background''
signal and light coming from the objects of interest. To be able to detect
signal and light coming from the objects of interest. To be able to detect
the faintest of these objects and also to measure accurately their fluxes, one needs
the faintest of these objects and also to measure accurately their fluxes, one needs
to have an accurate estimate of the background level in any place of the image,
to have an accurate estimate of the background level in any place of the \index{image} image,
a \emph{background map}.  Strictly speaking, there should be one background map per
a \emph{background map}.  Strictly speaking, there should be one \index{background map} background map per
object, that is, what would the image look like if that object was absent.
object, that is, what would the \index{image} image look like if that object was absent.
But, at least for detection, we may start by assuming that most discrete sources do not
But, at least for detection, we may start by assuming that most discrete sources do not
overlap too severely, which is generally the case for high galactic latitude fields.
overlap too severely, which is generally the case for high galactic latitude fields.
 
 
To construct the background map, {\sc SExtractor} makes a first pass through the pixel
To construct the \index{background map} background map, {\sc SExtractor} makes a first pass through the pixel
data, computing an estimator for the local background in each mesh of a grid
data, computing an estimator for the \index{local background} local background in each mesh of a grid
that covers the whole frame.
that covers the whole frame.
The background estimator is a combination of $\kappa\,\sigma$ clipping and mode estimation,
The background estimator is a combination of $\kappa\,\sigma$ clipping and \index{mode} mode estimation,
similar to the one employed in Stetson's DAOPHOT program (see e.g. Da Costa 1992).
similar to the one employed in Stetson's \index{DAOPHOT} DAOPHOT program (see e.g. Da Costa 1992).
Briefly, the local background histogram is clipped iteratively until convergence at
Briefly, the \index{local background} local background histogram is clipped iteratively until convergence at
$\pm 3\sigma$ around its median; \gam{Is the factor 3 configurable?} if $\sigma$ is changed by less than 20\% during that process,
$\pm 3\sigma$ around its \index{median} median; \gam{Is the factor 3 configurable?} if $\sigma$ is changed by less than 20\% during that process,
we consider that the field is not crowded and we simply take the mean of the clipped histogram
we consider that the field is not crowded and we simply take the \index{mean} mean of the clipped histogram
as a value for the background; otherwise we estimate the mode with:
as a value for the background; otherwise we estimate the \index{mode} mode with:
\label{eq:mode}
\label{eq:mode}
  \mbox{Mode} = 2.5 \times \mbox{Median} - 1.5 \times \mbox{Mean}
  \mbox{Mode} = 2.5 \times \mbox{Median} - 1.5 \times \mbox{Mean}
This expression is different from the usual approximation
This expression is different from the usual approximation
  \mbox{Mode} = 3 \times \mbox{Median} - 2 \times \mbox{Mean}
  \mbox{Mode} = 3 \times \mbox{Median} - 2 \times \mbox{Mean}
(e.g. Kendall and Stuart 1977), but was found to be more accurate with our clipped
(e.g. Kendall and Stuart 1977), but was found to be more accurate with our clipped
distributions, from the simulations we made. Fig. \ref{fig:modevsmean} shows that the expression of
distributions, from the simulations we made. Fig. \ref{fig:modevsmean} shows that the expression of
the mode above is considerably less affected\footnote{Obviously in some very unfavorable cases
the \index{mode} mode above is considerably less affected\footnote{Obviously in some very unfavorable cases
(like small meshes falling on bright stars), it leads to totally inaccurate results.} by crowding
(like small meshes falling on bright \index{stars} stars), it leads to totally inaccurate results.} by \index{crowding} crowding
than a simple clipped mean --- like the one used in FOCAS (Jarvis and Tyson 1981)
than a simple clipped \index{mean} mean --- like the one used in \index{FOCAS} FOCAS (Jarvis and Tyson 1981)
or by Infante (1987) --- but is $\approx 30\%$ noisier.
or by Infante (1987) --- but is $\approx 30\%$ noisier.
% For this reason
% For this reason
This is why
This is why
we revert to the clipped
we revert to the clipped
mean in non-crowded fields.
\index{mean} mean in non-crowded fields.
 
 
%---------------------------------- Fig.modevsmean  --------------------------------
%---------------------------------- Fig.modevsmean  --------------------------------
   \begin{figure}[htbp]
   \begin{figure}[htbp]
      \centerline{\includegraphics[width=12cm]{ps/modevsmean.ps}}
      \centerline{\includegraphics[width=12cm]{ps/modevsmean.ps}}
      \caption{
      \caption{
Line 47... Line 47...
              }
              }
      \label{fig:modevsmean}
      \label{fig:modevsmean}
   \end{figure}
   \end{figure}
 
 
 
 
Once the grid is set up, a median filter can be applied to suppress possible
Once the grid is set up, a \index{median} median filter can be applied to suppress possible
local overestimations due to bright stars. \gam{But sometimes the user will
local overestimations due to bright \index{stars} stars. \gam{But sometimes the user will
  want to have the bright star be part of the background!} The resulting background map is then simply a (natural)
  want to have the bright star be part of the background!} The resulting \index{background map} background map is then simply a (natural)
bicubic-spline interpolation between the meshes of the grid.
bicubic-spline \index{interpolation} interpolation between the meshes of the grid.
In parallel with the making of the background map, an \emph{RMS background map}, that is, a map of the
In parallel with the making of the \index{background map} background map, an \emph{RMS background map}, that is, a map of the
background noise in the image is produced. It will be used if the {\tt WEIGHT\_TYPE} parameter is
background noise in the \index{image} image is produced. It will be used if the {\tt WEIGHT\_TYPE} parameter is
set different from {\tt NONE} (see \S\ref{chap:weighttype}).
set different from {\tt NONE} (see \S\ref{chap:weighttype}).
 
 
\subsection{Configuration parameters and tuning}.
\subsection{Configuration parameters and tuning}.
The choice of the mesh size ({\tt BACK\_SIZE}) is very important.
The choice of the mesh size ({\tt BACK\_SIZE}) is very important.
If it is too small, the background estimation is affected by the presence of objects and
If it is too small, the background estimation is affected by the presence of objects and
random noise. Most importantly, part of the flux of the most extended
random noise. Most importantly, part of the flux of the most extended
objects can be absorbed into the background map. If the mesh size is too large,
objects can be absorbed into the \index{background map} background map. If the mesh size is too large,
it cannot reproduce the small scale variations of the background. Therefore
it cannot reproduce the small scale variations of the background. Therefore
a good compromise has to be found by the user. Typically, for reasonably
a good compromise has to be found by the user. Typically, for reasonably
sampled images, a width\footnote{{\sc SExtractor} offers the
sampled \index{image} images, a width\footnote{{\sc SExtractor} offers the
possibility of rectangular background meshes; but it is advised to use
possibility of rectangular background meshes; but it is advised to use
square ones, except in some very special cases (rapidly varying background
square ones, except in some very special cases (rapidly varying background
in one direction for example).} of 32 to 256 pixels works well. The user has
in one direction for example).} of 32 to 256 pixels works well. The user has
some control over the background map by specifying the size
some control over the \index{background map} background map by specifying the size
of the median filter ({\tt BACK\_FILTERSIZE}). A width
of the \index{median} median filter ({\tt BACK\_FILTERSIZE}). A width
and height of 1 means that no filtering will be
and height of 1 \index{mean} means that no filtering will be
applied to the background grid. Usually a size of $3\times3$ is enough, but it
applied to the background grid. Usually a size of $3\times3$ is enough, but it
may be necessary to use larger dimensions, especially to compensate, in part, for
may be necessary to use larger dimensions, especially to compensate, in part, for
small background mesh sizes, or in the case of large artefacts in the images.
small background mesh sizes, or in the case of large artefacts in the \index{image} images.
Median filtering also helps reducing possible ringing effects of the bicubic-spline
Median filtering also helps reducing possible \index{ringing} ringing effects of the bicubic-spline
around bright features. In some specific cases it might be desirable to median-filter
around bright features. In some specific cases it might be desirable to \index{median} median-filter
only background meshes whose original values exceed some threshold above the filtered-value.
only background meshes whose original values exceed some \index{threshold} threshold above the filtered-value.
This differential threshold is set by the {\tt BACK\_FILTERTHRESH} parameter, in ADUs.
This differential \index{threshold} threshold is set by the {\tt BACK\_FILTERTHRESH} parameter, in ADUs.
It is important to note that all {\tt BACK\_} configuration parameters also affect the
It is important to note that all {\tt BACK\_} configuration parameters also affect the
background-RMS map.
background-RMS map.
 
 
By default, the computed background map is automatically subtracted
By default, the computed \index{background map} background map is automatically subtracted
from the input image.  But there are some situations where it is more
from the input \index{image} image.  But there are some situations where it is more
appropriate to subtract a {\em constant} from the image (e.g., images
appropriate to subtract a {\em constant} from the \index{image} image (e.g., images
where the background noise distribution is strongly skewed).  The {\tt
where the background noise distribution is strongly skewed).  The {\tt
BACK\_TYPE} configuration parameter (set by default to AUTO'') can
BACK\_TYPE} configuration parameter (set by default to AUTO'') can
be switched to {\tt MANUAL} to allow for the value specified by the
be switched to {\tt MANUAL} to allow for the value specified by the
{\tt BACK\_VALUE} parameter to be subtracted from the input
{\tt BACK\_VALUE} parameter to be subtracted from the input
image. The default value is 0.
\index{image} image. The default value is 0.
 
 
\gam{Describe {\tt MINIBACK}}
\gam{Describe {\tt MINIBACK}}
\label{chap:miniback}
\label{chap:miniback}
 
 
\subsection{CPU cost}.
\subsection{CPU cost}.
The background estimation operation can take a considerable time on the largest images,
The background estimation operation can take a considerable time on the largest \index{image} images,
e.g. a few minutes minutes for a $32000\times32000$ frame on a 2GHz
e.g. a few minutes minutes for a $32000\times32000$ frame on a 2GHz
processor.
processor.
\gam{Update time?}
\gam{Update time?}
 
 
 
 
 No newline at end of file
 No newline at end of file