Loading src/fits/fitsbody.c +8 −2 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ void free_body(tabstruct *tab) return; } #ifdef HAVE_CFITSIO void readTileCompressed(tabstruct *tab, size_t spoonful, double* bufdata0) { int status, hdutype; Loading Loading @@ -352,6 +352,7 @@ void readTileCompressed(tabstruct *tab, size_t spoonful, double* bufdata0) { // update file 'pointer' tab->currentElement += spoonful; } #endif /******* read_body ************************************************************ PROTO read_body(tabstruct *tab, PIXTYPE *ptr, long size) Loading Loading @@ -409,10 +410,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) spoonful = size; bufdata = (char *)bufdata0; // CFITSIO #ifdef HAVE_CFITSIO if (tab->isTileCompressed) readTileCompressed(tab, spoonful, bufdata0); else #endif QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); switch(tab->bitpix) Loading Loading @@ -732,9 +734,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) bufdata = (char *)bufdata0; // CFITSIO #ifdef HAVE_CFITSIO if (tab->isTileCompressed) readTileCompressed(tab, spoonful, bufdata0); else #endif QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); switch(tab->bitpix) Loading Loading @@ -1033,6 +1037,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) } // CFITSIO - if cfitsio output file has been set up, then proceed to write using cfitsio #ifdef HAVE_CFITSIO if (0 && tab->infptr != NULL) { // TODO int status = 0; fits_write_img(tab->infptr, TFLOAT, tab->currentElement, spoonful, cbufdata0, &status); Loading @@ -1047,6 +1052,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) } // otherwise, continue with usual AstrOmatic fits writing routine else #endif QFWRITE(cbufdata0, spoonful*tab->bytepix, cat->file, cat->filename); } break; Loading src/fits/fitscat.c +12 −6 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ int close_cat(catstruct *cat) } #ifdef HAVE_CFITSIO int close_cfitsio(catstruct *cat) { Loading @@ -184,6 +185,7 @@ int close_cfitsio(catstruct *cat) } //printf("NO CFITSIO FILE TO CLOSE\n"); } #endif /****** free_cat *************************************************************** PROTO void free_cat(catstruct **cat, int ncat) Loading Loading @@ -343,6 +345,7 @@ int map_cat(catstruct *cat) tab->cat = cat; QFTELL(cat->file, tab->headpos, cat->filename); #ifdef HAVE_CFITSIO // CFITSIO fitsfile *infptr; int status, hdutype, hdunum; Loading @@ -352,6 +355,7 @@ int map_cat(catstruct *cat) printf("ERROR could not open FITS file with cfitsio: %s\n", cat->filename); } hdunum = 1; #endif for (ntab=0; !get_head(tab); ntab++) { Loading @@ -360,7 +364,7 @@ int map_cat(catstruct *cat) QFTELL(cat->file, tab->bodypos, cat->filename); tab->nseg = tab->seg = 1; // CFITSIO #ifdef HAVE_CFITSIO tab->hdunum = hdunum; tab->infptr = infptr; status = 0; fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status); Loading @@ -368,14 +372,15 @@ int map_cat(catstruct *cat) //tab->tabsize = infptr->Fptr->rowlength; //printf("TABSIZE = %ld\n", tab->tabsize); #endif if (tab->tabsize) { #ifdef HAVE_CFITSIO // IMPORTANT: moving to start of next header using fseek and cfitsio position rather than table size, as done previously fseek(cat->file, infptr->Fptr->headstart[hdunum], SEEK_SET); #else // this is how it was done previously //QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); #endif } if (prevtab) { Loading @@ -389,8 +394,9 @@ int map_cat(catstruct *cat) tab->cat = cat; QFTELL(cat->file, tab->headpos, cat->filename); // CFITSIO #ifdef HAVE_CFITSIO hdunum++; #endif } cat->ntab = ntab; Loading src/fits/fitscat.h +4 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,9 @@ #include <sys/types.h> #endif // CFITSIO #ifdef HAVE_CFITSIO #include FITSIO_H #endif #define MAXCHARS 256 /* max. number of characters */ #define WARNING_NMAX 1000 /* max. number of recorded warnings */ Loading Loading @@ -196,8 +197,9 @@ typedef struct structtab char swapname[MAXCHARS]; /* name of the swapfile */ unsigned int bodysum; /* Checksum of the FITS body */ // CFITSIO #ifdef HAVE_CFITSIO fitsfile *infptr; /* a cfitsio pointer to the file */ #endif int hdunum; /* FITS HDU number for this 'table' */ int isTileCompressed; /* is this a tile compressed image? */ long currentElement; /* tracks the current image pixel */ Loading Loading
src/fits/fitsbody.c +8 −2 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ void free_body(tabstruct *tab) return; } #ifdef HAVE_CFITSIO void readTileCompressed(tabstruct *tab, size_t spoonful, double* bufdata0) { int status, hdutype; Loading Loading @@ -352,6 +352,7 @@ void readTileCompressed(tabstruct *tab, size_t spoonful, double* bufdata0) { // update file 'pointer' tab->currentElement += spoonful; } #endif /******* read_body ************************************************************ PROTO read_body(tabstruct *tab, PIXTYPE *ptr, long size) Loading Loading @@ -409,10 +410,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) spoonful = size; bufdata = (char *)bufdata0; // CFITSIO #ifdef HAVE_CFITSIO if (tab->isTileCompressed) readTileCompressed(tab, spoonful, bufdata0); else #endif QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); switch(tab->bitpix) Loading Loading @@ -732,9 +734,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) bufdata = (char *)bufdata0; // CFITSIO #ifdef HAVE_CFITSIO if (tab->isTileCompressed) readTileCompressed(tab, spoonful, bufdata0); else #endif QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); switch(tab->bitpix) Loading Loading @@ -1033,6 +1037,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) } // CFITSIO - if cfitsio output file has been set up, then proceed to write using cfitsio #ifdef HAVE_CFITSIO if (0 && tab->infptr != NULL) { // TODO int status = 0; fits_write_img(tab->infptr, TFLOAT, tab->currentElement, spoonful, cbufdata0, &status); Loading @@ -1047,6 +1052,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) } // otherwise, continue with usual AstrOmatic fits writing routine else #endif QFWRITE(cbufdata0, spoonful*tab->bytepix, cat->file, cat->filename); } break; Loading
src/fits/fitscat.c +12 −6 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ int close_cat(catstruct *cat) } #ifdef HAVE_CFITSIO int close_cfitsio(catstruct *cat) { Loading @@ -184,6 +185,7 @@ int close_cfitsio(catstruct *cat) } //printf("NO CFITSIO FILE TO CLOSE\n"); } #endif /****** free_cat *************************************************************** PROTO void free_cat(catstruct **cat, int ncat) Loading Loading @@ -343,6 +345,7 @@ int map_cat(catstruct *cat) tab->cat = cat; QFTELL(cat->file, tab->headpos, cat->filename); #ifdef HAVE_CFITSIO // CFITSIO fitsfile *infptr; int status, hdutype, hdunum; Loading @@ -352,6 +355,7 @@ int map_cat(catstruct *cat) printf("ERROR could not open FITS file with cfitsio: %s\n", cat->filename); } hdunum = 1; #endif for (ntab=0; !get_head(tab); ntab++) { Loading @@ -360,7 +364,7 @@ int map_cat(catstruct *cat) QFTELL(cat->file, tab->bodypos, cat->filename); tab->nseg = tab->seg = 1; // CFITSIO #ifdef HAVE_CFITSIO tab->hdunum = hdunum; tab->infptr = infptr; status = 0; fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status); Loading @@ -368,14 +372,15 @@ int map_cat(catstruct *cat) //tab->tabsize = infptr->Fptr->rowlength; //printf("TABSIZE = %ld\n", tab->tabsize); #endif if (tab->tabsize) { #ifdef HAVE_CFITSIO // IMPORTANT: moving to start of next header using fseek and cfitsio position rather than table size, as done previously fseek(cat->file, infptr->Fptr->headstart[hdunum], SEEK_SET); #else // this is how it was done previously //QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); #endif } if (prevtab) { Loading @@ -389,8 +394,9 @@ int map_cat(catstruct *cat) tab->cat = cat; QFTELL(cat->file, tab->headpos, cat->filename); // CFITSIO #ifdef HAVE_CFITSIO hdunum++; #endif } cat->ntab = ntab; Loading
src/fits/fitscat.h +4 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,9 @@ #include <sys/types.h> #endif // CFITSIO #ifdef HAVE_CFITSIO #include FITSIO_H #endif #define MAXCHARS 256 /* max. number of characters */ #define WARNING_NMAX 1000 /* max. number of recorded warnings */ Loading Loading @@ -196,8 +197,9 @@ typedef struct structtab char swapname[MAXCHARS]; /* name of the swapfile */ unsigned int bodysum; /* Checksum of the FITS body */ // CFITSIO #ifdef HAVE_CFITSIO fitsfile *infptr; /* a cfitsio pointer to the file */ #endif int hdunum; /* FITS HDU number for this 'table' */ int isTileCompressed; /* is this a tile compressed image? */ long currentElement; /* tracks the current image pixel */ Loading