From c6dee909e8a50cd28d2e514ab6f5ca90eb7afbc9 Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 25 Jul 2020 04:26:06 +0200 Subject: [PATCH] less code, less bug ? --- funcs/fimg-fits.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/funcs/fimg-fits.c b/funcs/fimg-fits.c index aa8d7549..64e46bf3 100644 --- a/funcs/fimg-fits.c +++ b/funcs/fimg-fits.c @@ -1,6 +1,9 @@ /* * FLOATIMG * import/export to/from FITS files + + https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node1.html + */ #include @@ -21,7 +24,7 @@ int bitpix = FLOAT_IMG; long naxis = 2; long naxes[2]; -float **array; +// XXX float *array[1]; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags); @@ -36,22 +39,23 @@ if (fits_create_file(&fptr, outname, &status)) { } naxes[0] = src->width; naxes[1] = src->height; -array = calloc(src->height, sizeof(float *)); +// XXX array = calloc(src->height, sizeof(float *)); if (verbosity) fimg_describe(src, "to be saved as FITS"); -#define REVERSE 1 -/* initialize pointers to the start of each row of the image */ +/************************************************************ + ***** MAGIC CODE MUST COME HERE ? array[0] = src->R; +#define REVERSE 1 for( idx=0; idxR + (k*naxes[0]); - fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]); + fprintf(stderr, " %6d %6d %p\n", idx, k, array[idx]); } +**************************************************************/ if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) { fits_report_error(stderr, status); @@ -59,7 +63,7 @@ if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) { } sz = naxes[0]*naxes[1]; -if ( fits_write_img(fptr, TFLOAT, 1, sz, array[0], &status) ) { +if ( fits_write_img(fptr, TFLOAT, 1, sz, src->R, &status) ) { fits_report_error(stderr, status); return -10; }