IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 8, 2006, 5:08:08 PM (20 years ago)
Author:
Paul Price
Message:

Broad changes to introduce pmHDU, and allow read/write at any level. Modified the camera configuration to use camera config (components of the camera) and format descriptions (FITS file layout).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/pmHDU.c

    r6519 r6552  
    99{
    1010    psFree(hdu->extname);
     11    psFree(hdu->format);
    1112    psFree(hdu->header);
    1213    psFree(hdu->images);
     
    3233        hdu->extname = psStringCopy(extname);
    3334    }
     35    hdu->format = NULL;
    3436    hdu->header = NULL;
    3537    hdu->images = NULL;
    3638    hdu->table  = NULL;
    3739
    38     return file;
     40    return hdu;
    3941}
    4042
     
    5456            return false;
    5557        }
    56     } else if (! psFitsMoveExtName(fits, hdu->extname)) {
    57         psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
     58        hdu->phu = true;
     59    } else {
     60        if (! psFitsMoveExtName(fits, hdu->extname)) {
     61            psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
     62        }
     63        // Now, just in case for some reason the PHU has an extension name that we've moved to....
     64        if (psFitsGetExtNum(fits) == 0) {
     65            hdu->phu = true;
     66        } else {
     67            hdu->phu = false;
     68        }
    5869    }
    5970
     
    6374    }
    6475
     76    #ifdef FITS_TABLES
    6577    // What type is it?
    6678    if (psFitsIsImage(hdu->header)) {
     79        #endif
    6780        if (hdu->images) {
    6881            psFree(hdu->images);        // Blow away anything existing
     
    7083        hdu->images = psFitsReadImageCube(fits, psRegionSet(0,0,0,0));
    7184        return true;
     85        #ifdef FITS_TABLES
     86
    7287    }
    7388    if (psFitsIsTable(hdu->table)) {
     
    8297    psError(PS_ERR_UNKNOWN, true, "No idea what this HDU consists of!\n");
    8398    return false;
     99    #endif
    84100}
    85101
     
    99115    }
    100116
     117    #ifdef FITS_TABLES
    101118    if (hdu->images && (!hdu->table || psFitsIsImage(hdu->header))) {
     119        #endif
    102120        psFitsWriteImageCube(fits, hdu->header, hdu->images, hdu->extname);
    103121        return true;
     122        #ifdef FITS_TABLES
     123
    104124    }
    105125
     
    111131    psError(PS_ERR_IO, true, "No idea what this HDU consists of!\n");
    112132    return false;
    113 }
    114 
    115 
    116 pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
    117                    )
    118 {
    119     return fpa->hdu;
    120 }
    121 
    122 pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
    123                     )
    124 {
    125     pmHDU *hdu = chip->hdu;             // The HDU information
    126     if (!hdu) {
    127         hdu = pmHDUFromFPA(chip->parent); // Grab HDU info from the FPA
    128     }
    129 
    130     return hdu;
    131 }
    132 
    133 pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
    134                     )
    135 {
    136     pmHDU *hdu = cell->hdu;             // The HDU information
    137     if (!hdu) {
    138         hdu = pmHDUFromChip(cell->parent); // Grab HDU info from the chip
    139     }
    140 
    141     return hdu;
    142 }
    143 
     133    #endif
     134}
    144135
    145136
Note: See TracChangeset for help on using the changeset viewer.