Loading doc/src/conf.py +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = 'Fri Sep 16 2022' today = 'Sat Feb 25 2023' # # Else, today_fmt is used as the format for a strftime call. # Loading src/check.c +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: SExtractor * * Copyright: (C) 1993-2013 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see <http://www.gnu.org/licenses/>. * * Last modified: 23/09/2013 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -406,6 +406,7 @@ void reinitcheck(picstruct *field, checkstruct *check) remove_tabs(cat); copy_tab_fromptr(field->tab, cat, 0); tab = cat->tab; decomp_head(tab); tab->cat = cat; if (check->next<=1) prim_head(tab); Loading src/field.c +9 −15 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: SExtractor * * Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1993-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see <http://www.gnu.org/licenses/>. * * Last modified: 23/09/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -70,25 +70,19 @@ picstruct *newfield(char *filename, int flags, int ext) field->cat = cat; nok = 0; tab = cat->tab; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) nok++; #endif if (tab->naxis >= 2 if ((tab->isTileCompressed) || (tab->naxis >= 2 && strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))) nok++; ext2 = ext; for (ntab=cat->ntab; ext2-- && ntab--;) { tab=tab->nexttab; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) nok++; #endif if (tab->naxis >= 2 if ((tab->isTileCompressed) || (tab->naxis >= 2 && strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))) nok++; } if (!nok) Loading src/fits/fitsbody.c +5 −5 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: AstrOmatic FITS/LDAC library * * Copyright: (C) 1995-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1995-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -23,7 +23,7 @@ * along with AstrOmatic software. * If not, see <http://www.gnu.org/licenses/>. * * Last modified: 26/08/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -394,8 +394,8 @@ INPUT A pointer to the tab structure, the number of elements to be read. OUTPUT -. NOTES . AUTHOR E. Bertin (IAP) VERSION 26/08/2020 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) { Loading Loading @@ -439,7 +439,7 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) bufdata = (char *)bufdata0; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) if (tab->isTileCompressed && tab->infptr) readTileCompressed(tab, spoonful, (void *)bufdata0); else QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); Loading src/fits/fitscat.c +52 −65 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: AstrOmatic FITS/LDAC library * * Copyright: (C) 1995-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1995-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -23,7 +23,7 @@ * along with AstrOmatic software. * If not, see <http://www.gnu.org/licenses/>. * * Last modified: 26/08/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading @@ -42,6 +42,8 @@ #include "fitscat_defs.h" #include "fitscat.h" extern float *fits_rand_value; char fits_str[MAXCHAR]; /****** about_cat ************************************************************** Loading Loading @@ -168,29 +170,33 @@ int close_cat(catstruct *cat) } #ifdef HAVE_CFITSIO /****** close_cfitsio ************************************************************** Closes a file previously opened by cfitsio /****** close_cfitsio ********************************************************** PROTO int close_cfitsio(fitsfile **infptr) PURPOSE Close a file previously opened by cfitsio INPUT fitsfile structure. OUTPUT RETURN_OK if everything went as expected (exit in error otherwise). NOTES the fitsfile pointer is set to NULL; AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ int close_cfitsio(fitsfile *infptr) { int close_cfitsio(catstruct *cat) { if (infptr != NULL) { if ((cat) && (cat->infptr)) { int status = 0; fits_close_file(cat->infptr, &status); int status = 0; fits_close_file(infptr, &status); if (status != 0) { fits_report_error(stderr, status); printf("ERROR could not close FITS file with cfitsio\n"); } else { //printf("Successfully closed FITS file with cfitsio\n"); infptr == NULL; } } else { //printf("ERROR no cfitsio file to close\n"); error(EXIT_FAILURE, "Could not close FITS file with cfitsio: ", cat->filename); } else { // Successfully closed FITS file with cfitsio cat->infptr == NULL; // Free random seed in CFITSIO. QFREE(fits_rand_value); } } else return RETURN_ERROR; return RETURN_OK; } #endif // HAVE_CFITSIO Loading @@ -202,8 +208,8 @@ INPUT Pointer to a catalog structure, Number of catalogs. OUTPUT -. NOTES Unallocated pointers should have been put to NULL. AUTHOR E. Bertin (IAP & Leiden observatory) VERSION 05/12/2009 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ void free_cat(catstruct **cat, int ncat) Loading @@ -218,6 +224,10 @@ void free_cat(catstruct **cat, int ncat) if ((*thecat)->file) close_cat(*thecat); remove_tabs(*thecat); #ifdef HAVE_CFITSIO // Free resources allocated for CFITSIO close_cfitsio(*thecat); #endif free(*(thecat++)); } Loading Loading @@ -338,8 +348,8 @@ PURPOSE Explores the whole FITS file INPUT catalog structure. OUTPUT RETURN_OK if at least one table was found, RETURN_ERROR otherwise. NOTES Memory space for the array of fits structures is reallocated. AUTHOR E. Bertin (IAP & Leiden observatory) VERSION 14/12/2002 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ int map_cat(catstruct *cat) Loading @@ -355,15 +365,7 @@ int map_cat(catstruct *cat) #ifdef HAVE_CFITSIO fitsfile *infptr; int status, hdutype, hdunum; status = 0; fits_open_file(&infptr, cat->filename, READONLY, &status); if (status != 0) { fits_report_error(stderr, status); printf("ERROR could not open FITS file with cfitsio: %s\n", cat->filename); } hdunum = 1; int any_tile_compressed = 0; int status, hdutype, hdunum = 1; #endif // HAVE_CFITSIO for (ntab=0; !get_head(tab); ntab++) Loading @@ -375,31 +377,22 @@ int map_cat(catstruct *cat) #ifdef HAVE_CFITSIO if (tab->isTileCompressed) { any_tile_compressed = 1; tab->hdunum = hdunum; tab->infptr = infptr; status = 0; fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status); if (status != 0) printf("ERROR could not move to hdu %d in file %s\n", tab->hdunum, cat->filename); if (tab->tabsize) fseek(cat->file, infptr->Fptr->headstart[hdunum], SEEK_SET); // Trigger CFITSIO file opening status = 0; if (!cat->infptr) { fits_open_file(&cat->infptr, cat->filename, READONLY, &status); if (status != 0) { fits_report_error(stderr, status); error(EXIT_FAILURE, "Could not open FITS file with cfitsio: %s\n", cat->filename); } // NOT tile-compressed else { tab->infptr = NULL; if (tab->tabsize) QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); } hdunum++; #else tab->infptr = cat->infptr; } tab->hdunum = hdunum++; #endif // HAVE_CFITSIO if (tab->tabsize) QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); #endif // HAVE_CFITSIO if (prevtab) { Loading @@ -414,12 +407,6 @@ int map_cat(catstruct *cat) QFTELL(cat->file, tab->headpos, cat->filename); } #ifdef HAVE_CFITSIO // we will not need CFitsIO, so close CFitsIO file pointer now if (!any_tile_compressed) close_cfitsio(infptr); #endif cat->ntab = ntab; free(tab); if (prevtab) Loading Loading
doc/src/conf.py +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = 'Fri Sep 16 2022' today = 'Sat Feb 25 2023' # # Else, today_fmt is used as the format for a strftime call. # Loading
src/check.c +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: SExtractor * * Copyright: (C) 1993-2013 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see <http://www.gnu.org/licenses/>. * * Last modified: 23/09/2013 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -406,6 +406,7 @@ void reinitcheck(picstruct *field, checkstruct *check) remove_tabs(cat); copy_tab_fromptr(field->tab, cat, 0); tab = cat->tab; decomp_head(tab); tab->cat = cat; if (check->next<=1) prim_head(tab); Loading
src/field.c +9 −15 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: SExtractor * * Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1993-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with SExtractor. If not, see <http://www.gnu.org/licenses/>. * * Last modified: 23/09/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -70,25 +70,19 @@ picstruct *newfield(char *filename, int flags, int ext) field->cat = cat; nok = 0; tab = cat->tab; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) nok++; #endif if (tab->naxis >= 2 if ((tab->isTileCompressed) || (tab->naxis >= 2 && strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))) nok++; ext2 = ext; for (ntab=cat->ntab; ext2-- && ntab--;) { tab=tab->nexttab; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) nok++; #endif if (tab->naxis >= 2 if ((tab->isTileCompressed) || (tab->naxis >= 2 && strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))) nok++; } if (!nok) Loading
src/fits/fitsbody.c +5 −5 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: AstrOmatic FITS/LDAC library * * Copyright: (C) 1995-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1995-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -23,7 +23,7 @@ * along with AstrOmatic software. * If not, see <http://www.gnu.org/licenses/>. * * Last modified: 26/08/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading Loading @@ -394,8 +394,8 @@ INPUT A pointer to the tab structure, the number of elements to be read. OUTPUT -. NOTES . AUTHOR E. Bertin (IAP) VERSION 26/08/2020 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) { Loading Loading @@ -439,7 +439,7 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) bufdata = (char *)bufdata0; #ifdef HAVE_CFITSIO if (tab->isTileCompressed) if (tab->isTileCompressed && tab->infptr) readTileCompressed(tab, spoonful, (void *)bufdata0); else QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); Loading
src/fits/fitscat.c +52 −65 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * * This file part of: AstrOmatic FITS/LDAC library * * Copyright: (C) 1995-2020 IAP/CNRS/SorbonneU * Copyright: (C) 1995-2023 CFHT/IAP/CNRS/SorbonneU * * License: GNU General Public License * Loading @@ -23,7 +23,7 @@ * along with AstrOmatic software. * If not, see <http://www.gnu.org/licenses/>. * * Last modified: 26/08/2020 * Last modified: 25/02/2023 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ Loading @@ -42,6 +42,8 @@ #include "fitscat_defs.h" #include "fitscat.h" extern float *fits_rand_value; char fits_str[MAXCHAR]; /****** about_cat ************************************************************** Loading Loading @@ -168,29 +170,33 @@ int close_cat(catstruct *cat) } #ifdef HAVE_CFITSIO /****** close_cfitsio ************************************************************** Closes a file previously opened by cfitsio /****** close_cfitsio ********************************************************** PROTO int close_cfitsio(fitsfile **infptr) PURPOSE Close a file previously opened by cfitsio INPUT fitsfile structure. OUTPUT RETURN_OK if everything went as expected (exit in error otherwise). NOTES the fitsfile pointer is set to NULL; AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ int close_cfitsio(fitsfile *infptr) { int close_cfitsio(catstruct *cat) { if (infptr != NULL) { if ((cat) && (cat->infptr)) { int status = 0; fits_close_file(cat->infptr, &status); int status = 0; fits_close_file(infptr, &status); if (status != 0) { fits_report_error(stderr, status); printf("ERROR could not close FITS file with cfitsio\n"); } else { //printf("Successfully closed FITS file with cfitsio\n"); infptr == NULL; } } else { //printf("ERROR no cfitsio file to close\n"); error(EXIT_FAILURE, "Could not close FITS file with cfitsio: ", cat->filename); } else { // Successfully closed FITS file with cfitsio cat->infptr == NULL; // Free random seed in CFITSIO. QFREE(fits_rand_value); } } else return RETURN_ERROR; return RETURN_OK; } #endif // HAVE_CFITSIO Loading @@ -202,8 +208,8 @@ INPUT Pointer to a catalog structure, Number of catalogs. OUTPUT -. NOTES Unallocated pointers should have been put to NULL. AUTHOR E. Bertin (IAP & Leiden observatory) VERSION 05/12/2009 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ void free_cat(catstruct **cat, int ncat) Loading @@ -218,6 +224,10 @@ void free_cat(catstruct **cat, int ncat) if ((*thecat)->file) close_cat(*thecat); remove_tabs(*thecat); #ifdef HAVE_CFITSIO // Free resources allocated for CFITSIO close_cfitsio(*thecat); #endif free(*(thecat++)); } Loading Loading @@ -338,8 +348,8 @@ PURPOSE Explores the whole FITS file INPUT catalog structure. OUTPUT RETURN_OK if at least one table was found, RETURN_ERROR otherwise. NOTES Memory space for the array of fits structures is reallocated. AUTHOR E. Bertin (IAP & Leiden observatory) VERSION 14/12/2002 AUTHOR E. Bertin (CFHT/IAP/CNRS/SorbonneU) VERSION 25/02/2023 ***/ int map_cat(catstruct *cat) Loading @@ -355,15 +365,7 @@ int map_cat(catstruct *cat) #ifdef HAVE_CFITSIO fitsfile *infptr; int status, hdutype, hdunum; status = 0; fits_open_file(&infptr, cat->filename, READONLY, &status); if (status != 0) { fits_report_error(stderr, status); printf("ERROR could not open FITS file with cfitsio: %s\n", cat->filename); } hdunum = 1; int any_tile_compressed = 0; int status, hdutype, hdunum = 1; #endif // HAVE_CFITSIO for (ntab=0; !get_head(tab); ntab++) Loading @@ -375,31 +377,22 @@ int map_cat(catstruct *cat) #ifdef HAVE_CFITSIO if (tab->isTileCompressed) { any_tile_compressed = 1; tab->hdunum = hdunum; tab->infptr = infptr; status = 0; fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status); if (status != 0) printf("ERROR could not move to hdu %d in file %s\n", tab->hdunum, cat->filename); if (tab->tabsize) fseek(cat->file, infptr->Fptr->headstart[hdunum], SEEK_SET); // Trigger CFITSIO file opening status = 0; if (!cat->infptr) { fits_open_file(&cat->infptr, cat->filename, READONLY, &status); if (status != 0) { fits_report_error(stderr, status); error(EXIT_FAILURE, "Could not open FITS file with cfitsio: %s\n", cat->filename); } // NOT tile-compressed else { tab->infptr = NULL; if (tab->tabsize) QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); } hdunum++; #else tab->infptr = cat->infptr; } tab->hdunum = hdunum++; #endif // HAVE_CFITSIO if (tab->tabsize) QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); #endif // HAVE_CFITSIO if (prevtab) { Loading @@ -414,12 +407,6 @@ int map_cat(catstruct *cat) QFTELL(cat->file, tab->headpos, cat->filename); } #ifdef HAVE_CFITSIO // we will not need CFitsIO, so close CFitsIO file pointer now if (!any_tile_compressed) close_cfitsio(infptr); #endif cat->ntab = ntab; free(tab); if (prevtab) Loading