Changeset 13347 for trunk/psModules/src/objects/pmSourceIO.c
- Timestamp:
- May 10, 2007, 5:44:16 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceIO.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceIO.c
r13192 r13347 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $6 * @date $Date: 2007-05- 03 20:04:31$5 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-05-11 03:44:16 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #include <math.h> 18 18 #include <string.h> 19 #include <strings.h> /* for strn?casecmp */19 #include <strings.h> /* for strn?casecmp */ 20 20 #include <pslib.h> 21 21 … … 71 71 { 72 72 if (type == 4) { 73 source->mode |= PM_SOURCE_MODE_FAIL;73 source->mode |= PM_SOURCE_MODE_FAIL; 74 74 } 75 75 if (type == 7) { 76 source->mode |= PM_SOURCE_MODE_POOR;76 source->mode |= PM_SOURCE_MODE_POOR; 77 77 } 78 78 if (type == 10) { 79 source->mode |= PM_SOURCE_MODE_SATSTAR;79 source->mode |= PM_SOURCE_MODE_SATSTAR; 80 80 } 81 81 … … 85 85 case 7: 86 86 case 10: 87 source->type = PM_SOURCE_TYPE_STAR; 88 return true;87 source->type = PM_SOURCE_TYPE_STAR; 88 return true; 89 89 case 2: 90 source->type = PM_SOURCE_TYPE_EXTENDED; 91 return true;90 source->type = PM_SOURCE_TYPE_EXTENDED; 91 return true; 92 92 case 8: 93 source->type = PM_SOURCE_TYPE_DEFECT; 94 return true;93 source->type = PM_SOURCE_TYPE_DEFECT; 94 return true; 95 95 default: 96 return false;96 return false; 97 97 } 98 98 return false; … … 209 209 bool status; 210 210 char *exttype; 211 char *realname;212 char *filename;213 211 char *dataname; 214 212 char *headname; … … 223 221 return true; 224 222 225 bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;226 227 223 switch (file->type) { 228 224 case PM_FPA_FILE_RAW: 229 filename = pmFPAfileNameFromRule (file->filerule, file, view); 230 realname = pmConfigConvertFilename (filename, config, create); 231 pmSourcesWriteRAW (sources, realname); 232 psFree (realname); 233 psFree (filename); 225 pmSourcesWriteRAW (sources, file->filename); 234 226 break; 235 227 236 228 case PM_FPA_FILE_OBJ: 237 filename = pmFPAfileNameFromRule (file->filerule, file, view); 238 realname = pmConfigConvertFilename (filename, config, create); 239 pmSourcesWriteOBJ (sources, realname); 240 psFree (realname); 241 psFree (filename); 229 pmSourcesWriteOBJ (sources, file->filename); 242 230 break; 243 231 244 232 case PM_FPA_FILE_SX: 245 filename = pmFPAfileNameFromRule (file->filerule, file, view); 246 realname = pmConfigConvertFilename (filename, config, create); 247 pmSourcesWriteSX (sources, realname); 248 psFree (realname); 249 psFree (filename); 233 pmSourcesWriteSX (sources, file->filename); 250 234 break; 251 235 … … 253 237 // a SPLIT format : only one header and object table per file 254 238 hdu = pmFPAviewThisHDU (view, file->fpa); 255 filename = pmFPAfileNameFromRule (file->filerule, file, view);256 realname = pmConfigConvertFilename (filename, config, create);257 239 258 240 // copy the header to an output header, add the output header data … … 271 253 } 272 254 273 bool status = pmSourcesWriteCMP (sources, realname, outhead);255 bool status = pmSourcesWriteCMP (sources, file->filename, outhead); 274 256 psFree (outhead); 275 psFree (realname);276 psFree (filename);277 257 278 258 if (!status) { … … 355 335 // this header block is new, write it to disk 356 336 if (hdu->header != file->header) { 357 // XXX I was building a new copy, why? supplement the output header337 // XXX I was building a new copy, why? supplement the output header 358 338 // outhead = psMetadataCopy (NULL, hdu->header); 359 339 … … 547 527 // read in header, if not yet loaded 548 528 hdu = pmFPAviewThisHDU (view, file->fpa); 529 #if 0 549 530 if (file->filename) 550 531 psFree (file->filename); 551 532 file->filename = pmFPAfileNameFromRule (file->filerule, file, view); 533 #endif 552 534 553 535 // indirect filenames … … 562 544 } 563 545 564 bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;565 psString realname = pmConfigConvertFilename (file->filename, config, create);566 567 546 // read the PHU from this file 568 file->fits = psFitsOpen ( realname, "r");547 file->fits = psFitsOpen (file->filename, "r"); 569 548 if (hdu->header != NULL) { 570 549 psFree (hdu->header); … … 574 553 file->fits = NULL; 575 554 576 sources = pmSourcesReadCMP (realname, hdu->header); 577 psFree (realname); 555 sources = pmSourcesReadCMP (file->filename, hdu->header); 578 556 break; 579 557 … … 667 645 668 646 if (view->chip == -1) { 669 bool exists = pmFPACheckDataStatusForSources (fpa);647 bool exists = pmFPACheckDataStatusForSources (fpa); 670 648 return exists; 671 649 } 672 650 if (view->chip >= fpa->chips->n) { 673 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);651 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 674 652 return false; 675 653 } … … 681 659 } 682 660 if (view->cell >= chip->cells->n) { 683 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);661 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 684 662 return false; 685 663 } … … 692 670 693 671 if (view->readout >= cell->readouts->n) { 694 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);672 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 695 673 return false; 696 674 } … … 704 682 705 683 for (int i = 0; i < fpa->chips->n; i++) { 706 pmChip *chip = fpa->chips->data[i];707 if (!chip) continue;708 if (pmChipCheckDataStatusForSources (chip)) return true;684 pmChip *chip = fpa->chips->data[i]; 685 if (!chip) continue; 686 if (pmChipCheckDataStatusForSources (chip)) return true; 709 687 } 710 688 return false; … … 714 692 715 693 for (int i = 0; i < chip->cells->n; i++) { 716 pmCell *cell = chip->cells->data[i];717 if (!cell) continue;718 if (pmCellCheckDataStatusForSources (cell)) return true;694 pmCell *cell = chip->cells->data[i]; 695 if (!cell) continue; 696 if (pmCellCheckDataStatusForSources (cell)) return true; 719 697 } 720 698 return false; … … 724 702 725 703 for (int i = 0; i < cell->readouts->n; i++) { 726 pmReadout *readout = cell->readouts->data[i];727 if (!readout) continue;728 if (pmReadoutCheckDataStatusForSources (readout)) return true;704 pmReadout *readout = cell->readouts->data[i]; 705 if (!readout) continue; 706 if (pmReadoutCheckDataStatusForSources (readout)) return true; 729 707 } 730 708 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
