IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2857


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

Added better error checking.

Location:
trunk/psModules
Files:
5 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);
  • trunk/psModules/src/pmReadoutCombine.c

    r2832 r2857  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-27 23:16:51 $
     7 *  @version $Revision: 1.18 $ $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
     
    8282    if (1 < DetermineNumBits(params->stats->options)) {
    8383        psError(PS_ERR_UNKNOWN, true,
    84                 "Multiple statistical options have been requested.\n");
     84                "Multiple statistical options have been requested.  Returning NULL.\n");
    8585        return(NULL);
    8686    }
     
    128128        PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL);
    129129        if (numInputs > zero->n) {
    130             psError(PS_ERR_UNKNOWN, true, "zero vector has incorrect size (%d)\n", zero->n);
     130            psError(PS_ERR_UNKNOWN, true, "zero vector has incorrect size (%d).  Returning NULL.\n", zero->n);
    131131            return(NULL);
    132132        } else if (numInputs < zero->n) {
     
    140140        PS_VECTOR_CHECK_TYPE(scale, PS_TYPE_F32, NULL);
    141141        if (numInputs > scale->n) {
    142             psError(PS_ERR_UNKNOWN, true, "scale vector has incorrect size (%d)\n", scale->n);
     142            psError(PS_ERR_UNKNOWN, true, "scale vector has incorrect size (%d).  Returning NULL.\n", scale->n);
    143143            return(NULL);
    144144        } else if (numInputs < scale->n) {
     
    163163                ((output->row0 + output->numRows) < maxInputRows)) {
    164164            psError(PS_ERR_UNKNOWN, true,
    165                     "Output image (%d, %d) is too small to hold combined images.\n",
     165                    "Output image (%d, %d) is too small to hold combined images.  Returning NULL.\n",
    166166                    output->row0 + output->numRows,
    167167                    output->col0 + output->numCols);
     
    171171        if ((output->col0 > minInputCols) || (output->row0 > minInputRows)) {
    172172            psError(PS_ERR_UNKNOWN, true,
    173                     "Output image offset is larger then input image offset.\n");
     173                    "Output image offset is larger then input image offset.  Returning NULL.\n");
    174174            return(NULL);
    175175        }
     
    313313                }
    314314                // Calculate the specified statistic on the stack of pixels.
    315                 stats = psVectorStats(stats,
    316                                       tmpPixels,
    317                                       tmpPixelErrors,
    318                                       tmpPixelMaskNKeep,
    319                                       1);
     315                psStats *rc = psVectorStats(stats,
     316                                            tmpPixels,
     317                                            tmpPixelErrors,
     318                                            tmpPixelMaskNKeep,
     319                                            1);
     320                if (rc == NULL) {
     321                    psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning NULL.\n");
     322                    return(NULL);
     323                }
    320324            } else {
    321325                if (scale != NULL) {
     
    333337
    334338                // Calculate the specified statistic on the stack of pixels.
    335                 stats = psVectorStats(stats,
    336                                       tmpPixels,
    337                                       NULL,
    338                                       tmpPixelMaskNKeep,
    339                                       1);
     339                psStats *rc = psVectorStats(stats,
     340                                            tmpPixels,
     341                                            NULL,
     342                                            tmpPixelMaskNKeep,
     343                                            1);
     344                if (rc == NULL) {
     345                    psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning NULL.\n");
     346                    return(NULL);
     347                }
    340348            }
    341349
     
    344352            double statValue;
    345353            if (!p_psGetStatValue(stats, &statValue)) {
    346                 psError(PS_ERR_UNKNOWN, true, "Could not determine stats value.\n");
     354                psError(PS_ERR_UNKNOWN, true, "Could not determine stats value.  Returning NULL.\n");
    347355                return(NULL);
    348356            } else {
  • trunk/psModules/src/pmSubtractBias.c

    r2856 r2857  
    66 *  @author George Gusciora, MHPCC
    77 *
    8  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-30 21:35:03 $
     8 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-30 22:22:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939
    4040    if (((in->image)->numRows + in->row0 - bias->row0) > (bias->image)->numRows) {
    41         psError(PS_ERR_UNKNOWN,true, "bias image does not have enough rows\n");
     41        psError(PS_ERR_UNKNOWN,true, "bias image does not have enough rows.  Returning in image\n");
    4242        return(in);
    4343    }
    4444    if (((in->image)->numCols + in->row0 - bias->row0) > (bias->image)->numCols) {
    45         psError(PS_ERR_UNKNOWN,true, "bias image does not have enough columns\n");
     45        psError(PS_ERR_UNKNOWN,true, "bias image does not have enough columns.  Returning in image\n");
    4646        return(in);
    4747    }
     
    129129
    130130    if (numOptions == 0) {
    131         psError(PS_ERR_UNKNOWN,true, "No statistics options have been specified\n");
     131        psError(PS_ERR_UNKNOWN,true, "No statistics options have been specified.\n");
    132132    }
    133133    if (numOptions != 1) {
     
    225225
    226226    } else {
    227         psError(PS_ERR_UNKNOWN, true, "unknown fit type\n");
     227        psError(PS_ERR_UNKNOWN, true, "unknown fit type.  Returning NULL.\n");
     228        psFree(newVec);
     229        return(NULL);
    228230    }
    229231
     
    251253    PS_READOUT_CHECK_TYPE(in, PS_TYPE_F32, NULL);
    252254    if ((overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)) {
    253         psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)\n");
     255        psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE).  Returning in image\n");
    254256        return(in);
    255257    }
     
    260262            (fit != PM_OVERSCAN_COLUMNS) &&
    261263            (fit != PM_OVERSCAN_ALL)) {
    262         psError(PS_ERR_UNKNOWN, true, "fit is unallowable (%d)\n", fit);
     264        psError(PS_ERR_UNKNOWN, true, "fit is unallowable (%d).  Returning in image.\n", fit);
    263265        return(in);
    264266    }
     
    268270            (overScanAxis != PM_OVERSCAN_COLUMNS) &&
    269271            (overScanAxis != PM_OVERSCAN_ALL)) {
    270         psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d)\n", overScanAxis);
     272        psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d).  Returning in image.\n", overScanAxis);
    271273        return(in);
    272274    }
     
    302304        if (fit != PM_FIT_NONE) {
    303305            psLogMsg(__func__, PS_LOG_WARN,
    304                      "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE\n");
     306                     "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE.  Proceeding to full fram subtraction.\n");
    305307        }
    306308
    307309        if (overscans != NULL) {
    308310            psLogMsg(__func__, PS_LOG_WARN,
    309                      "WARNING: pmSubtractBias.(): overScanAxis equals NONE and overscans does not equal NULL\n");
     311                     "WARNING: pmSubtractBias.(): overScanAxis equals NONE and overscans does not equal NULL.  Proceeding to full fram subtraction.\n");
    310312        }
    311313        return(psSubtractFrame(in, bias));
     
    314316    if ((overScanAxis == PM_OVERSCAN_ALL) && (fit != PM_FIT_NONE)) {
    315317        psLogMsg(__func__, PS_LOG_WARN,
    316                  "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE\n");
     318                 "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE.  Proceeding with the rest of the module.\n");
    317319    }
    318320
     
    321323    // We subtract each overscan region from the image data.
    322324    //
    323     // XXX: Do we generate a single stat from all the overscan regions, and
    324     // subtract that from the input image?  Or do we generate a single stat
    325     // from each overscan region, and subtract them from the input image?
    326     // The SDR is ambiguous.
    327325    if (overScanAxis == PM_OVERSCAN_ALL) {
    328326        tmpOverscan = (psListElem *) overscans->head;
    329327        while (NULL != tmpOverscan) {
    330328            myOverscanImage = (psImage *) tmpOverscan->data;
    331             psImageStats(myStats, myOverscanImage, NULL, 0xffffffff);
    332             p_psGetStatValue(myStats, &statValue);
     329            psStats *rc = psImageStats(myStats, myOverscanImage, NULL, 0xffffffff);
     330            if (rc == NULL) {
     331                psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
     332                return(in);
     333            }
     334            if (false == p_psGetStatValue(myStats, &statValue)) {
     335                psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation.  Returning in image.\n");
     336                return(in);
     337            }
    333338            p_psImageSubtractScalar(in->image, statValue);
    334339
     
    340345    // This check is redundant with above code.
    341346    if (!((overScanAxis == PM_OVERSCAN_ROWS) || (overScanAxis == PM_OVERSCAN_COLUMNS))) {
    342         psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d)\n", overScanAxis);
     347        psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d).\nReturning in image.\n", overScanAxis);
    343348        return(in);
    344349    }
     
    371376                    tmpRow->data.F32[j] = myOverscanImage->data.F32[j][i];
    372377                }
    373                 myStats = psVectorStats(myStats, tmpRow, NULL, NULL, 0);
    374                 p_psGetStatValue(myStats, &statValue);
     378                psStats *rc = psVectorStats(myStats, tmpRow, NULL, NULL, 0);
     379                if (rc == NULL) {
     380                    psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning in image.\n");
     381                    return(in);
     382                }
     383                if (false ==  p_psGetStatValue(rc, &statValue)) {
     384                    psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation.  Returning in image.\n");
     385                    return(in);
     386                }
    375387                overscanVector->data.F32[i] = statValue;
    376388            }
     
    383395                                                           in->image->numCols,
    384396                                                           fitSpec, fit);
     397                    if (newVec == NULL) {
     398                        psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector(): could not scale the overscan vector.  Returning in image.\n");
     399                        return(in);
     400                    }
    385401                    psFree(overscanVector);
    386402                    overscanVector = newVec;
    387403                } else {
    388                     psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector.  Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL.\n");
     404                    psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector.  Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL.  Returning in image.\n");
    389405                    psFree(overscanVector);
    390406                    return(in);
     
    414430                    tmpCol->data.F32[j] = myOverscanImage->data.F32[i][j];
    415431                }
    416                 myStats = psVectorStats(myStats, tmpCol, NULL, NULL, 0);
    417                 p_psGetStatValue(myStats, &statValue);
     432                psStats *rc = psVectorStats(myStats, tmpCol, NULL, NULL, 0);
     433                if (rc == NULL) {
     434                    psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning in image.\n");
     435                    return(in);
     436                }
     437                if (false ==  p_psGetStatValue(rc, &statValue)) {
     438                    psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation.  Returning in image.\n");
     439                    return(in);
     440                }
    418441                overscanVector->data.F32[i] = statValue;
    419442            }
     
    426449                                                           in->image->numRows,
    427450                                                           fitSpec, fit);
     451                    if (newVec == NULL) {
     452                        psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector(): could not scale the overscan vector.  Returning in image.\n");
     453                        return(in);
     454                    }
    428455                    psFree(overscanVector);
    429456                    overscanVector = newVec;
    430457                } else {
    431                     psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector.  Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL.\n");
     458                    psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector.  Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL.  Returning in image.\n");
    432459                    psFree(overscanVector);
    433460                    return(in);
     
    456483                    }
    457484                }
    458                 myStats = psVectorStats(myStats, binVec, NULL, NULL, 0);
    459                 p_psGetStatValue(myStats, &statValue);
     485                psStats *rc = psVectorStats(myStats, binVec, NULL, NULL, 0);
     486                if (rc == NULL) {
     487                    psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning in image.\n");
     488                    return(in);
     489                }
     490                if (false ==  p_psGetStatValue(rc, &statValue)) {
     491                    psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation.  Returning in image.\n");
     492                    return(in);
     493                }
    460494                myBin->data.F32[i] = statValue;
    461495            }
     
    486520                myPoly = psVectorFitPolynomial1D(myPoly, NULL, overscanVector, NULL);
    487521                if (myPoly == NULL) {
    488                     psError(PS_ERR_UNKNOWN, false, "Could not fit a polynomial to overscan vector.\n");
     522                    psError(PS_ERR_UNKNOWN, false, "Could not fit a polynomial to overscan vector.  Returning in image.\n");
    489523                    psFree(overscanVector);
    490524                    return(in);
     
    494528                mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
    495529                if (mySpline == NULL) {
    496                     psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector.\n");
     530                    psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector.  Returning in image.\n");
    497531                    psFree(overscanVector);
    498532                    return(in);
     
    535569            }
    536570        } else {
     571            //
    537572            // If we get here, then no polynomials were fit to the overscan
    538573            // vector.  We simply subtract it, taking into account binning,
    539574            // from the image.
     575            //
    540576
    541577            //
  • trunk/psModules/src/pmSubtractSky.c

    r2848 r2857  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-29 22:44:33 $
     8 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-30 22:22:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    106106                }
    107107            }
    108             myStats = psVectorStats(myStats, binVector, NULL, binMask, 1);
     108            psStats *rc1 = psVectorStats(myStats, binVector, NULL, binMask, 1);
     109            if (rc1 == NULL) {
     110                psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation.  Returning in image.\n");
     111                return(origImage);
     112            }
    109113            psF64 statValue;
    110             psBool rc = p_psGetStatValue(myStats, &statValue);
     114            psBool rc = p_psGetStatValue(rc1, &statValue);
    111115
    112116            if (rc == true) {
     
    427431            (fit != PM_FIT_POLYNOMIAL) &&
    428432            (fit != PM_FIT_SPLINE)) {
    429         psError(PS_ERR_UNKNOWN, true, "psFit is unallowable (%d)\n", fit);
     433        psError(PS_ERR_UNKNOWN, true, "psFit is unallowable (%d).  Returning in image.\n", fit);
    430434        return(in);
    431435    }
     
    436440    if ((fitSpec == NULL) ||
    437441            ((fit == PM_FIT_NONE) || (fit == PM_FIT_SPLINE))) {
     442        psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined.  Returning in image.\n");
    438443        return(in);
    439444    }
     
    452457            psLogMsg(__func__, PS_LOG_WARN, "WARNING: Multiple statistical options have been requested.\n");
    453458            statOptions = getHighestPriorityStatOption(statOptions);
    454 
     459            if (statOptions == -1) {
     460                psError(PS_ERR_UNKNOWN, true, "Not allowable stats->option was specified.  Returning in image.\n");
     461                return(in);
     462            }
    455463            // Save old input "stats" parameter.
    456464            oldStatOptions = stats->options;
     
    483491        // and a mask.
    484492        binnedImage = psImageCopy(binnedImage, origImage, PS_TYPE_F32);
     493        if (binnedImage == NULL) {
     494            psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL.  Returning in image.\n");
     495            return(in);
     496        }
     497
    485498        if (in->mask != NULL) {
    486499            binnedMaskImage = psImageCopy(binnedMaskImage, in->mask, PS_TYPE_U8);
     500            if (binnedMaskImage == NULL) {
     501                psError(PS_ERR_UNKNOWN, false, "psImageCopy() returned NULL.  Returning in image.\n");
     502                psFree(binnedImage);
     503                return(in);
     504            }
    487505        } else {
    488506            binnedMaskImage = psImageAlloc(binnedImage->numCols,
     
    493511    } else {
    494512        binnedImage = psImageRebin(NULL, origImage, in->mask, 0, binFactor, stats);
     513        if (binnedImage == NULL) {
     514            psError(PS_ERR_UNKNOWN, false, "psImageRebin() returned NULL.  Returning in image.\n");
     515            return(in);
     516        }
    495517        binnedMaskImage = psImageAlloc(binnedImage->numCols,
    496518                                       binnedImage->numRows,
     
    512534        psF64 binnedStdev;
    513535        psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    514         myStats =  psImageStats(myStats, binnedImage, NULL, 0);
    515         p_psGetStatValue(myStats, &binnedMean);
     536        psStats *rc =  psImageStats(myStats, binnedImage, NULL, 0);
     537        if (rc == NULL) {
     538            psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
     539            return(in);
     540        }
     541        if (false == p_psGetStatValue(rc, &binnedMean)) {
     542            psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
     543            return(in);
     544        }
    516545        psTrace(".psModule.pmSubtractSky", 6,
    517546                "binned Mean is %f\n", binnedMean);
    518547
    519548        myStats->options = PS_STAT_SAMPLE_STDEV;
    520         myStats =  psImageStats(myStats, binnedImage, NULL, 0);
    521         p_psGetStatValue(myStats, &binnedStdev);
     549        rc =  psImageStats(myStats, binnedImage, NULL, 0);
     550        if (rc == NULL) {
     551            psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation.  Returning in image.\n");
     552            return(in);
     553        }
     554        if (false == p_psGetStatValue(myStats, &binnedStdev)) {
     555            psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine requested statistical operation.  Returning in image.\n");
     556            return(in);
     557        }
    522558        psFree(myStats);
    523559        psTrace(".psModule.pmSubtractSky", 6,
     
    551587            // Set the pixels in the binned image to that of the polynomial.
    552588            binnedImage = psImageEvalPolynomial(binnedImage, myPoly);
     589            if (binnedImage == NULL) {
     590                psError(PS_ERR_UNKNOWN, false, "psImageEvalPolynomial() returned NULL.  Returning in image.\n");
     591                psFree(binnedMaskImage);
     592                if (!((binFactor <= 1) || (stats == NULL))) {
     593                    psFree(binnedImage);
     594                }
     595                if (oldStatOptions != 0) {
     596                    stats->options = statOptions;
     597                }
     598                return(in);
     599            }
    553600        } else {
    554601            psLogMsg(__func__, PS_LOG_WARN,
     
    565612    } else {
    566613        // We shouldn't get here since we check this above.
    567         psError(PS_ERR_UNKNOWN, true, "Unallowable fit type.");
     614        psError(PS_ERR_UNKNOWN, true, "Unallowable fit type.  Returning in image.\n");
     615        psFree(binnedMaskImage);
     616        if (!((binFactor <= 1) || (stats == NULL))) {
     617            psFree(binnedImage);
     618        }
     619        if (oldStatOptions != 0) {
     620            stats->options = statOptions;
     621        }
     622        return(in);
    568623    }
    569624
  • trunk/psModules/test/tst_pmNonLinear.c

    r2589 r2857  
    1313 *  @author GLG, MHPCC
    1414 *
    15  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2004-12-01 22:08:15 $
     15 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2004-12-30 22:22:00 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646    int testStatus = 0;
    4747    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    48     psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
     48    //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
     49    psReadout *myReadout = psReadoutAlloc();
     50    myReadout->image = myImage;
    4951    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
    5052    myPoly->coeff[1] = 1.0;
     
    9597    int tableSize = PS_MAX(numCols, numRows)*2;
    9698    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    97     psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
     99    //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);
     100    psReadout *myReadout = psReadoutAlloc();
     101    myReadout->image = myImage;
    98102    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
    99103    psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32);
Note: See TracChangeset for help on using the changeset viewer.