Changeset 5084 for trunk/psphot/src/psPolynomials.c
- Timestamp:
- Sep 20, 2005, 6:48:16 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psPolynomials.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psPolynomials.c
r5068 r5084 507 507 psVector *zFit = NULL; 508 508 psVector *zResid = psVectorAlloc (x->n, PS_TYPE_F64); 509 510 // XXX EAM : use SAMPLE_MEAN and SAMPLE_STDEV for stats: 509 float minClipSigma = stats->min; 510 float maxClipSigma = stats->max; 511 float minClipValue; 512 float maxClipValue; 513 514 // XXX EAM : use SAMPLE_MEDIAN and SAMPLE_STDEV for stats: 511 515 stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 512 516 513 for (int N = 0; N < 3; N++) {517 for (int N = 0; N < stats->clipIter; N++) { 514 518 int Nkeep = 0; 515 519 … … 519 523 520 524 stats = psVectorStats (stats, zResid, NULL, mask, maskValue); 521 psTrace (".psphot.RobustFit", 4, "residual stats for robust fit: %g +/- %g\n", 525 minClipValue = -1*fabs(minClipSigma)*stats->sampleStdev; 526 maxClipValue = +1*fabs(maxClipSigma)*stats->sampleStdev; 527 528 psTrace (".psphot.VectorClipFit", 4, "residual stats for robust fit: %g +/- %g\n", 522 529 stats->sampleMedian, stats->sampleStdev); 523 530 … … 527 534 for (int i = 0; i < zResid->n; i++) { 528 535 if (mask->data.U8[i]) continue; 529 if (fabs(zResid->data.F64[i] - stats->sampleMedian) > 2*stats->sampleStdev) { 536 if (zResid->data.F64[i] - stats->sampleMedian > maxClipValue) { 537 mask->data.U8[i] |= 0x01; 538 continue; 539 } 540 if (zResid->data.F64[i] - stats->sampleMedian < minClipValue) { 530 541 mask->data.U8[i] |= 0x01; 531 542 continue; … … 534 545 } 535 546 536 psTrace (".psphot. RobustFit", 4, "keeping %d of %d pts for fit\n",547 psTrace (".psphot.VectorClipFit", 4, "keeping %d of %d pts for fit\n", 537 548 Nkeep, x->n); 538 549
Note:
See TracChangeset
for help on using the changeset viewer.
