Changeset 20659
- Timestamp:
- Nov 10, 2008, 3:31:25 PM (17 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 2 edited
-
ppStack.h (modified) (1 diff)
-
ppStackLoop.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.h
r20427 r20659 11 11 typedef enum { 12 12 PPSTACK_MASK_MATCH = 0x01, // PSF-matching failed 13 PPSTACK_MASK_REJECT = 0x02, // Rejection failed 14 PPSTACK_MASK_BAD = 0x04, // Bad image (too many pixels rejected) 13 PPSTACK_MASK_CHI2 = 0x02, // Chi^2 too deviant 14 PPSTACK_MASK_REJECT = 0x04, // Rejection failed 15 PPSTACK_MASK_BAD = 0x08, // Bad image (too many pixels rejected) 15 16 PPSTACK_MASK_ALL = 0xff // All errors 16 17 } ppStackMask; -
trunk/ppStack/src/ppStackLoop.c
r20568 r20659 532 532 psFree(cells); 533 533 psFree(inputMask); 534 psFree(matchChi2); 535 return false; 536 } 537 538 // Reject images out-of-hand on the basis of their match chi^2 539 { 540 psVector *values = psVectorAllocEmpty(num, PS_TYPE_F32); // Values to sort 541 for (int i = 0; i < num; i++) { 542 if (inputMask->data.PS_TYPE_MASK_DATA[i] & PPSTACK_MASK_ALL) { 543 continue; 544 } 545 values->data.F32[values->n++] = matchChi2->data.F32[i]; 546 } 547 assert(values->n == numGood); 548 if (!psVectorSortInPlace(values)) { 549 psError(PS_ERR_UNKNOWN, false, "Unable to sort vector."); 550 psFree(subKernels); 551 psFree(subRegions); 552 psFree(cells); 553 psFree(inputMask); 554 psFree(matchChi2); 555 psFree(values); 556 return false; 557 } 558 float median = numGood % 2 ? values->data.F32[numGood / 2] : 559 0.5 * (values->data.F32[numGood / 2 - 1] + values->data.F32[numGood / 2]); 560 561 float rms = 0.74 * (values->data.F32[numGood * 3 / 4] - 562 values->data.F32[numGood / 4]); // Estimated RMS from interquartile range 563 564 psFree(values); 565 566 float rej = psMetadataLookupF32(NULL, recipe, "MATCH.REJ"); // Rejection threshold (stdevs) 567 if (isfinite(rej)) { 568 float thresh = median + rej * rms; // Threshold for rejection 569 psLogMsg("ppStack", PS_LOG_INFO, "chi^2 rejection threshold = %f + %f * %f = %f", 570 median, rej, rms, thresh); 571 572 int numRej = 0; // Number rejected 573 numGood = 0; // Number of good images 574 for (int i = 0; i < num; i++) { 575 if (inputMask->data.PS_TYPE_MASK_DATA[i] & PPSTACK_MASK_ALL) { 576 continue; 577 } 578 if (matchChi2->data.F32[i] > thresh) { 579 numRej++; 580 inputMask->data.PS_TYPE_MASK_DATA[i] |= PPSTACK_MASK_CHI2; 581 psLogMsg("ppStack", PS_LOG_INFO, "Rejecting image %d because of large matching chi^2: %f", 582 i, matchChi2->data.F32[i]); 583 } else { 584 numGood++; 585 } 586 } 587 } 588 } 589 590 if (numGood == 0) { 591 psError(PS_ERR_UNKNOWN, false, "No good images to combine."); 592 psFree(subKernels); 593 psFree(subRegions); 594 psFree(cells); 534 595 psFree(inputMask); 535 596 psFree(matchChi2); … … 776 837 // Reject bad pixels 777 838 for (int i = 0; i < num; i++) { 839 if (inputMask->data.U8[i]) { 840 continue; 841 } 778 842 psTimerStart("PPSTACK_REJECT"); 779 843
Note:
See TracChangeset
for help on using the changeset viewer.
