Commit d242beed authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Added new NLOWWEIGHT_ISO and NLOWDWEIGHT_ISO parameters that count the number...

Added new NLOWWEIGHT_ISO and NLOWDWEIGHT_ISO parameters that count the number of bad pixels within the measured isophotal footprint, and within one pixel of the detected isophotal footprint, respectively.
FLAGS_WEIGHT is now working without crashing.
Pushed version number to 2.9.3.
parent 1d1d4318
#! /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.2. # Generated by GNU Autoconf 2.63 for sextractor 2.9.3.
# #
# Report bugs to <bertin@iap.fr>. # Report bugs to <bertin@iap.fr>.
# #
...@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -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.2' PACKAGE_VERSION='2.9.3'
PACKAGE_STRING='sextractor 2.9.2' PACKAGE_STRING='sextractor 2.9.3'
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 ...@@ -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.2 to adapt to many kinds of systems. \`configure' configures sextractor 2.9.3 to adapt to many kinds of systems.
   
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
   
...@@ -1575,7 +1575,7 @@ fi ...@@ -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.2:";; short | recursive ) echo "Configuration of sextractor 2.9.3:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
   
...@@ -1706,7 +1706,7 @@ fi ...@@ -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.2 sextractor configure 2.9.3
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 ...@@ -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.2, which was It was created by sextractor $as_me 2.9.3, 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 ...@@ -2423,7 +2423,7 @@ fi
   
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sextractor' PACKAGE='sextractor'
VERSION='2.9.2' VERSION='2.9.3'
   
   
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -28290,7 +28290,7 @@ exec 6>&1 ...@@ -28290,7 +28290,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.2, which was This file was extended by sextractor $as_me 2.9.3, 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
...@@ -28353,7 +28353,7 @@ Report bugs to <bug-autoconf@gnu.org>." ...@@ -28353,7 +28353,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.2 sextractor config.status 2.9.3
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'`\\"
   
