IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17288


Ignore:
Timestamp:
Apr 2, 2008, 12:41:16 PM (18 years ago)
Author:
eugene
Message:

handle case of failed statistics

File:
1 edited

Legend:

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

    r17110 r17288  
    267267        psStatsInit (statsM);
    268268
    269         psVectorStats (statsS, dASubset, NULL, mkSubset, 0xff);
    270         psVectorStats (statsM, dMSubset, NULL, mkSubset, 0xff);
    271 
    272         dSo->data.F32[i] = statsS->robustStdev;
    273         dMo->data.F32[i] = statsM->sampleMean;
    274 
    275         dRo->data.F32[i] = statsS->robustStdev / statsM->sampleMean;
     269        if (j > 2) {
     270            bool status = true;
     271            status &= psVectorStats (statsS, dASubset, NULL, mkSubset, 0xff);
     272            status &= psVectorStats (statsM, dMSubset, NULL, mkSubset, 0xff);
     273            if (!status) { psErrorClear (); }
     274            dSo->data.F32[i] = statsS->robustStdev;
     275            dMo->data.F32[i] = statsM->sampleMean;
     276            dRo->data.F32[i] = statsS->robustStdev / statsM->sampleMean;
     277        } else {
     278            dSo->data.F32[i] = NAN;
     279            dMo->data.F32[i] = NAN;
     280            dRo->data.F32[i] = NAN;
     281        }
    276282    }
    277283    psFree (dMSubset);
     
    280286   
    281287    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN);
    282     psVectorStats (stats, dRo, NULL, NULL, 0);
     288    if (!psVectorStats (stats, dRo, NULL, NULL, 0)) {
     289        // XXX better testing of raised error
     290        psErrorClear();
     291    }
    283292
    284293    *errorScale = stats->sampleMedian;
Note: See TracChangeset for help on using the changeset viewer.