From e698f1c94e78e3cbc2b920449b2254d6c66fb1cb Mon Sep 17 00:00:00 2001 From: rhenders Date: Tue, 17 Sep 2013 09:16:43 +0000 Subject: [PATCH] Merged recent changes from trunk --- src/analyse.c | 5 ++++- src/back.c | 9 +-------- src/catout.c | 22 +++++++++++++++++++++- src/field.c | 1 + src/fits/fitsbody.c | 4 ---- src/fits/fitscat.h | 2 +- src/globals.h | 5 +++-- src/makeit.c | 8 +++++++- src/readimage.c | 1 - 9 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/analyse.c b/src/analyse.c index 271ce2d..9e73e24 100644 --- a/src/analyse.c +++ b/src/analyse.c @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see . * -* Last modified: 02/11/2011 +* Last modified: 12/09/2013 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -830,6 +830,9 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield, } } + /* Clean (zero) all measurements */ + zerocat(); + return; } diff --git a/src/back.c b/src/back.c index ebe3471..f3a7d28 100644 --- a/src/back.c +++ b/src/back.c @@ -253,7 +253,6 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) { QFSEEK(wfield->file, wfcurpos2, SEEK_SET, wfield->filename); wtab->currentElement = (wfcurpos2 == 0) ? 1 : wfcurpos2; // CFITSIO - wbm = wbackmesh; for (m=nx; m--; wbm++) if (wbm->mean <= -BIG) @@ -266,14 +265,10 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) { if (bufsize2>size) bufsize2 = size; - read_body(field->tab, buf, bufsize2); - if (wfield) { - - read_body(wfield->tab, wbuf, bufsize2); - + read_body(wfield->tab, wbuf, bufsize2); weight_to_var(wfield, wbuf, bufsize2); } backhisto(backmesh, wbackmesh, buf, wbuf, bufsize2, nx, w, bw, @@ -313,11 +308,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) /* Go back to the original position */ QFSEEK(field->file, fcurpos, SEEK_SET, field->filename); field->tab->currentElement = fcurpos; // CFITSIO - if (wfield) { QFSEEK(wfield->file, wfcurpos, SEEK_SET, wfield->filename); wfield->tab->currentElement = (wfcurpos == 0) ? 1 : wfcurpos; // CFITSIO - } /* Median-filter and check suitability of the background map */ diff --git a/src/catout.c b/src/catout.c index ed169c9..d03e71c 100644 --- a/src/catout.c +++ b/src/catout.c @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see . * -* Last modified: 05/07/2013 +* Last modified: 12/09/2013 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -933,6 +933,8 @@ void reinitcat(picstruct *field) init_writeobj(fitscat, objtab, &buf); } + zerocat(); + return; } @@ -1101,3 +1103,21 @@ void reendcat() } +/********************************** zerocat **********************************/ +/* +Reset to 0 all measurements in the current catalog. +*/ +void zerocat(void) + { + keystruct *key; + int i; + + key = objtab->key; + for (i=objtab->nkey; i--; key=key->nextkey) + memset(key->ptr, 0, key->nbytes); + + return; + } + + + diff --git a/src/field.c b/src/field.c index 60fe2ca..117a5a1 100644 --- a/src/field.c +++ b/src/field.c @@ -87,6 +87,7 @@ picstruct *newfield(char *filename, int flags, int ext) } if (!nok) error(EXIT_FAILURE, "Not a valid FITS image in ",filename); + field->tab = tab; if (ntab<0) error(EXIT_FAILURE, "Not enough valid FITS image extensions in ",filename); diff --git a/src/fits/fitsbody.c b/src/fits/fitsbody.c index 3aabd20..66c55d8 100644 --- a/src/fits/fitsbody.c +++ b/src/fits/fitsbody.c @@ -389,7 +389,6 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) } else QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); - switch(tab->bitpix) { case BP_BYTE: @@ -665,8 +664,6 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) default: error(EXIT_FAILURE,"*Internal Error*: unknown compression mode in ", "read_body()"); - - } //printf("SSSS %f %f %f %f %f\n", bufdata[0], bufdata[10], bufdata[100], bufdata[1000], bufdata[spoonful-1]); @@ -977,7 +974,6 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) for (i=spoonful; i--;) *(bufdata++) = (*(ptr++)-bz)/bs; - // CFITSIO - only perform byte-swap if we are NOT writing a tile-compressed format using cfitsio if (0 && tab->infptr == NULL) // TODO if (bswapflag) diff --git a/src/fits/fitscat.h b/src/fits/fitscat.h index d79ff38..6b4d4af 100644 --- a/src/fits/fitscat.h +++ b/src/fits/fitscat.h @@ -23,7 +23,7 @@ * along with AstrOmatic software. * If not, see . * -f* Last modified: 29/08/2012 +* Last modified: 29/08/2012 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ diff --git a/src/globals.h b/src/globals.h index cc98d66..f6ded6f 100644 --- a/src/globals.h +++ b/src/globals.h @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see . * -* Last modified: 11/10/2010 +* Last modified: 12/09/2013 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -85,7 +85,8 @@ extern void alloccatparams(void), useprefs(void), writecat(int, objliststruct *), write_error(char *msg1, char *msg2), - write_vo_fields(FILE *file); + write_vo_fields(FILE *file), + zerocat(void); extern double counter_seconds(void); diff --git a/src/makeit.c b/src/makeit.c index c43e998..339ea17 100644 --- a/src/makeit.c +++ b/src/makeit.c @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see . * -* Last modified: 13/02/2013 +* Last modified: 17/08/2013 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -57,7 +57,11 @@ static int selectext(char *filename); time_t thetimet, thetimet2; +#ifdef USE_MODEL extern profitstruct *theprofit,*thedprofit, *thepprofit,*theqprofit; +#else +profitstruct *theprofit,*thedprofit, *thepprofit,*theqprofit; +#endif extern char profname[][32]; double dtime; @@ -479,6 +483,7 @@ if (!imatab->isTileCompressed) thepsf = psf_load(prefs.psf_name[0], nok); } +#ifdef USE_MODEL if (prefs.prof_flag) { /*------ Create profiles at full resolution */ @@ -502,6 +507,7 @@ if (!imatab->isTileCompressed) theqprofit = profit_init(thepsf, MODEL_EXPONENTIAL); } } +#endif } /*-- Initialize PSF contexts and workspace */ diff --git a/src/readimage.c b/src/readimage.c index 6f34aa4..76dc670 100644 --- a/src/readimage.c +++ b/src/readimage.c @@ -294,7 +294,6 @@ void readimagehead(picstruct *field) QFSEEK(field->file, tab->bodypos, SEEK_SET, field->filename); - return; #undef FITSREADS -- GitLab