......
...@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],) ...@@ -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.2, [bertin@iap.fr]) AC_INIT(sextractor, 2.9.3, [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)
......
.TH SEXTRACTOR "1" "September 2009" "SWarp 2.9.2" "User Commands" .TH SEXTRACTOR "1" "October 2009" "SWarp 2.9.3" "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
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: analyse(), endobject()...: measurements on detections. * Contents: analyse(), endobject()...: measurements on detections.
* *
* Last modify: 24/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "profit.h" #include "profit.h"
#include "retina.h" #include "retina.h"
#include "som.h" #include "som.h"
#include "weight.h"
#include "winpos.h" #include "winpos.h"
static obj2struct *obj2 = &outobj2; static obj2struct *obj2 = &outobj2;
...@@ -63,7 +64,6 @@ void analyse(picstruct *field, picstruct *dfield, int objnb, ...@@ -63,7 +64,6 @@ void analyse(picstruct *field, picstruct *dfield, int objnb,
examineiso(field, dfield, obj, objlist->plist); examineiso(field, dfield, obj, objlist->plist);
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* Put here your calls to custom functions related to isophotal measurements. /* Put here your calls to custom functions related to isophotal measurements.
Ex: Ex:
...@@ -234,6 +234,10 @@ void examineiso(picstruct *field, picstruct *dfield, objstruct *obj, ...@@ -234,6 +234,10 @@ void examineiso(picstruct *field, picstruct *dfield, objstruct *obj,
if (PLISTEXIST(flag)) if (PLISTEXIST(flag))
getflags(obj, pixel); getflags(obj, pixel);
/* Flag and count pixels with a low weight */
if (PLISTEXIST(wflag))
weight_count(obj, pixel);
if (cleanflag) if (cleanflag)
{ {
obj->mthresh = *heap; obj->mthresh = *heap;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: functions for output of catalog data. * Contents: functions for output of catalog data.
* *
* Last modify: 29/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -599,6 +599,8 @@ void updateparamflags() ...@@ -599,6 +599,8 @@ void updateparamflags()
for (i=0; i<NISO; i++) for (i=0; i<NISO; i++)
FLAG(obj.iso[0]) |= FLAG(obj.iso[i]); FLAG(obj.iso[0]) |= FLAG(obj.iso[i]);
FLAG(obj.wflag) |= FLAG(obj.nzwpix) | FLAG(obj.nzdwpix);
return; return;
} }
......
...@@ -172,7 +172,7 @@ void fft_conv(float *data1, float *fdata2, int *size) ...@@ -172,7 +172,7 @@ void fft_conv(float *data1, float *fdata2, int *size)
/* Actual convolution (Fourier product) */ /* Actual convolution (Fourier product) */
fac = 1.0/npix; fac = 1.0/npix;
fdata1p = fdata1; fdata1p = (float *)fdata1;
fdata2p = fdata2; fdata2p = fdata2;
for (i=npix2/2; i--; fdata2p+=2) for (i=npix2/2; i--; fdata2p+=2)
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: Handling of field structures. * Contents: Handling of field structures.
* *
* Last modify: 19/12/2007 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -153,9 +153,10 @@ picstruct *newfield(char *filename, int flags, int nok) ...@@ -153,9 +153,10 @@ picstruct *newfield(char *filename, int flags, int nok)
if (prefs.filter_flag) if (prefs.filter_flag)
{ {
/*-- If filtering is on, one should consider the height of the conv. mask */ /*-- If filtering is on, one should consider the height of the conv. mask */
/*-- + 1 line for detectinhg zero-weight neighbours */
if (field->stripheight < thefilter->convh) if (field->stripheight < thefilter->convh)
field->stripheight = thefilter->convh; field->stripheight = thefilter->convh;
if (field->stripmargin < (margin = (thefilter->convh-1)/2)) if (field->stripmargin < (margin = (thefilter->convh-1)/2+1))
field->stripmargin = margin; field->stripmargin = margin;
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Contents: functions dealing with on-line filtering of the image * Contents: functions dealing with on-line filtering of the image
* (for detection). * (for detection).
* *
* Last modify: 13/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -36,10 +36,10 @@ ...@@ -36,10 +36,10 @@
/* /*
Convolve a scan line with an array. Convolve a scan line with an array.
*/ */
void convolve(picstruct *field, PIXTYPE *mscan) void convolve(picstruct *field, PIXTYPE *mscan, int y)
{ {
int mw,mw2,m0,me,m,mx,dmx, y0,dy, sw,sh; int mw,mw2,m0,me,m,mx,dmx, y0, dy, sw,sh;
float *mask; float *mask;
PIXTYPE *mscane, *s,*s0, *d,*de, mval; PIXTYPE *mscane, *s,*s0, *d,*de, mval;
...@@ -48,7 +48,7 @@ void convolve(picstruct *field, PIXTYPE *mscan) ...@@ -48,7 +48,7 @@ void convolve(picstruct *field, PIXTYPE *mscan)
mw = thefilter->convw; mw = thefilter->convw;
mw2 = mw/2; mw2 = mw/2;
mscane = mscan+sw; mscane = mscan+sw;
y0 = field->y - (thefilter->convh/2); y0 = y - (thefilter->convh/2);
if ((dy = field->ymin-y0) > 0) if ((dy = field->ymin-y0) > 0)
{ {
m0 = mw*dy; m0 = mw*dy;
...@@ -265,13 +265,13 @@ void endfilter() ...@@ -265,13 +265,13 @@ void endfilter()
/* /*
Switch to the appropriate filtering routine. Switch to the appropriate filtering routine.
*/ */
void filter(picstruct *field, PIXTYPE *mscan) void filter(picstruct *field, PIXTYPE *mscan, int y)
{ {
if (thefilter->bpann) if (thefilter->bpann)
neurfilter(field, mscan); neurfilter(field, mscan, y);
else else
convolve(field, mscan); convolve(field, mscan, y);
return; return;
} }
...@@ -281,7 +281,7 @@ void filter(picstruct *field, PIXTYPE *mscan) ...@@ -281,7 +281,7 @@ void filter(picstruct *field, PIXTYPE *mscan)
/* /*
Filter a scan line using an artificial retina. Filter a scan line using an artificial retina.
*/ */
void neurfilter(picstruct *field, PIXTYPE *mscan) void neurfilter(picstruct *field, PIXTYPE *mscan, int y)
{ {
PIXTYPE cval; PIXTYPE cval;
...@@ -302,7 +302,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan) ...@@ -302,7 +302,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan)
{ {
if (tflag) if (tflag)
{ {
cval = PIX(field, x, field->y); cval = PIX(field, x, y);
if (cval<threshlow || cval>threshhigh) if (cval<threshlow || cval>threshhigh)
{ {
*(mscan++) = cval; *(mscan++) = cval;
...@@ -311,7 +311,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan) ...@@ -311,7 +311,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan)
} }
/*-- Copy the surrounding image area to the retina */ /*-- Copy the surrounding image area to the retina */
copyimage(field, thefilter->conv, thefilter->convw, thefilter->convh, copyimage(field, thefilter->conv, thefilter->convw, thefilter->convh,
x, field->y); x, y);
pix = thefilter->conv; pix = thefilter->conv;
/*-- Apply a transform of the intensity scale */ /*-- Apply a transform of the intensity scale */
for (i=thefilter->nconv; i--; pix++) for (i=thefilter->nconv; i--; pix++)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Contents: functions dealing with on-line filtering of the image * Contents: functions dealing with on-line filtering of the image
* (for detection). * (for detection).
* *
* Last modify: 13/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -35,11 +35,11 @@ typedef struct structfilter ...@@ -35,11 +35,11 @@ typedef struct structfilter
filterstruct *thefilter; filterstruct *thefilter;
/*------------------------------- functions ---------------------------------*/ /*------------------------------- functions ---------------------------------*/
void convolve(picstruct *, PIXTYPE *), void convolve(picstruct *, PIXTYPE *, int y),
convolve_image(picstruct *field, float *vig1, convolve_image(picstruct *field, float *vig1,
float *vig2, int width, int height), float *vig2, int width, int height),
filter(picstruct *, PIXTYPE *), filter(picstruct *, PIXTYPE *, int y),
neurfilter(picstruct *, PIXTYPE *), neurfilter(picstruct *, PIXTYPE *, int y),
endfilter(void), endfilter(void),
getfilter(char *filename); getfilter(char *filename);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: global declarations. * Contents: global declarations.
* *
* Last modify: 14/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: parameter list for catalog data. * Contents: parameter list for catalog data.
* *
* Last modify: 24/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -670,6 +670,12 @@ keystruct objkey[] = { ...@@ -670,6 +670,12 @@ keystruct objkey[] = {
{"NIMAFLAGS_ISO", "Number of flagged pixels entering IMAFLAGS_ISO", {"NIMAFLAGS_ISO", "Number of flagged pixels entering IMAFLAGS_ISO",
outobj.imanflag, H_INT, T_LONG, "%9d", "", outobj.imanflag, H_INT, T_LONG, "%9d", "",
"meta.number", "", 1, &prefs.imanflag_size}, "meta.number", "", 1, &prefs.imanflag_size},
{"NLOWWEIGHT_ISO", "Nb of pixels with low weight over the iso. profile",
&outobj.nzwpix, H_INT, T_LONG, "%9d", "",
"meta.number", ""},
{"NLOWDWEIGHT_ISO", "Nb of pixels with low det. weight over the iso. profile",
&outobj.nzdwpix, H_INT, T_LONG, "%9d", "",
"meta.number", ""},
{"FWHM_IMAGE", "FWHM assuming a gaussian core", {"FWHM_IMAGE", "FWHM assuming a gaussian core",
&outobj.fwhm, H_FLOAT, T_FLOAT, "%8.2f", "pixel", &outobj.fwhm, H_FLOAT, T_FLOAT, "%8.2f", "pixel",
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: functions dealing with the handling of pixel lists. * Contents: functions dealing with the handling of pixel lists.
* *
* Last modify: 29/11/2005 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -184,7 +184,7 @@ void init_plist(void) ...@@ -184,7 +184,7 @@ void init_plist(void)
else else
plistexist_flag = 0; plistexist_flag = 0;
if (FLAG(obj.wflag)) if (prefs.weight_flag && prefs.dweight_flag && FLAG(obj.wflag))
{ {
plistexist_wflag = 1; plistexist_wflag = 1;
plistoff_wflag = plistsize; plistoff_wflag = plistsize;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Contents: functions for extraction of connected pixels from * Contents: functions for extraction of connected pixels from
* a pixmap. * a pixmap.
* *
* Last modify: 11/01/2008 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "filter.h" #include "filter.h"
#include "image.h" #include "image.h"
#include "plist.h" #include "plist.h"
#include "weight.h"
/****************************** scanimage ************************************ /****************************** scanimage ************************************
PROTO void scanimage(picstruct *field, picstruct *dfield, picstruct *ffield, PROTO void scanimage(picstruct *field, picstruct *dfield, picstruct *ffield,
...@@ -47,7 +48,7 @@ INPUT Measurement field pointer, ...@@ -47,7 +48,7 @@ INPUT Measurement field pointer,
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 29/05/2009 VERSION 01/10/2009
***/ ***/
void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
int nffield, picstruct *wfield, picstruct *dwfield) int nffield, picstruct *wfield, picstruct *dwfield)
...@@ -67,15 +68,18 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -67,15 +68,18 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
nposize, stacksize, w, h, blankh, maxpixnb, nposize, stacksize, w, h, blankh, maxpixnb,
varthreshflag, ontotal; varthreshflag, ontotal;
short trunflag; short trunflag;
PIXTYPE thresh, relthresh, cdnewsymbol, cdvar, PIXTYPE thresh, relthresh, cdnewsymbol, cdvar,cdwthresh,wthresh,
*scan,*dscan,*cdscan,*dwscan,*cdwscan,*cdwscanp, *scan,*dscan,*cdscan,*dwscan,*dwscanp,*dwscann,
*scant, *wscan,*wscanp; *cdwscan,*cdwscanp,*cdwscann,*wscand,
*scant, *wscan,*wscann,*wscanp;
FLAGTYPE *pfscan[MAXFLAG]; FLAGTYPE *pfscan[MAXFLAG];
status cs, ps, *psstack; status cs, ps, *psstack;
int *start, *end, ymax; int *start, *end, ymax;
/* Avoid gcc -Wall warnings */ /* Avoid gcc -Wall warnings */
scan = dscan = cdscan = cdwscan = cdwscanp = wscan = wscanp = NULL; scan = dscan = cdscan = cdwscan = cdwscann = cdwscanp
= dwscan = dwscann = dwscanp
= wscan = wscann = wscanp = NULL;
victim = NULL; /* Avoid gcc -Wall warnings */ victim = NULL; /* Avoid gcc -Wall warnings */
blankh = 0; /* Avoid gcc -Wall warnings */ blankh = 0; /* Avoid gcc -Wall warnings */
/*----- Beginning of the main loop: Initialisations */ /*----- Beginning of the main loop: Initialisations */
...@@ -86,6 +90,10 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -86,6 +90,10 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
/* cdwfield is the detection weight-field if available */ /* cdwfield is the detection weight-field if available */
cdwfield = dwfield? dwfield:(prefs.dweight_flag?wfield:NULL); cdwfield = dwfield? dwfield:(prefs.dweight_flag?wfield:NULL);
cdwthresh = cdwfield ? cdwfield->weight_thresh : 0.0;
if (cdwthresh>BIG*WTHRESH_CONVFAC);
cdwthresh = BIG*WTHRESH_CONVFAC;
wthresh = wfield? wfield->weight_thresh : 0.0;
/* If WEIGHTing and no absolute thresholding, activate threshold scaling */ /* If WEIGHTing and no absolute thresholding, activate threshold scaling */
varthreshflag = (cdwfield && prefs.thresh_type[0]!=THRESH_ABSOLUTE); varthreshflag = (cdwfield && prefs.thresh_type[0]!=THRESH_ABSOLUTE);
...@@ -137,28 +145,6 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -137,28 +145,6 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
blankpad = bpt = NULL; blankpad = bpt = NULL;
lutzalloc(w,h); lutzalloc(w,h);
allocparcelout(); allocparcelout();
if (prefs.filter_flag)
{
QMALLOC(cdscan, PIXTYPE, stacksize);
if (cdwfield)
{
QCALLOC(cdwscan, PIXTYPE, stacksize);
if (PLISTEXIST(wflag))
{
QMALLOC(cdwscanp, PIXTYPE, stacksize);
}
}
/*-- One needs a buffer to protect filtering if source-blanking applies */
if (prefs.blank_flag)
{
blankh = thefilter->convh/2+1;
QMALLOC(blankpad, char, w*blankh);
cfield->yblank -= blankh;
if (dfield)
field->yblank = cfield->yblank;
bpt = blankpad;
}
}
/* Some initializations */ /* Some initializations */
...@@ -195,6 +181,31 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -195,6 +181,31 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
PLIST(pixt, nextpix) = i; PLIST(pixt, nextpix) = i;
PLIST(pixt, nextpix) = -1; PLIST(pixt, nextpix) = -1;
/* Allocate memory for other buffers */
if (prefs.filter_flag)
{
QMALLOC(cdscan, PIXTYPE, stacksize);
if (cdwfield)
{
QCALLOC(cdwscan, PIXTYPE, stacksize);
if (PLISTEXIST(wflag))
{
QCALLOC(cdwscanp, PIXTYPE, stacksize);
QCALLOC(cdwscann, PIXTYPE, stacksize);
}
}
/*-- One needs a buffer to protect filtering if source-blanking applies */
if (prefs.blank_flag)
{
blankh = thefilter->convh/2+1;
QMALLOC(blankpad, char, w*blankh);
cfield->yblank -= blankh;
if (dfield)
field->yblank = cfield->yblank;
bpt = blankpad;
}
}
/*----- Here we go */ /*----- Here we go */
for (yl=0; yl<=h;) for (yl=0; yl<=h;)
{ {
...@@ -208,12 +219,17 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -208,12 +219,17 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
free(cdscan); free(cdscan);
if (cdwfield) if (cdwfield)
{ {
free(cdwscan);
if (PLISTEXIST(wflag)) if (PLISTEXIST(wflag))
{
free(cdwscanp); free(cdwscanp);
free(cdwscann);
cdwscanp = cdwscan;
}
else
free(cdwscan);
} }
} }
cdwscan = cdwscanp = cdscan = dumscan; cdwscan = cdwscann = cdscan = dumscan;
} }
else else
{ {
...@@ -231,21 +247,42 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -231,21 +247,42 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
wscan = (wfield->stripy==wfield->stripysclim)? wscan = (wfield->stripy==wfield->stripysclim)?
(PIXTYPE *)loadstrip(wfield, (picstruct *)NULL) (PIXTYPE *)loadstrip(wfield, (picstruct *)NULL)
: &wfield->strip[wfield->stripy*wfield->width]; : &wfield->strip[wfield->stripy*wfield->width];
if (yl && PLISTEXIST(wflag)) if (PLISTEXIST(wflag))
wscanp = &wfield->strip[((yl-1)%wfield->stripheight)*wfield->width]; {
if (yl>0)
wscanp = &wfield->strip[((yl-1)%wfield->stripheight)*wfield->width];
if (yl<h-1)
wscann = &wfield->strip[((yl+1)%wfield->stripheight)*wfield->width];
}
} }
else
wscan = NULL;
scan = (field->stripy==field->stripysclim)? scan = (field->stripy==field->stripysclim)?
(PIXTYPE *)loadstrip(field, wfield) (PIXTYPE *)loadstrip(field, wfield)
: &field->strip[field->stripy*field->width]; : &field->strip[field->stripy*field->width];
if (dwfield) if (dwfield)
{
dwscan = (dwfield->stripy==dwfield->stripysclim)? dwscan = (dwfield->stripy==dwfield->stripysclim)?
(PIXTYPE *)loadstrip(dwfield, (PIXTYPE *)loadstrip(dwfield,
dfield?(picstruct *)NULL:dwfield) dfield?(picstruct *)NULL:dwfield)
: &dwfield->strip[dwfield->stripy*dwfield->width]; : &dwfield->strip[dwfield->stripy*dwfield->width];
if (PLISTEXIST(wflag))
{
if (yl>0)
dwscanp = &dwfield->strip[((yl-1)%dwfield->stripheight)
*dwfield->width];
if (yl<h-1)
dwscann = &dwfield->strip[((yl+1)%dwfield->stripheight)
*dwfield->width];
}
}
else else
{
dwscan = wscan; dwscan = wscan;
if (PLISTEXIST(wflag))
{
dwscanp = wscanp;
dwscann = wscann;
}
}
if (dfield) if (dfield)
dscan = (dfield->stripy==dfield->stripysclim)? dscan = (dfield->stripy==dfield->stripysclim)?
(PIXTYPE *)loadstrip(dfield, dwfield) (PIXTYPE *)loadstrip(dfield, dwfield)
...@@ -253,19 +290,37 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -253,19 +290,37 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
else else
dscan = scan; dscan = scan;
if (PLISTEXIST(wflag) && cdwfield) if (cdwfield && PLISTEXIST(wflag))
/*------ Copy the previous filtered weight line to track bad pixel limits */ /*------ Copy the previously filtered weight line to track bad pixel limits */
memcpy(cdwscanp, cdwscan, wfield->width*sizeof(PIXTYPE)); {
}
if (prefs.filter_flag) if (prefs.filter_flag)
{ {
filter(cfield, cdscan); filter(cfield, cdscan, cfield->y);
if (cdwfield) if (cdwfield)
filter(cdwfield, cdwscan); if (PLISTEXIST(wflag))
{
if (yl==0)
filter(cdwfield, cdwscann, yl);
wscand = cdwscanp;
cdwscanp = cdwscan;
cdwscan = cdwscann;
cdwscann = wscand;
if (yl < h-1)
filter(cdwfield, cdwscann, yl + 1);
}
else
filter(cdwfield, cdwscan, yl);
} }
else else
{ {
cdscan = dscan; cdscan = dscan;
cdwscan = dwscan; cdwscan = dwscan;
if (PLISTEXIST(wflag))
{
cdwscanp = dwscanp;
cdwscann = dwscann;
}
} }
if ((check=prefs.check[CHECK_FILTERED])) if ((check=prefs.check[CHECK_FILTERED]))
...@@ -343,30 +398,36 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -343,30 +398,36 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
if (PLISTEXIST(flag)) if (PLISTEXIST(flag))
for (i=0; i<nffield; i++) for (i=0; i<nffield; i++)
PLISTFLAG(pixt, flag[i]) = pfscan[i][xl]; PLISTFLAG(pixt, flag[i]) = pfscan[i][xl];
/*--------------------- Detect pixels with a low weight ---------------------*/
if (PLISTEXIST(wflag) && wscan) if (PLISTEXIST(wflag) && wscan)
{ {
PLISTFLAG(pixt, wflag) = 0; PLISTFLAG(pixt, wflag) = 0;
if (xl>0) if (wscan[xl] >= wthresh)
{ PLISTFLAG(pixt, wflag) |= OBJ_LOWWEIGHT;
if (wscan[xl-1] >= BIG) if (cdwscan[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO; PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (cdwscan[xl-1] >= BIG)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO; if (yl>0)
}
PLISTFLAG(pixt, wflag) = 0;
if (xl<w-1)
{ {
if (wscan[xl+1] >= BIG) if (cdwscanp[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO; PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (cdwscan[xl+1] >= BIG) if (xl>0 && cdwscanp[xl-1]>=cdwthresh)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO; PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl<w-1 && cdwscanp[xl+1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
} }
if (yl>0) if (xl>0 && cdwscan[xl-1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl<w-1 && cdwscan[xl+1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (yl<h-1)
{ {
if (wscanp[xl] >= BIG) if (cdwscann[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO; PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (cdwscanp[xl] >= BIG) if (xl>0 && cdwscann[xl-1]>=cdwthresh)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO; PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl<w-1 && cdwscann[xl+1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
} }
} }
if (PLISTEXIST(dthresh)) if (PLISTEXIST(dthresh))
...@@ -628,6 +689,8 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield, ...@@ -628,6 +689,8 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
endclean(); endclean();
/*Free memory */ /*Free memory */
if (prefs.filter_flag && cdwfield && PLISTEXIST(wflag))
free(cdwscanp);
freeparcelout(); freeparcelout();
free(pixel); free(pixel);
lutzfree(); lutzfree();
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: global type definitions. * Contents: global type definitions.
* *
* Last modify: 29/09/2009 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
/*----------------------------- weight flags --------------------------------*/ /*----------------------------- weight flags --------------------------------*/
#define OBJ_WEIGHTZERO 0x0001 #define OBJ_LOWWEIGHT 0x0001
#define OBJ_DWEIGHTZERO 0x0002 #define OBJ_LOWDWEIGHT 0x0002
/*---------------------------- preanalyse flags -----------------------------*/ /*---------------------------- preanalyse flags -----------------------------*/
...@@ -81,6 +81,8 @@ typedef struct ...@@ -81,6 +81,8 @@ typedef struct
int fdnpix; /* nb of extracted pix */ int fdnpix; /* nb of extracted pix */
int dnpix; /* nb of pix above thresh */ int dnpix; /* nb of pix above thresh */
int npix; /* "" in measured frame */ int npix; /* "" in measured frame */
int nzdwpix; /* nb of zero-dweights around */
int nzwpix; /* nb of zero-weights inside */
float fdflux; /* integrated ext. flux */ float fdflux; /* integrated ext. flux */
float dflux; /* integrated det. flux */ float dflux; /* integrated det. flux */
float flux; /* integrated mes. flux */ float flux; /* integrated mes. flux */
...@@ -114,6 +116,7 @@ typedef struct ...@@ -114,6 +116,7 @@ typedef struct
float mthresh; /* max. threshold (ADU) */ float mthresh; /* max. threshold (ADU) */
int iso[NISO]; /* isophotal areas */ int iso[NISO]; /* isophotal areas */
float fwhm; /* IMAGE FWHM */ float fwhm; /* IMAGE FWHM */
} objstruct; } objstruct;
/* II: "BLIND" parameters */ /* II: "BLIND" parameters */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: Handling of weight maps. * Contents: Handling of weight maps.
* *
* Last modify: 28/11/2003 * Last modify: 30/09/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "define.h" #include "define.h"
#include "globals.h" #include "globals.h"
#include "field.h" #include "field.h"
#include "plist.h"
#include "weight.h" #include "weight.h"
/******************************* newweight **********************************/ /******************************* newweight **********************************/
...@@ -124,3 +125,42 @@ void weight_to_var(picstruct *wfield, PIXTYPE *data, int npix) ...@@ -124,3 +125,42 @@ void weight_to_var(picstruct *wfield, PIXTYPE *data, int npix)
return; return;
} }
/******************************** weight_count *******************************
PROTO void weight_count(objstruct *obj, pliststruct *pixel)
PURPOSE Count pixels with zero weights.
INPUT Objstruct pointer,
pixel list pointer.
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 01/10/2009
***/
void weight_count(objstruct *obj, pliststruct *pixel)
{
pliststruct *pixt;
int i, nw,ndw, wflag;
nw = ndw = wflag = 0;
for (i=obj->firstpix; i!=-1; i=PLIST(pixt,nextpix))
{
pixt = pixel+i;
if (PLISTFLAG(pixt, wflag) & OBJ_LOWWEIGHT)
nw++;
if (PLISTFLAG(pixt, wflag) & OBJ_LOWDWEIGHT)
ndw++;
}
obj->nzwpix = nw;
obj->nzdwpix = ndw;
obj->wflag = nw? OBJ_LOWWEIGHT : 0;
if (ndw)
obj->wflag |= OBJ_LOWDWEIGHT;
return;
}
...@@ -9,16 +9,22 @@ ...@@ -9,16 +9,22 @@
* *
* Contents: Include file for weight.c. * Contents: Include file for weight.c.
* *
* Last modify: 14/12/2002 * Last modify: 01/10/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
/*------------------------------- definitions -------------------------------*/
#define WTHRESH_CONVFAC 1e-4 /* Factor to apply to weights when */
/* thresholding filtered weight-maps */
/*---------------------------------- protos --------------------------------*/ /*---------------------------------- protos --------------------------------*/
extern picstruct *newweight(char *filename, picstruct *reffield, extern picstruct *newweight(char *filename, picstruct *reffield,
weightenum wtype, int nok); weightenum wtype, int nok);
void weight_to_var(picstruct *wfield, PIXTYPE *data, void weight_count(objstruct *obj, pliststruct *pixel),
weight_to_var(picstruct *wfield, PIXTYPE *data,
int npix); int npix);
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