Compare commits

..

No commits in common. "d8bb6f4ec6b76660f7ae16b8a1be523aae4df187" and "334cffce6055a1e4b4583240d3eea85889db6357" have entirely different histories.

View File

@ -16,7 +16,7 @@ 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, idx, sz;
int bitpix = FLOAT_IMG; int bitpix = FLOAT_IMG;
long naxis = 2; long naxis = 2;
@ -36,21 +36,16 @@ if (fits_create_file(&fptr, outname, &status)) {
} }
naxes[0] = src->width; naxes[1] = src->height; naxes[0] = src->width; naxes[1] = src->height;
array = calloc(src->height, sizeof(float *));
if (verbosity) fimg_describe(src, "to be saved as FITS");
#define REVERSE 1 array = calloc(src->height, sizeof(float *));
if (verbosity) fimg_describe(src, "to be saved as fits");
/* initialize pointers to the start of each row of the image */ /* initialize pointers to the start of each row of the image */
array[0] = src->R;
for( idx=0; idx<naxes[1]; idx++ ) { for( idx=0; idx<naxes[1]; idx++ ) {
/**** MAGIC CODE MUST COME HERE ****/ /**** MAGIC CODE MUST COME HERE ****/
#if REVERSE array[idx] = src->R + (idx*naxes[0]);
k = naxes[1] - idx - 1; // fprintf(stderr, " %6d %p\n", idx, array[idx]);
#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) ) {