IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25497


Ignore:
Timestamp:
Sep 23, 2009, 11:17:41 AM (17 years ago)
Author:
eugene
Message:

psf model ap radius different from fit radius; both set based on results of moments analysis

Location:
branches/eam_branches/20090715/psphot/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psphot/src/psphotChoosePSF.c

    r23989 r25497  
    7373    // get the fixed PSF fit radius
    7474    // XXX check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS
    75     options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
    76     assert (status);
     75    // options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
     76    // assert (status);
     77
     78    // XXX we have calculated a Gaussian window function, use that for both the PSF fit radius
     79    // and the aperture radius (scaling SIGMA)
     80    // XXX put the scale factors into the recipe
     81    float gaussSigma = psMetadataLookupF32(&status, recipe, "MOMENTS_GAUSS_SIGMA");
     82    float fitScale = psMetadataLookupF32(&status, recipe, "PSF_FIT_RADIUS_SCALE");
     83    float apScale = psMetadataLookupF32(&status, recipe, "PSF_APERTURE_SCALE");
     84    options->fitRadius = (int)(fitScale*gaussSigma);
     85    options->apRadius = (int)(apScale*gaussSigma);
    7786
    7887    // XXX ROBUST seems to be too agressive given the small numbers.
     
    289298    // XXX test dump of psf star data and psf-subtracted image
    290299    if (psTraceGetLevel("psphot.psfstars") > 5) {
    291         psphotDumpPSFStars (readout, try, options->radius, maskVal, markVal);
     300        psphotDumpPSFStars (readout, try, options->fitRadius, maskVal, markVal);
    292301    }
    293302
  • branches/eam_branches/20090715/psphot/src/psphotFitSourcesLinear.c

    r25452 r25497  
    264264        float x = model->params->data.F32[PM_PAR_XPOS];
    265265        float y = model->params->data.F32[PM_PAR_YPOS];
    266         psImageMaskCircle (source->maskView, x, y, model->radiusFit, "AND", PS_NOT_IMAGE_MASK(markVal));
     266        psImageMaskCircle (source->maskView, x, y, model->fitRadius, "AND", PS_NOT_IMAGE_MASK(markVal));
    267267    }
    268268
  • branches/eam_branches/20090715/psphot/src/psphotRadiusChecks.c

    r25433 r25497  
    3535        }
    3636    }
    37     model->radiusFit = (RADIUS_TYPE)(radiusFit + PSF_FIT_PADDING);
     37    model->fitRadius = (RADIUS_TYPE)(radiusFit + PSF_FIT_PADDING);
    3838
    39     if (isnan(model->radiusFit)) psAbort("error in radius");
     39    if (isnan(model->fitRadius)) psAbort("error in radius");
    4040       
    4141    if (source->mode & PM_SOURCE_MODE_SATSTAR) {
    42         model->radiusFit *= 2;
     42        model->fitRadius *= 2;
    4343    }
    4444
    45     bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit);
     45    source->apRadius = model->fitRadius;
     46    // XXX for now, use the same radius for aperture and fit
     47    // XXX to use different radii, we will need to set the apRadius mask with a call to
     48    // psImageKeepCircle in the function psphotMagnitudes_Threaded
     49
     50    bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius);
    4651
    4752    // set the mask to flag the excluded pixels
    48     psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal);
     53    psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius, "OR", markVal);
    4954    return status;
    5055}
     
    5863
    5964    // set the fit radius based on the object flux limit and the model
    60     model->radiusFit = (RADIUS_TYPE) (model->modelRadius (model->params, PSF_FIT_NSIGMA*moments->dSky) + dR + PSF_FIT_PADDING);
    61     if (isnan(model->radiusFit)) psAbort("error in radius");
     65    model->fitRadius = (RADIUS_TYPE) (model->modelRadius (model->params, PSF_FIT_NSIGMA*moments->dSky) + dR + PSF_FIT_PADDING);
     66    if (isnan(model->fitRadius)) psAbort("error in radius");
    6267       
    6368    if (source->mode &  PM_SOURCE_MODE_SATSTAR) {
    64         model->radiusFit *= 2;
     69        model->fitRadius *= 2;
    6570    }
    6671
    67     bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit);
     72    source->apRadius = model->fitRadius;
     73    // XXX for now, use the same radius for aperture and fit
     74    // XXX to use different radii, we will need to set the apRadius mask with a call to
     75    // psImageKeepCircle in the function psphotMagnitudes_Threaded
     76
     77    bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius);
    6878
    6979    // set the mask to flag the excluded pixels
    70     psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal);
     80    psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius, "OR", markVal);
    7181    return status;
    7282}
     
    141151    float rawRadius = model->modelRadius (model->params, EXT_FIT_NSIGMA*moments->dSky);
    142152
    143     model->radiusFit = rawRadius + EXT_FIT_PADDING;
    144     if (isnan(model->radiusFit)) psAbort("error in radius");
     153    model->fitRadius = rawRadius + EXT_FIT_PADDING;
     154    if (isnan(model->fitRadius)) psAbort("error in radius");
     155
     156    // XXX this make the psf photometry for extended sources inconsistent with the other psf sources
     157    // XXX for now, use the same radius for aperture and fit
     158    // XXX to use different radii, we will need to set the apRadius mask with a call to
     159    // psImageKeepCircle in the function psphotMagnitudes_Threaded
    145160
    146161    // redefine the pixels if needed
    147     bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit);
     162    bool status = pmSourceRedefinePixels (source, readout, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius);
    148163
    149164    // set the mask to flag the excluded pixels
    150     psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->radiusFit, "OR", markVal);
     165    psImageKeepCircle (source->maskObj, PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], model->fitRadius, "OR", markVal);
    151166    return status;
    152167}
  • branches/eam_branches/20090715/psphot/src/psphotSourceFits.c

    r25433 r25497  
    294294    // save new model
    295295    source->modelEXT = EXT;
    296     source->modelEXT->radiusFit = radius;
     296    source->modelEXT->fitRadius = radius;
    297297    source->type = PM_SOURCE_TYPE_EXTENDED;
    298298    source->mode |= PM_SOURCE_MODE_EXTMODEL;
     
    324324    source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    325325    source->mode     |= PM_SOURCE_MODE_PAIR;
    326     source->modelPSF->radiusFit = radius;
     326    source->modelPSF->fitRadius = radius;
    327327
    328328    // copy most data from the primary source (modelEXT, blends stay NULL)
    329329    pmSource *newSrc = pmSourceCopy (source);
    330330    newSrc->modelPSF = psMemIncrRefCounter (DBL->data[1]);
    331     newSrc->modelPSF->radiusFit = radius;
     331    newSrc->modelPSF->fitRadius = radius;
    332332
    333333    // build cached models and subtract
Note: See TracChangeset for help on using the changeset viewer.