Changeset 15562 for trunk/psModules/src/objects/pmSourceIO.c
- Timestamp:
- Nov 9, 2007, 3:09:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceIO.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceIO.c
r15227 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2007-1 0-05 22:46:34$5 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 int pmSourceGetDophotType (pmSource *source) 48 48 { 49 PS_ASSERT_PTR_NON_NULL(source, -1); 50 49 51 switch (source->type) { 50 52 … … 74 76 bool pmSourceSetDophotType (pmSource *source, int type) 75 77 { 78 PS_ASSERT_PTR_NON_NULL(source, false); 79 76 80 if (type == 4) { 77 81 source->mode |= PM_SOURCE_MODE_FAIL; … … 106 110 bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 107 111 { 112 PS_ASSERT_PTR_NON_NULL(view, false); 113 PS_ASSERT_PTR_NON_NULL(file, false); 114 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 108 115 109 116 pmFPA *fpa = file->fpa; … … 165 172 bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 166 173 { 174 PS_ASSERT_PTR_NON_NULL(view, false); 175 PS_ASSERT_PTR_NON_NULL(fpa, false); 176 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 177 167 178 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 168 179 *thisView = *view; … … 184 195 bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 185 196 { 197 PS_ASSERT_PTR_NON_NULL(chip, false); 198 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 199 PS_ASSERT_PTR_NON_NULL(view, false); 200 186 201 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 187 202 *thisView = *view; … … 203 218 bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 204 219 { 220 PS_ASSERT_PTR_NON_NULL(cell, false); 221 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 222 PS_ASSERT_PTR_NON_NULL(view, false); 223 205 224 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 206 225 *thisView = *view; … … 222 241 bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 223 242 { 243 PS_ASSERT_PTR_NON_NULL(readout, false); 244 PS_ASSERT_PTR_NON_NULL(view, false); 245 PS_ASSERT_PTR_NON_NULL(file, false); 246 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 224 247 225 248 bool status; 226 char *exttype;227 char *dataname;228 char *headname;229 249 pmHDU *hdu; 230 250 psMetadata *updates; 231 251 psMetadata *outhead; 252 253 char *exttype = NULL; 254 char *dataname = NULL; 255 char *xsrcname = NULL; 256 char *headname = NULL; 232 257 233 258 // XXX if sources is NULL, skip the cell or write out empty tables? … … 284 309 // get the current header 285 310 hdu = pmFPAviewThisHDU (view, file->fpa); 311 312 // determine the output table format 313 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT"); 314 if (!status) { 315 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data"); 316 return false; 317 } 318 319 // if this is not TRUE, the output files only contain the psf measurements. 320 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC"); 286 321 287 322 // define the EXTNAME values for the different data segments: … … 312 347 } 313 348 dataname = pmFPAfileNameFromRule (rule, file, view); 349 350 if (XSRC_OUTPUT) { 351 // EXTNAME for extended source data table 352 rule = psMetadataLookupStr(&status, menu, "CMF.XSRC"); 353 if (!rule) { 354 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XSRC in EXTNAME.RULES in camera.config"); 355 return false; 356 } 357 xsrcname = pmFPAfileNameFromRule (rule, file, view); 358 } 314 359 } 315 360 … … 350 395 outhead = psMetadataAlloc (); 351 396 352 // determine the output table format353 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");354 if (!status) {355 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");356 return false;357 }358 397 exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT")); 359 398 if (!exttype) { … … 375 414 } 376 415 if (!strcmp (exttype, "PS1_DEV_1")) { 377 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname );416 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname); 378 417 } 379 380 418 if (!status) { 381 419 psError(PS_ERR_IO, false, "writing CMF data to %s with format %s\n", file->filename, exttype); … … 403 441 404 442 // if this file needs to have a PHU written out, write one 405 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) { 443 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 444 { 445 PS_ASSERT_PTR_NON_NULL(view, false); 446 PS_ASSERT_PTR_NON_NULL(file, false); 406 447 407 448 bool status; … … 512 553 bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 513 554 { 555 PS_ASSERT_PTR_NON_NULL(view, false); 556 PS_ASSERT_PTR_NON_NULL(file, false); 557 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 558 514 559 pmFPA *fpa = file->fpa; 515 560 … … 551 596 bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 552 597 { 598 PS_ASSERT_PTR_NON_NULL(view, false); 599 PS_ASSERT_PTR_NON_NULL(file, false); 600 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 601 PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false); 602 553 603 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 554 604 *thisView = *view; … … 572 622 bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 573 623 { 624 PS_ASSERT_PTR_NON_NULL(view, false); 625 PS_ASSERT_PTR_NON_NULL(chip, false); 626 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 627 574 628 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 575 629 *thisView = *view; … … 596 650 bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 597 651 { 652 PS_ASSERT_PTR_NON_NULL(view, false); 653 PS_ASSERT_PTR_NON_NULL(cell, false); 654 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 655 598 656 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 599 657 *thisView = *view; … … 637 695 bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 638 696 { 697 PS_ASSERT_PTR_NON_NULL(view, false); 698 PS_ASSERT_PTR_NON_NULL(file, false); 639 699 640 700 bool status; … … 774 834 bool pmFPAviewCheckDataStatusForSources (const pmFPAview *view, const pmFPAfile *file) 775 835 { 836 PS_ASSERT_PTR_NON_NULL(view, false); 837 PS_ASSERT_PTR_NON_NULL(file, false); 838 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 839 776 840 pmFPA *fpa = file->fpa; 777 841 … … 811 875 } 812 876 813 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) { 877 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) 878 { 879 PS_ASSERT_PTR_NON_NULL(fpa, false); 880 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 814 881 815 882 for (int i = 0; i < fpa->chips->n; i++) { … … 821 888 } 822 889 823 bool pmChipCheckDataStatusForSources (const pmChip *chip) { 890 bool pmChipCheckDataStatusForSources (const pmChip *chip) 891 { 892 PS_ASSERT_PTR_NON_NULL(chip, false); 893 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 824 894 825 895 for (int i = 0; i < chip->cells->n; i++) { … … 831 901 } 832 902 833 bool pmCellCheckDataStatusForSources (const pmCell *cell) { 903 bool pmCellCheckDataStatusForSources (const pmCell *cell) 904 { 905 PS_ASSERT_PTR_NON_NULL(cell, false); 906 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 834 907 835 908 for (int i = 0; i < cell->readouts->n; i++) { … … 841 914 } 842 915 843 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) { 916 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) 917 { 918 PS_ASSERT_PTR_NON_NULL(readout, false); 844 919 845 920 bool status;
Note:
See TracChangeset
for help on using the changeset viewer.
