IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 28, 2006, 9:21:35 AM (20 years ago)
Author:
magnier
Message:

fixes for correct PHU/HDU output handling

File:
1 edited

Legend:

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

    r7712 r7726  
    7373
    7474// given an already-opened fits file, write the components corresponding
    75 // to the specified view
     75// to the specified view. when the file was opened, pmFPA/Chip/CellWrite was
     76// called on it with blank=true to write the (possible) blank PHU
     77// do NOT call the functions below with blank=true or they will write
     78// out data in an inconsistent fashion
     79// the calls below should recurse down the element to write out all components.
    7680bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file)
    7781{
     
    8488    // pmFPAWrite takes care of all PHUs as needed
    8589    if (view->chip == -1) {
    86         pmFPAWrite(fpa, fits, NULL, true, true);
     90        pmFPAWrite(fpa, fits, NULL, false, true);
    8791        return true;
    8892    }
     
    9498    pmChip *chip = fpa->chips->data[view->chip];
    9599
    96 
     100    if (view->cell == -1) {
     101        pmChipWrite (chip, fits, NULL, false, true);
     102        return true;
     103    }
     104
     105    if (view->cell >= chip->cells->n) {
     106        psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n);
     107        return false;
     108    }
     109    pmCell *cell = chip->cells->data[view->cell];
     110
     111    if (view->readout == -1) {
     112        return pmCellWrite (cell, fits, NULL, false);
     113    }
     114    psError(PS_ERR_UNKNOWN, true, "Returning false");
     115    return false;
     116
     117    // XXX disable readout write for now
    97118    #if 0
    98     // XXX This no longer required since we write the PHU at open.
    99 
    100     // do we need to write out a PHU for this entry?
    101     if (file->phu == NULL) {
     119
     120    if (view->readout >= cell->readouts->n) {
     121        psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d",
     122                view->readout, cell->readouts->n);
     123        return false;
     124    }
     125    pmReadout *readout = cell->readouts->data[view->readout];
     126
     127    if (view->nRows == 0) {
     128        pmReadoutWrite (readout, fits, NULL, NULL);
     129    } else {
     130        pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
     131    }
     132    return true;
     133    #endif
     134}
     135
     136// this old code was used to write the blank by hand.
     137// pmFPAWrite now takes care of this choice.
     138# if 0
     139// do we need to write out a PHU for this entry?
     140if (file->phu == NULL)
     141    {
    102142        pmHDU *hdu = pmFPAviewThisHDU (view, file->fpa);
    103143        pmHDU *phu = pmFPAviewThisPHU (view, file->fpa);
     
    119159        }
    120160    }
    121     #endif
    122 
    123     if (view->cell == -1) {
    124         pmChipWrite (chip, fits, NULL, true, true);
    125         return true;
    126     }
    127 
    128     if (view->cell >= chip->cells->n) {
    129         psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n);
    130         return false;
    131     }
    132     pmCell *cell = chip->cells->data[view->cell];
    133 
    134     if (view->readout == -1) {
    135         return pmCellWrite (cell, fits, NULL, true);
    136     }
    137     psError(PS_ERR_UNKNOWN, true, "Returning false");
    138     return false;
    139 
    140     // XXX disable readout write for now
    141     #if 0
    142 
    143     if (view->readout >= cell->readouts->n) {
    144         psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d",
    145                 view->readout, cell->readouts->n);
    146         return false;
    147     }
    148     pmReadout *readout = cell->readouts->data[view->readout];
    149 
    150     if (view->nRows == 0) {
    151         pmReadoutWrite (readout, fits, NULL, NULL);
    152     } else {
    153         pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
    154     }
    155     return true;
    156     #endif
    157 }
     161# endif
    158162
    159163// given an already-opened fits file, read the components corresponding
Note: See TracChangeset for help on using the changeset viewer.