IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30171


Ignore:
Timestamp:
Dec 24, 2010, 3:25:24 PM (15 years ago)
Author:
eugene
Message:

save radial aperture results on the parent source; ensure subtracted source is re-added to the same pixels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psphot/src/psphotRadialAperturesByObject.c

    r30140 r30171  
    120120
    121121            // allocate pmSourceExtendedParameters, if not already defined
    122             if (!source->radialAper) {
    123                 source->radialAper = psArrayAlloc(nPSFsizes);
     122            if (source->parent) {
     123                if (!source->parent->radialAper) {
     124                    source->parent->radialAper = psArrayAlloc(nPSFsizes);
     125                }
     126            } else {
     127                if (!source->radialAper) {
     128                    source->radialAper = psArrayAlloc(nPSFsizes);
     129                }
    124130            }
    125131
     
    128134                pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);
    129135            }
     136
     137            // we need to change the view for the radial aperture analysis, but we want to recover exactly
     138            // the original view; the following elements get destroyed by pmSourceRedefinePixels so save them:
     139            psImage *oldMaskObj   = psMemIncrRefCounter(source->maskObj);
     140            psImage *oldModelFlux = psMemIncrRefCounter(source->modelFlux);
     141            psImage *oldPSFimage  = psMemIncrRefCounter(source->psfImage);
     142            psRegion oldRegion    = source->region;
     143
    130144            Nradial ++;
    131145
     
    138152            // radius = PS_MAX (radius, source->pixels->numRows - source->peak->yf + source->pixels->row0);
    139153            // radius = PS_MAX (radius, source->pixels->numCols - source->peak->xf + source->pixels->col0);
    140             pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, outerRadius + 2, false);
     154            pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, outerRadius + 2);
    141155
    142156            if (!psphotRadialApertureSource (source, recipe, skynoise, maskVal, radMax, nMatchedPSF)) {
     
    145159                source->mode |= PM_SOURCE_MODE_RADIAL_FLUX;
    146160            }
     161
     162            pmSourceRedefinePixelsByRegion (source, readout, oldRegion);
     163            psFree(source->maskObj);   source->maskObj   = oldMaskObj;
     164            psFree(source->modelFlux); source->modelFlux = oldModelFlux;
     165            psFree(source->psfImage);  source->psfImage  = oldPSFimage;
    147166
    148167            // re-subtract the object, leave local sky
Note: See TracChangeset for help on using the changeset viewer.