IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 18, 2010, 6:42:01 PM (16 years ago)
Author:
Paul Price
Message:

Reworked ppStack to be better about error codes and their translation to exit codes.

Location:
trunk/ppStack/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src

    • Property svn:ignore
      •  

        old new  
        1010stamp-h1
        1111ppStackVersionDefinitions.h
         12ppStackErrorCodes.c
         13ppStackErrorCodes.h
  • trunk/ppStack/src/ppStackMatch.c

    r26898 r27004  
    3131    psFree(resolved);
    3232    if (!fits) {
    33         psError(PS_ERR_IO, false, "Unable to open previously produced image: %s", name);
     33        psError(PPSTACK_ERR_IO, false, "Unable to open previously produced image: %s", name);
    3434        return false;
    3535    }
    3636    psImage *image = psFitsReadImage(fits, psRegionSet(0,0,0,0), 0); // Image of interest
    3737    if (!image) {
    38         psError(PS_ERR_IO, false, "Unable to read previously produced image: %s", name);
     38        psError(PPSTACK_ERR_IO, false, "Unable to read previously produced image: %s", name);
    3939        psFitsClose(fits);
    4040        return false;
     
    150150    psImage *unbinned = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Unbinned background model
    151151    if (!psImageUnbin(unbinned, binned, binning)) {
    152         psError(PS_ERR_UNKNOWN, false, "Unable to unbin background model");
     152        psError(PPSTACK_ERR_DATA, false, "Unable to unbin background model");
    153153        psFree(unbinned);
    154154        return NULL;
     
    177177    int num = psMetadataLookupS32(&mdok, recipe, "RENORM.NUM");
    178178    if (!mdok) {
    179         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.NUM is not set in the recipe");
     179        psError(PPSTACK_ERR_CONFIG, true, "RENORM.NUM is not set in the recipe");
    180180        return false;
    181181    }
    182182    float minValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MIN");
    183183    if (!mdok) {
    184         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MIN is not set in the recipe");
     184        psError(PPSTACK_ERR_CONFIG, true, "RENORM.MIN is not set in the recipe");
    185185        return false;
    186186    }
    187187    float maxValid = psMetadataLookupF32(&mdok, recipe, "RENORM.MAX");
    188188    if (!mdok) {
    189         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "RENORM.MAX is not set in the recipe");
     189        psError(PPSTACK_ERR_CONFIG, true, "RENORM.MAX is not set in the recipe");
    190190        return false;
    191191    }
     
    229229
    230230    if (!pmReadoutMaskNonfinite(readout, maskVal)) {
    231         psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in readout.");
     231        psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels in readout.");
    232232        return false;
    233233    }
     
    256256            psFree(resolved);
    257257            if (!fits || !pmReadoutReadSubtractionKernels(conv, fits)) {
    258                 psError(PS_ERR_IO, false, "Unable to read previously produced kernel");
     258                psError(PPSTACK_ERR_IO, false, "Unable to read previously produced kernel");
    259259                psFitsClose(fits);
    260260                return false;
     
    265265                !readImage(&readout->mask, options->convMasks->data[index], config) ||
    266266                !readImage(&readout->variance, options->convVariances->data[index], config)) {
    267                 psError(PS_ERR_IO, false, "Unable to read previously produced image.");
     267                psError(PPSTACK_ERR_IO, false, "Unable to read previously produced image.");
    268268                return false;
    269269            }
     
    326326            float scaleMax = psMetadataLookupF32(NULL, ppsub, "SCALE.MAX"); // Maximum for scaling
    327327            if (!isfinite(scaleRef) || !isfinite(scaleMin) || !isfinite(scaleMax)) {
    328                 psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     328                psError(PPSTACK_ERR_CONFIG, false,
    329329                        "Scale parameters (SCALE.REF=%f, SCALE.MIN=%f, SCALE.MAX=%f) not set in PPSUB recipe.",
    330330                        scaleRef, scaleMin, scaleMax);
     
    346346            psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
    347347            if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskVal | maskBad, rng)) {
    348                 psError(PS_ERR_UNKNOWN, false, "Can't measure background for image.");
     348                psError(PPSTACK_ERR_DATA, false, "Can't measure background for image.");
    349349                psFree(fake);
    350350                psFree(optWidths);
     
    366366                                          stampSources, SOURCE_MASK, NULL, NULL, options->psf,
    367367                                          minFlux, footprint + size, false, true)) {
    368                 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake image with target PSF.");
     368                psError(PPSTACK_ERR_DATA, false, "Unable to generate fake image with target PSF.");
    369369                psFree(fake);
    370370                psFree(optWidths);
     
    417417                                               stride, kernelError, covarFrac, maskVal, maskBad, maskPoor,
    418418                                               poorFrac, badFrac)) {
    419                     psError(PS_ERR_UNKNOWN, false, "Unable to convolve images.");
     419                    psError(psErrorCodeLast(), false, "Unable to convolve images.");
    420420                    psFree(fake);
    421421                    psFree(optWidths);
     
    433433                                                       options->inputSeeing->data.F32[index],
    434434                                                       options->targetSeeing, scaleRef, scaleMin, scaleMax)) {
    435                     psError(PS_ERR_UNKNOWN, false, "Unable to scale kernel parameters");
     435                    psError(psErrorCodeLast(), false, "Unable to scale kernel parameters");
    436436                    psFree(fake);
    437437                    psFree(optWidths);
     
    451451                                        sysError, skyErr, kernelError, covarFrac, maskVal, maskBad, maskPoor,
    452452                                        poorFrac, badFrac, PM_SUBTRACTION_MODE_2)) {
    453                     psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
     453                    psError(psErrorCodeLast(), false, "Unable to match images.");
    454454                    psFree(fake);
    455455                    psFree(optWidths);
     
    464464                psFree(widthsCopy);
    465465            }
     466
    466467
    467468#ifdef TESTING
     
    628629    // Measure the variance level for the weighting
    629630    if (!psImageBackground(bg, NULL, readout->variance, readout->mask, maskVal | maskBad, rng)) {
    630         psError(PS_ERR_UNKNOWN, false, "Can't measure mean variance for image.");
     631        psError(PPSTACK_ERR_DATA, false, "Can't measure mean variance for image.");
    631632        psFree(rng);
    632633        psFree(bg);
Note: See TracChangeset for help on using the changeset viewer.