IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2007, 11:13:14 AM (19 years ago)
Author:
Paul Price
Message:

Don't produce an error if an Inf/NaN value is masked --- it should be quietly ignored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psStats.c

    r13494 r13647  
    1313 * use ->min and ->max (PS_STAT_USE_RANGE)
    1414 *
    15  *  @version $Revision: 1.211 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2007-05-24 02:06:51 $
     15 *  @version $Revision: 1.212 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2007-06-05 21:13:14 $
    1717 *
    1818 *  Copyright 2006 IfA, University of Hawaii
     
    259259    for (long i = 0; i < num; i++) {
    260260        // Check if the data is with the specified range
    261         if (!isfinite(vector[i])) {
     261        if (maskData && (maskData[i] & maskVal)) {
     262            continue;
     263        }
     264
     265        if (useRange) {
     266            if (vector[i] < stats->min || vector[i] > stats->max) {
     267                continue;
     268            }
     269        } else if (!isfinite(vector[i])) {
    262270            stats->max = stats->min = NAN;
    263271            psError(PS_ERR_IEEE, true, "Element %ld of vector is Inf/NaN", i);
     
    265273        }
    266274
    267         if (useRange && (vector[i] < stats->min))
    268             continue;
    269         if (useRange && (vector[i] > stats->max))
    270             continue;
    271         if (maskData && (maskData[i] & maskVal))
    272             continue;
    273275        numValid++;
    274276        max = PS_MAX (vector[i], max);
Note: See TracChangeset for help on using the changeset viewer.