IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 22, 2006, 2:23:08 PM (20 years ago)
Author:
Paul Price
Message:

Adding pmHDUGenerate to make an HDU (image) from the cells contained below. Altered pmFPACopy to use pmHDUGenerate functions. The motivation for pmHDUGenerate is that when we go through an FPA bit by bit, creating an output FPA, we don't know the size of the resultant output images until we're done with the whole lot. So we simply create the cells, and call pmHDUGenerateFromFPA (etc) to generate the HDU image which is then written out. It takes care of the TRIMSEC, BIASSEC, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAWrite.c

    r7097 r7168  
    66#include "pmHDU.h"
    77#include "pmHDUUtils.h"
     8#include "pmHDUGenerate.h"
    89#include "pmConcepts.h"
    910
     11#include "pmFPAWrite.h"
    1012
    1113bool pmReadoutWriteNext(pmReadout *readout, // Readout to write
     
    5153        return false;
    5254    }
    53     psImage *image = hdu->images->data[z]; // The image from the HDU to write
     55    psImage *image = readout->image; // The image from the HDU to write
    5456    if (readout->row0 == 0 && readout->col0 == 0 && z == 0) {
    5557        // Then we can assume that nothing has been written to the FITS file for now
     
    6870
    6971    // We can simply update an existing HDU
    70     if (!psFitsMoveExtName(fits, hdu->extname)) {
     72    if (((hdu->phu || strcasecmp(hdu->extname, "PHU") == 0) && !psFitsMoveExtNum(fits, 0, false)) ||
     73            !psFitsMoveExtName(fits, hdu->extname)) {
    7174        psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
    7275        return false;
     
    8689    pmHDU *hdu = cell->hdu;             // The HDU
    8790    if (hdu && ((!pixels && hdu->phu) || pixels)) {
     91        if (pixels && !hdu->images && !pmHDUGenerateForCell(cell)) {
     92            psError(PS_ERR_IO, false, "Unable to generate HDU for cell.\n");
     93            return false;
     94        }
    8895        bool status = pmConceptsWriteCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA |
    8996                                          PM_CONCEPT_SOURCE_DEFAULTS, false, NULL);
     
    107114    pmHDU *hdu = chip->hdu;             // The HDU
    108115    if (hdu && ((!pixels && hdu->phu) || pixels)) {
     116        if (pixels && !hdu->images && !pmHDUGenerateForChip(chip)) {
     117            psError(PS_ERR_IO, false, "Unable to generate HDU for chip.\n");
     118            return false;
     119        }
    109120        bool status = pmConceptsWriteChip(chip, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA |
    110121                                          PM_CONCEPT_SOURCE_DEFAULTS, false, NULL);
     
    130141
    131142
    132 
    133143bool pmFPAWrite(pmFPA *fpa,             // FPA to write
    134144                psFits *fits,           // FITS file to which to write
     
    139149    pmHDU *hdu = fpa->hdu;              // The HDU
    140150    if (hdu && ((!pixels && hdu->phu) || pixels)) {
     151        if (pixels && !hdu->images && !pmHDUGenerateForFPA(fpa)) {
     152            psError(PS_ERR_IO, false, "Unable to generate HDU for FPA.\n");
     153            return false;
     154        }
    141155        bool status = pmConceptsWriteFPA(fpa, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA |
    142156                                         PM_CONCEPT_SOURCE_DEFAULTS, NULL);
Note: See TracChangeset for help on using the changeset viewer.