Commit 4d8f6615 authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed world coordinates in PSF-fitting.

Fixed error ellipse measurements in PSF-fitting (but works only for PSF_NMAX=1 currently).
Simplified PSF parameter handling (removed PSFDISPLAY_TYPE configuration option).
Simplified triggering of local north axis computation.
Allowed model axis ratios to exceed 1 to facilitate convergence.
Fixed alignment bug for symmetric models.
Restricted maximum allowed range for model coordinates.
Pushed version number to 2.10.0.
parent 98adcc78
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
#! /bin/sh
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for sextractor 2.9.9.
# Generated by GNU Autoconf 2.63 for sextractor 2.10.0.
#
#
# Report bugs to <bertin@iap.fr>.
# Report bugs to <bertin@iap.fr>.
#
#
@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
# Identity of this package.
PACKAGE_NAME='sextractor'
PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.9.9'
PACKAGE_VERSION='2.10.0'
PACKAGE_STRING='sextractor 2.9.9'
PACKAGE_STRING='sextractor 2.10.0'
PACKAGE_BUGREPORT='bertin@iap.fr'
PACKAGE_BUGREPORT='bertin@iap.fr'
ac_unique_file="src/makeit.c"
ac_unique_file="src/makeit.c"
@@ -1505,7 +1505,7 @@ if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # 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.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
  cat <<_ACEOF
