Changeset 14207 for trunk/psModules/src/objects/pmPSF_IO.c
- Timestamp:
- Jul 13, 2007, 5:20:22 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSF_IO.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF_IO.c
r13526 r14207 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 5-26 02:52:27$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-07-14 03:20:22 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 224 224 bool status; 225 225 pmHDU *hdu; 226 pmHDU *phu;227 226 char *headName, *tableName, *residName; 228 227 … … 240 239 // XXX this code could be placed in a 'pmPSF_WritePHU' function and called 241 240 // from pmFPAfileIO.c. 242 if ((file->fileLevel == PM_FPA_LEVEL_FPA) && (file->fpa->chips->n > 1) && !file->phu) {243 244 // find the FPA phu245 phu = pmFPAviewThisPHU (view, file->fpa);246 247 // if there is no PHU, this is a single header+image (extension-less) file248 // if there is a PHU, write it out as a 'blank'249 psMetadata *outhead = psMetadataAlloc();250 if (phu) {251 psMetadataCopy (outhead, phu->header);252 } else {253 pmConfigConformHeader (outhead, file->format);254 255 psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information256 const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME");257 if (fpaNameHdr && strlen(fpaNameHdr) > 0) {258 const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME");259 psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);260 }261 }262 263 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true);264 psFitsWriteBlank (file->fits, outhead, "");265 file->phu = true;266 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type);267 psFree (outhead);268 }269 241 270 242 // define the EXTNAME values used for image header, table data, and residual image segments … … 315 287 psMetadataAddStr (hdu->header, PS_LIST_TAIL, "EXTRESID", PS_META_REPLACE, "name of resid extension", residName); 316 288 psMetadataAddStr (hdu->header, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", "IMAGE"); 317 if (!file-> phu) {289 if (!file->wrote_phu) { 318 290 // this hdu->header acts as the PHU: set EXTEND to be true 319 291 psMetadataAddBool (hdu->header, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true); 292 file->wrote_phu = true; 320 293 } 321 294 … … 471 444 } 472 445 446 // if this file needs to have a PHU written out, write one 447 bool pmPSF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) { 448 449 // not needed if already written 450 if (file->wrote_phu) return true; 451 452 // not needed if not FPA 453 // XXX this prevents us from defining a SPLIT/MEF CMF file... 454 if (file->fileLevel != PM_FPA_LEVEL_FPA) return true; 455 456 // not needed if only one chip 457 if (file->fpa->chips->n == 1) return true; 458 459 // find the FPA phu 460 pmHDU *phu = pmFPAviewThisPHU (view, file->fpa); 461 462 // if there is no PHU, this is a single header+image (extension-less) file. This could be 463 // the case for an input SPLIT set of files being written out as a MEF. if there is a PHU, 464 // write it out as a 'blank' 465 psMetadata *outhead = psMetadataAlloc(); 466 if (phu) { 467 psMetadataCopy (outhead, phu->header); 468 } else { 469 pmConfigConformHeader (outhead, file->format); 470 471 psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information 472 const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME"); 473 if (fpaNameHdr && strlen(fpaNameHdr) > 0) { 474 const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME"); 475 psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName); 476 } 477 } 478 479 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true); 480 psFitsWriteBlank (file->fits, outhead, ""); 481 file->wrote_phu = true; 482 483 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type); 484 psFree (outhead); 485 486 return true; 487 } 488 473 489 bool pmFPAviewReadPSFmodel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 474 490 {
Note:
See TracChangeset
for help on using the changeset viewer.
