IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2007, 11:32:43 AM (19 years ago)
Author:
Paul Price
Message:

Merging branch with FITS compression development. Minor conflicts in pmConfig.c, pmFPAfileDefine.c, pmFPAfileIO.c resolved.

File:
1 edited

Legend:

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

    r15140 r15180  
    359359            return false;
    360360        }
     361
     362        // do we need to write out a PHU?
     363        if (!pmFPAfileWritePHU(file, fileView, config)) {
     364            psError(PS_ERR_IO, false, "failed to write phu for %s (%s)", file->filename, file->name);
     365            return false;
     366        }
     367
    361368        psFree (fileView);
    362369    }
    363370
    364     // do we need to write out a PHU?
    365     if (level >= file->fileLevel) {
    366         if (!pmFPAfileWritePHU (file, view, config)) {
    367             psError(PS_ERR_IO, false, "failed to write phu for %s (%s)", file->filename, file->name);
     371    if (file->compression) {
     372        psTrace("psModules.camera", 7, "Setting compression for %s (%s)\n", file->filename, file->name);
     373        if (!psFitsCompressionApply(file->fits, file->compression)) {
     374            psError(PS_ERR_UNKNOWN, false, "Unable to set compression options for %s (%s) (%d:%d:%d)\n",
     375                    file->filename, file->name, view->chip, view->cell, view->readout);
    368376            return false;
    369377        }
     
    667675      case PM_FPA_FILE_CMF:
    668676      case PM_FPA_FILE_PSF:
    669         psTrace ("psModules.camera", 5, "opening %s (%s) (%d:%d:%d)\n", file->filename, file->name, view->chip, view->cell, view->readout);
     677        psTrace ("psModules.camera", 5, "opening %s (%s) (%d:%d:%d)\n",
     678                 file->filename, file->name, view->chip, view->cell, view->readout);
    670679        file->fits = psFitsOpen (file->filename, mode);
    671680        if (file->fits == NULL) {
     
    679688            psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE");
    680689            if (!fileMenu) {
    681                 psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n", file->formatName);
     690                psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n",
     691                         config->formatName);
    682692                return false;
    683693            }
     
    688698        }
    689699
    690         // In some cases, we need to read the PHU after we've opened the file.  This happens for
    691         // the images supplied by the detrend database, which are only identified here (pmConfigConvertFilename).
     700        if (file->compression) {
     701            psTrace("psModules.camera", 7, "Setting compression for %s (%s)\n", file->filename, file->name);
     702            if (!psFitsCompressionApply(file->fits, file->compression)) {
     703                psError(PS_ERR_UNKNOWN, false, "Unable to set compression options for %s (%s) (%d:%d:%d)\n",
     704                        file->filename, file->name, view->chip, view->cell, view->readout);
     705                return false;
     706            }
     707        }
     708
     709        // In some cases, we need to read the PHU after we've opened the file.  This happens for the images
     710        // supplied by the detrend database, which are only identified here (pmConfigConvertFilename).
    692711        if (!pmFPAfileReadPHU (file, view, config)) {
    693             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);
     712            psError (PS_ERR_IO, true, "error reading PHU for %s (%s) (%d:%d:%d)\n",
     713                     file->filename, file->name, view->chip, view->cell, view->readout);
    694714            return false;
    695715        }
     
    758778            return false;
    759779        }
    760         file->formatName = psStringCopy(config->formatName);
     780        file->formatName = psStringCopy(config->formatName);
    761781
    762782    } else {
     
    796816      case PM_FPA_FILE_WEIGHT:
    797817      case PM_FPA_FILE_FRINGE:
    798         status = pmFPAviewFitsWritePHU (view, file, config);
    799         break;
     818        status = pmFPAviewFitsWritePHU (view, file, config);
     819        break;
    800820      case PM_FPA_FILE_CMF:
    801         status = pmSource_CMF_WritePHU (view, file, config);
    802         break;
     821        status = pmSource_CMF_WritePHU (view, file, config);
     822        break;
    803823      case PM_FPA_FILE_PSF:
    804         status = pmPSFmodelWritePHU (view, file, config);
    805         break;
     824        status = pmPSFmodelWritePHU (view, file, config);
     825        break;
    806826      case PM_FPA_FILE_SX:
    807827      case PM_FPA_FILE_RAW:
Note: See TracChangeset for help on using the changeset viewer.