IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

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

    r2269 r2273  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-03 03:30:30 $
     11 *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-11-04 01:04:59 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434#include "psFunctions.h"
    3535#include "psConstants.h"
     36
     37#include "psDataManipErrors.h"
    3638
    3739/*****************************************************************************/
     
    735737
    736738    // Ensure that stats->clipIter is within the proper range.
    737     if (!((PS_CLIPPED_NUM_ITER_LB <= stats->clipIter) && (stats->clipIter <= PS_CLIPPED_NUM_ITER_UB))) {
    738         psError(__func__, "Unallowed value for clipIter (%d).\n", stats->clipIter);
    739         return(-1);
    740     }
     739    PS_INT_CHECK_RANGE(stats->clipIter,PS_CLIPPED_NUM_ITER_LB,PS_CLIPPED_NUM_ITER_UB,-1);
     740
    741741    // Ensure that stats->clipSigma is within the proper range.
    742     if (!((PS_CLIPPED_SIGMA_LB <= stats->clipSigma) && (stats->clipSigma <= PS_CLIPPED_SIGMA_UB))) {
    743         psError(__func__, "Unallowed value for clipSigma (%f).\n", stats->clipSigma);
    744         return(-1);
    745     }
     742    PS_INT_CHECK_RANGE(stats->clipSigma,PS_CLIPPED_SIGMA_LB,PS_CLIPPED_SIGMA_UB,-1);
     743
    746744    // We allocate a temporary mask vector since during the iterative
    747745    // steps that follow, we will be masking off additional data points.
     
    869867        p_psNormalizeVectorRangeF64(myData, low, high);
    870868    } else {
    871         psError(__func__, "Unalowable data type.\n");
     869        char* strType;
     870        PS_TYPE_NAME(strType,myData->type.type);
     871        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     872                PS_ERRORTEXT_psStats_NOT_F32_F64,
     873                strType);
    872874    }
    873875}
     
    954956        // Ensure that yVal is within the range of the bins we are using.
    955957        if (!((y->data.F64[0] <= yVal) && (yVal <= y->data.F64[2]))) {
    956             printf("((%f), %f, %f)\n", yVal, y->data.F64[0], y->data.F64[2]);
    957             psError(__func__, "yVal not within y-range\n");
     958            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     959                    PS_ERRORTEXT_psStats_YVAL_OUT_OF_RANGE,
     960                    (double)yVal,y->data.F64[2],y->data.F64[0]);
    958961        }
    959962        yErr->data.F64[0] = 1.0;
     
    11131116
    11141117    if ((LQBinNum < 0) || (UQBinNum < 0)) {
    1115         psError(__func__, "Could not determine the robust lower/upper quartile bin numbers.");
     1118        psError(PS_ERR_UNKNOWN, true,
     1119                PS_ERRORTEXT_psStats_ROBUST_QUARTILE_BINS_FAILED);
    11161120        return(1);
    11171121    }
    11181122    if (medianBinNum < 0) {
    1119         psError(__func__, "Could not determine the robust lower/upper quartile bin numbers.");
     1123        psError(PS_ERR_UNKNOWN, true,
     1124                PS_ERRORTEXT_psStats_ROBUST_QUARTILE_BINS_FAILED);
    11201125        return(1);
    11211126    }
     
    11741179    psVector *y = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32);
    11751180
    1176     p_psNormalizeVectorRange(robustHistogramVector, 0.0, 1.0);
     1181    psNormalizeVectorRange(robustHistogramVector, 0.0, 1.0);
    11771182    for (i=0;i<robustHistogramVector->n;i++) {
    11781183        myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32);
     
    15361541        // do nothing
    15371542    } else {
    1538         psError(__func__, "unsupported vector type 0x%x\n", in->type.type);
     1543        char* strType;
     1544        PS_TYPE_NAME(strType,in->type.type);
     1545        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     1546                PS_ERRORTEXT_psStats_VECTOR_TYPE_UNSUPPORTED,
     1547                strType);
    15391548    }
    15401549    return (tmp);
     
    16031612            (stats->options & PS_STAT_ROBUST_STDEV) || (stats->options & PS_STAT_ROBUST_QUARTILE)) {
    16041613        if (0 != p_psVectorRobustStats(inF32, mask, maskVal, stats)) {
    1605             psError(__func__, "p_psVectorRobustStats() failed.\n");
     1614            psError(PS_ERR_UNKNOWN, false,
     1615                    PS_ERRORTEXT_psStats_STATS_FAILED);
    16061616        }
    16071617    }
     
    16091619    if ((stats->options & PS_STAT_CLIPPED_MEAN) || (stats->options & PS_STAT_CLIPPED_STDEV)) {
    16101620        if (0 != p_psVectorClippedStats(inF32, mask, maskVal, stats)) {
    1611             psError(__func__, "p_psVectorClippedStats() failed.\n");
     1621            psError(PS_ERR_UNKNOWN, false,
     1622                    "Failed to calculate statistics for input psVector.");
    16121623        }
    16131624    }
Note: See TracChangeset for help on using the changeset viewer.