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