Changeset 21092 for trunk/ppStack/src/ppStackLoop.c
- Timestamp:
- Jan 8, 2009, 2:01:33 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackLoop.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackLoop.c
r20997 r21092 254 254 psArray *sourceLists = psArrayAlloc(num); // Individual lists of sources for matching 255 255 pmPSF *targetPSF = NULL; // Target PSF 256 float sumExposure = NAN; // Sum of exposure times 256 257 if (psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) { 257 258 pmFPAfileActivate(config->files, false, NULL); … … 348 349 349 350 // Zero point calibration 350 if (!ppStackSourcesTransparency(sourceLists, view, config)) { 351 sumExposure = ppStackSourcesTransparency(sourceLists, view, config); 352 if (!isfinite(sumExposure) || sumExposure <= 0) { 351 353 psError(PS_ERR_UNKNOWN, false, "Unable to calculate transparency differences"); 352 354 psFree(sourceLists); … … 407 409 psVector *weightings = psVectorAlloc(num, PS_TYPE_F32); // Combination weightings for images (1/noise^2) 408 410 psVectorInit(weightings, NAN); 411 psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging 412 psList *cellList = psListAlloc(NULL); // List of input cells, for concept averaging 409 413 for (int i = 0; i < num; i++) { 410 414 psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num); … … 475 479 writeImage(weightNames->data[i], hdu->header, readout->weight, config); 476 480 477 cells->data[i] = psMemIncrRefCounter(readout->parent); 481 pmCell *inCell = readout->parent; // Input cell 482 483 psListAdd(cellList, PS_LIST_TAIL, inCell); 484 psListAdd(fpaList, PS_LIST_TAIL, inCell->parent->parent); 485 486 cells->data[i] = psMemIncrRefCounter(inCell); 478 487 if (!filesIterateUp(config)) { 479 488 return false; … … 496 505 return false; 497 506 } 507 508 509 // Update concepts for output 510 { 511 pmFPAview view; // View for output 512 view.chip = view.cell = view.readout = 0; 513 pmCell *outCell = pmFPAfileThisCell(config->files, &view, "PPSTACK.OUTPUT"); // Output cell 514 pmFPA *outFPA = outCell->parent->parent; // Output FPA 515 pmConceptsAverageFPAs(outFPA, fpaList); 516 pmConceptsAverageCells(outCell, cellList, NULL, NULL, true); 517 psFree(fpaList); 518 psFree(cellList); 519 520 // Update the value of a concept 521 #define UPDATE_CONCEPT(SOURCE, NAME, VALUE) { \ 522 psMetadataItem *item = psMetadataLookup(SOURCE->concepts, NAME); \ 523 psAssert(item, "Concept should be present"); \ 524 psAssert(item->type == PS_TYPE_F32, "Concept should be F32"); \ 525 item->data.F32 = VALUE; \ 526 } 527 528 UPDATE_CONCEPT(outFPA, "FPA.EXPOSURE", sumExposure); 529 UPDATE_CONCEPT(outCell, "CELL.EXPOSURE", sumExposure); 530 UPDATE_CONCEPT(outCell, "CELL.DARKTIME", NAN); 531 } 532 498 533 499 534 // Reject images out-of-hand on the basis of their match chi^2 … … 626 661 return false; 627 662 } 628 629 psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging630 psList *cellList = psListAlloc(NULL); // List of input cells, for concept averaging631 for (int i = 0; i < num; i++) {632 pmCell *inCell = cells->data[i]; // Input cell633 if (!inCell) {634 exptimes->data.F32[i] = 0.0;635 continue;636 }637 exptimes->data.F32[i] = psMetadataLookupF32(NULL, inCell->concepts, "CELL.EXPOSURE");638 psListAdd(cellList, PS_LIST_TAIL, inCell);639 psListAdd(fpaList, PS_LIST_TAIL, inCell->parent->parent);640 }641 642 // Copy concepts643 pmChip *outChip = outCell->parent; // Output chip644 pmFPA *outFPA = outChip->parent; // Output FPA645 pmConceptsAverageFPAs(outFPA, fpaList);646 pmConceptsAverageCells(outCell, cellList, NULL, NULL, true);647 psFree(fpaList);648 psFree(cellList);649 663 650 664 psFree(cells); … … 977 991 // Close up 978 992 bool wcsDone = false; // Have we done the WCS? 979 float totExposure = 0.0; // Total exposure time980 993 for (int i = 0; i < num; i++) { 981 994 if (inputMask->data.U8[i]) { 982 995 continue; 983 996 } 984 totExposure += exptimes->data.F32[i];985 997 986 998 ppStackThread *thread = stack->threads->data[0]; // Representative stack
Note:
See TracChangeset
for help on using the changeset viewer.
