IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 30, 2004, 12:22:00 PM (22 years ago)
Author:
gusciora
Message:

Added better error checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmNonLinear.c

    r2481 r2857  
    33 *  Provides polynomial or table lookup non-linearity corrections to readouts.
    44 *
    5  *  @author George Gusciora, MHPCC
     5 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-11-25 02:54:45 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-30 22:22:00 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131                                    const psPolynomial1D *coeff)
    3232{
    33     int i;
    34     int j;
    35 
    3633    PS_PTR_CHECK_NULL(in,NULL);
    3734    PS_PTR_CHECK_NULL(in->image, NULL);
    3835    PS_PTR_CHECK_NULL(coeff,NULL);
     36
     37    psS32 i;
     38    psS32 j;
    3939
    4040    for (i=0;i<(in->image)->numRows;i++) {
     
    6363    PS_PTR_CHECK_NULL(outFlux,NULL);
    6464
    65     int i;
    66     int j;
    67     int tableSize = inFlux->n;
    68     int binNum;
     65    psS32 i;
     66    psS32 j;
     67    psS32 tableSize = inFlux->n;
     68    psS32 binNum;
    6969    psScalar x;
    70     int numPixels = 0;
    71     float slope;
     70    psS32 numPixels = 0;
     71    psF32 slope;
    7272
    7373    x.type.type = PS_TYPE_F32;
    7474    if (inFlux->n != outFlux->n) {
    75         // XXX: psWarning("pmNonLinearityLookup(): input vectors have different size");
    7675        tableSize = PS_MIN(inFlux->n, outFlux->n);
     76        psLogMsg(__func__, PS_LOG_WARN,
     77                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n);
    7778    }
    7879    if (inFlux->n < 2) {
    79         // XXX: psWarning("pmNonLinearityLookup(): input vector less than 2 elements");
     80        psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements.  Returning in image.");
    8081        return(in);
    8182    }
     
    9697
    9798                numPixels++;
     99            } else if (binNum < -2) {
     100                // We get here if there was some other problem.
     101                psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect().  Returning in image.");
     102                return(in);
     103                numPixels++;
    98104            } else {
    99105                // Perform linear interpolation.
     
    106112    }
    107113    if (numPixels > 0) {
    108         // XXX: psWarning("Warning: pmNonLinearityLookup(): %d pixels outside table.", numPixels);
     114        psLogMsg(__func__, PS_LOG_WARN,
     115                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): %d pixels outside table.", numPixels);
    109116    }
    110117    return(in);
Note: See TracChangeset for help on using the changeset viewer.