Changeset 6726
- Timestamp:
- Mar 29, 2006, 10:55:42 AM (20 years ago)
- Location:
- branches/rel10_ifa/psModules/src
- Files:
-
- 11 edited
-
astrom/pmFPAfile.c (modified) (22 diffs)
-
astrom/pmFPAfile.h (modified) (2 diffs)
-
astrom/pmFPAview.c (modified) (9 diffs)
-
astrom/pmFPAview.h (modified) (5 diffs)
-
astrom/pmHDU.c (modified) (1 diff)
-
objects/pmFPAviewObjectsIO.h (modified) (2 diffs)
-
objects/pmFPAviewReadObjects.c (modified) (6 diffs)
-
objects/pmFPAviewWriteObjects.c (modified) (12 diffs)
-
objects/pmSourceIO_CMF.c (modified) (3 diffs)
-
objects/pmSourceIO_CMP.c (modified) (2 diffs)
-
objects/pmSourceIO_SX.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.c
r6713 r6726 1 1 #include <stdio.h> 2 2 #include "pslib.h" 3 #include "psAdditionals.h" 3 4 #include "pmHDU.h" 4 5 #include "pmFPA.h" … … 19 20 psFree (file->names); 20 21 21 psFitsClose (file->fits); 22 if (file->fits != NULL) { 23 psFitsClose (file->fits); 24 } 22 25 23 26 psFree (file->filerule); … … 26 29 psFree (file->extxtra); 27 30 28 // these are just views: 29 // psFree (file->filename); 30 // psFree (file->extname); 31 psFree (file->filename); 32 psFree (file->extname); 33 34 // these are just views ?? 31 35 // psFree (file->phu); 32 36 // psFree (file->header); … … 63 67 } 64 68 65 // XXX is a file allowed to be both READ and WRITE?66 69 pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *format, pmFPA *fpa, char *name) 67 70 { … … 195 198 } 196 199 197 // open file (if not already opened XXX : better tracking of open state?198 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view)200 // open file (if not already opened) 201 bool pmFPAfileOpen (pmFPAfile *file, const pmFPAview *view) 199 202 { 200 203 … … 220 223 221 224 // determine the file name 222 // XXX file->filename needs to be a copy, and freed in places like this...223 225 file->filename = pmFPAfileNameFromRule (file->filerule, file, view); 224 226 if (file->filename == NULL) … … 227 229 // indirect filenames 228 230 if (!strcasecmp (file->filename, "@FPAIO")) { 231 psFree (file->filename); 229 232 extra = pmFPAfileNameFromRule (file->filextra, file, view); 230 233 file->filename = psMetadataLookupStr (&status, file->names, extra); 234 psFree (extra); 231 235 if (file->filename == NULL) 232 236 return false; 237 // psMetadataLookupStr just returns a view, file->filename must be protected 238 psMemIncrRefCounter (file->filename); 233 239 } 234 240 if (!strcasecmp (file->filename, "@DETDB")) { 241 psFree (file->filename); 235 242 extra = pmFPAfileNameFromRule (file->filextra, file, view); 236 243 // file->filename = pmDetrendSelect (extra); 244 psFree (extra); 237 245 if (file->filename == NULL) 238 246 return false; 247 psMemIncrRefCounter (file->filename); 239 248 } 240 249 … … 263 272 } 264 273 265 bool pmFPAfileRead (pmFPAfile *file, pmFPAview *view)274 bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view) 266 275 { 267 276 if (file->mode != PM_FPA_MODE_READ) … … 305 314 } 306 315 307 bool pmFPAfileWrite (pmFPAfile *file, pmFPAview *view)316 bool pmFPAfileWrite (pmFPAfile *file, const pmFPAview *view) 308 317 { 309 318 if (file->mode != PM_FPA_MODE_WRITE) … … 324 333 switch (file->type) { 325 334 case PM_FPA_FILE_IMAGE: 326 psLogMsg (__func__, 3, "write image disabled\n"); 327 // XXX disabled for now 328 // XXX pmFPAviewWriteFitsImage (view, file->fits); 335 pmFPAviewWriteFitsImage (view, file); 336 psTrace ("pmFPAfile", 5, "wrote image %s (fpa: %p)\n", file->filename, file->fpa); 329 337 break; 330 338 … … 335 343 case PM_FPA_FILE_CMF: 336 344 pmFPAviewWriteObjects (view, file); 337 psTrace ("pmFPAfile", 5, "wrote %s (type: %d)\n", file->filename, file->type);345 psTrace ("pmFPAfile", 5, "wrote object %s (fpa: %p)\n", file->filename, file->fpa); 338 346 break; 339 347 … … 345 353 } 346 354 347 bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view)355 bool pmFPAfileClose (pmFPAfile *file, const pmFPAview *view) 348 356 { 349 357 if (file->state == PM_FPA_STATE_CLOSED) { … … 385 393 386 394 // attempt open, read, write, or close pmFPAfiles in files 387 bool pmFPAfileIOChecks (psMetadata *files, pmFPAview *view, pmFPAfilePlace place)395 bool pmFPAfileIOChecks (psMetadata *files, const pmFPAview *view, pmFPAfilePlace place) 388 396 { 389 397 // recipe override values (command-line options): … … 405 413 406 414 // select the rule from the camera configuration, perform substitutions as needed 407 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, pmFPAview *view)415 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view) 408 416 { 409 417 … … 445 453 } 446 454 447 psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type)455 psImage *pmFPAfileReadoutImage (psMetadata *files, const pmFPAview *view, char *name, int Nx, int Ny, int type) 448 456 { 449 457 bool status; … … 476 484 // given an already-opened fits file, read the components corresponding 477 485 // to the specified view 478 bool pmFPAviewReadFitsImage ( pmFPAview *view, pmFPAfile *file)486 bool pmFPAviewReadFitsImage (const pmFPAview *view, pmFPAfile *file) 479 487 { 480 488 bool status; … … 506 514 return status; 507 515 } 516 return false; 508 517 509 518 // XXX pmReadoutRead, pmReadoutReadSegement disabled for now 510 return false;511 512 519 # if (0) 513 520 … … 526 533 } 527 534 528 // XXX image writes disabled for now 529 # if (0) 530 // given an already-opened fits file, write the components corresponding 531 // to the specified view 532 bool pmFPAviewWriteFitsImage (pmFPAview *view, pmFPAfile *file) 535 // given an already-opened fits file, write the components corresponding 536 // to the specified view 537 bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file) 533 538 { 534 539 … … 536 541 psFits *fits = file->fits; 537 542 543 // pmFPAWrite takes care of all PHUs as needed 538 544 if (view->chip == -1) { 539 pmFPAWrite (fpa, fits, NULL , NULL);545 pmFPAWrite (fpa, fits, NULL); 540 546 return true; 541 547 } … … 546 552 pmChip *chip = fpa->chips->data[view->chip]; 547 553 554 // do we need to write out a PHU for this entry? 555 if (file->phu == NULL) { 556 pmHDU *hdu = pmFPAviewThisHDU (view, file->fpa); 557 pmHDU *phu = pmFPAviewThisPHU (view, file->fpa); 558 // if this hdu is the phu, the write function below will create the phu 559 if (hdu != phu) { 560 // we assume that the PHU is just a header 561 psMetadata *outhead = psMetadataCopy (NULL, phu->header); 562 psMetadataAdd (outhead, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true); 563 psFitsWriteHeaderNotImage (file->fits, outhead); 564 file->phu = phu->header; 565 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type); 566 psFree (outhead); 567 } 568 } 569 548 570 if (view->cell == -1) { 549 pmChipWrite (chip, fits, NULL , NULL);571 pmChipWrite (chip, fits, NULL); 550 572 return true; 551 573 } … … 557 579 558 580 if (view->readout == -1) { 559 pmCellWrite (cell, fits, NULL , NULL);581 pmCellWrite (cell, fits, NULL); 560 582 return true; 561 583 } 562 563 if (view->readout >= cell->readouts->n) { 564 return false; 565 } 584 return false; 585 586 // XXX disable readout write for now 587 # if (0) 588 589 if (view->readout >= cell->readouts->n) { 590 return false; 591 } 566 592 pmReadout *readout = cell->readouts->data[view->readout]; 567 593 … … 572 598 } 573 599 return true; 574 } 575 # endif 600 # endif 601 } -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h
r6713 r6726 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03-2 8 02:16:26$9 * @version $Revision: 1.1.2.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-29 20:55:42 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 74 74 pmFPAfile *pmFPAfileAlloc (); 75 75 pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name); 76 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view);77 bool pmFPAfileRead (pmFPAfile *file, pmFPAview *view);78 bool pmFPAfileWrite (pmFPAfile *file, pmFPAview *view);79 bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view);76 bool pmFPAfileOpen (pmFPAfile *file, const pmFPAview *view); 77 bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view); 78 bool pmFPAfileWrite (pmFPAfile *file, const pmFPAview *view); 79 bool pmFPAfileClose (pmFPAfile *file, const pmFPAview *view); 80 80 81 bool pmFPAfileReadChecks (psMetadata *files, pmFPAview *view);82 bool pmFPAfileIOChecks (psMetadata *files, pmFPAview *view, pmFPAfilePlace place);81 bool pmFPAfileReadChecks (psMetadata *files, const pmFPAview *view); 82 bool pmFPAfileIOChecks (psMetadata *files, const pmFPAview *view, pmFPAfilePlace place); 83 83 84 psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type);84 psImage *pmFPAfileReadoutImage (psMetadata *files, const pmFPAview *view, char *name, int Nx, int Ny, int type); 85 85 86 86 // read an image into the current view 87 bool pmFPAviewReadFitsImage ( pmFPAview *view, pmFPAfile *file);87 bool pmFPAviewReadFitsImage (const pmFPAview *view, pmFPAfile *file); 88 88 89 89 // write the components for the specified view 90 bool pmFPAviewWriteFitsImage ( pmFPAview *view, pmFPAfile *file);90 bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file); 91 91 92 92 // convert the rule to a name based on the current view 93 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, pmFPAview *view);93 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view); 94 94 95 95 pmFPAfile *pmFPAfileConstruct (psMetadata *files, psMetadata *format, psMetadata *camera, char *name); -
branches/rel10_ifa/psModules/src/astrom/pmFPAview.c
r6713 r6726 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 5$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03-2 8 02:16:26$5 * @version $Revision: 1.1.2.6 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 } 40 40 41 pmFPAdepth pmFPAviewDepth ( pmFPAview *view)41 pmFPAdepth pmFPAviewDepth (const pmFPAview *view) 42 42 { 43 43 … … 54 54 } 55 55 56 pmChip *pmFPAviewThisChip ( pmFPAview *view, pmFPA *fpa)56 pmChip *pmFPAviewThisChip (const pmFPAview *view, pmFPA *fpa) 57 57 { 58 58 … … 100 100 } 101 101 102 pmCell *pmFPAviewThisCell ( pmFPAview *view, pmFPA *fpa)102 pmCell *pmFPAviewThisCell (const pmFPAview *view, pmFPA *fpa) 103 103 { 104 104 … … 156 156 } 157 157 158 pmReadout *pmFPAviewThisReadout ( pmFPAview *view, pmFPA *fpa)158 pmReadout *pmFPAviewThisReadout (const pmFPAview *view, pmFPA *fpa) 159 159 { 160 160 … … 211 211 } 212 212 213 pmHDU *pmFPAviewThisHDU ( pmFPAview *view, pmFPA *fpa)213 pmHDU *pmFPAviewThisHDU (const pmFPAview *view, pmFPA *fpa) 214 214 { 215 215 // the HDU is attached to a cell, chip or fpa … … 229 229 } 230 230 231 pmHDU *pmFPAviewThisPHU ( pmFPAview *view, pmFPA *fpa)231 pmHDU *pmFPAviewThisPHU (const pmFPAview *view, pmFPA *fpa) 232 232 { 233 233 // select the HDU which corresponds to the PHU containing this view 234 234 235 235 pmHDU *hdu; 236 pmFPAview *new;236 pmFPAview new; 237 237 pmChip *chip; 238 238 pmCell *cell; 239 239 240 *new = *view;240 new = *view; 241 241 242 242 if (view->chip < 0) { … … 251 251 if (hdu->phu) 252 252 return hdu; 253 new ->chip = -1;254 hdu = pmFPAviewThisPHU ( new, fpa);253 new.chip = -1; 254 hdu = pmFPAviewThisPHU (&new, fpa); 255 255 return hdu; 256 256 } … … 260 260 if (hdu->phu) 261 261 return hdu; 262 new ->cell = -1;263 hdu = pmFPAviewThisPHU ( new, fpa);262 new.cell = -1; 263 hdu = pmFPAviewThisPHU (&new, fpa); 264 264 return hdu; 265 265 } -
branches/rel10_ifa/psModules/src/astrom/pmFPAview.h
r6713 r6726 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03-2 8 02:16:26$9 * @version $Revision: 1.1.2.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-29 20:55:42 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 44 44 45 45 // determine the current view depth 46 pmFPAdepth pmFPAviewDepth ( pmFPAview *view);46 pmFPAdepth pmFPAviewDepth (const pmFPAview *view); 47 47 48 48 // return the currently selected chip for this view 49 pmChip *pmFPAviewThisChip ( pmFPAview *view, pmFPA *fpa);49 pmChip *pmFPAviewThisChip (const pmFPAview *view, pmFPA *fpa); 50 50 51 51 // advance view to the next chip … … 53 53 54 54 // return the currently selected cell for this view 55 pmCell *pmFPAviewThisCell ( pmFPAview *view, pmFPA *fpa);55 pmCell *pmFPAviewThisCell (const pmFPAview *view, pmFPA *fpa); 56 56 57 57 // advance view to the next cell … … 59 59 60 60 // return the currently selected readout for this view 61 pmReadout *pmFPAviewThisReadout ( pmFPAview *view, pmFPA *fpa);61 pmReadout *pmFPAviewThisReadout (const pmFPAview *view, pmFPA *fpa); 62 62 63 63 // advance view to the next readout … … 65 65 66 66 // return the HDU corresponding to the current view 67 pmHDU *pmFPAviewThisHDU ( pmFPAview *view, pmFPA *fpa);68 pmHDU *pmFPAviewThisPHU ( pmFPAview *view, pmFPA *fpa);67 pmHDU *pmFPAviewThisHDU (const pmFPAview *view, pmFPA *fpa); 68 pmHDU *pmFPAviewThisPHU (const pmFPAview *view, pmFPA *fpa); 69 69 70 70 # endif -
branches/rel10_ifa/psModules/src/astrom/pmHDU.c
r6722 r6726 13 13 psFree(hdu->images); 14 14 psFree(hdu->table); 15 psFree(hdu->weights); 16 psFree(hdu->masks); 15 17 } 16 18 -
branches/rel10_ifa/psModules/src/objects/pmFPAviewObjectsIO.h
r6556 r6726 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 03:14:23$5 * @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 13 13 # define PM_FPA_OBJECTS_IO_H 14 14 15 bool pmFPAviewReadObjects ( pmFPAview *view, pmFPAfile *file);16 bool pmFPAReadObjects (pmFPA *fpa, pmFPAview *view, pmFPAfile *file);17 bool pmChipReadObjects (pmChip *chip, pmFPAview *view, pmFPAfile *file);18 bool pmCellReadObjects (pmCell *cell, pmFPAview *view, pmFPAfile *file);19 bool pmReadoutReadObjects (pmReadout *readout, pmFPAview *view, pmFPAfile *file);15 bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file); 16 bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file); 17 bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file); 18 bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file); 19 bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file); 20 20 21 bool pmFPAviewWriteObjects ( pmFPAview *view, pmFPAfile *file);22 bool pmFPAWriteObjects (pmFPA *fpa, pmFPAview *view, pmFPAfile *file);23 bool pmChipWriteObjects (pmChip *chip, pmFPAview *view, pmFPAfile *file);24 bool pmCellWriteObjects (pmCell *cell, pmFPAview *view, pmFPAfile *file);25 bool pmReadoutWriteObjects (pmReadout *readout, pmFPAview *view, pmFPAfile *file);21 bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file); 22 bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file); 23 bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file); 24 bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file); 25 bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file); 26 26 27 27 # endif /* PM_FPA_OBJECTS_IO_H */ -
branches/rel10_ifa/psModules/src/objects/pmFPAviewReadObjects.c
r6712 r6726 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03-2 8 02:14:56$5 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 // Given a FITS file pointer, read the table of object data 30 bool pmFPAviewReadObjects ( pmFPAview *view, pmFPAfile *file)30 bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file) 31 31 { 32 32 pmFPA *fpa = file->fpa; … … 67 67 68 68 // read in all chip-level Objects files for this FPA 69 bool pmFPAReadObjects (pmFPA *fpa, pmFPAview *view, pmFPAfile *file)69 bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file) 70 70 { 71 71 … … 79 79 80 80 // read in all cell-level Objects files for this chip 81 bool pmChipReadObjects (pmChip *chip, pmFPAview *view, pmFPAfile *file)81 bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file) 82 82 { 83 83 … … 91 91 92 92 // read in all readout-level Objects files for this cell 93 bool pmCellReadObjects (pmCell *cell, pmFPAview *view, pmFPAfile *file)93 bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file) 94 94 { 95 95 … … 103 103 104 104 // read in all readout-level Objects files for this cell 105 bool pmReadoutReadObjects (pmReadout *readout, pmFPAview *view, pmFPAfile *file)105 bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file) 106 106 { 107 107 -
branches/rel10_ifa/psModules/src/objects/pmFPAviewWriteObjects.c
r6712 r6726 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03-2 8 02:14:56$5 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 14 14 #include <string.h> 15 15 #include "pslib.h" 16 #include "psAdditionals.h" 16 17 #include "pmHDU.h" 17 18 #include "pmFPA.h" … … 27 28 #include "pmFPAviewObjectsIO.h" 28 29 29 bool psFitsWriteHeaderNotImage (psFits *fits, psMetadata *header)30 {31 32 int status = 0;33 char fitsErr[1024];34 35 psMetadataItem *mdi = NULL;36 mdi = psMetadataLookup (header, "NAXIS");37 if (mdi != NULL) {38 mdi->data.S32 = 0;39 mdi->type = PS_DATA_S32;40 }41 42 fits_create_img (fits->fd, SHORT_IMG, 0, NULL, &status);43 44 if (status != 0) {45 fits_get_errstatus (status, fitsErr);46 psError (PS_ERR_IO, true, PS_ERRORTEXT_psFits_WRITE_FAILED, fitsErr);47 exit (2);48 }49 50 psFitsWriteHeader (header, fits);51 52 return true;53 }54 55 30 // Given a FITS file pointer, read the table of object data 56 bool pmFPAviewWriteObjects ( pmFPAview *view, pmFPAfile *file)31 bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file) 57 32 { 58 33 … … 94 69 95 70 // read in all chip-level Objects files for this FPA 96 bool pmFPAWriteObjects (pmFPA *fpa, pmFPAview *view, pmFPAfile *file)71 bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file) 97 72 { 98 73 … … 106 81 107 82 // read in all cell-level Objects files for this chip 108 bool pmChipWriteObjects (pmChip *chip, pmFPAview *view, pmFPAfile *file)83 bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file) 109 84 { 110 85 … … 118 93 119 94 // read in all readout-level Objects files for this cell 120 bool pmCellWriteObjects (pmCell *cell, pmFPAview *view, pmFPAfile *file)95 bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file) 121 96 { 122 97 … … 130 105 131 106 // read in all readout-level Objects files for this cell 132 bool pmReadoutWriteObjects (pmReadout *readout, pmFPAview *view, pmFPAfile *file)107 bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file) 133 108 { 134 109 … … 139 114 pmHDU *hdu; 140 115 pmHDU *phu; 116 psMetadata *updates; 117 psMetadata *outhead; 141 118 142 119 psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES"); 143 return true;144 120 145 121 switch (file->type) { … … 166 142 hdu = pmFPAviewThisHDU (view, file->fpa); 167 143 filename = pmFPAfileNameFromRule (file->filerule, file, view); 168 pmSourcesWriteCMP (sources, filename, hdu->header); 144 145 // copy the header to an output header, add the output header data 146 outhead = psMetadataCopy (NULL, hdu->header); 147 148 // check/fix first line (must be SIMPLE = F) 149 psMetadataItem *item = psMetadataGet (outhead, PS_LIST_HEAD); 150 if (strcmp (item->name, "SIMPLE") && strcmp (item->name, "XTENSION")) { 151 psErrorStackPrint(stderr, "invalid header: first line is neither SIMPLE nor XTENSION\n"); 152 exit(EXIT_FAILURE); 153 } 154 if (!strcmp (item->name, "XTENSION")) { 155 psMetadataRemoveIndex (outhead, PS_LIST_HEAD); 156 } 157 psMetadataAddBool (outhead, PS_LIST_HEAD, "SIMPLE", PS_META_REPLACE, "CMP file, not simple", false); 158 159 // copy over the entries saved in the 160 updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER"); 161 psMetadataCopy (outhead, updates); 162 163 pmSourcesWriteCMP (sources, filename, outhead); 164 psFree (outhead); 169 165 psFree (filename); 170 166 break; … … 184 180 185 181 // CMF always has extensions 186 psMetadataAdd (phu->header, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true); 187 psFitsWriteHeaderNotImage (file->fits, phu->header); 182 outhead = psMetadataCopy (NULL, phu->header); 183 psMetadataAdd (outhead, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true); 184 psFitsWriteHeaderNotImage (file->fits, outhead); 188 185 file->phu = phu->header; 189 186 psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type); 190 191 file->phu = phu->header; 187 psFree (outhead); 192 188 } 193 189 … … 196 192 // determine name for header extension 197 193 headname = pmFPAfileNameFromRule (file->extxtra, file, view); 198 psMetadataAddStr (hdu->header, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname); 199 psFitsWriteHeaderNotImage (file->fits, hdu->header); 194 outhead = psMetadataCopy (NULL, hdu->header); 195 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname); 196 psFitsWriteHeaderNotImage (file->fits, outhead); 200 197 psTrace ("pmFPAfile", 5, "wrote ext head %s (type: %d)\n", file->filename, file->type); 201 198 file->header = hdu->header; 199 psFree (outhead); 202 200 psFree (headname); 203 201 } … … 205 203 // write this table to disk 206 204 dataname = pmFPAfileNameFromRule (file->extrule, file, view); 207 pmSourcesWriteCMF (file->fits, sources, hdu->header, dataname); 205 updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER"); 206 pmSourcesWriteCMF (file->fits, sources, updates, dataname); 207 psTrace ("pmFPAfile", 5, "wrote ext data %s (type: %d)\n", file->filename, file->type); 208 208 psFree (dataname); 209 209 break; -
branches/rel10_ifa/psModules/src/objects/pmSourceIO_CMF.c
r6712 r6726 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03-2 8 02:14:56$5 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 psArray *table; 35 35 psMetadata *row; 36 psMetadata *theader;37 36 int i, type; 38 37 psF32 *PAR, *dPAR; … … 84 83 85 84 // create the basic table header 86 theader = psMetadataAlloc (); 87 psMetadataAdd (theader, PS_LIST_HEAD, "EXTNAME", PS_DATA_STRING, "extension name", extname); 85 psMetadataAdd (header, PS_LIST_HEAD, "EXTNAME", PS_DATA_STRING | PS_META_REPLACE, "extension name", extname); 88 86 89 psFitsWriteTable (fits, theader, table);87 psFitsWriteTable (fits, header, table); 90 88 psTrace ("pmFPAfile", 5, "wrote ext data %s\n", extname); 91 89 90 psFree (table); 92 91 return true; 93 92 } -
branches/rel10_ifa/psModules/src/objects/pmSourceIO_CMP.c
r6565 r6726 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 3$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 04:25:03$5 * @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 107 107 } 108 108 fclose (f); 109 psFree (line); 109 110 return true; 110 111 } -
branches/rel10_ifa/psModules/src/objects/pmSourceIO_SX.c
r6565 r6726 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 3$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 04:25:03$5 * @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-29 20:55:42 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 76 76 } 77 77 fclose (f); 78 psFree (line); 78 79 return true; 79 80 }
Note:
See TracChangeset
for help on using the changeset viewer.
