IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 20, 2005, 6:48:16 PM (21 years ago)
Author:
eugene
Message:

alternative clipping for pmPSFtryMetric

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psPolynomials.c

    r5068 r5084  
    507507    psVector *zFit   = NULL;
    508508    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:
    511515    stats->options |= (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    512516
    513     for (int N = 0; N < 3; N++) {
     517    for (int N = 0; N < stats->clipIter; N++) {
    514518        int Nkeep = 0;
    515519
     
    519523
    520524        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",
    522529                 stats->sampleMedian, stats->sampleStdev);
    523530
     
    527534        for (int i = 0; i < zResid->n; i++) {
    528535            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) {
    530541                mask->data.U8[i] |= 0x01;
    531542                continue;
     
    534545        }
    535546
    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",
    537548                 Nkeep, x->n);
    538549
Note: See TracChangeset for help on using the changeset viewer.