cosmetic clean

This commit is contained in:
tth 2020-07-25 10:34:18 +02:00
parent c6dee909e8
commit efc2807227

View File

@ -19,12 +19,11 @@ extern int verbosity;
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags) int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
{ {
fitsfile *fptr; /* pointer to the FITS file */ fitsfile *fptr; /* pointer to the FITS file */
int status, idx, k, sz; int status, sz;
int bitpix = FLOAT_IMG; int bitpix = FLOAT_IMG;
long naxis = 2; long naxis = 2;
long naxes[2]; long naxes[2];
// XXX float *array[1];
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags); fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
@ -39,23 +38,8 @@ if (fits_create_file(&fptr, outname, &status)) {
} }
naxes[0] = src->width; naxes[1] = src->height; naxes[0] = src->width; naxes[1] = src->height;
// XXX array = calloc(src->height, sizeof(float *));
if (verbosity) fimg_describe(src, "to be saved as FITS"); if (verbosity) fimg_describe(src, "to be saved as FITS");
/************************************************************
***** MAGIC CODE MUST COME HERE ?
array[0] = src->R;
#define REVERSE 1
for( idx=0; idx<naxes[1]; idx++ ) {
#if REVERSE
k = naxes[1] - idx - 1;
#else
k = idx;
#endif
array[idx] = src->R + (k*naxes[0]);
fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]);
}
**************************************************************/
if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) { if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) {
fits_report_error(stderr, status); fits_report_error(stderr, status);
@ -76,3 +60,24 @@ if ( fits_close_file(fptr, &status) ) {
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/************************************************************
***** MAGIC CODE FROM OUTERSPACE ?
function 'writeimage' from :
https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples/cookbook.c
float **array;
array = calloc(src->height, sizeof(float *));
array[0] = src->R;
#define REVERSE 1
for( idx=0; idx<naxes[1]; idx++ ) {
#if REVERSE
k = naxes[1] - idx - 1;
#else
k = idx;
#endif
array[idx] = src->R + (k*naxes[0]);
fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]);
}
**************************************************************/