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