Changeset 10920 for trunk/psModules/src/objects/pmSourceIO.c
- Timestamp:
- Jan 5, 2007, 10:19:23 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceIO.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceIO.c
r10829 r10920 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $6 * @date $Date: 200 6-12-25 01:49:50$5 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-01-05 20:19:23 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 168 168 169 169 bool status; 170 char *exttype; 170 171 char *realname; 171 172 char *filename; … … 248 249 249 250 // if file does not yet have a PHU, attempt to write one to disk 250 if (file->phu == NULL) { 251 // get the corresponding phu 251 // we only need a PHU if chips->n > 1 and file->fileLevel == FPA 252 // otherwise, the chip header fills the PHU location 253 if ((file->fileLevel == PM_FPA_LEVEL_FPA) && (file->fpa->chips->n > 1) && !file->phu) { 254 255 // find the FPA phu 252 256 phu = pmFPAviewThisPHU (view, file->fpa); 253 257 254 258 // if there is no PHU, this is a single header+image (extension-less) file 255 259 // if there is a PHU, write it out as a 'blank' 260 outhead = psMetadataAlloc(); 256 261 if (phu) { 257 outhead = psMetadataCopy (NULL, phu->header); 258 259 // if we have mosaic-level astrometry information, add it here: 260 updates = psMetadataLookupPtr (&status, file->fpa->analysis, "PSASTRO.HEADER"); 261 if (updates) { 262 psMetadataCopy (outhead, updates); 263 } 264 265 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true); 266 // XXX what is the EXTNAME?? 267 psFitsWriteBlank (file->fits, outhead, ""); 268 file->phu = phu->header; 269 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type); 270 psFree (outhead); 262 psMetadataCopy (outhead, phu->header); 271 263 } 272 } 264 265 // if we have mosaic-level astrometry information, add it here: 266 updates = psMetadataLookupPtr (&status, file->fpa->analysis, "PSASTRO.HEADER"); 267 if (updates) { 268 psMetadataCopy (outhead, updates); 269 } 270 271 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true); 272 psFitsWriteBlank (file->fits, outhead, ""); 273 file->phu = true; 274 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type); 275 psFree (outhead); 276 } 277 278 // EXTNAME values used to for table data and image header segments 279 dataname = pmFPAfileNameFromRule (file->extrule, file, view); 280 headname = pmFPAfileNameFromRule (file->extxtra, file, view); 273 281 274 282 // this header block is new, write it to disk 275 283 if (hdu->header != file->header) { 276 // determine name for header extension277 headname = pmFPAfileNameFromRule (file->extxtra, file, view);278 284 outhead = psMetadataCopy (NULL, hdu->header); 279 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname); 280 if (file->phu == NULL) { 285 286 // add EXTNAME, EXTHEAD, EXTTYPE to header 287 // psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname); 288 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTDATA", PS_META_REPLACE, "name of table extension", dataname); 289 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", "IMAGE"); 290 if (!file->phu) { 281 291 // this hdu->header acts as the PHU: set EXTEND to be true 282 292 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true); 283 293 } 284 294 285 // XXX : see note below about DVO/addstar expectations295 // save psphot and psastro metadata in the image (not table) header 286 296 updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER"); 287 297 if (updates) { … … 298 308 file->header = hdu->header; 299 309 psFree (outhead); 300 psFree (headname); 301 } 302 303 // write this table to disk 304 dataname = pmFPAfileNameFromRule (file->extrule, file, view); 305 306 // XXX : currently, this is being added to the TABLE header 307 // this may be the correct location for a MEF file, but it is 308 // inconsistent with DVO/addstar expectations. DVO/addstar 309 // currently only expects a single header/table pair, and the 310 // metadata are in the blank (image) header, not the table header 311 // it may be necessary to put the results from the first readout 312 // in the blank image header to cover this case. 313 updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER"); 314 pmSourcesWriteCMF (file->fits, sources, updates, dataname); 310 } 311 312 // create a header to hold the output data 313 outhead = psMetadataAlloc (); 314 315 exttype = psStringCopy ("SMPDATA"); // XXX derive this from the recipes 316 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTHEAD", PS_META_REPLACE, "name of image extension w/", headname); 317 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", exttype); 318 psFree (exttype); 319 320 pmSourcesWriteCMF (file->fits, sources, outhead, dataname); 315 321 psTrace ("pmFPAfile", 5, "wrote ext data %s (type: %d)\n", file->filename, file->type); 322 323 psFree (headname); 316 324 psFree (dataname); 325 psFree (outhead); 317 326 break; 318 327
Note:
See TracChangeset
for help on using the changeset viewer.
