IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14206


Ignore:
Timestamp:
Jul 13, 2007, 5:20:00 PM (19 years ago)
Author:
magnier
Message:

output FITS files now consistently call a WritePHU function for their type; dropping pmFPA.wrote_phu, adding pmFPAfile.wrote_phu

File:
1 edited

Legend:

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

    r13894 r14206  
    465465        status = psFitsClose (file->fits);
    466466        file->fits = NULL;
    467         file->phu = NULL;
    468467        file->header = NULL;
    469468        file->state = PM_FPA_STATE_CLOSED;
     469        file->wrote_phu = false;
    470470        break;
    471471
     
    664664      case PM_FPA_FILE_HEADER:
    665665      case PM_FPA_FILE_FRINGE:
    666         // XXX note that for CMF and PSF, we do not know yet if there is actually any data to
    667         // write out.  this is because these types of output files have their data stored on the
    668         // readout->analysis metadata structure of another (existing) fpa
    669666      case PM_FPA_FILE_CMF:
    670667      case PM_FPA_FILE_PSF:
     
    691688
    692689        // In some cases, we need to read the PHU after we've opened the file.  This happens for
    693         // the images supplied by the detrend database, which are only identified here (above).
     690        // the images supplied by the detrend database, which are only identified here (pmConfigConvertFilename).
    694691        if (!pmFPAfileReadPHU (file, view, config)) {
    695692            psError (PS_ERR_IO, true, "error reading PHU for %s (%s) (%d:%d:%d)\n", file->filename, file->name, view->chip, view->cell, view->readout);
     
    787784    PS_ASSERT_PTR_NON_NULL(view, false);
    788785
     786    if (file->wrote_phu) return true;
     787
    789788    bool status = true;
    790789    switch (file->type) {
     
    793792      case PM_FPA_FILE_WEIGHT:
    794793      case PM_FPA_FILE_FRINGE:
    795         if (file->mode == PM_FPA_MODE_WRITE) {
    796             // Want to write out any potential blank
    797             // XXX why do we need to construct a new fpa??
    798             pmFPA *fpa = pmFPAfileSuitableFPA(file, view, config); // FPA, ensuring it's ready to write a blank
    799 
    800             switch (file->fileLevel) {
    801               case PM_FPA_LEVEL_FPA:
    802                 if (file->fpa->wrote_phu) break;
    803                 status = pmFPAWrite(fpa, file->fits, NULL, true, false);
    804                 file->fpa->wrote_phu = true;
    805                 break;
    806               case PM_FPA_LEVEL_CHIP: {
    807                   pmChip *chip = pmFPAviewThisChip(view, fpa);
    808                   if (chip->wrote_phu) break;
    809                   status = pmChipWrite(chip, file->fits, NULL, true, false);
    810                   chip->wrote_phu = true;
    811                   break;
    812               }
    813               case PM_FPA_LEVEL_CELL: {
    814                   pmCell *cell = pmFPAviewThisCell(view, fpa);
    815                   if (cell->wrote_phu) break;
    816                   status = pmCellWrite(cell, file->fits, NULL, true);
    817                   cell->wrote_phu = true;
    818                   break;
    819               }
    820               default:
    821                 psAbort("fileLevel not correctly set");
    822                 break;
    823             }
    824 
    825             psFree(fpa);
    826         }
     794        status = pmFPAviewFitsWritePHU (view, file, config);
     795        break;
     796      case PM_FPA_FILE_CMF:
     797        status = pmSource_CMF_WritePHU (view, file, config);
     798        break;
     799      case PM_FPA_FILE_PSF:
     800        status = pmPSF_WritePHU (view, file, config);
     801        break;
    827802      case PM_FPA_FILE_SX:
    828803      case PM_FPA_FILE_RAW:
    829804      case PM_FPA_FILE_OBJ:
    830805      case PM_FPA_FILE_CMP:
    831       case PM_FPA_FILE_CMF:
    832       case PM_FPA_FILE_PSF:
    833806      case PM_FPA_FILE_JPEG:
    834807      case PM_FPA_FILE_KAPA:
     
    842815        return false;
    843816    }
     817    // XXX this is also being set in the individual functions.  choose one or the other
     818    file->wrote_phu = true;
    844819    return true;
    845820}
Note: See TracChangeset for help on using the changeset viewer.