Commit 0bfc62ab authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Document BACK_PEARSON config parameter (S dropped at the end).

parent 40833b3b
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -18,19 +18,26 @@ 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:
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 the semi-empirical relation

.. math::
  :label: sexbackmode
  :label: ksbackmode

  \mbox{Mode} = 2.5 \times \mbox{Median} - 1.5 \times \mbox{Mean}.
  \mbox{Mode} - \mbox{Mean} \approx \alpha_{\rm{Pearson}} \times (\mbox{Median} - \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`):
and therefore

.. math::
  :label: ksbackmode
  :label: sexbackmode

  \mbox{Mode} \approx \alpha_{\rm{Pearson}} \times \mbox{Median} - (\alpha_{\rm{Pearson}} - 1) \times \mbox{Mean},

with :math:`\alpha_{\rm{Pearson}} \approx 3`  :cite:`1895RSTA_0010,1911AITS,stuart2009kendall`.

  \mbox{Mode} = 3 \times \mbox{Median} - 2 \times \mbox{Mean}.
Using simulated images, :cite:`1996AAS_117_393B` found :math:`\alpha_{\rm{Pearson}} \approx 2.5` more appropriate for determining the mode of the background histogram in |SExtractor|.
However, extensive photometric assessments carried out in the context of the `Dark Energy Survey <https://darkenergysurvey.org>`_ later showed that this value leads to a slight overestimation of the local background :cite:`2022ApJS_258_15E`, and a higher :math:`\alpha_{\rm{Pearson}} \approx 3.5` was adopted in |DES|.
Since |SExtractor| v2.28, :math:`\alpha_{\rm{Pearson}}` can be changed using the ``BACK_PEARSON`` configuration parameter.
However, for the sake of compatibility with previous results, the default value of ``BACK_PEARSON`` remains ``2.5``.

: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%.
@@ -56,7 +63,7 @@ In parallel with the making of the background map, an *RMS background map*, that
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.
+31 −223
Original line number Diff line number Diff line
@@ -16,32 +16,27 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os, sys
sys.path.insert(0, os.path.abspath('.'))

import sphinx_rtd_theme
import adsarxiv


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
#   'sphinx.ext.intersphinx',
#   'sphinx.ext.todo',
    'sphinx.ext.mathjax',
    'sphinxcontrib.bibtex',
    'sphinx.ext.githubpages'
    'sphinx.ext.githubpages',
    'sphinx.ext.mathjax',
    'sphinx.ext.todo',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ['../theme']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
@@ -59,7 +54,7 @@ master_doc = 'index'
# General information about the project.
project = u'SExtractor'
filename = 'sextractor'
copyright = u'2017, IAP/CNRS/UPMC'
copyright = u'2017-2023, CFHT/IAP/CNRS/SorbonneU'
author = u'E. Bertin'

# The version info for the project you're documenting, acts as replacement for
@@ -71,13 +66,6 @@ version = '2.28.0'
# The full version, including alpha/beta/rc tags.
release = '2.28.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
@@ -90,21 +78,7 @@ today = 'Tue Mar 07 2023'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['global.rst','keys.rst','roles.rst']

# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
exclude_patterns = ['global.rst','keys.rst','macro.rst','roles.rst']

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
@@ -114,53 +88,17 @@ exclude_patterns = ['global.rst','keys.rst','roles.rst']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

numfig = True

# -- Options for HTML output ----------------------------------------------
smartquotes = False

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'SExtractor v2.28.0'

# A shorter title for the navigation bar.  Default is the same as html_title.
#
# html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None

# The name of an image file (relative to this directory) to use as a favicon of
# the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
@@ -168,49 +106,7 @@ html_static_path = ['../theme']

# Trick for having ReadTheDocs read custom theme changes
def setup(app):
    app.add_stylesheet("css/custom.css")

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []

# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}

# If false, no module index is generated.
#
# html_domain_indices = True

# If false, no index is generated.
#
# html_use_index = True

# If true, the index is split into individual pages for each letter.
#
# html_split_index = False

# If true, links to the reST sources are added to the pages.
#
html_show_sourcelink = False
    app.add_css_file("css/custom.css")

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
@@ -218,39 +114,9 @@ html_show_sphinx = False

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
html_show_copyright = True

# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = filename + 'doc'

# -- Options for LaTeX output ---------------------------------------------
# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
     # The paper size ('letterpaper' or 'a4paper').
@@ -263,7 +129,10 @@ latex_elements = {

     # Additional stuff for the LaTeX preamble.
     #
'preamble': '\usepackage{amssymb}',
'preamble': r'''
\usepackage{amssymb}
\newcommand{\DUrolecredits}{\footnotesize\color{lightgray}\newline}
''',

     # Latex figure (float) alignment
     #
@@ -311,7 +180,7 @@ latex_show_urls = 'footnote'
# latex_domain_indices = True


# -- Options for manual page output ---------------------------------------
# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
@@ -325,7 +194,7 @@ man_pages = [
# man_show_urls = False


# -- Options for Texinfo output -------------------------------------------
# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
@@ -353,7 +222,7 @@ texinfo_documents = [
# texinfo_no_detailmenu = False


# -- Options for Epub output ----------------------------------------------
# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project
@@ -437,74 +306,13 @@ epub_exclude_files = ['search.html']
#
# epub_use_index = True

# -- Extension configurations ------------------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

# -- Options for pybtex ----------------------------------------------
from pybtex.style.formatting.unsrt import Style as UnsrtStyle, date, pages, toplevel
from pybtex.style.template import * # ... and anything else needed
from pybtex.plugin import register_plugin

class ADSArxivStyle(UnsrtStyle):

    def format_article(self, e):
        volume_and_pages = first_of [
            # volume and pages, with optional issue number
            optional [
                join [
                    field('volume'),
                    optional['(', field('number'),')'],
                    ':', pages
                ],
            ],
            # pages only
            words ['pages', pages],
        ]
        myurl = first_of [
                optional_field('adsurl'),
                join ['http://arxiv.org/abs/', optional_field('eprint')],
                optional_field('url'),
                optional [join ['http://dx.doi.org/', field('doi')]]
        ]
        template = toplevel [
            self.format_names('author'),
            href [myurl, self.format_title(e, 'title')] \
                if len(myurl.format_data(e)) > 0 \
                else tag('strong') [self.format_title(e, 'title')],
            sentence(capfirst=False) [
                tag('emph') [field('journal')],
                optional[ volume_and_pages ],
                field('year')],
            sentence(capfirst=False) [ optional_field('note') ],
        ]
        return template.format_data(e)

    def format_inproceedings(self, e):
        myurl = first_of [
                optional_field('adsurl'),
                optional [join ['http://arxiv.org/abs/', field('eprint')]],
                optional_field('url'),
                optional [join ['http://dx.doi.org/', field('doi')]]
        ]
        template = toplevel [
            sentence [self.format_names('author')],
            href [myurl, self.format_title(e, 'title')] \
                if len(myurl.format_data(e)) > 0 \
                else tag('strong') [self.format_title(e, 'title')],
            words [
                'In',
                sentence(capfirst=False) [
                    optional[ self.format_editor(e, as_sentence=False) ],
                    self.format_btitle(e, 'booktitle', as_sentence=False),
                    self.format_volume_and_series(e, as_sentence=False),
                    optional[ pages ],
                ],
                self.format_address_organization_publisher_date(e),
            ],
            sentence(capfirst=False) [ optional_field('note') ],
        ]
        return template.format_data(e)
# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

register_plugin('pybtex.style.formatting', 'adsarxiv', ADSArxivStyle)
# -- Options for pybtex ------------------------------------------------------
bibtex_bibfiles = ['references.bib']
+3 −0
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
.. |DAOPHOT| replace:: :program:`DAOPHOT`
.. _DAOPHOT: http://ascl.net/phpBB3/viewtopic.php?t=23410

.. |DES| replace:: :abbr:`Dark Energy Survey`
.. _DES: https://darkenergysurvey.org

.. |.dmg| replace:: :file:`.dmg`
.. _.dmg: https://en.wikipedia.org/wiki/Apple_Disk_Image

+42 −1
Original line number Diff line number Diff line
@@ -141,6 +141,26 @@ archivePrefix = "arXiv",
    pages = {1016-1022},
      doi = {10.1175/1520-0450(1979)018<1016:LFIOAT>2.0.CO;2},
}

@ARTICLE{2022ApJS_258_15E,
       author = {{Everett}, S. and {Yanny}, B. and {Kuropatkin}, N. and {Huff}, E.~M. and {Zhang}, Y. and {Myles}, J. and {Masegian}, A. and {Elvin-Poole}, J. and {Allam}, S. and {Bernstein}, G.~M. and {Sevilla-Noarbe}, I. and {Splettstoesser}, M. and {Sheldon}, E. and {Jarvis}, M. and {Amon}, A. and {Harrison}, I. and {Choi}, A. and {Hartley}, W.~G. and {Alarcon}, A. and {S{\'a}nchez}, C. and {Gruen}, D. and {Eckert}, K. and {Prat}, J. and {Tabbutt}, M. and {Busti}, V. and {Becker}, M.~R. and {MacCrann}, N. and {Diehl}, H.~T. and {Tucker}, D.~L. and {Bertin}, E. and {Jeltema}, T. and {Drlica-Wagner}, A. and {Gruendl}, R.~A. and {Bechtol}, K. and {Carnero Rosell}, A. and {Abbott}, T.~M.~C. and {Aguena}, M. and {Annis}, J. and {Bacon}, D. and {Bhargava}, S. and {Brooks}, D. and {Burke}, D.~L. and {Carrasco Kind}, M. and {Carretero}, J. and {Castander}, F.~J. and {Conselice}, C. and {Costanzi}, M. and {da Costa}, L.~N. and {Pereira}, M.~E.~S. and {De Vicente}, J. and {DeRose}, J. and {Desai}, S. and {Eifler}, T.~F. and {Evrard}, A.~E. and {Ferrero}, I. and {Fosalba}, P. and {Frieman}, J. and {Garc{\'\i}a-Bellido}, J. and {Gaztanaga}, E. and {Gerdes}, D.~W. and {Gutierrez}, G. and {Hinton}, S.~R. and {Hollowood}, D.~L. and {Honscheid}, K. and {Huterer}, D. and {James}, D.~J. and {Kent}, S. and {Krause}, E. and {Kuehn}, K. and {Lahav}, O. and {Lima}, M. and {Lin}, H. and {Maia}, M.~A.~G. and {Marshall}, J.~L. and {Melchior}, P. and {Menanteau}, F. and {Miquel}, R. and {Mohr}, J.~J. and {Morgan}, R. and {Muir}, J. and {Ogando}, R.~L.~C. and {Palmese}, A. and {Paz-Chinch{\'o}n}, F. and {Plazas}, A.~A. and {Rodriguez-Monroy}, M. and {Romer}, A.~K. and {Roodman}, A. and {Sanchez}, E. and {Scarpine}, V. and {Serrano}, S. and {Smith}, M. and {Soares-Santos}, M. and {Suchyta}, E. and {Swanson}, M.~E.~C. and {Tarle}, G. and {To}, C. and {Troxel}, M.~A. and {Varga}, T.~N. and {Weller}, J. and {Wilkinson}, R.~D. and {Wilkinson}, R.~D.},
        title = "{Dark Energy Survey Year 3 Results: Measuring the Survey Transfer Function with Balrog}",
      journal = {\apjs},
     keywords = {343, 1464, 351, 1857, Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Instrumentation and Methods for Astrophysics},
         year = 2022,
        month = jan,
       volume = {258},
       number = {1},
          eid = {15},
        pages = {15},
          doi = {10.3847/1538-4365/ac26c1},
archivePrefix = {arXiv},
       eprint = {2012.12825},
 primaryClass = {astro-ph.CO},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2022ApJS..258...15E},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{2002AA_395_1061G,
   author = {{Greisen}, E.~W. and {Calabretta}, M.~R.},
    title = "{Representations of world coordinates in FITS}",
@@ -283,6 +303,18 @@ archivePrefix = "arXiv",
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{1895RSTA_0010,
   author = {{Pearson}, K.},
    title = "{Contributions to the mathematical theory of evolution.—II. Skew variation in homogeneous material}",
  journal = {Philosophical Transactions of the Royal Society of London},
     year = 1895,
    month = jan,
   volume = 186,
    pages = {343-414},
      doi = {10.1098/rsta.1895.0010},
      url = {https://dx.doi.org/10.1098/rsta.1895.0010},
}

@ARTICLE{1976ApJ_209L_1P,
   author = {{Petrosian}, V.},
    title = "{Surface brightness and evolution of galaxies}",
@@ -340,13 +372,13 @@ author={{Saerens}, M. and {Latinne}, P. and {Decaestecker}, C.},
journal={IEEE Transactions on Neural Networks},
title={Any reasonable cost function can be used for a posteriori probability approximation},
year={2002},
month={Sep},
volume={13},
number={5},
pages={1204-1210},
keywords={Bayes methods;decision theory;learning (artificial intelligence);Bayes decision making;a posteriori probability;class membership;cost function;learning machine;loss function;subjective probability theory;Artificial intelligence;Artificial neural networks;Bayesian methods;Computational modeling;Cost function;Decision making;Input variables;Laboratories;Machine learning;Mean square error methods},
doi={10.1109/TNN.2002.1031952},
ISSN={1045-9227},
month={Sep}
}

@ARTICLE{1987PASP_99_191S,
@@ -542,6 +574,15 @@ publisher = {Cordoba, Argentina: Observatorio Astronomico, 1968},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@BOOK{1911AITS,
   author = {{Yule}, G.~U.},
    title = "{ An introduction to the theory of statistics}",
publisher = {C. Griffin and Company, limited},
     year = 1911,
      url = {https://archive.org/details/anintroductiont01yulegoog/page/n139/mode/2up},
}


@PHDTHESIS{1996PhDT_68B,
   author = {{Bertin}, E.},
    title = "{Photom\'etrie automatique de galaxies et contraintes sur leur \'evolution r\'ecente}",
+2 −2
Original line number Diff line number Diff line
@@ -689,8 +689,8 @@ float backguess(backstruct *bkg, float *mean, float *sigma)

  sig = 10.0*nlevelsm1;
  sig1 = 1.0;
  medfac = prefs.back_pearsons;
  meafac = prefs.back_pearsons - 1.0;
  medfac = prefs.back_pearson;
  meafac = prefs.back_pearson - 1.0;
  mea = med = bkg->mean;
  for (n=100; n-- && (sig>=0.1) && (fabs(sig/sig1-1.0)>EPS);)
    {
Loading