IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41526


Ignore:
Timestamp:
Apr 2, 2021, 2:52:30 PM (5 years ago)
Author:
eugene
Message:

plug a leak from dropped transformations; minor comment and whitespace changes; add applyPixelNaN lookup to config->arguments

Location:
trunk/pswarp/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpCleanup.c

    r41510 r41526  
    8686        }
    8787    }
     88
    8889    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    8990        psError(psErrorCodeLast(), false, "Unable to write files.");
  • trunk/pswarp/src/pswarpDefineLayout.c

    r41510 r41526  
    174174
    175175    psImageInit(readout->image, NAN);
    176     psFree(readout);                // Drop reference
     176    psFree(readout);                // Drop reference (saved on cell)
    177177               
    178178    // copy the image concepts from the skycell
  • trunk/pswarp/src/pswarpLoadAstrometry.c

    r39981 r41526  
    150150            }
    151151        }
    152         targetChip->toFPA = psMemIncrRefCounter (chip->toFPA);
    153         targetChip->fromFPA = psMemIncrRefCounter (chip->fromFPA);
     152        if (targetChip != chip) {
     153          psAssert (!targetChip->toFPA, "oops");
     154          psAssert (!targetChip->fromFPA, "oops");
     155          targetChip->toFPA = psMemIncrRefCounter (chip->toFPA);
     156          targetChip->fromFPA = psMemIncrRefCounter (chip->fromFPA);
     157        }
    154158    }
    155159
    156160    // for pswarpLocalFrame, I need transformations and HDUs on a single fpa (so set on astrom as well as target)
    157     target->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA);
    158     target->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA);
    159     target->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
     161    // But: do not increment the ref counter if this is the same entry
     162    if (target->fpa != astrom->fpa) {
     163      psAssert (!target->fpa->toTPA, "oops");
     164      psAssert (!target->fpa->fromTPA, "oops");
     165      psAssert (!target->fpa->toSky, "oops");
     166      target->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA);
     167      target->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA);
     168      target->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
     169    }
    160170
    161171    // reset the type to the original value
  • trunk/pswarp/src/pswarpLoop.c

    r41510 r41526  
    1515bool pswarpLoop(pmConfig *config, psMetadata *stats)
    1616{
    17 
    1817    // load the recipe
    1918    bool status = false;
  • trunk/pswarp/src/pswarpOptions.c

    r39981 r41526  
    7070    }
    7171
     72    bool applyPixelNaN = psMetadataLookupBool(&status,recipe, "APPLY.PIXELNAN"); ///< apply NaN value to masked pixels
     73    if (!status) {
     74        applyPixelNaN = true;
     75        psWarning("APPLY.PIXELNAN is not set in the %s recipe -- defaulting to %d.", PSWARP_RECIPE, applyPixelNaN);
     76    }
     77   
    7278    // BACKGROUND.MODEL gets set in config->arguments (to false) if no input model is found
    7379    bool doBKG = psMetadataLookupBool(&status,config->arguments, "BACKGROUND.MODEL"); ///< Generate the warped background model?
     
    109115    psMetadataAddBool(recipe, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
    110116    psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG);
     117    psMetadataAddBool(recipe, PS_LIST_TAIL, "APPLY.PIXELNAN", PS_META_REPLACE, "apply NaN values to bad pixels?", applyPixelNaN);
    111118    psMetadataAddS32(recipe, PS_LIST_TAIL, "BKG.XGRID", PS_META_REPLACE, "Xsize of background model", bkgXgrid);
    112119    psMetadataAddS32(recipe, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid);
     
    120127    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF);
    121128    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG);
     129    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "APPLY.PIXELNAN", PS_META_REPLACE, "apply NaN values to bad pixels?", applyPixelNaN);
    122130    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BKG.XGRID", PS_META_REPLACE, "Xsize of background model", bkgXgrid);
    123131    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid);
  • trunk/pswarp/src/pswarpTransformReadout.c

    r41510 r41526  
    4040    // output mask bits
    4141    psImageMaskType maskIn   = 0 ;
    42     if(doApplyMaskNaN) {
     42    if (doApplyMaskNaN) {
    4343      maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
    4444      psAssert(mdok, "MASK.INPUT was not defined");
  • trunk/pswarp/src/pswarpTransformTile.c

    r35563 r41526  
    132132            double imageValue, varValue; // Value of image and variance map
    133133            psImageMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask
    134             if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) {
     134
     135            if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) {
    135136                psError(psErrorCodeLast(), false, "Unable to interpolate image.");
    136137                return false;
Note: See TracChangeset for help on using the changeset viewer.