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