Commit 3b59ee2e authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Removed redundant code in astrom_pos().

Fixed random crashes with model fitting (thanks to S.Desai).
Fixed gain problem in PSF fitting.
Pushed version number to 2.8.9.
parent 952f3275
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for sextractor 2.8.8.
# Generated by GNU Autoconf 2.63 for sextractor 2.8.9.
#
# Report bugs to <bertin@iap.fr>.
#
......@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.8.8'
PACKAGE_STRING='sextractor 2.8.8'
PACKAGE_VERSION='2.8.9'
PACKAGE_STRING='sextractor 2.8.9'
PACKAGE_BUGREPORT='bertin@iap.fr'
 
ac_unique_file="src/makeit.c"
......@@ -1500,7 +1500,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sextractor 2.8.8 to adapt to many kinds of systems.
\`configure' configures sextractor 2.8.9 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
......@@ -1570,7 +1570,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.8.8:";;
short | recursive ) echo "Configuration of sextractor 2.8.9:";;
esac
cat <<\_ACEOF
 
......@@ -1697,7 +1697,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sextractor configure 2.8.8
sextractor configure 2.8.9
generated by GNU Autoconf 2.63
 
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
......@@ -1711,7 +1711,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by sextractor $as_me 2.8.8, which was
It was created by sextractor $as_me 2.8.9, which was
generated by GNU Autoconf 2.63. Invocation command line was
 
$ $0 $@
......@@ -2414,7 +2414,7 @@ fi
 
# Define the identity of the package.
PACKAGE='sextractor'
VERSION='2.8.8'
VERSION='2.8.9'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -28127,7 +28127,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sextractor $as_me 2.8.8, which was
This file was extended by sextractor $as_me 2.8.9, which was
generated by GNU Autoconf 2.63. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
......@@ -28190,7 +28190,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sextractor config.status 2.8.8
sextractor config.status 2.8.9
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
......
......@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)
# This is your standard Bertin source code...
AC_INIT(sextractor, 2.8.8, [bertin@iap.fr])
AC_INIT(sextractor, 2.8.9, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h)
......
.TH SEXTRACTOR "1" "July 2009" "SWarp 2.8.8" "User Commands"
.TH SEXTRACTOR "1" "August 2009" "SWarp 2.8.9" "User Commands"
.SH NAME
sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS
......
......@@ -9,7 +9,7 @@
*
* Contents: analyse(), endobject()...: measurements on detections.
*
* Last modify: 20/07/2009
* Last modify: 27/08/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -474,6 +474,7 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield,
if (FLAG(obj2.mxf) || FLAG(obj2.mxw))
astrom_pos(field, obj);
pixscale2 = 0.0; /* To avoid gcc -Wall warnings */
if (FLAG(obj2.mx2w)
|| FLAG(obj2.win_mx2w)
|| FLAG(obj2.poserr_mx2w)
......
......@@ -9,7 +9,7 @@
*
* Contents: Astrometrical computations.
*
* Last modify: 20/07/2009
* Last modify: 27/08/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -88,7 +88,7 @@ void astrom_pos(picstruct *field, objstruct *obj)
{
wcsstruct *wcs;
double rawpos[NAXIS], wcspos[NAXIS],
pixscale2, da,dd;
da,dd;
int lng,lat;
wcs = field->wcs;
......@@ -164,21 +164,6 @@ void astrom_pos(picstruct *field, objstruct *obj)
obj2->mamaposy = wcspos[0]*(MAMA_CORFLEX+1.0);
}
if (FLAG(obj2.mx2w)
|| FLAG(obj2.win_mx2w)
|| FLAG(obj2.poserr_mx2w)
|| FLAG(obj2.winposerr_mx2w)
|| FLAG(obj2.poserrmx2w_prof)
|| FLAG(obj2.prof_flagw)
|| ((!prefs.pixel_scale) && (FLAG(obj2.npixw)
|| FLAG(obj2.fdnpixw)
|| FLAG(obj2.fwhmw))))
{
rawpos[0] = obj2->posx;
rawpos[1] = obj2->posy;
pixscale2 = wcs_jacobian(wcs, rawpos, obj2->jacob);
}
return;
}
......
......@@ -9,7 +9,7 @@
*
* Contents: Fit an arbitrary profile combination to a detection.
*
* Last modify: 13/07/2009
* Last modify: 07/08/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -168,7 +168,7 @@ OUTPUT Pointer to an allocated fit structure (containing details about the
fit).
NOTES It is a modified version of the lm_minimize() of lmfit.
AUTHOR E. Bertin (IAP)
VERSION 13/07/2009
VERSION 29/05/2009
***/
void profit_fit(profitstruct *profit,
picstruct *field, picstruct *wfield,
......@@ -178,10 +178,8 @@ void profit_fit(profitstruct *profit,
patternstruct *pattern;
psfstruct *psf;
checkstruct *check;
double *oldparaminit,
psf_fwhm, a , cp,sp, emx2,emy2,emxy, dchi2, err,
oldchi2;
int i,j,p, nparam, ncomp, nprof, oldniter;
double psf_fwhm, a , cp,sp, emx2,emy2,emxy, dchi2, err;
int i,j,p, nparam, ncomp, nprof;
nparam = profit->nparam;
nprof = profit->nprof;
......@@ -259,21 +257,7 @@ the_gal++;
/* Actual minimisation */
profit->niter = profit_minimize(profit, PROFIT_MAXITER);
profit_residuals(profit,field,wfield, 10.0, profit->param,profit->resi);
/*
oldchi2 = profit->chi2;
oldniter = profit->niter;
oldparaminit = profit_reresetparams(profit);
profit->niter = profit_minimize(profit, PROFIT_MAXITER);
if (profit->chi2 > oldchi2)
{
memcpy(profit->paraminit, oldparaminit, nparam*sizeof(double));
profit->chi2 = oldchi2;
profit->niter = oldniter;
}
else
obj2->prof_flag |= PROFIT_FLIPPED;
free(oldparaminit);
*/
/*
QMEMCPY(profit->paraminit, oldparaminit, double, nparam);
if (profit_setparam(profit, PARAM_ARMS_PITCH, 160.0, 130.0, 175.0)==RETURN_OK)
......@@ -609,7 +593,7 @@ INPUT Profile-fitting structure.
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 30/06/2009
VERSION 22/10/2008
***/
void profit_psf(profitstruct *profit)
{
......@@ -660,7 +644,6 @@ void profit_psf(profitstruct *profit)
*(pixout++) *= norm;
}
return;
}
......@@ -714,9 +697,9 @@ int profit_minimize(profitstruct *profit, int niter)
/* Perform fit */
lm_opts[0] = 1.0e-3;
lm_opts[1] = 1.0e-17;
lm_opts[2] = 1.0e-17;
lm_opts[3] = 1.0e-17;
lm_opts[1] = 1.0e-18;
lm_opts[2] = 1.0e-18;
lm_opts[3] = 1.0e-18;
lm_opts[4] = 1.0e-6;
niter = dlevmar_dif(profit_evaluate, profit->paraminit, profit->resi,
......@@ -885,8 +868,8 @@ double *profit_compresi(profitstruct *profit, double dynparam, double *resi)
val = *(objpix++);
if ((wval=*(objweight++))>0.0)
{
val2 = (val - *lmodpix)*invsig;
// val2 = val2>0.0? sqrt(1.0+val2) - 1.0 : 1.0 - sqrt(1.0-val2);
val2 = (val - *lmodpix)*wval*invsig;
val2 = val2>0.0? LOGF(1.0+val2) : -LOGF(1.0-val2);
*(resit++) = val2*dynparam;
error += val2*val2;
}
......@@ -1641,35 +1624,6 @@ void profit_resetparam(profitstruct *profit, paramenum paramtype)
}
/****** profit_reresetparams ****************************************************
PROTO double *profit_reresetparams(profitstruct *profit)
PURPOSE Reset profile parameters once more according to previous findings.
INPUT Pointer to the profit structure.
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 13/07/2009
***/
double *profit_reresetparams(profitstruct *profit)
{
double *param, *parami;
int p, nparam;
QMEMCPY(profit->paraminit, param, double, PARAM_NPARAM);
nparam = profit->nparam;
profit_resetparams(profit);
profit_boundtounbound(profit, profit->paraminit);
profit_boundtounbound(profit, param);
parami = profit->paraminit;
for (p=0; p<nparam; p++)
parami[p] = 3.0*param[p] - 2.0*parami[p];
profit_unboundtobound(profit, profit->paraminit);
profit_unboundtobound(profit, param);
return param;
}
/****** profit_resetparams ****************************************************
PROTO void profit_resetparams(profitstruct *profit)
PURPOSE Set the initial, lower and upper boundary values of profile parameters.
......@@ -1691,7 +1645,6 @@ void profit_resetparams(profitstruct *profit)
}
/****** profit_setparam ****************************************************
PROTO void profit_setparam(profitstruct *profit, paramenum paramtype,
double param, double parammin, double parammax)
......@@ -2038,7 +1991,7 @@ INPUT Profile structure,
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 03/10/2008
VERSION 07/08/2009
***/
void prof_add(profstruct *prof, profitstruct *profit)
{
......@@ -2430,7 +2383,7 @@ width = 3.0;
/* Threshold and measure the flux */
flux = 0.0;
pixin = profit->pmodpix;
for (n=npix; n--; pixin++)
for (i=npix; i--; pixin++)
if (*pixin >= thresh)
flux += *pixin;
else
......@@ -2441,7 +2394,7 @@ width = 3.0;
prof->fluxfac = fluxfac;
pixin = profit->pmodpix;
pixout = profit->modpix;
for (n=npix; n--;)
for (i=npix; i--;)
*(pixout++) += fluxfac * *(pixin++);
return;
......
......@@ -9,7 +9,7 @@
*
* Contents: Include file for profit.c.
*
* Last modify: 13/07/2009
* Last modify: 20/03/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -144,7 +144,6 @@ profstruct *prof_init(profitstruct *profit, proftypenum profcode);
double *profit_compresi(profitstruct *profit, double dynparam,
double *resi),
*profit_reresetparams(profitstruct *profit),
*profit_residuals(profitstruct *profit, picstruct *field,
picstruct *wfield, double dynparam,
double *param, double *resi),
......
......@@ -10,7 +10,7 @@
*
* Contents: Fit the PSF to a detection.
*
* Last modify: 19/12/2007
* Last modify: 19/08/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -339,7 +339,7 @@ void psf_fit(psfstruct *psf, picstruct *field, picstruct *wfield,
niter = 0;
npsfmax = prefs.psf_npsfmax;
pixstep = 1.0/psf->pixstep;
gain = field->gain;
gain = (field->gain >0.0? field->gain: 1e30);
backnoise2 = field->backsig*field->backsig;
satlevel = field->satur_level - obj->bkg;
wthresh = wfield?wfield->weight_thresh:BIG;
......@@ -763,7 +763,7 @@ void double_psf_fit(psfstruct *ppsf, picstruct *pfield, picstruct *pwfield,
pdx = pdy =dx = dy = 0.0;
ppixstep = 1.0/ppsf->pixstep;
pixstep = 1.0/psf->pixstep;
gain = field->gain;
gain = (field->gain >0.0? field->gain: 1e30);
npsfmax=prefs.psf_npsfmax;
pbacknoise2 = pfield->backsig*pfield->backsig;
satlevel = field->satur_level - obj->bkg;
......
......@@ -153,7 +153,6 @@ typedef struct
/* ---- astrometric data */
double posx,posy; /* "FITS" pos. in pixels */
double jacob[NAXIS*NAXIS]; /* Local deproject. Jacobian */
double mamaposx,mamaposy; /* "MAMA" pos. in pixels */
float sposx,sposy; /* single precision pos. */
float poserr_a, poserr_b,
......@@ -170,10 +169,10 @@ typedef struct
float poserr_cxxw, poserr_cyyw,
poserr_cxyw; /* WORLD error ellipse */
double mx2w,my2w,mxyw; /* WORLD var. and covar. */
double peakxw, peakyw; /* WORLD of brightest pix */
double peakxf, peakyf; /* FOCAL of brightest pix */
double mxw, myw; /* WORLD barycenters */
double peakxw, peakyw; /* WORLD of brightest pix */
double mxf, myf; /* FOCAL barycenters */
double mxw, myw; /* WORLD barycenters */
double alphas, deltas; /* native alpha, delta */
float thetas; /* native position angle E/N*/
double peakalphas, peakdeltas; /* native for brightest pix */
......@@ -236,8 +235,8 @@ typedef struct
float win_theta1950; /* B1950 error pos. angle */
float win_cxxw, win_cyyw,
win_cxyw; /* WORLD ellipse parameters */
double winpos_xw, winpos_yw; /* WORLD coordinates */
double winpos_xf, winpos_yf; /* FOCAL coordinates */
double winpos_xw, winpos_yw; /* WORLD coordinates */
double winpos_alphas, winpos_deltas; /* native alpha, delta */
double winpos_alpha2000, winpos_delta2000; /* J2000 alpha, delta */
double winpos_alpha1950, winpos_delta1950; /* B1950 alpha, delta */
......@@ -315,8 +314,8 @@ typedef struct
float mag_prof; /* Mag from model-fitting */
float magerr_prof; /* RMS mag from model-fitting */
float x_prof, y_prof; /* Coords from model-fitting*/
double xw_prof, yw_prof; /* WORLD coordinates */
double xf_prof, yf_prof; /* FOCAL coordinates */
double xw_prof, yw_prof; /* WORLD coords */
double alphas_prof, deltas_prof; /* native alpha, delta */
double alpha2000_prof, delta2000_prof; /* J2000 alpha, delta */
double alpha1950_prof, delta1950_prof; /* B1950 alpha, delta */
......
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