Changeset 21092
- Timestamp:
- Jan 8, 2009, 2:01:33 PM (17 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 3 edited
-
ppStack.h (modified) (1 diff)
-
ppStackLoop.c (modified) (7 diffs)
-
ppStackSources.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.h
r20995 r21092 154 154 /// Calculate transparency differences between images 155 155 /// 156 /// Corrects the source PSF photometry to a common system 157 boolppStackSourcesTransparency(const psArray *sourceLists, // Sources for each input158 const pmFPAview *view, // View to readout159 const pmConfig *config // Configuration156 /// Corrects the source PSF photometry to a common system. Return the sum of the exposure times. 157 float ppStackSourcesTransparency(const psArray *sourceLists, // Sources for each input 158 const pmFPAview *view, // View to readout 159 const pmConfig *config // Configuration 160 160 ); 161 161 -
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 -
trunk/ppStack/src/ppStackSources.c
r21016 r21092 10 10 11 11 12 boolppStackSourcesTransparency(const psArray *sourceLists, const pmFPAview *view, const pmConfig *config)12 float ppStackSourcesTransparency(const psArray *sourceLists, const pmFPAview *view, const pmConfig *config) 13 13 { 14 PS_ASSERT_ARRAY_NON_NULL(sourceLists, false);15 PS_ASSERT_PTR_NON_NULL(view, false);16 PS_ASSERT_PTR_NON_NULL(config, false);14 PS_ASSERT_ARRAY_NON_NULL(sourceLists, NAN); 15 PS_ASSERT_PTR_NON_NULL(view, NAN); 16 PS_ASSERT_PTR_NON_NULL(config, NAN); 17 17 18 18 #ifdef TESTING … … 46 46 if (!airmassZP) { 47 47 psError(PS_ERR_UNKNOWN, false, "Unable to find ZP.AIRMASS in recipe."); 48 return false;48 return NAN; 49 49 } 50 50 … … 69 69 exptime, airmass, expFilter); 70 70 psFree(zp); 71 return false;71 return NAN; 72 72 } 73 73 … … 79 79 "Unable to find airmass term (ZP.AIRMASS) for filter %s", filter); 80 80 psFree(zp); 81 return false;81 return NAN; 82 82 } 83 83 } else if (strcmp(filter, expFilter) != 0) { 84 84 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Filters don't match: %s vs %s", filter, expFilter); 85 85 psFree(zp); 86 return false;86 return NAN; 87 87 } 88 88 … … 95 95 psError(PS_ERR_UNKNOWN, false, "Unable to match sources"); 96 96 psFree(zp); 97 return false;97 return NAN; 98 98 } 99 99 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, … … 128 128 if (!trans) { 129 129 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies"); 130 return false;130 return NAN; 131 131 } 132 132 … … 158 158 psError(PS_ERR_UNKNOWN, false, "Unable to match sources"); 159 159 psFree(zp); 160 return false;160 return NAN; 161 161 } 162 162 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, … … 165 165 } 166 166 #endif 167 return true; 167 168 return sumExpTime; 168 169 }
Note:
See TracChangeset
for help on using the changeset viewer.
