IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34705


Ignore:
Timestamp:
Nov 27, 2012, 11:26:17 AM (14 years ago)
Author:
bills
Message:

check whether the range of values is finite before using the
resulting value to calculate the number of bins for a histogram

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20121026/psLib/src/math/psStats.c

    r31152 r34705  
    764764            goto escape;
    765765        }
     766        if (!isfinite(max - min)) {
     767            COUNT_WARNING(10, 100, "Range of of the input vector is too large: %lf.\n", (double)max - (double) min);
     768            goto escape;
     769        }
    766770        psTrace(TRACE, 6, "Data min/max is (%.2f, %.2f)\n", min, max);
    767771
     
    802806        psTrace(TRACE, 6, "Numbins is %ld\n", numBins);
    803807        psTrace(TRACE, 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
     808
     809        // We are sometimes causing psHistogramAlloc to assert.
     810        // Assert here so we can get more information about what is going wrong.
     811        psAssert(numBins > 0, "Invalid numBins: %ld max: %f min: %f binSize: %f", numBins, max, min, binSize);
     812       
    804813        // Generate the histogram
    805814        histogram = psHistogramAlloc(min - 2.0*binSize, max + 2.0*binSize, numBins);
     
    858867            // if we did not mask anything, give up.
    859868        }
     869
     870        // We were causing psHistogramAlloc to assert.
     871        // Assert here so we can get more information about what is going wrong.
     872        psAssert(numBins > 0, "Invalid numBins %ld max: %f min: %f binSize: %f", numBins, max, min, binSize);
    860873
    861874        // ADD step 1: Convert the specific histogram to a cumulative histogram
Note: See TracChangeset for help on using the changeset viewer.