Weighting.rst 7.39 KB
Newer Older
1
2
.. File Weighting.rst

Emmanuel Bertin's avatar
Emmanuel Bertin committed
3
4
.. include:: global.rst

5
6
7
Weighting
=========

Emmanuel Bertin's avatar
Emmanuel Bertin committed
8
9
10
The noise level in astronomical images is often fairly constant, that is, constant values for the gain, the background noise and the detection thresholds can be used over the whole frame.
Unfortunately in some cases, like strongly vignetted or composited images, this approximation is no longer good enough.
This leads to detecting clusters of detected noise peaks in the noisiest parts of the image, or missing obvious objects in the most sensitive ones.
11
|SExtractor| is able to handle images with variable noise.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
12
It does it through *weight maps*, which are frames having the same size as the images where objects are detected or measured, and which describe the noise intensity at each pixel.
13
These maps are internally stored in units of *absolute variance* (in :math:`ADU^2`)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
14
We employ the generic term *weight map* because these maps can also be interpreted as quality index maps: infinite variance (:math:`\ge 10^{30}` by definition in |SExtractor|) means that the related pixel in the science frame is totally unreliable and should be ignored.
15
16
The variance format was adopted as it linearizes most of the operations done over weight maps (see below).

Emmanuel Bertin's avatar
Emmanuel Bertin committed
17
18
19
20
21
This means that the noise covariances between pixels are ignored. Although raw CCD images have essentially white noise, this is not the case for warped images, for which resampling may induce a strong correlation between neighboring pixels.
In theory, all non-zero covariances within the geometrical limits of the analysed patterns should be taken into account to derive 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 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.
22

23
24
.. _weigth-map-format:

25
26
27
28
29
Weight-map formats
------------------

|SExtractor| accepts in input, and converts to its internal variance format, several types of weight-maps.
This is controlled through the ``WEIGHT_TYPE`` configuration keyword.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
30
Those weight-maps can either be read from a FITS file, whose name is specified by the ``WEIGHT_IMAGE`` keyword, or computed internally.
31
32
Valid ``WEIGHT_TYPE`` values are:

33
* ``NONE`` :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
34
35
    No weighting is applied.
    The related ``WEIGHT_IMAGE`` and ``WEIGHT_THRESH`` (see below) parameters are ignored.
36
37


