- Timestamp:
- Jun 20, 2008, 3:27:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_080617/psModules/src/imcombine/pmSubtraction.c
r18163 r18248 4 4 * @author GLG, MHPCC 5 5 * 6 * @version $Revision: 1.94 $ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06- 17 22:16:38$6 * @version $Revision: 1.94.2.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-21 01:27:33 $ 8 8 * 9 9 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 512 512 PS_ASSERT_IMAGE_TYPE(subMask, PS_TYPE_MASK, -1); 513 513 514 double totalSquareDev = 0.0; // Total square deviation from zero 514 // I used to measure the rms deviation about zero, and use that as the sigma against which to clip, but 515 // the distribution is actually something like a chi^2 or Student's t, both of which become Gaussian-like 516 // with large N. Therefore, let's just treat this as a Gaussian distribution. 517 518 double mean = 0.0; // Mean deviation 515 519 int numStamps = 0; // Number of used stamps 516 520 for (int i = 0; i < stamps->num; i++) { … … 519 523 continue; 520 524 } 521 totalSquareDev += PS_SQR(deviations->data.F32[i]);525 mean += deviations->data.F32[i]; 522 526 numStamps++; 523 527 } 524 525 float rms = sqrt(totalSquareDev / (double)numStamps); // Convert to RMS 528 mean /= numStamps; 529 530 double rms = 0.0; // Standard deviation 531 for (int i = 0; i < stamps->num; i++) { 532 pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest 533 if (stamp->status != PM_SUBTRACTION_STAMP_USED) { 534 continue; 535 } 536 rms += PS_SQR(deviations->data.F32[i] - mean); 537 } 538 rms = sqrt(rms / (numStamps - 1)); 526 539 527 540 if (rmsPtr) { … … 549 562 int numRejected = 0; // Number of stamps rejected 550 563 int numGood = 0; // Number of good stamps 551 double new SquareDev = 0.0; // New square deviation564 double newMean = 0.0; // New mean 552 565 for (int i = 0; i < stamps->num; i++) { 553 566 pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest 554 567 if (stamp->status == PM_SUBTRACTION_STAMP_USED) { 555 if (deviations->data.F32[i] > limit) { 568 // Should we reject stars with low deviation? Well, if this is really a Gaussian-like 569 // distribution and they're low, then we have the right to ask why. Isn't it suspicious that 570 // they're anomalously low, compared to the rest of the population which (we hope) is indicative 571 // of normality? Besides, the standard deviation is going to be blown up by stars that didn't 572 // subtract well, in which case very few (if any) stars will be legitimately rejected for being 573 // low. 574 if (deviations->data.F32[i] - mean > limit) { 556 575 // Mask out the stamp in the image so you it's not found again 557 576 psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d)\n", i, … … 587 606 } else { 588 607 numGood++; 589 new SquareDev += PS_SQR(deviations->data.F32[i]);608 newMean += deviations->data.F32[i]; 590 609 } 591 610 } 592 611 } 612 newMean /= numGood; 593 613 594 614 if (numRejected > 0) { 595 615 psLogMsg("psModules.imcombine", PS_LOG_INFO, 596 "%d good stamps; %d rejected.\nRMS deviation: %f --> %f\n", 597 numGood, numRejected, rms, 598 sqrt(newSquareDev / (double)numGood)); 616 "%d good stamps; %d rejected.\nMean deviation: %lf --> %lf\n", 617 numGood, numRejected, mean, newMean); 599 618 } else { 600 619 psLogMsg("psModules.imcombine", PS_LOG_INFO, 601 "%d good stamps; 0 rejected.\n RMS deviation: %f\n",602 numGood, rms);620 "%d good stamps; 0 rejected.\nMean deviation: %lf\n", 621 numGood, mean); 603 622 } 604 623
Note:
See TracChangeset
for help on using the changeset viewer.
