# public documents.sextractor_doc

## [/] [flags.tex] - Rev 19

\chapter{Flags}
A set of both {\em internal} and {\em external} flags is accessible
for each object. Internal flags are produced by the various detection
and measurement processes within {\sc SExtractor}; they tell for
instance if an object is saturated or has been truncated at the edge
of the image. External flags come from \emph{flag maps}: these are images
with the same size as the one where objects are detected, where
integer numbers can be used to flag some pixels (for instance, bad''
or noisy pixels). Different combinations of flags can be applied
within the isophotal area that defines each object, to produce a
unique value that will be written to the catalogue.

\section{Internal flags}
The internal flags are {\em always} computed. They are accessible
through the {\tt FLAGS} catalogue parameter, which is a short integer.
{\tt FLAGS} contains, coded in decimal, all the extraction flags as a
sum of powers of 2:

\begin{tabular}{ll}
{\tt   1} &     The object has neighbours, bright and close enough to significantly bias the
{\tt MAG\_AUTO}\\
&     photometry\footnotemark{}, or bad pixels (more than 10\% of the integrated area
affected),\\
{\tt   2} &     The object was originally blended with another one,\\
{\tt   4} &     At least one pixel of the object is saturated (or very close to),\\
{\tt   8} &     The object is truncated (too close to an image boundary),\\
{\tt  16} &     Object's aperture data are incomplete or corrupted,\\
{\tt  32} &     Object's isophotal data are incomplete or corrupted\footnotemark{},\\
{\tt  64} &     A memory overflow occurred during deblending,\\
{\tt 128} &     A memory overflow occurred during extraction.
\end{tabular}

only when {\tt MAG\_AUTO} magnitudes are requested.}
{\sc SExtractor} V1.0, and has been kept for compatibility reasons.
With {\sc SExtractor} V2.0+, having this flag activated doesn't have
any consequence for the extracted parameters.}

For example, an object close to an image border may have {\tt FLAGS} =
16, and perhaps {\tt FLAGS} = 8+16+32 = 56.

\section{External flags}
{\sc SExtractor} understands that it must process external flags when
{\tt IMAFLAGS\_ISO} or {\tt NIMAFLAGS\_ISO} are present in the catalogue
parameter file. It then looks for a FITS image specified by the {\tt
FLAG\_IMAGE} keyword in the configuration file. The FITS image must
contain the flag map, in the form of a 2-dimensional array of 8, 16 or
32 bits integers. It must have the same size as the image used for
detection. Such flag maps can be created using for example the {\bf
WeightWatcher} software (Bertin 1997).

The flag map values for pixels that coincide with the isophotal area
of a given detected object are then combined, and stored in the
catalogue as the long integer {\tt IMAFLAGS\_ISO}. 5 kinds of
combination can be selected using the
{\tt FLAG\_TYPE} configuration keyword:
\begin{itemize}
\item {\tt OR}: the result is an arithmetic (bit-to-bit) {\bf OR} of flag map pixels.
\item {\tt AND}: the result is an arithmetic (bit-to-bit) {\bf AND} of non-zero flag map pixels.
\item {\tt MIN}: the result is the minimum of the (signed) flag map
pixels. \gam{How can they be negative?}
\item {\tt MAX}: the result is the maximum of the (signed) flag map pixels.
\item {\tt MOST}: the result is the most frequent non-zero flag map pixel-value.
\end{itemize}

The {\tt NIMAFLAGS\_ISO} catalogue parameter contains a number of
relevant flag map pixels: the number of non-zero flag map pixels in
the case of an {\tt OR} or {\tt AND} {\tt FLAG\_TYPE}, or the number
of pixels with value {\tt IMAFLAGS\_ISO} if the {\tt FLAG\_TYPE} is
{\tt MIN},{\tt MAX} or {\tt MOST}.