Changeset 18177 for trunk/psModules/src/camera/pmFPAfileIO.c
- Timestamp:
- Jun 18, 2008, 12:39:44 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfileIO.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileIO.c
r18139 r18177 438 438 PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE; // Concept sources to write 439 439 if (cell) { 440 if (!pmConceptsWriteCell(cell, sources, true, NULL)) {440 if (!pmConceptsWriteCell(cell, sources, true, config)) { 441 441 psError(PS_ERR_IO, false, "Unable to write concepts for cell.\n"); 442 442 return false; 443 443 } 444 444 } else if (chip) { 445 if (!pmConceptsWriteChip(chip, sources, true, true, NULL)) {445 if (!pmConceptsWriteChip(chip, sources, true, true, config)) { 446 446 psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n"); 447 447 return false; 448 448 } 449 } else if (!pmConceptsWriteFPA(fpa, sources, true, NULL)) {449 } else if (!pmConceptsWriteFPA(fpa, sources, true, config)) { 450 450 psError(PS_ERR_IO, false, "Unable to write concepts for FPA.\n"); 451 451 return false; … … 779 779 file->fits->options = psMemIncrRefCounter(file->options); 780 780 781 // in most cases, we have already open and read the phu and determined the format.782 // in some cases, (eg DetDB images), we have only just determined the filename.783 // we need to check the file format before we can work with the file784 if (!file->format) {785 psMetadata *phu = psFitsReadHeader (NULL, file->fits);786 if (!phu) {787 psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename);788 return false;789 }790 791 // determine the current format from the header792 // determine camera if not specified already793 // XXX can I actually reach this with camera not specified??794 file->format = pmConfigCameraFormatFromHeader (NULL, NULL, config, phu, true);795 if (!file->format) {796 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename);797 psFree(phu);798 return false;799 }800 psFree(phu);801 }802 803 // if needed, set the optional EXTWORD field based on the camera value804 psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE");805 if (!fileMenu) {806 psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n",807 config->formatName);808 return false;809 }810 char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD");811 if (status) {812 psFitsSetExtnameWord (file->fits, extword);813 }781 // in most cases, we have already open and read the phu and determined the format. 782 // in some cases, (eg DetDB images), we have only just determined the filename. 783 // we need to check the file format before we can work with the file 784 if (!file->format) { 785 psMetadata *phu = psFitsReadHeader (NULL, file->fits); 786 if (!phu) { 787 psError(PS_ERR_IO, false, "Failed to read file header %s\n", file->filename); 788 return false; 789 } 790 791 // determine the current format from the header 792 // determine camera if not specified already 793 // XXX can I actually reach this with camera not specified?? 794 file->format = pmConfigCameraFormatFromHeader (NULL, NULL, config, phu, true); 795 if (!file->format) { 796 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", file->filename); 797 psFree(phu); 798 return false; 799 } 800 psFree(phu); 801 } 802 803 // if needed, set the optional EXTWORD field based on the camera value 804 psMetadata *fileMenu = psMetadataLookupMetadata (NULL, file->format, "FILE"); 805 if (!fileMenu) { 806 psError (PS_ERR_IO, true, "FILE METADATA missing from camera format %s\n", 807 config->formatName); 808 return false; 809 } 810 char *extword = psMetadataLookupStr (&status, fileMenu, "EXTWORD"); 811 if (status) { 812 psFitsSetExtnameWord (file->fits, extword); 813 } 814 814 815 815 // XXX these are probably only needed for WRITE files … … 888 888 psMetadata *phu = psFitsReadHeader (NULL, file->fits); 889 889 if (!file->format) { 890 // determine the format (camera is already known); do not load the recipe890 // determine the format (camera is already known); do not load the recipe 891 891 file->format = pmConfigCameraFormatFromHeader (NULL, &file->formatName, config, phu, false); 892 892 if (!file->format) {
Note:
See TracChangeset
for help on using the changeset viewer.
