IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 24, 2007, 11:00:07 AM (18 years ago)
Author:
eugene
Message:

fixed mis-match in psType to CFITSIO type for U8, S8; avoid setting noise bits for invalid compression types; avoid setting compression data if type is NONE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.c

    r15625 r15908  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-11-16 00:14:49 $
     9 *  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-12-24 21:00:07 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    570570    }
    571571
     572    // if we are setting a trivial compression (NONE), don't bother with the other parameters
     573    if (type == PS_FITS_COMPRESS_NONE) return true;
     574
    572575    // convert a psVector into the (long *) array that cfitsio requires
    573576    psVector *dim = NULL;
     
    592595    }
    593596
    594     if (fits_set_noise_bits(fits->fd, noisebits, &status)) {
    595         fits_set_compression_type(fits->fd, 0x0, &status);
    596         char fitsErr[MAX_STRING_LENGTH];
    597         fits_get_errstatus(status, fitsErr);
    598         psError(PS_ERR_BAD_FITS, true,
    599             "Error while configuring compression. CFITSIO error: %s", fitsErr);
    600         return false;
     597    // noise bits are irrelevant (not allowed) for PLIO.  XXX actually, it is the data type
     598    // that is the restriction; data must be 32 or 64 bit for noise bits to be valid.
     599    if (type != PS_FITS_COMPRESS_PLIO) {
     600        if (fits_set_noise_bits(fits->fd, noisebits, &status)) {
     601            fits_set_compression_type(fits->fd, 0x0, &status);
     602            char fitsErr[MAX_STRING_LENGTH];
     603            fits_get_errstatus(status, fitsErr);
     604            psError(PS_ERR_BAD_FITS, true,
     605                    "Error while configuring compression. CFITSIO error: %s", fitsErr);
     606            return false;
     607        }
    601608    }
    602609
     
    776783    case PS_TYPE_U8:
    777784        bitpix = BYTE_IMG;
     785        bzero = -1.0 * INT8_MIN;
    778786        datatype = TBYTE;
    779787        break;
     
    781789    case PS_TYPE_S8:
    782790        bitpix = BYTE_IMG;
    783         bzero = INT8_MIN;
    784791        datatype = TSBYTE;
    785792        break;
Note: See TracChangeset for help on using the changeset viewer.