IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 13, 2011, 11:43:27 AM (15 years ago)
Author:
eugene
Message:

plug leaks in ppSub; adjust kernel auto-scaling to take place after we have measured the source sizes; new option to allow positive output (A+B) instead of diff output (A-B); do NOT weight covariances when averaging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubMatchPSFs.c

    r29937 r30619  
    7878        return true;
    7979    }
    80 
    8180    psFree(view);
    8281
     
    127126    if (!inSourceRO || !refSourceRO) {
    128127        psError(PPSUB_ERR_DATA, false, "Unable to scale kernel, since no sources were provided.");
     128        psFree(view);
    129129        return false;
    130130    }
     
    164164
    165165    // is auto-scaling needed?
    166     if (!psMetadataLookupBool(NULL, recipe, "SCALE")) {
    167         // No scaling requested
    168         psFree(view);
    169         return true;
    170     }
    171 
     166    bool scale = psMetadataLookupBool(NULL, recipe, "SCALE");
    172167    float scaleRef = psMetadataLookupF32(NULL, recipe, "SCALE.REF"); // Reference for scaling
    173168    float scaleMin = psMetadataLookupF32(NULL, recipe, "SCALE.MIN"); // Minimum for scaling
    174169    float scaleMax = psMetadataLookupF32(NULL, recipe, "SCALE.MAX"); // Maximum for scaling
    175     if (!isfinite(scaleRef) || !isfinite(scaleMin) || !isfinite(scaleMax)) {
     170
     171    if (scale && (!isfinite(scaleRef) || !isfinite(scaleMin) || !isfinite(scaleMax))) {
    176172        psError(PPSUB_ERR_ARGUMENTS, false,
    177                 "Scale parameters (SCALE.REF=%f, SCALE.MIN=%f, SCALE.MAX=%f) not set in recipe.",
     173                "auto-scale selected but scale parameters (SCALE.REF=%f, SCALE.MIN=%f, SCALE.MAX=%f) not set in recipe.",
    178174                scaleRef, scaleMin, scaleMax);
    179175        return false;
    180176    }
    181177
    182     if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, scaleRef, scaleMin, scaleMax)) {
    183         psError(PPSUB_ERR_DATA, false, "Unable to scale parameters.");
    184         return false;
    185     }
     178    pmSubtractionParamScaleOptions(scale, scaleRef, scaleMin, scaleMax);
     179
     180    // if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths)) {
     181    //     psError(PPSUB_ERR_DATA, false, "Unable to scale parameters.");
     182    //     return false;
     183    // }
    186184
    187185    return true;
     
    221219        pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.INPUT.CONV"); // Cell for convolved input
    222220        inConv = pmReadoutAlloc(cell);
     221        psFree(inConv);
    223222    }
    224223    pmReadout *refConv = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); // Reference convolved
     
    226225        pmCell *cell = pmFPAfileThisCell(config->files, view, "PPSUB.REF.CONV"); // Cell for convolved ref.
    227226        refConv = pmReadoutAlloc(cell);
     227        psFree(refConv);
    228228    }
    229229
     
    380380
    381381    if (inRO->covariance) {
    382         psImageCovarianceTruncate(inRO->covariance, COVAR_FRAC);
     382        psKernel *truncated = psImageCovarianceTruncate(inRO->covariance, COVAR_FRAC);
     383        psFree(inRO->covariance);
     384        inRO->covariance = truncated;
    383385    }
    384386    if (refRO->covariance) {
    385         psImageCovarianceTruncate(refRO->covariance, COVAR_FRAC);
     387        psKernel *truncated = psImageCovarianceTruncate(refRO->covariance, COVAR_FRAC);
     388        psFree(refRO->covariance);
     389        refRO->covariance = truncated;
    386390    }
    387391
     
    494498
    495499    if (inConv->covariance) {
    496         psImageCovarianceTruncate(inConv->covariance, COVAR_FRAC);
     500        psKernel *truncated = psImageCovarianceTruncate(inConv->covariance, COVAR_FRAC);
     501        psFree(inConv->covariance);
     502        inConv->covariance = truncated;
    497503    }
    498504    if (refConv->covariance) {
    499         psImageCovarianceTruncate(refConv->covariance, COVAR_FRAC);
     505        psKernel *truncated = psImageCovarianceTruncate(refConv->covariance, COVAR_FRAC);
     506        psFree(refConv->covariance);
     507        refConv->covariance = truncated;
    500508    }
    501509
Note: See TracChangeset for help on using the changeset viewer.