diff --git a/doc/src/Background.rst b/doc/src/Background.rst new file mode 100644 index 0000000000000000000000000000000000000000..e9e159d51f78d8d5f42df7904cdd229fcdf13240 --- /dev/null +++ b/doc/src/Background.rst @@ -0,0 +1,87 @@ +.. File Background.rst + +.. include:: global.rst + +Modeling the background +======================= + +On linear detectors, the value measured at each pixel is the sum of a "background" signal and light coming from the sources of interest. +To be able to detect the faintest objects and make accurate measurements, |SExtractor| needs first computing a precise estimate of the background level at any position of the image: a *background map*. +Strictly speaking, there should be one background map per source, that is, what would the image look like if that very source was missing. +But, at least for detection, one can start by assuming that most discrete sources do not overlap too severely — which is generally the case for high galactic latitude fields —, and that the background varies smoothly across the field. + +Background estimation +--------------------- + +To compute the background map, |SExtractor| makes a first pass through the pixel data, estimating the local background in each mesh of a rectangular grid that covers the whole frame. +The background estimator is a combination of :math:`\kappa\,\sigma` clipping and mode estimation, similar to Stetson’s |DAOPHOT|_ program :cite:`1987PASP_99_191S,1992ASPC_23_90D`. + +Briefly, the local background histogram is clipped iteratively until convergence at :math:`\pm 3\sigma` around its median. The mode of the histogram is estimated using: + +.. math:: + :label: sexbackmode + + \mbox{Mode} = 2.5 \times \mbox{Median} - 1.5 \times \mbox{Mean}. + +Using simulated images, the expression above was found more accurate with clipped distributions :cite:1996AAS_117_393B than the usual approximation (e.g., :cite:`stuart2009kendall`): + +.. math:: + :label: ksbackmode + + \mbox{Mode} = 3 \times \mbox{Median} - 2 \times \mbox{Mean}. + +:numref:`fig_modevsmean` shows that the mode estimation in :eq:`sexbackmode` is considerably less affected by source crowding than a simple clipped mean :cite:`1981AJ_86_476J,1987AA_183_177I` but it is :math:`\approx 30\%` noisier. +Obviously :eq:`sexbackmode` is not valid for any distribution; |SExtractor| falls back to a simple median for estimating the local background value if the mode and the median disagree by more than 30%. + +.. _fig_modevsmean: + +.. figure:: figures/modevsmean.* + :figwidth: 100% + :align: center + + Simulations of :math:`32\times32` pixels background meshes contamined by random Gaussian profiles. + The true background lies at 0 ADUs. + While being a bit noisier, the clipped "mode" gives a more robust estimate than the clipped mean in crowded regions. + +Background map +-------------- + +Once the grid is set up, a median filter can be applied to suppress possible local overestimations due to bright stars. +The final background map is simply a (natural) bicubic-spline interpolation between the meshes of the grid. +Median filtering helps reducing possible ringing effects of the bicubic-spline around bright features. + +In parallel with the making of the background map, an *RMS background map*, that is, a map of the background noise standard deviation in the image is produced. +It may be used as an internal weight map if the ``WEIGHT_TYPE`` configuration parameter is to ``BACKGROUND`` (see :ref:`weight-map_format`). + +Configuration and tuning +------------------------ + +.. note:: + All background configuration parameters also affect background-RMS maps. + +The choice of the mesh size ``BACK_SIZE`` is very important. +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 objects can be absorbed into the background map. +If the mesh size is too large, it cannot reproduce the small scale variations of the background. +Therefore a good compromise must be found by the user. +Typically, for reasonably sampled images, a width [#recmesh]_ of 32 to 512 pixels works well. + +The user has some control over background map filtering by specifying the size of the median filter ``BACK_FILTERSIZE``. +A width and height of 1 means that no filtering is applied to the background grid. +A :math:`3\times3` filtering is sufficient in most cases. +Larger dimensions may occasionally be used to compensate for small background mesh sizes, or in the presence of large image artifacts. +In some specific cases it is desirable to median-filter only background meshes that have values exceeding some threshold above the filtered value. +This differential threshold is set by the ``BACK_FILTERTHRESH`` parameter, in ADUs. + +By default, the computed background maps are automatically subtracted from input images. +However there are some situations where it is more appropriate to subtract a *constant* from the image (e.g., images with strongly non-Gaussian background noise |pdf|\ s). +The ``BACK_TYPE`` configuration parameter (set to ``AUTO`` by default) may be switched to ``MANUAL`` to force the value specified by the ``BACK_VALUE`` parameter to be subtracted from the input image, instead of the background map. ``BACK_VALUE`` is ``0`` by default. + +Computing cost +-------------- + +The background estimation operation is generally |I/O|\ -bound, unless the image file already resides in the disk cache. + +.. [#recmesh] + It is possible to specify rectangular background meshes, although it is advised to use square ones, except in special cases (background varying rapidly along the x or y axis). diff --git a/doc/src/figures/modevsmean.pdf b/doc/src/figures/modevsmean.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d41ec251b1c281e5ff559345dc09a51b8fbfb503 Binary files /dev/null and b/doc/src/figures/modevsmean.pdf differ diff --git a/doc/src/figures/modevsmean.svg b/doc/src/figures/modevsmean.svg new file mode 100644 index 0000000000000000000000000000000000000000..8cf573781822b3b88fb6959deed05230a2dbeb1c --- /dev/null +++ b/doc/src/figures/modevsmean.svg @@ -0,0 +1,16 @@ + +-10 +-5 +0 +5 +10 +0 +5 +10 +15 +20 +25 +30 +Clipped Mode (ADU) +Clipped Mean (ADU) + diff --git a/doc/src/index.rst b/doc/src/index.rst index 99a31c5c2058dc9ac9e786564d03835c639da444..802cabf246c3bba54043977eb0a389078a782722 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -20,6 +20,7 @@ Contents Using Config Param + Background Weighting Flagging Measurements diff --git a/doc/src/keys.rst b/doc/src/keys.rst index d8afefaeaa12285ab0c962b5ac4b69ca1fee6063..abbabe894e8cfaf68b7c29309384271a0a9ce0ba 100644 --- a/doc/src/keys.rst +++ b/doc/src/keys.rst @@ -1,6 +1,9 @@ .. |ATLAS| replace:: :program:`ATLAS` .. _ATLAS: http://math-atlas.sourceforge.net +.. |DAOPHOT| replace:: :program:`DAOPHOT` +.. _DAOPHOT: http://ascl.net/phpBB3/viewtopic.php?t=23410 + .. |.dmg| replace:: :file:`.dmg` .. _.dmg: https://en.wikipedia.org/wiki/Apple_Disk_Image @@ -22,6 +25,9 @@ .. |Intel| replace:: Intel\ :sup:`®`\ .. _Intel: http://intel.com +.. |I/O| replace:: :abbr:`I/O (Input/Output)` +.. _I/O: https://en.wikipedia.org/wiki/Input/output + .. |LevMar| replace:: :program:`LevMar` .. _LevMar: http://users.ics.forth.gr/~lourakis/levmar diff --git a/doc/src/references.bib b/doc/src/references.bib index c66c5b2ecbfd95624b9b7159946c5d33328cac82..9ff01a230187d59b7c1c7dabce19fcf8ef6efe02 100644 --- a/doc/src/references.bib +++ b/doc/src/references.bib @@ -184,6 +184,20 @@ archivePrefix = "arXiv", adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@ARTICLE{1981AJ_86_476J, + author = {{Jarvis}, J.~F. and {Tyson}, J.~A.}, + title = "{FOCAS - Faint Object Classification and Analysis System}", + journal = {AJ}, + keywords = {Astronomical Catalogs, Astronomical Photography, Celestial Bodies, Image Resolution, Systems Analysis, Classifications, Digital Systems, Galaxies, Magnitude, Pattern Recognition, Photographic Plates, Stars}, + year = 1981, + month = mar, + volume = 86, + pages = {476-495}, + doi = {10.1086/112907}, + adsurl = {http://adsabs.harvard.edu/abs/1981AJ.....86..476J}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + @ARTICLE{2012MNRAS_427_2711K, author = {{Kacprzak}, T. and {Zuntz}, J. and {Rowe}, B. and {Bridle}, S. and {Refregier}, A. and {Amara}, A. and {Voigt}, L. and {Hirsch}, M.}, title = "{Measurement and calibration of noise bias in weak lensing galaxy shape estimation}", @@ -335,6 +349,20 @@ ISSN={1045-9227}, month={Sep} } +@ARTICLE{1987PASP_99_191S, + author = {{Stetson}, P.~B.}, + title = "{DAOPHOT - A computer program for crowded-field stellar photometry}", + journal = {PASP}, + keywords = {Algorithms, Astronomical Photometry, Computer Programs, Charge Coupled Devices, Color-Magnitude Diagram, Magellanic Clouds, Point Spread Functions, Television Cameras}, + year = 1987, + month = mar, + volume = 99, + pages = {191-222}, + doi = {10.1086/131977}, + adsurl = {http://adsabs.harvard.edu/abs/1987PASP...99..191S}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + @ARTICLE{2001AJ_122_1104Y, author = {{Yasuda}, N. and {Fukugita}, M. and {Narayanan}, V.~K. and {Lupton}, R.~H. and {Strateva}, I. and {Strauss}, M.~A. and {Ivezi{\'c}}, {\v Z}. and @@ -405,6 +433,19 @@ booktitle = {Astronomical Data Analysis Software and Systems (ADASS) XIII}, adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@INPROCEEDINGS{1992ASPC_23_90D, + author = {{Da Costa}, G.~S.}, + title = "{Basic Photometry Techniques}", +booktitle = {Astronomical CCD Observing and Reduction Techniques}, + year = 1992, + series = {Astronomical Society of the Pacific Conference Series}, + volume = 23, + editor = {{Howell}, S.~B.}, + pages = {90}, + adsurl = {http://adsabs.harvard.edu/abs/1992ASPC...23...90D}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + @INPROCEEDINGS{2008ASPC_394_619M, author = {{Marmo}, C. and {Bertin}, E.}, title = "{MissFITS and WeightWatcher: Two Optimised Tools for Managing FITS Data.}", @@ -452,6 +493,18 @@ booktitle = {Conference on Applications of Digital Image Processing to Astronomy adsnote = {Provided by the SAO/NASA Astrophysics Data System} } +@book{stuart2009kendall, + title={Kendall's Advanced Theory of Statistics: Volume 1: Distribution Theory}, + author={Stuart, A. and Ord, K.}, + number={vol.~1~;vol.~1994}, + isbn={9780340614303}, + lccn={94188490}, + series={Kendall's Advanced Theory of Statistics}, + url={https://books.google.fr/books?id=tW18thQWJQIC}, + year={2009}, + publisher={Wiley} +} + @BOOK{1968adga_book_S, author = {{Sérsic}, J.~L.}, title = "{Atlas de Galaxias Australes}",