38
* ``BACKGROUND`` :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
39
40
41
    The science image itself is used to compute internally a variance map (the related ``WEIGHT_IMAGE`` parameter is ignored).
    Robust (:math:`3\sigma`-clipped) variance estimates are first computed within the same background meshes as those described in ?? [#f1]_.
    The resulting low-resolution variance map is then bicubic-spline-interpolated on the fly to produce the actual full-size variance map.
42
43
44
    A check-image with ``CHECKIMAGE_TYPE`` ``MINIBACK_RMS`` can be requested to examine the low-resolution variance map.


45
* ``MAP_RMS`` :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
46
    The FITS image specified by the ``WEIGHT_IMAGE`` file name must contain a weight-map in units of absolute standard deviations (in ADUs per pixel).
47
48


49
* ``MAP_VAR`` :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
50
51
    The FITS image specified by the ``WEIGHT_IMAGE`` file name must contain a weight-map in units of relative variance.
    A robust scaling to the appropriate absolute level is then performed by comparing this variance map to an internal, low-resolution, absolute variance map built from the science image itself.
52
53


54
* ``MAP_WEIGHT`` :
Emmanuel Bertin's avatar
Emmanuel Bertin committed
55
56
57
    The FITS image specified by the ``WEIGHT_IMAGE`` file name must contain a weight-map in units of relative weights.
    The data are converted to variance units (by definition variance :math:`\propto\frac{1}{weight}`), and scaled as for ``MAP_VAR``.
    ``MAP_WEIGHT`` is the most commonly used type of weight-map: a flat-field, for example, is generally a good approximation to a perfect weight-map.
58

59
60
.. _effect_of_weighting:

61
62
63
64
65
66
Effect of weighting
-------------------

Weight-maps modify the working of |SExtractor| in the following respects:

#. Bad pixels are discarded from the background statistics.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
67
   If more than :math:`50\%` of the pixels in a background mesh are bad, the local background value and the background standard deviation are replaced by interpolation of the nearest valid meshes.
68

Emmanuel Bertin's avatar
Emmanuel Bertin committed
69
#. The detection threshold *t* above the local sky background is adjusted for each pixel *i* with variance :math:`\sigma^2_i` : :math:`t_i=DETECT\_THRESH\times\sqrt{\sigma^2_i}`, where ``DETECT_THRESH`` is expressed in units of standard deviations of the background noise.
70
71
72
73
74
75
76
   Pixels with variance above the threshold set with the ``WEIGHT_THRESH`` parameter are therefore simply not detected.
   This may result in splitting objects crossed by a group of bad pixels.
   Interpolation (see ???) should be used to avoid this problem.
   If convolution filtering is applied for detection, the variance map is convolved too.
   This yields optimum scaling of the detection threshold in the case where noise is uncorrelated from pixel to pixel.
   Non-linear filtering operations (like those offered by artificial retinae) are not affected.

Emmanuel Bertin's avatar
Emmanuel Bertin committed
77
#. The cleaning process (??) takes into account the exact individual thresholds assigned to each pixel for deciding about the fate of faint detections.
78

Emmanuel Bertin's avatar
Emmanuel Bertin committed
79
#. Error estimates like ``FLUXISO_ERR`` , ``ERRA_IMAGE`` , etc. also make use of individual variances.
80
   Local background-noise standard deviation is simply set to :math:`\sqrt{\sigma^2_i}`.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
81
   In addition, if the ``WEIGHT_GAIN`` parameter is set to ``Y`` (which is the default), it is assumed that the local pixel gain (i.e., the conversion factor from photo-electrons to ADUs) is inversely proportional to :math:`\sigma^2_i`, the median value over the image being set by the ``GAIN`` configuration parameter.
82
83
   In other words, it is then supposed that the changes in noise intensities seen over the images are due to gain changes.
   This is the most common case: correction for vignetting, or coverage depth.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
84
   When this is not the case, for instance when changes are purely dominated by those of the read-out noise, ``WEIGHT_GAIN`` shall be set to ``N``.
85
86
87
88
89
90

#. Finally, pixels with weights beyond ``WEIGHT_THRESH`` are treated just like pixels discarded by the masking process (??).

Combining weight maps
---------------------

Emmanuel Bertin's avatar
Emmanuel Bertin committed
91
All the weighting options listed in :ref:`weigth-map-format` can be applied separately to detection and measurement images (:ref:`using-sextractor`), even if some combinations may not always make sense.
92
93
94
95
96
97
For instance, the following set of configuration lines:

``WEIGHT_IMAGE`` *rms.fits*, *weight.fits*

``WEIGHT_TYPE`` ``MAP_RMS``, ``MAP_WEIGHT``

Emmanuel Bertin's avatar
Emmanuel Bertin committed
98
will load the FITS file *rms.fits* and use it as an RMS map for adjusting the detection threshold and cleaning, while the *weight.fits* weight map will only be used for scaling the error estimates on measurements.
99
This can be done in single- as well as in dual-image mode (:ref:`using-sextractor`).
100
101
102
103
104
105
106
107
108
109
``WEIGHT_IMAGE`` can be ignored for ``BACKGROUND`` ``WEIGHT_TYPE``.
It is of course possible to use weight-maps for detection or for measurement only.
The following configuration:

``WEIGHT_IMAGE`` *weight.fits*

``WEIGHT_TYPE`` ``NONE``, ``MAP_WEIGHT``

will apply weighting only for measurements; detection and cleaning operations will remain unaffected.

110
111
112
113
.. rubric:: Footnotes

.. [#f1] The mesh-filtering procedures act on the variance map, too.

114