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
# 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>.
#
......@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.9.2'
PACKAGE_STRING='sextractor 2.9.2'
PACKAGE_VERSION='2.9.3'
PACKAGE_STRING='sextractor 2.9.3'
PACKAGE_BUGREPORT='bertin@iap.fr'
 
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.
# This message is too long to be a string in the A/UX 3.1 sh.
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]...
 
......@@ -1575,7 +1575,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.9.2:";;
short | recursive ) echo "Configuration of sextractor 2.9.3:";;
esac
cat <<\_ACEOF
 
......@@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sextractor configure 2.9.2
sextractor configure 2.9.3
generated by GNU Autoconf 2.63
 
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
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
 
$ $0 $@
......@@ -2423,7 +2423,7 @@ fi
 
# Define the identity of the package.
PACKAGE='sextractor'
VERSION='2.9.2'
VERSION='2.9.3'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -28290,7 +28290,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.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
 
CONFIG_FILES = $CONFIG_FILES
......@@ -28353,7 +28353,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sextractor config.status 2.9.2
sextractor config.status 2.9.3
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.9.2, [bertin@iap.fr])
AC_INIT(sextractor, 2.9.3, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
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
sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS
......
......@@ -9,7 +9,7 @@
*
* Contents: analyse(), endobject()...: measurements on detections.
*
* Last modify: 24/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -40,6 +40,7 @@
#include "profit.h"
#include "retina.h"
#include "som.h"
#include "weight.h"
#include "winpos.h"
static obj2struct *obj2 = &outobj2;
......@@ -63,7 +64,6 @@ void analyse(picstruct *field, picstruct *dfield, int objnb,
examineiso(field, dfield, obj, objlist->plist);
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/* Put here your calls to custom functions related to isophotal measurements.
Ex:
......@@ -234,6 +234,10 @@ void examineiso(picstruct *field, picstruct *dfield, objstruct *obj,
if (PLISTEXIST(flag))
getflags(obj, pixel);
/* Flag and count pixels with a low weight */
if (PLISTEXIST(wflag))
weight_count(obj, pixel);
if (cleanflag)
{
obj->mthresh = *heap;
......
......@@ -9,7 +9,7 @@
*
* Contents: functions for output of catalog data.
*
* Last modify: 29/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -599,6 +599,8 @@ void updateparamflags()
for (i=0; i<NISO; i++)
FLAG(obj.iso[0]) |= FLAG(obj.iso[i]);
FLAG(obj.wflag) |= FLAG(obj.nzwpix) | FLAG(obj.nzdwpix);
return;
}
......
......@@ -172,7 +172,7 @@ void fft_conv(float *data1, float *fdata2, int *size)
/* Actual convolution (Fourier product) */
fac = 1.0/npix;
fdata1p = fdata1;
fdata1p = (float *)fdata1;
fdata2p = fdata2;
for (i=npix2/2; i--; fdata2p+=2)
{
......
......@@ -9,7 +9,7 @@
*
* 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)
if (prefs.filter_flag)
{
/*-- 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)
field->stripheight = thefilter->convh;
if (field->stripmargin < (margin = (thefilter->convh-1)/2))
if (field->stripmargin < (margin = (thefilter->convh-1)/2+1))
field->stripmargin = margin;
}
......
......@@ -10,7 +10,7 @@
* Contents: functions dealing with on-line filtering of the image
* (for detection).
*
* Last modify: 13/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -36,10 +36,10 @@
/*
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;
PIXTYPE *mscane, *s,*s0, *d,*de, mval;
......@@ -48,7 +48,7 @@ void convolve(picstruct *field, PIXTYPE *mscan)
mw = thefilter->convw;
mw2 = mw/2;
mscane = mscan+sw;
y0 = field->y - (thefilter->convh/2);
y0 = y - (thefilter->convh/2);
if ((dy = field->ymin-y0) > 0)
{
m0 = mw*dy;
......@@ -265,13 +265,13 @@ void endfilter()
/*
Switch to the appropriate filtering routine.
*/
void filter(picstruct *field, PIXTYPE *mscan)
void filter(picstruct *field, PIXTYPE *mscan, int y)
{
if (thefilter->bpann)
neurfilter(field, mscan);
neurfilter(field, mscan, y);
else
convolve(field, mscan);
convolve(field, mscan, y);
return;
}
......@@ -281,7 +281,7 @@ void filter(picstruct *field, PIXTYPE *mscan)
/*
Filter a scan line using an artificial retina.
*/
void neurfilter(picstruct *field, PIXTYPE *mscan)
void neurfilter(picstruct *field, PIXTYPE *mscan, int y)
{
PIXTYPE cval;
......@@ -302,7 +302,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan)
{
if (tflag)
{
cval = PIX(field, x, field->y);
cval = PIX(field, x, y);
if (cval<threshlow || cval>threshhigh)
{
*(mscan++) = cval;
......@@ -311,7 +311,7 @@ void neurfilter(picstruct *field, PIXTYPE *mscan)
}
/*-- Copy the surrounding image area to the retina */
copyimage(field, thefilter->conv, thefilter->convw, thefilter->convh,
x, field->y);
x, y);
pix = thefilter->conv;
/*-- Apply a transform of the intensity scale */
for (i=thefilter->nconv; i--; pix++)
......
......@@ -10,7 +10,7 @@
* Contents: functions dealing with on-line filtering of the image
* (for detection).
*
* Last modify: 13/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -35,11 +35,11 @@ typedef struct structfilter
filterstruct *thefilter;
/*------------------------------- functions ---------------------------------*/
void convolve(picstruct *, PIXTYPE *),
void convolve(picstruct *, PIXTYPE *, int y),
convolve_image(picstruct *field, float *vig1,
float *vig2, int width, int height),
filter(picstruct *, PIXTYPE *),
neurfilter(picstruct *, PIXTYPE *),
filter(picstruct *, PIXTYPE *, int y),
neurfilter(picstruct *, PIXTYPE *, int y),
endfilter(void),
getfilter(char *filename);
......
......@@ -9,7 +9,7 @@
*
* Contents: global declarations.
*
* Last modify: 14/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......
......@@ -9,7 +9,7 @@
*
* Contents: parameter list for catalog data.
*
* Last modify: 24/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -670,6 +670,12 @@ keystruct objkey[] = {
{"NIMAFLAGS_ISO", "Number of flagged pixels entering IMAFLAGS_ISO",
outobj.imanflag, H_INT, T_LONG, "%9d", "",
"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",
&outobj.fwhm, H_FLOAT, T_FLOAT, "%8.2f", "pixel",
......
......@@ -9,7 +9,7 @@
*
* 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)
else
plistexist_flag = 0;
if (FLAG(obj.wflag))
if (prefs.weight_flag && prefs.dweight_flag && FLAG(obj.wflag))
{
plistexist_wflag = 1;
plistoff_wflag = plistsize;
......
......@@ -10,7 +10,7 @@
* Contents: functions for extraction of connected pixels from
* a pixmap.
*
* Last modify: 11/01/2008
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -34,6 +34,7 @@
#include "filter.h"
#include "image.h"
#include "plist.h"
#include "weight.h"
/****************************** scanimage ************************************
PROTO void scanimage(picstruct *field, picstruct *dfield, picstruct *ffield,
......@@ -47,7 +48,7 @@ INPUT Measurement field pointer,
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 29/05/2009
VERSION 01/10/2009
***/
void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
int nffield, picstruct *wfield, picstruct *dwfield)
......@@ -67,15 +68,18 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
nposize, stacksize, w, h, blankh, maxpixnb,
varthreshflag, ontotal;
short trunflag;
PIXTYPE thresh, relthresh, cdnewsymbol, cdvar,
*scan,*dscan,*cdscan,*dwscan,*cdwscan,*cdwscanp,
*scant, *wscan,*wscanp;
PIXTYPE thresh, relthresh, cdnewsymbol, cdvar,cdwthresh,wthresh,
*scan,*dscan,*cdscan,*dwscan,*dwscanp,*dwscann,
*cdwscan,*cdwscanp,*cdwscann,*wscand,
*scant, *wscan,*wscann,*wscanp;
FLAGTYPE *pfscan[MAXFLAG];
status cs, ps, *psstack;
int *start, *end, ymax;
/* 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 */
blankh = 0; /* Avoid gcc -Wall warnings */
/*----- Beginning of the main loop: Initialisations */
......@@ -86,6 +90,10 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
/* cdwfield is the detection weight-field if available */
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 */
varthreshflag = (cdwfield && prefs.thresh_type[0]!=THRESH_ABSOLUTE);
......@@ -137,28 +145,6 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
blankpad = bpt = NULL;
lutzalloc(w,h);
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 */
......@@ -195,6 +181,31 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
PLIST(pixt, nextpix) = i;
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 */
for (yl=0; yl<=h;)
{
......@@ -208,12 +219,17 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
free(cdscan);
if (cdwfield)
{
free(cdwscan);
if (PLISTEXIST(wflag))
{
free(cdwscanp);
free(cdwscann);
cdwscanp = cdwscan;
}
else
free(cdwscan);
}
}
cdwscan = cdwscanp = cdscan = dumscan;
cdwscan = cdwscann = cdscan = dumscan;
}
else
{
......@@ -231,21 +247,42 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
wscan = (wfield->stripy==wfield->stripysclim)?
(PIXTYPE *)loadstrip(wfield, (picstruct *)NULL)
: &wfield->strip[wfield->stripy*wfield->width];
if (yl && PLISTEXIST(wflag))
wscanp = &wfield->strip[((yl-1)%wfield->stripheight)*wfield->width];
if (PLISTEXIST(wflag))
{
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)?
(PIXTYPE *)loadstrip(field, wfield)
: &field->strip[field->stripy*field->width];
if (dwfield)
{
dwscan = (dwfield->stripy==dwfield->stripysclim)?
(PIXTYPE *)loadstrip(dwfield,
dfield?(picstruct *)NULL:dwfield)
: &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
{
dwscan = wscan;
if (PLISTEXIST(wflag))
{
dwscanp = wscanp;
dwscann = wscann;
}
}
if (dfield)
dscan = (dfield->stripy==dfield->stripysclim)?
(PIXTYPE *)loadstrip(dfield, dwfield)
......@@ -253,19 +290,37 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
else
dscan = scan;
if (PLISTEXIST(wflag) && cdwfield)
/*------ Copy the previous filtered weight line to track bad pixel limits */
memcpy(cdwscanp, cdwscan, wfield->width*sizeof(PIXTYPE));
if (cdwfield && PLISTEXIST(wflag))
/*------ Copy the previously filtered weight line to track bad pixel limits */
{
}
if (prefs.filter_flag)
{
filter(cfield, cdscan);
filter(cfield, cdscan, cfield->y);
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
{
cdscan = dscan;
cdwscan = dwscan;
if (PLISTEXIST(wflag))
{
cdwscanp = dwscanp;
cdwscann = dwscann;
}
}
if ((check=prefs.check[CHECK_FILTERED]))
......@@ -343,30 +398,36 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
if (PLISTEXIST(flag))
for (i=0; i<nffield; i++)
PLISTFLAG(pixt, flag[i]) = pfscan[i][xl];
/*--------------------- Detect pixels with a low weight ---------------------*/
if (PLISTEXIST(wflag) && wscan)
{
PLISTFLAG(pixt, wflag) = 0;
if (xl>0)
{
if (wscan[xl-1] >= BIG)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO;
if (cdwscan[xl-1] >= BIG)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO;
}
PLISTFLAG(pixt, wflag) = 0;
if (xl<w-1)
if (wscan[xl] >= wthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWWEIGHT;
if (cdwscan[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (yl>0)
{
if (wscan[xl+1] >= BIG)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO;
if (cdwscan[xl+1] >= BIG)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO;
if (cdwscanp[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl>0 && cdwscanp[xl-1]>=cdwthresh)
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)
PLISTFLAG(pixt, wflag) |= OBJ_WEIGHTZERO;
if (cdwscanp[xl] >= BIG)
PLISTFLAG(pixt, wflag) = OBJ_DWEIGHTZERO;
if (cdwscann[xl] >= cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl>0 && cdwscann[xl-1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
if (xl<w-1 && cdwscann[xl+1]>=cdwthresh)
PLISTFLAG(pixt, wflag) |= OBJ_LOWDWEIGHT;
}
}
if (PLISTEXIST(dthresh))
......@@ -628,6 +689,8 @@ void scanimage(picstruct *field, picstruct *dfield, picstruct **pffield,
endclean();
/*Free memory */
if (prefs.filter_flag && cdwfield && PLISTEXIST(wflag))
free(cdwscanp);
freeparcelout();
free(pixel);
lutzfree();
......
......@@ -9,7 +9,7 @@
*
* Contents: global type definitions.
*
* Last modify: 29/09/2009
* Last modify: 01/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -36,8 +36,8 @@
/*----------------------------- weight flags --------------------------------*/
#define OBJ_WEIGHTZERO 0x0001
#define OBJ_DWEIGHTZERO 0x0002
#define OBJ_LOWWEIGHT 0x0001
#define OBJ_LOWDWEIGHT 0x0002
/*---------------------------- preanalyse flags -----------------------------*/
......@@ -81,6 +81,8 @@ typedef struct
int fdnpix; /* nb of extracted pix */
int dnpix; /* nb of pix above thresh */
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 dflux; /* integrated det. flux */
float flux; /* integrated mes. flux */
......@@ -114,6 +116,7 @@ typedef struct
float mthresh; /* max. threshold (ADU) */
int iso[NISO]; /* isophotal areas */
float fwhm; /* IMAGE FWHM */
} objstruct;
/* II: "BLIND" parameters */
......
......@@ -9,7 +9,7 @@
*
* Contents: Handling of weight maps.
*
* Last modify: 28/11/2003
* Last modify: 30/09/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -26,6 +26,7 @@
#include "define.h"
#include "globals.h"
#include "field.h"
#include "plist.h"
#include "weight.h"
/******************************* newweight **********************************/
......@@ -124,3 +125,42 @@ void weight_to_var(picstruct *wfield, PIXTYPE *data, int npix)
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 @@
*
* 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 --------------------------------*/
extern picstruct *newweight(char *filename, picstruct *reffield,
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);
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