\`configure' configures sextractor 2.9.9 to adapt to many kinds of systems.
\`configure' configures sextractor 2.10.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1575,7 +1575,7 @@ fi
if test -n "$ac_init_help"; then
if test -n "$ac_init_help"; then
  case $ac_init_help in
  case $ac_init_help in
     short | recursive ) echo "Configuration of sextractor 2.9.9:";;
     short | recursive ) echo "Configuration of sextractor 2.10.0:";;
   esac
   esac
  cat <<\_ACEOF
  cat <<\_ACEOF
@@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
if $ac_init_version; then
  cat <<\_ACEOF
  cat <<\_ACEOF
sextractor configure 2.9.9
sextractor configure 2.10.0
generated by GNU Autoconf 2.63
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1720,7 +1720,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
running configure, to aid debugging if configure makes a mistake.
It was created by sextractor $as_me 2.9.9, which was
It was created by sextractor $as_me 2.10.0, which was
generated by GNU Autoconf 2.63.  Invocation command line was
generated by GNU Autoconf 2.63.  Invocation command line was
  $ $0 $@
  $ $0 $@
@@ -2423,7 +2423,7 @@ fi
# Define the identity of the package.
# Define the identity of the package.
 PACKAGE='sextractor'
 PACKAGE='sextractor'
 VERSION='2.9.9'
 VERSION='2.10.0'
cat >>confdefs.h <<_ACEOF
cat >>confdefs.h <<_ACEOF
@@ -28535,7 +28535,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
# values after options handling.
ac_log="
ac_log="
This file was extended by sextractor $as_me 2.9.9, which was
This file was extended by sextractor $as_me 2.10.0, which was
generated by GNU Autoconf 2.63.  Invocation command line was
generated by GNU Autoconf 2.63.  Invocation command line was
  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_FILES    = $CONFIG_FILES
@@ -28598,7 +28598,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
ac_cs_version="\\
sextractor config.status 2.9.9
sextractor config.status 2.10.0
configured by $0, generated by GNU Autoconf 2.63,
configured by $0, generated by GNU Autoconf 2.63,
  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+1 −1
Original line number Original line Diff line number Diff line
@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)
define([AC_CACHE_SAVE],)


# This is your standard Bertin source code...
# This is your standard Bertin source code...
AC_INIT(sextractor, 2.9.9, [bertin@iap.fr])
AC_INIT(sextractor, 2.10.0, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(config.h)
+1 −1
Original line number Original line Diff line number Diff line
.TH SEXTRACTOR "1" "December 2009" "SWarp 2.9.9" "User Commands"
.TH SEXTRACTOR "1" "December 2009" "SWarp 2.10.0" "User Commands"
.SH NAME
.SH NAME
sex \- extract a source catalog from an astronomical FITS image
sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS
.SH SYNOPSIS
+20 −37
Original line number Original line Diff line number Diff line
@@ -9,7 +9,7 @@
*
*
*	Contents:	analyse(), endobject()...: measurements on detections.
*	Contents:	analyse(), endobject()...: measurements on detections.
*
*
*	Last modify:	01/12/2009
*	Last modify:	15/12/2009
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
*/
@@ -488,6 +488,7 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield,
	|| FLAG(obj2.win_mx2w)
	|| FLAG(obj2.win_mx2w)
	|| FLAG(obj2.poserr_mx2w)
	|| FLAG(obj2.poserr_mx2w)
	|| FLAG(obj2.winposerr_mx2w)
	|| FLAG(obj2.winposerr_mx2w)
	|| FLAG(obj2.poserrmx2w_psf)
	|| FLAG(obj2.poserrmx2w_prof)
	|| FLAG(obj2.poserrmx2w_prof)
	|| FLAG(obj2.prof_flagw)
	|| FLAG(obj2.prof_flagw)
	|| ((!prefs.pixel_scale) && FLAG(obj2.area_flagw)))
	|| ((!prefs.pixel_scale) && FLAG(obj2.area_flagw)))
@@ -671,31 +672,10 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield,
      else
      else
        psf_fit(thepsf, field, wfield, obj);
        psf_fit(thepsf, field, wfield, obj);
      obj2->npsf = thepsfit->npsf;
      obj2->npsf = thepsfit->npsf;
      if (prefs.psfdisplay_type == PSFDISPLAY_SPLIT)
        {
      nsub = thepsfit->npsf;
      nsub = thepsfit->npsf;
      if (nsub<1)
      if (nsub<1)
        nsub = 1;
        nsub = 1;
      }
      }
      else
        for (j=0; j<thepsfit->npsf; j++)
          {
          if (FLAG(obj2.x_psf) && j<prefs.psf_xsize)
            obj2->x_psf[j] = thepsfit->x[j];
          if (FLAG(obj2.y_psf) && j<prefs.psf_ysize)
            obj2->y_psf[j] = thepsfit->y[j];
          if (FLAG(obj2.flux_psf) && j<prefs.psf_fluxsize)
            obj2->flux_psf[j] = thepsfit->flux[j];
          if (FLAG(obj2.magerr_psf) && j<prefs.psf_magerrsize)
            obj2->magerr_psf[j] = obj2->fluxerr_psf[j]>0.0?
		1.086*obj2->fluxerr_psf[j]/thepsfit->flux[j] : 99.0;
          if (FLAG(obj2.fluxerr_psf) && j<prefs.psf_fluxerrsize)
            obj2->fluxerr_psf[j] = obj2->fluxerr_psf[j];     
          if (FLAG(obj2.mag_psf) && j<prefs.psf_magsize)
            obj2->mag_psf[j] = thepsfit->flux[j]>0.0?
		prefs.mag_zeropoint -2.5*log10(thepsfit->flux[j]) : 99.0;
          }
      }


/*----------------------------- Profile fitting -----------------------------*/
/*----------------------------- Profile fitting -----------------------------*/
    if (prefs.prof_flag)
    if (prefs.prof_flag)
@@ -726,23 +706,26 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield,
/*-- Go through each newly identified component */
/*-- Go through each newly identified component */
    for (j=0; j<nsub; j++)
    for (j=0; j<nsub; j++)
      {
      {
      if (prefs.psf_flag && prefs.psfdisplay_type == PSFDISPLAY_SPLIT)
      if (prefs.psf_flag)
        {
        {
        if (FLAG(obj2.x_psf))
        obj2->x_psf = thepsfit->x[j];
          obj2->x_psf[0] = thepsfit->x[j];
        obj2->y_psf = thepsfit->y[j];
        if (FLAG(obj2.y_psf))
        if (FLAG(obj2.xf_psf) || FLAG(obj2.xw_psf))
          obj2->y_psf[0] = thepsfit->y[j];
          astrom_psfpos(field, obj);
/*------ Express position error parameters in the FOCAL or WORLD frame */
        if (FLAG(obj2.poserrmx2w_psf))
          astrom_psferrparam(field, obj);
        if (FLAG(obj2.flux_psf))
        if (FLAG(obj2.flux_psf))
          obj2->flux_psf[0] = thepsfit->flux[j]>0.0? thepsfit->flux[j]:0.0; /*?*/
          obj2->flux_psf = thepsfit->flux[j]>0.0? thepsfit->flux[j]:0.0; /*?*/
        if (FLAG(obj2.mag_psf))
        if (FLAG(obj2.mag_psf))
          obj2->mag_psf[0] = thepsfit->flux[j]>0.0?
          obj2->mag_psf = thepsfit->flux[j]>0.0?
		prefs.mag_zeropoint -2.5*log10(thepsfit->flux[j]) : 99.0;
		prefs.mag_zeropoint -2.5*log10(thepsfit->flux[j]) : 99.0;
        if (FLAG(obj2.magerr_psf))
          obj2->magerr_psf[0]=
		(thepsfit->flux[j]>0.0 && obj2->fluxerr_psf[j]>0.0) ? /*?*/
			1.086*obj2->fluxerr_psf[j]/thepsfit->flux[j] : 99.0;
        if (FLAG(obj2.fluxerr_psf))
        if (FLAG(obj2.fluxerr_psf))
          obj2->fluxerr_psf[0]= obj2->fluxerr_psf[j];
          obj2->fluxerr_psf= thepsfit->fluxerr[j];
        if (FLAG(obj2.magerr_psf))
          obj2->magerr_psf =
		(thepsfit->flux[j]>0.0 && thepsfit->fluxerr[j]>0.0) ? /*?*/
			1.086*thepsfit->fluxerr[j]/thepsfit->flux[j] : 99.0;
        if (j)
        if (j)
          obj->number = ++thecat.ntotal;
          obj->number = ++thecat.ntotal;
        }
        }
+135 −10
Original line number Original line Diff line number Diff line
@@ -9,7 +9,7 @@
*
*
*	Contents:	Astrometrical computations.
*	Contents:	Astrometrical computations.
*
*
*	Last modify:	27/08/2009
*	Last modify:	15/12/2009
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
*/
@@ -46,15 +46,7 @@ void initastrom(picstruct *field)
/* Test if the WCS is in use */
/* Test if the WCS is in use */
  if (wcs->lng != wcs->lat)
  if (wcs->lng != wcs->lat)
    {
    {
    if (FLAG(obj2.theta2000) || FLAG(obj2.theta1950)
    if (FLAG(obj2.dtheta2000) || FLAG(obj2.dtheta1950))
	|| FLAG(obj2.poserr_theta2000) || FLAG(obj2.poserr_theta1950)
	|| FLAG(obj2.win_theta2000) || FLAG(obj2.win_theta1950)
	|| FLAG(obj2.winposerr_theta2000) || FLAG(obj2.winposerr_theta1950)
	|| FLAG(obj2.prof_spheroid_theta2000)
	|| FLAG(obj2.prof_spheroid_theta1950)
	|| FLAG(obj2.prof_disk_theta2000) || FLAG(obj2.prof_disk_theta1950)
//	|| FLAG(obj2.prof_arms_theta2000) || FLAG(obj2.prof_arms_theta1950)
	|| FLAG(obj2.prof_bar_theta2000) || FLAG(obj2.prof_bar_theta1950))
      {
      {
      if (fabs(wcs->equinox-2000.0)>0.003)
      if (fabs(wcs->equinox-2000.0)>0.003)
        precess(wcs->equinox, 0.0, 90.0, 2000.0, &wcs->ap2000, &wcs->dp2000);
        precess(wcs->equinox, 0.0, 90.0, 2000.0, &wcs->ap2000, &wcs->dp2000);
@@ -278,6 +270,61 @@ void astrom_winpos(picstruct *field, objstruct *obj)
  }
  }




/****************************** astrom_psfpos *******************************/
/*
Compute real FOCAL and WORLD PSF coordinates according to FITS info.
*/
void	astrom_psfpos(picstruct *field, objstruct *obj)

  {
   wcsstruct	*wcs;
   double	rawpos[NAXIS], wcspos[NAXIS];
   int		lng,lat;

  wcs = field->wcs;
  lng = wcs->lng;
  lat = wcs->lat;

  if (FLAG(obj2.xf_psf))
    {
    rawpos[0] = obj2->x_psf;
    rawpos[1] = obj2->y_psf;
    raw_to_red(wcs, rawpos, wcspos);
    obj2->xf_psf = wcspos[0];
    obj2->yf_psf = wcspos[1];
    }
  if (FLAG(obj2.xw_psf))
    {
    rawpos[0] = obj2->x_psf;
    rawpos[1] = obj2->y_psf;
    raw_to_wcs(wcs, rawpos, wcspos);
    obj2->xw_psf = wcspos[0];
    obj2->yw_psf = wcspos[1];
    if (lng != lat)
      {
      obj2->alphas_psf = lng<lat? obj2->xw_psf : obj2->yw_psf;
      obj2->deltas_psf = lng<lat? obj2->yw_psf : obj2->xw_psf;
      if (FLAG(obj2.alpha2000_psf))
        {
        if (fabs(wcs->equinox-2000.0)>0.003)
          precess(wcs->equinox, wcspos[0], wcspos[1],
		2000.0, &obj2->alpha2000_psf, &obj2->delta2000_psf);
        else
          {
          obj2->alpha2000_psf = lng<lat? obj2->xw_psf : obj2->yw_psf;
          obj2->delta2000_psf = lng<lat? obj2->yw_psf : obj2->xw_psf;
          }
        if (FLAG(obj2.alpha1950_psf))
          j2b(wcs->equinox, obj2->alpha2000_psf, obj2->delta2000_psf,
		&obj2->alpha1950_psf, &obj2->delta1950_psf);
        }
      }
    }

  return;
  }


/****************************** astrom_profpos *******************************/
/****************************** astrom_profpos *******************************/
/*
/*
Compute real FOCAL and WORLD profit coordinates according to FITS info.
Compute real FOCAL and WORLD profit coordinates according to FITS info.
@@ -644,6 +691,84 @@ void astrom_winerrparam(picstruct *field, objstruct *obj)
  }
  }




/***************************** astrom_psferrparam ***************************/
/*
Compute error ellipse parameters in WORLD and SKY coordinates.
*/
void	astrom_psferrparam(picstruct *field, objstruct *obj)
  {
   wcsstruct	*wcs;
   double	dx2,dy2,dxy, xm2,ym2,xym, temp,pm2, lm0,lm1,lm2,lm3;
   int		lng,lat, naxis;

  wcs = field->wcs;
  naxis = wcs->naxis;
  lng = wcs->lng;
  lat = wcs->lat;
  if (lng == lat)
    {
    lng = 0;
    lat = 1;
    }
  lm0 = obj2->jacob[lng+naxis*lng];
  lm1 = obj2->jacob[lat+naxis*lng];
  lm2 = obj2->jacob[lng+naxis*lat];
  lm3 = obj2->jacob[lat+naxis*lat];

/* All WORLD params based on 2nd order moments have to pass through here */
  dx2 = obj2->poserrmx2_psf;
  dy2 = obj2->poserrmy2_psf;
  dxy = obj2->poserrmxy_psf;
  obj2->poserrmx2w_psf = xm2 = lm0*lm0*dx2+lm1*lm1*dy2+lm0*lm1*dxy;
  obj2->poserrmy2w_psf = ym2 = lm2*lm2*dx2+lm3*lm3*dy2+lm2*lm3*dxy;
  obj2->poserrmxyw_psf = xym = lm0*lm2*dx2+lm1*lm3*dy2+(lm0*lm3+lm1*lm2)*dxy;
  temp=xm2-ym2;
  if (FLAG(obj2.poserrthetaw_psf))
    {
    obj2->poserrthetaw_psf = (fmod_m90_p90(temp==0.0)?
				(45.0):(0.5*atan2(2.0*xym,temp)/DEG));

/*-- Compute position angles in J2000 or B1950 reference frame */
    if (wcs->lng != wcs->lat)
      {
      if (FLAG(obj2.poserrthetas_psf))
        obj2->poserrthetas_psf = fmod_m90_p90(lng<lat?
		((obj2->poserrthetaw_psf>0.0?90:-90.0)-obj2->poserrthetaw_psf)
		: obj2->poserrthetaw_psf);
      if (FLAG(obj2.poserrtheta2000_psf))
        obj2->poserrtheta2000_psf = fmod_m90_p90(obj2->poserrthetas_psf
				+ obj2->dtheta2000);
      if (FLAG(obj2.poserrtheta1950_psf))
        obj2->poserrtheta1950_psf = fmod_m90_p90(obj2->poserrthetas_psf
				+ obj2->dtheta1950);
      }
    }

  if (FLAG(obj2.poserraw_psf))
    {
    temp = sqrt(0.25*temp*temp+xym*xym);
    pm2 = 0.5*(xm2+ym2);
    obj2->poserraw_psf = (float)sqrt(pm2+temp);
    obj2->poserrbw_psf = (float)sqrt(pm2-temp);
    }

  if (FLAG(obj2.poserrcxxw_psf))
    {
/*-- Handle large, fully correlated profiles (can cause a singularity...) */
    if ((temp=xm2*ym2-xym*xym)<1e-6)
      {
      temp = 1e-6;
      xym *= 0.99999;
      }
    obj2->poserrcxxw_psf = (float)(ym2/temp);
    obj2->poserrcyyw_psf = (float)(xm2/temp);
    obj2->poserrcxyw_psf = (float)(-2*xym/temp);
    }

  return;
  }


/***************************** astrom_proferrparam ***************************/
/***************************** astrom_proferrparam ***************************/
/*
/*
Compute error ellipse parameters in WORLD and SKY coordinates.
Compute error ellipse parameters in WORLD and SKY coordinates.
Loading