IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 8, 2006, 4:26:44 PM (20 years ago)
Author:
jhoblitt
Message:

normalize psTrace() facility names

File:
1 edited

Legend:

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

    r8232 r8245  
    1616 * use ->min and ->max (PS_STAT_USE_RANGE)
    1717 *
    18  *  @version $Revision: 1.183 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2006-08-08 23:32:23 $
     18 *  @version $Revision: 1.184 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2006-08-09 02:26:44 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    110110                             psStats* stats)
    111111{
    112     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     112    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    113113
    114114    psF32 mean = 0.0;                   // The mean
     
    221221    stats->sampleMean = mean;
    222222    if (isnan(mean)) {
    223         psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     223        psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__);
    224224        return false;
    225225    }
    226226
    227     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     227    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    228228    return true;
    229229}
     
    240240                        )
    241241{
    242     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     242    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    243243    psF32 max = -PS_MAX_F32;            // The calculated maximum
    244244    psF32 min = PS_MAX_F32;             // The calculated minimum
     
    316316        stats->min = min;
    317317    }
    318     psTrace(__func__, 4, "---- %s(%d) end ----\n", __func__, numValid);
     318    psTrace("psLib.math", 4, "---- %s(%d) end ----\n", __func__, numValid);
    319319    return numValid;
    320320}
     
    332332                                psStats* stats)
    333333{
    334     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     334    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    335335    PS_ASSERT_VECTOR_NON_NULL(myVector, false);
    336336    PS_ASSERT_PTR_NON_NULL(stats, false);
     
    342342                        (stats->min <= myVector->data.F32[i]) &&
    343343                        (myVector->data.F32[i] <= stats->max)) {
    344                     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     344                    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    345345                    return true;
    346346                }
     
    350350                if ((stats->min <= myVector->data.F32[i]) &&
    351351                        (myVector->data.F32[i] <= stats->max)) {
    352                     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     352                    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    353353                    return true;
    354354                }
     
    359359            for (long i = 0; i < myVector->n; i++) {
    360360                if (!(maskVal & maskVector->data.U8[i])) {
    361                     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     361                    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    362362                    return true;
    363363                }
     
    365365        } else {
    366366            if (myVector->n > 0) {
    367                 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     367                psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    368368                return true;
    369369            }
    370370        }
    371371    }
    372     psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     372    psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__);
    373373    return(false);
    374374}
     
    385385                               psStats* stats)
    386386{
    387     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     387    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    388388
    389389    // Allocate temporary vectors for the data.
     
    441441                false,
    442442                _("Failed to sort input data."));
    443         psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     443        psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__);
    444444        psFree(vector);
    445445        return false;
     
    463463
    464464    // Return "true" on success.
    465     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     465    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    466466    return true;
    467467}
     
    475475                                   psF32 sigma)
    476476{
    477     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
    478     psTrace(__func__, 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);
     477    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
     478    psTrace("psLib.math", 5, "(histogram->nums->n, sigma) is (%d, %.2f\n", (int) histogram->nums->n, sigma);
    479479    PS_ASSERT_PTR_NON_NULL(histogram, NULL);
    480480    PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL);
     
    564564        PS_VECTOR_PRINT_F32(smooth);
    565565    }
    566     psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     566    psTrace("psLib.math", 4, "---- %s() end ----\n", __func__);
    567567    return(smooth);
    568568}
     
    586586                              psStats* stats)
    587587{
    588     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     588    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    589589
    590590    // This procedure requires the mean.  If it has not been already
     
    597597        stats->sampleStdev = NAN;
    598598        psLogMsg(__func__, PS_LOG_WARN, "WARNING: vectorSampleStdev(): vectorSampleMean() reported a NAN mean.\n");
    599         psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     599        psTrace("psLib.math", 4, "---- %s() end ----\n", __func__);
    600600        return false;
    601601    }
     
    680680                                  (float)(count - 1));
    681681    }
    682     psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     682    psTrace("psLib.math", 4, "---- %s() end ----\n", __func__);
    683683
    684684    return true;
     
    704704                              )
    705705{
    706     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
    707     psTrace(__func__, 4, "Trace level is %d\n", psTraceGetLevel(__func__));
     706    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
     707    psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel(__func__));
    708708
    709709    // Ensure that stats->clipIter is within the proper range.
     
    739739        stats->clippedMean = NAN;
    740740        stats->clippedStdev = NAN;
    741         psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     741        psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__);
    742742        psFree(tmpMask);
    743743        psFree(statsTmp);
    744744        return false;
    745745    }
    746     psTrace(__func__, 6, "The initial sample median is %f\n", statsTmp->sampleMedian);
     746    psTrace("psLib.math", 6, "The initial sample median is %f\n", statsTmp->sampleMedian);
    747747
    748748    // 2. Compute the sample standard deviation.
     
    752752        stats->clippedMean = NAN;
    753753        stats->clippedStdev = NAN;
    754         psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);
     754        psTrace("psLib.math", 4, "---- %s(false) end ----\n", __func__);
    755755        psFree(tmpMask);
    756756        psFree(statsTmp);
    757757        return false;
    758758    }
    759     psTrace(__func__, 6, "The initial sample stdev is %f\n", statsTmp->sampleStdev);
     759    psTrace("psLib.math", 6, "The initial sample stdev is %f\n", statsTmp->sampleStdev);
    760760
    761761    // 3. Use the sample median as the first estimator of the mean X.
     
    770770    for (int iter = 0; iter < stats->clipIter && clipped; iter++) {
    771771        clipped = false;
    772         psTrace(__func__, 6, "------------ Iteration %d ------------\n", iter);
     772        psTrace("psLib.math", 6, "------------ Iteration %d ------------\n", iter);
    773773        // a) Exclude all values x_i for which |x_i - x| > K * stdev
    774774        if (errors) {
     
    777777                        fabsf(myVector->data.F32[j] - clippedMean) > stats->clipSigma * errors->data.F32[j]) {
    778778                    tmpMask->data.U8[j] = 0xff;
    779                     psTrace(__func__, 10, "Clipped %d: %f +/- %f\n", j,
     779                    psTrace("psLib.math", 10, "Clipped %d: %f +/- %f\n", j,
    780780                            myVector->data.F32[j], errors->data.F32[j]);
    781781                    numClipped++;
     
    788788                        fabsf(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
    789789                    tmpMask->data.U8[j] = 0xff;
    790                     psTrace(__func__, 10, "Clipped %d: %f\n", j, myVector->data.F32[j]);
     790                    psTrace("psLib.math", 10, "Clipped %d: %f\n", j, myVector->data.F32[j]);
    791791                    numClipped++;
    792792                    clipped = true;
     
    798798        vectorSampleMean(myVector, errors, tmpMask, maskVal, statsTmp);
    799799        vectorSampleStdev(myVector, errors, tmpMask, maskVal, statsTmp);
    800         psTrace(__func__, 6, "The new sample mean is %f\n", statsTmp->sampleMean);
    801         psTrace(__func__, 6, "The new sample stdev is %f\n", statsTmp->sampleStdev);
     800        psTrace("psLib.math", 6, "The new sample mean is %f\n", statsTmp->sampleMean);
     801        psTrace("psLib.math", 6, "The new sample stdev is %f\n", statsTmp->sampleStdev);
    802802
    803803        // If the new mean and stdev are NAN, we must exit the loop.
     
    821821    if (stats->options & PS_STAT_CLIPPED_MEAN) {
    822822        stats->clippedMean = clippedMean;
    823         psTrace(__func__, 6, "The final clipped mean is %f\n", clippedMean);
     823        psTrace("psLib.math", 6, "The final clipped mean is %f\n", clippedMean);
    824824    }
    825825    // 8. The last calcuated value of stdev is the clipped stdev.
    826826    if (stats->options & PS_STAT_CLIPPED_STDEV) {
    827827        stats->clippedStdev = clippedStdev;
    828         psTrace(__func__, 6, "The final clipped stdev is %f\n", clippedStdev);
     828        psTrace("psLib.math", 6, "The final clipped stdev is %f\n", clippedStdev);
    829829    }
    830830
    831831    psFree(tmpMask);
    832832    psFree(statsTmp);
    833     psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);
     833    psTrace("psLib.math", 4, "---- %s(true) end ----\n", __func__);
    834834    return true;
    835835}
     
    884884                                              )
    885885{
    886     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
    887     psTrace(__func__, 5, "binNum, yVal is (%d, %f)\n", binNum, yVal);
     886    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
     887    psTrace("psLib.math", 5, "binNum, yVal is (%d, %f)\n", binNum, yVal);
    888888    if (psTraceGetLevel(__func__) >= 8) {
    889889        PS_VECTOR_PRINT_F32(xVec);
     
    913913        y->data.F64[1] = yVec->data.F32[binNum];
    914914        y->data.F64[2] = yVec->data.F32[binNum + 1];
    915         psTrace(__func__, 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1],
     915        psTrace("psLib.math", 6, "x vec (orig) is (%f %f %f %f)\n", xVec->data.F32[binNum - 1],
    916916                xVec->data.F32[binNum], xVec->data.F32[binNum+1], xVec->data.F32[binNum+2]);
    917         psTrace(__func__, 6, "x data is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]);
    918         psTrace(__func__, 6, "y data is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]);
     917        psTrace("psLib.math", 6, "x data is (%f %f %f)\n", x->data.F64[0], x->data.F64[1], x->data.F64[2]);
     918        psTrace("psLib.math", 6, "y data is (%f %f %f)\n", y->data.F64[0], y->data.F64[1], y->data.F64[2]);
    919919
    920920        //
     
    937937            psFree(x);
    938938            psFree(y);
    939             psTrace(__func__, 5, "---- %s() end ----\n", __func__);
     939            psTrace("psLib.math", 5, "---- %s() end ----\n", __func__);
    940940            return NAN;
    941941        }
     
    949949            psFree(x);
    950950            psFree(y);
    951             psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
     951            psTrace("psLib.math", 5, "---- %s(NAN) end ----\n", __func__);
    952952            return NAN;
    953953        }
    954         psTrace(__func__, 6, "myPoly->coeff[0] is %f\n", myPoly->coeff[0]);
    955         psTrace(__func__, 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]);
    956         psTrace(__func__, 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]);
    957         psTrace(__func__, 6, "Fitted y vec is (%f %f %f)\n",
     954        psTrace("psLib.math", 6, "myPoly->coeff[0] is %f\n", myPoly->coeff[0]);
     955        psTrace("psLib.math", 6, "myPoly->coeff[1] is %f\n", myPoly->coeff[1]);
     956        psTrace("psLib.math", 6, "myPoly->coeff[2] is %f\n", myPoly->coeff[2]);
     957        psTrace("psLib.math", 6, "Fitted y vec is (%f %f %f)\n",
    958958                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[0]),
    959959                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[1]),
    960960                (psF32) psPolynomial1DEval(myPoly, (psF64) x->data.F64[2]));
    961961
    962         psTrace(__func__, 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal);
     962        psTrace("psLib.math", 6, "We fit the polynomial, now find x such that f(x) equals %f\n", yVal);
    963963        tmpFloat = QuadraticInverse(myPoly->coeff[2], myPoly->coeff[1], myPoly->coeff[0], yVal,
    964964                                    x->data.F64[0], x->data.F64[2]);
     
    970970            psFree(x);
    971971            psFree(y);
    972             psTrace(__func__, 5, "---- %s(NAN) end ----\n", __func__);
     972            psTrace("psLib.math", 5, "---- %s(NAN) end ----\n", __func__);
    973973            return(NAN);
    974974        }
     
    990990    }
    991991
    992     psTrace(__func__, 6, "FIT: return %f\n", tmpFloat);
     992    psTrace("psLib.math", 6, "FIT: return %f\n", tmpFloat);
    993993    psFree(x);
    994994    psFree(y);
    995995
    996     psTrace(__func__, 5, "---- %s(%f) end ----\n", __func__, tmpFloat);
     996    psTrace("psLib.math", 5, "---- %s(%f) end ----\n", __func__, tmpFloat);
    997997    return tmpFloat;
    998998}
     
    10061006                                  )
    10071007{
    1008     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     1008    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    10091009    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
    10101010    PS_ASSERT_VECTOR_SIZE(params, 2, NAN);
     
    10281028
    10291029
    1030     psTrace(__func__, 4, "---- %s() end ----\n", __func__);
     1030    psTrace("psLib.math", 4, "---- %s() end ----\n", __func__);
    10311031    return gauss;
    10321032}
     
    10571057                              psStats* stats)
    10581058{
    1059     psTrace(__func__, 4, "---- %s() begin ----\n", __func__);
     1059    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    10601060    if (psTraceGetLevel(__func__) >= 8) {
    10611061        PS_VECTOR_PRINT_F32(myVector);
     
    10851085    // Iterate to get the best bin size
    10861086    for (int iterate = 1; iterate > 0; iterate++) {
    1087         psTrace(__func__, 6,
     1087        psTrace("psLib.math", 6,
    10881088                "-------------------- Iterating on Bin size.  Iteration number %d --------------------\n",
    10891089                iterate);
     
    10981098            psFree(statsMinMax);
    10991099            psFree(mask);
    1100             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1100            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    11011101            return false;
    11021102        }
    1103         psTrace(__func__, 6, "Data min/max is (%.2f, %.2f)\n", min, max);
     1103        psTrace("psLib.math", 6, "Data min/max is (%.2f, %.2f)\n", min, max);
    11041104
    11051105        // If all data points have the same value, then we set the appropiate members of stats and return.
    11061106        if (fabs(max - min) <= FLT_EPSILON) {
    1107             psTrace(__func__, 5, "All data points have the same value: %f.\n", min);
     1107            psTrace("psLib.math", 5, "All data points have the same value: %f.\n", min);
    11081108            if (stats->options & PS_STAT_ROBUST_MEDIAN) {
    11091109                stats->robustMedian = min;
     
    11171117            psFree(mask);
    11181118
    1119             psTrace(__func__, 4, "---- %s(0) end  ----\n", __func__);
     1119            psTrace("psLib.math", 4, "---- %s(0) end  ----\n", __func__);
    11201120            return false;
    11211121        }
     
    11251125            // Set initial bin size to the specified value.
    11261126            binSize = stats->binsize;
    1127             psTrace(__func__, 6, "Setting initial robust bin size to %.2f\n", binSize);
     1127            psTrace("psLib.math", 6, "Setting initial robust bin size to %.2f\n", binSize);
    11281128        } else {
    11291129            // Determine the bin size of the robust histogram, using the pre-defined number of bins
    11301130            binSize = (max - min) / INITIAL_NUM_BINS;
    11311131        }
    1132         psTrace(__func__, 6, "Initial robust bin size is %.2f\n", binSize);
     1132        psTrace("psLib.math", 6, "Initial robust bin size is %.2f\n", binSize);
    11331133
    11341134        // ADD step 0: Construct the histogram with the specified bin size.  NOTE: we can not specify the bin
     
    11361136        // we get here, we know that binSize != 0.0.
    11371137        long numBins = (max - min) / binSize; // Number of bins
    1138         psTrace(__func__, 6, "Numbins is %d\n", numBins);
    1139         psTrace(__func__, 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
     1138        psTrace("psLib.math", 6, "Numbins is %d\n", numBins);
     1139        psTrace("psLib.math", 6, "Creating a robust histogram from data range (%.2f - %.2f)\n", min, max);
    11401140        // Generate the histogram
    11411141        histogram = psHistogramAlloc(min, max, numBins);
     
    11591159        // ADD step 2: Find the bin which contains the 50% data point.
    11601160        totalDataPoints = cumulative->nums->data.F32[numBins - 1];
    1161         psTrace(__func__, 6, "Total data points is %d\n", totalDataPoints);
     1161        psTrace("psLib.math", 6, "Total data points is %d\n", totalDataPoints);
    11621162        long binMedian;
    11631163        if (totalDataPoints/2.0 < cumulative->nums->data.F32[0]) {
     
    11751175                psFree(cumulative);
    11761176                psFree(mask);
    1177                 psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1177                psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    11781178                return false;
    11791179            }
    11801180        }
    1181         psTrace(__func__, 6, "The median bin is %d (%.2f to %.2f)\n", binMedian,
     1181        psTrace("psLib.math", 6, "The median bin is %d (%.2f to %.2f)\n", binMedian,
    11821182                cumulative->bounds->data.F32[binMedian], cumulative->bounds->data.F32[binMedian+1]);
    11831183
     
    11921192            psFree(cumulative);
    11931193            psFree(mask);
    1194             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1194            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    11951195            return false;
    11961196        }
    1197         psTrace(__func__, 6, "Current robust median is %f\n", stats->robustMedian);
     1197        psTrace("psLib.math", 6, "Current robust median is %f\n", stats->robustMedian);
    11981198
    11991199        // ADD step 4: Find the bins which contains the 15.8655% and 84.1345% data points.
     
    12171217            }
    12181218        }
    1219         psTrace(__func__, 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n",
     1219        psTrace("psLib.math", 6, "The 15.8655%% and 84.1345%% data point bins are (%d, %d).\n",
    12201220                binLo, binHi);
    1221         psTrace(__func__, 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));
    1222         psTrace(__func__, 6, "binHi midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binHi));
     1221        psTrace("psLib.math", 6, "binLo midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binLo));
     1222        psTrace("psLib.math", 6, "binHi midpoint is %f\n", PS_BIN_MIDPOINT(cumulative, binHi));
    12231223
    12241224        if ((binLo < 0) || (binHi < 0)) {
     
    12281228            psFree(cumulative);
    12291229            psFree(mask);
    1230             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1230            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    12311231            return false;
    12321232        }
     
    12441244        float binHiF32 = fitQuadraticSearchForYThenReturnX(cumulative->bounds, cumulative->nums, binHi,
    12451245                         totalDataPoints * 0.841345f);
    1246         psTrace(__func__, 6, "The exact 15.8655%% and 84.1345%% data point positions are: (%f, %f)\n",
     1246        psTrace("psLib.math", 6, "The exact 15.8655%% and 84.1345%% data point positions are: (%f, %f)\n",
    12471247                binLoF32, binHiF32);
    12481248        #else
    12491249        // This code basically interpolates to find the positions exactly.
    1250         psTrace(__func__, 6, "binLo is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
     1250        psTrace("psLib.math", 6, "binLo is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
    12511251                binLo, cumulative->nums->data.F32[binLo], cumulative->nums->data.F32[binLo+1]);
    1252         psTrace(__func__, 6, "binHi is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
     1252        psTrace("psLib.math", 6, "binHi is %d.  Nums at that bin and the next are (%.2f, %.2f)\n",
    12531253                binHi, cumulative->nums->data.F32[binHi], cumulative->nums->data.F32[binHi+1]);
    12541254
     
    12661266        float base = cumulative->bounds->data.F32[binLo];
    12671267        float binLoF32 = base + (deltaBounds / deltaNums) * percentNums; // Value for the 15.8655% mark
    1268         psTrace(__func__, 6,
     1268        psTrace("psLib.math", 6,
    12691269                "(base, deltaBounds, deltaNums, prevPixels, percentNums) is (%.2f %.2f %.2f %.2f %.2f)\n",
    12701270                base, deltaBounds, deltaNums, prevPixels, percentNums);
     
    12811281        base = cumulative->bounds->data.F32[binHi];
    12821282        float binHiF32 = base + (deltaBounds / deltaNums) * percentNums; // Value for the 84.1345% mark
    1283         psTrace(__func__, 6,
     1283        psTrace("psLib.math", 6,
    12841284                "(base, deltaBounds, deltaNums, prevPixels, percentNums) is (%.2f %.2f %.2f %.2f %.2f)\n",
    12851285                base, deltaBounds, deltaNums, prevPixels, percentNums);
    1286         psTrace(__func__, 6,
     1286        psTrace("psLib.math", 6,
    12871287                "The exact 15.8655 and 84.1345 percent data point positions are: (%f, %f)\n",
    12881288                binLoF32, binHiF32);
     
    12911291        // ADD step 5: Determine SIGMA as 1/2 of the distance between these positions.
    12921292        sigma = (binHiF32 - binLoF32) / 2.0;
    1293         psTrace(__func__, 6, "The current sigma is %f.\n", sigma);
     1293        psTrace("psLib.math", 6, "The current sigma is %f.\n", sigma);
    12941294        stats->robustStdev = sigma;
    12951295
     
    12971297        // than 25 bins from the median, recalculate the bin size, and perform the algorithm again.
    12981298        if (sigma < (2 * binSize)) {
    1299             psTrace(__func__, 6, "*************: Do another iteration (%f %f).\n", sigma, binSize);
     1299            psTrace("psLib.math", 6, "*************: Do another iteration (%f %f).\n", sigma, binSize);
    13001300            long maskLo = PS_MAX(0, (binMedian - 25)); // Low index for masking region
    13011301            long maskHi = PS_MIN(histogram->bounds->n - 1, (binMedian + 25)); // High index for masking
    13021302            psF32 medianLo = histogram->bounds->data.F32[maskLo]; // Value at low index
    13031303            psF32 medianHi = histogram->bounds->data.F32[maskHi]; // Value at high index
    1304             psTrace(__func__, 6, "Masking data more than 25 bins from the median\n");
    1305             psTrace(__func__, 6,
     1304            psTrace("psLib.math", 6, "Masking data more than 25 bins from the median\n");
     1305            psTrace("psLib.math", 6,
    13061306                    "The median is at bin number %d.  We mask bins outside the bin range (%d:%d)\n",
    13071307                    binMedian, maskLo, maskHi);
    1308             psTrace(__func__, 6, "Masking data outside (%f %f)\n", medianLo, medianHi);
     1308            psTrace("psLib.math", 6, "Masking data outside (%f %f)\n", medianLo, medianHi);
    13091309            for (long i = 0 ; i < myVector->n ; i++) {
    13101310                if ((myVector->data.F32[i] < medianLo) || (myVector->data.F32[i] > medianHi)) {
    13111311                    mask->data.U8[i] = 0xff;
    1312                     psTrace(__func__, 6, "Masking element %d is %f\n", i, myVector->data.F32[i]);
     1312                    psTrace("psLib.math", 6, "Masking element %d is %f\n", i, myVector->data.F32[i]);
    13131313                }
    13141314            }
     
    13181318        } else {
    13191319            // We've got the bin size correct now
    1320             psTrace(__func__, 6, "*************: No more iteration.  sigma is %f\n", sigma);
     1320            psTrace("psLib.math", 6, "*************: No more iteration.  sigma is %f\n", sigma);
    13211321            iterate = -1;
    13221322        }
     
    13471347        psFree(cumulative);
    13481348        psFree(mask);
    1349         psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1349        psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    13501350        return false;
    13511351    }
    1352     psTrace(__func__, 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25);
     1352    psTrace("psLib.math", 6, "The 25-percent and 75-precent data point bins are (%d, %d).\n", binLo25, binHi25);
    13531353
    13541354    // ADD step 8: Interpolate to find these two positions exactly: these are the upper and lower quartile
     
    13651365        psFree(statsMinMax);
    13661366        psFree(mask);
    1367         psTrace(__func__, 4, "---- %s(1) end  ----\n", __func__);
     1367        psTrace("psLib.math", 4, "---- %s(1) end  ----\n", __func__);
    13681368        return false;
    13691369    }
     
    13711371    stats->robustLQ = binLo25F32;
    13721372    stats->robustUQ = binHi25F32;
    1373     psTrace(__func__, 6, "The 25 and 75 percent data point exact positions are (%f, %f).\n",
     1373    psTrace("psLib.math", 6, "The 25 and 75 percent data point exact positions are (%f, %f).\n",
    13741374            binLo25F32, binHi25F32);
    13751375    long N50 = 0;
     
    13811381    }
    13821382    stats->robustN50 = N50;
    1383     psTrace(__func__, 6, "The robustN50 is %d.\n", N50);
     1383    psTrace("psLib.math", 6, "The robustN50 is %d.\n", N50);
    13841384
    13851385
     
    14051405            psFree(statsMinMax);
    14061406            psFree(mask);
    1407             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1407            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    14081408            return false;
    14091409        }
     
    14111411        // Calculate the number of bins.
    14121412        long numBins = (max - min) / newBinSize;
    1413         psTrace(__func__, 6, "The new min/max values are (%f, %f).\n", min, max);
    1414         psTrace(__func__, 6, "The new bin size is %f.\n", newBinSize);
    1415         psTrace(__func__, 6, "The numBins is %d\n", numBins);
     1413        psTrace("psLib.math", 6, "The new min/max values are (%f, %f).\n", min, max);
     1414        psTrace("psLib.math", 6, "The new bin size is %f.\n", newBinSize);
     1415        psTrace("psLib.math", 6, "The numBins is %d\n", numBins);
    14161416
    14171417        psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers)
     
    14481448            psFree(histogram);
    14491449            psFree(mask);
    1450             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1450            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    14511451            return false;
    14521452        }
     
    14601460            }
    14611461        }
    1462         psTrace(__func__, 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums);
     1462        psTrace("psLib.math", 6, "The peak bin is %d, with %f data.n", binNum, binMaxNums);
    14631463
    14641464        // Fit a Gaussian to the bins in the range 20 sigma of the robust histogram median.
     
    14801480            psFree(histogram);
    14811481            psFree(mask);
    1482             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1482            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    14831483            return false;
    14841484        }
     
    15111511            psFree(histogram);
    15121512            psFree(statsMinMax);
    1513             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1513            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    15141514            return false;
    15151515        }
     
    15371537            psFree(params);
    15381538            psFree(mask);
    1539             psTrace(__func__, 4, "---- %s(false) end  ----\n", __func__);
     1539            psTrace("psLib.math", 4, "---- %s(false) end  ----\n", __func__);
    15401540            return false;
    15411541        }
     
    15461546        // The fitted mean is the Gaussian mean.
    15471547        stats->fittedMean = params->data.F32[0];
    1548         psTrace(__func__, 6, "The fitted mean is %f.\n", params->data.F32[0]);
     1548        psTrace("psLib.math", 6, "The fitted mean is %f.\n", params->data.F32[0]);
    15491549
    15501550        // The fitted standard deviation, SIGMA_r is determined by subtracting the smoothing scale in
    15511551        // quadrature: SIGMA_r^2 = SIGMA^2 - sigma_s^2
    15521552        stats->fittedStdev = sqrt(PS_SQR(params->data.F32[1]) - PS_SQR(newBinSize));
    1553         psTrace(__func__, 6, "The fitted stdev is %f.\n", stats->fittedStdev);
     1553        psTrace("psLib.math", 6, "The fitted stdev is %f.\n", stats->fittedStdev);
    15541554
    15551555        // Clean up after fitting
     
    15641564    psFree(mask);
    15651565
    1566     psTrace(__func__, 4, "---- %s(0) end  ----\n", __func__);
     1566    psTrace("psLib.math", 4, "---- %s(0) end  ----\n", __func__);
    15671567    return true;
    15681568}
     
    15871587psStats* psStatsAlloc(psStatsOptions options)
    15881588{
    1589     psTrace(__func__, 3,"---- %s() begin  ----\n", __func__);
     1589    psTrace("psLib.math", 3,"---- %s() begin  ----\n", __func__);
    15901590    psStats* newStruct = NULL;
    15911591
     
    16161616    newStruct->options = options;
    16171617
    1618     psTrace(__func__, 3, "---- %s() end  ----\n", __func__);
     1618    psTrace("psLib.math", 3, "---- %s() end  ----\n", __func__);
    16191619    return (newStruct);
    16201620}
     
    16451645psHistogram* psHistogramAlloc(float lower, float upper, int n)
    16461646{
    1647     psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
    1648     psTrace(__func__, 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n);
     1647    psTrace("psLib.math", 3, "---- %s() begin  ----\n", __func__);
     1648    psTrace("psLib.math", 5, "(lower, upper, n) is (%f, %f, %d)\n", lower, upper, n);
    16491649    PS_ASSERT_INT_POSITIVE(n, NULL);
    16501650    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(upper, lower, NULL);
     
    16781678    newHist->uniform = true;
    16791679
    1680     psTrace(__func__, 3, "---- %s() end  ----\n", __func__);
     1680    psTrace("psLib.math", 3, "---- %s() end  ----\n", __func__);
    16811681    return newHist;
    16821682}
     
    16931693psHistogram* psHistogramAllocGeneric(const psVector* bounds)
    16941694{
    1695     psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     1695    psTrace("psLib.math", 3, "---- %s() begin  ----\n", __func__);
    16961696    PS_ASSERT_VECTOR_NON_NULL(bounds, NULL);
    16971697    PS_ASSERT_VECTOR_TYPE(bounds, PS_TYPE_F32, NULL);
     
    17211721    newHist->uniform = false;
    17221722
    1723     psTrace(__func__, 3, "---- %s() end  ----\n", __func__);
     1723    psTrace("psLib.math", 3, "---- %s() end  ----\n", __func__);
    17241724    return (newHist);
    17251725}
     
    17571757                               )
    17581758{
    1759     psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     1759    psTrace("psLib.math", 3, "---- %s() begin  ----\n", __func__);
    17601760    PS_ASSERT_PTR_NON_NULL(out, false);
    17611761    PS_ASSERT_PTR_NON_NULL(out->bounds, false);
     
    17941794    if (boxcarLeftBinNum == boxcarRightBinNum) {
    17951795        out->nums->data.F32[binNum] += 1.0;
    1796         psTrace(__func__, 3, "---- %s(true) end  ----\n", __func__);
     1796        psTrace("psLib.math", 3, "---- %s(true) end  ----\n", __func__);
    17971797        return true;
    17981798    }
     
    18131813        (boxcarRight - out->bounds->data.F32[boxcarRightBinNum]) / boxcarWidth;
    18141814
    1815     psTrace(__func__, 3, "---- %s(true) end  ----\n", __func__);
     1815    psTrace("psLib.math", 3, "---- %s(true) end  ----\n", __func__);
    18161816    return true;
    18171817}
     
    18381838                               psMaskType maskVal)
    18391839{
    1840     psTrace(__func__, 3, "---- %s() begin  ----\n", __func__);
     1840    psTrace("psLib.math", 3, "---- %s() begin  ----\n", __func__);
    18411841    PS_ASSERT_PTR_NON_NULL(out, NULL);
    18421842    PS_ASSERT_VECTOR_NON_NULL(out->bounds, NULL);
     
    19331933    psFree(errorsF32);
    19341934
    1935     psTrace(__func__, 3, "---- %s() end  ----\n", __func__);
     1935    psTrace("psLib.math", 3, "---- %s() end  ----\n", __func__);
    19361936    return (out);
    19371937}
     
    19591959    psMaskType maskVal)
    19601960{
    1961     psTrace(__func__, 3,"---- %s() begin  ----\n", __func__);
     1961    psTrace("psLib.math", 3,"---- %s() begin  ----\n", __func__);
    19621962    PS_ASSERT_PTR_NON_NULL(stats, NULL);
    19631963    PS_ASSERT_VECTOR_NON_NULL(in, NULL);
     
    20392039            psFree(inF32);
    20402040            psFree(errorsF32);
    2041             psTrace(__func__, 3,"---- %s(NULL) end  ----\n", __func__);
     2041            psTrace("psLib.math", 3,"---- %s(NULL) end  ----\n", __func__);
    20422042            return(NULL);
    20432043        }
     
    20632063    psFree(errorsF32);
    20642064    psFree(maskU8);
    2065     psTrace(__func__, 3,"---- %s() end  ----\n", __func__);
     2065    psTrace("psLib.math", 3,"---- %s() end  ----\n", __func__);
    20662066    return (stats);
    20672067}
Note: See TracChangeset for help on using the changeset viewer.