Unverified Commit 34c3c87c authored by Emmanuel Bertin's avatar Emmanuel Bertin Committed by GitHub
Browse files

Merge pull request #45 from astromatic/Pearsons

Add a config option to change Pearson's factor in background mode estimation
parents 1f1191b0 f66d6f79
......@@ -7,7 +7,7 @@
#
# This file part of: SExtractor
#
# Copyright: (C) 2002-2023 IAP/CNRS/SorbonneU
# Copyright: (C) 2002-2023 CFHT/IAP/CNRS/SorbonneU
#
# License: GNU General Public License
#
......@@ -22,7 +22,7 @@
# You should have received a copy of the GNU General Public License
# along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
#
# Last modified: 26/02/2023
# Last modified: 07/03/2023
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)
# This is your standard AstrOmatic source code...
AC_INIT([SExtractor],[2.27.1],[astromatic@astromatic.iap.fr],
AC_INIT([SExtractor],[2.28.0],[astromatic@astromatic.iap.fr],
[sextractor],[http://astromatic.net/software/sextractor])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(autoconf)
......
......@@ -67,9 +67,9 @@ author = u'E. Bertin'
# built documents.
#
# The short X.Y version.
version = '2.27.1'
version = '2.28.0'
# The full version, including alpha/beta/rc tags.
release = '2.27.1'
release = '2.28.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......@@ -144,7 +144,7 @@ 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.27.1'
# html_title = u'SExtractor v2.28.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#
......
......@@ -673,7 +673,7 @@ float backguess(backstruct *bkg, float *mean, float *sigma)
{
LONG *histo, *hilow, *hihigh, *histot;
unsigned long lowsum, highsum, sum;
double ftemp, mea, sig, sig1, med, dpix;
double ftemp, mea,meafac, sig, sig1, med,medfac, dpix;
int i, n, lcut,hcut, nlevelsm1, pix;
/* Leave here if the mesh is already classified as `bad' */
......@@ -689,6 +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;
mea = med = bkg->mean;
for (n=100; n-- && (sig>=0.1) && (fabs(sig/sig1-1.0)>EPS);)
{
......@@ -725,7 +727,7 @@ float backguess(backstruct *bkg, float *mean, float *sigma)
*mean = fabs(sig)>0.0? (fabs(bkg->sigma/(sig*bkg->qscale)-1) < 0.0 ?
bkg->qzero+mea*bkg->qscale
:(fabs((mea-med)/sig)< 0.3 ?
bkg->qzero+(2.5*med-1.5*mea)*bkg->qscale
bkg->qzero+(medfac*med - meafac*mea)*bkg->qscale
:bkg->qzero+med*bkg->qscale))
:bkg->qzero+mea*bkg->qscale;
......
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 15/07/2020
* Last modified: 07/03/2023
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -61,6 +61,7 @@
{"BACK_FILTERSIZE", P_INTLIST, prefs.backfsize, 1,11, 0.0,0.0,
{""}, 1,2, &prefs.nbackfsize},
{"BACK_FILTTHRESH", P_FLOAT, &prefs.backfthresh, 0,0, 0.0,BIG},
{"BACK_PEARSONS", P_FLOAT, &prefs.back_pearsons, 0,0, 1.0,BIG},
{"BACKPHOTO_THICK", P_INT, &prefs.pback_size, 1, 256},
{"BACKPHOTO_TYPE", P_KEY, &prefs.pback_type, 0,0, 0.0,0.0,
{"GLOBAL","LOCAL",""}},
......@@ -261,6 +262,9 @@ char *default_prefs[] =
" ",
"*BACK_TYPE AUTO # AUTO or MANUAL",
"*BACK_VALUE 0.0 # Default background value in MANUAL mode",
"*BACK_PEARSONS 2.5 # Pearson's factor P >= 1 with",
"* # (mean - mode) ~ P * (mean - median)",
"* # Legacy value is 2.5, but 3.5 is more accurate",
"BACK_SIZE 64 # Background mesh: <size> or <width>,<height>",
"BACK_FILTERSIZE 3 # Background filter: <size> or <width>,<height>",
" ",
......
......@@ -7,7 +7,7 @@
*
* This file part of: SExtractor
*
* Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU
* Copyright: (C) 1993-2023 IAP/CNRS/SorbonneU
*
* License: GNU General Public License
*
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 15/07/2020
* Last modified: 07/03/2023
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -136,6 +136,7 @@ typedef struct
int backfsize[2]; /* bkgnd filt. size */
int nbackfsize; /* nb of params */
double backfthresh; /* bkgnd fil. thresh */
double back_pearsons; /* Pearson's factor */
enum {GLOBAL, LOCAL} pback_type; /* phot. bkgnd type */
int pback_size; /* rect. ann. width */
/*----- memory */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment