IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 17, 2009, 2:26:32 PM (17 years ago)
Author:
eugene
Message:

change radius for extended sources to use footprint; clean up some of the visualizations; plug some leaks

File:
1 edited

Legend:

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

    r24592 r25433  
    223223    if (source->peak->SN < EXT_MIN_SN) return false;
    224224
     225    float radius = psphotSetRadiusEXT (readout, source, markVal);
     226
     227    // XXX note that this changes the source moments that are published...
    225228    // recalculate the source moments using the larger extended-source moments radius
    226229    // at this stage, skip Gaussian windowing, and do not clip pixels by S/N
    227     if (!pmSourceMoments (source, EXT_MOMENTS_RAD, 0.0, 0.0)) return false;
     230    // XXX use the deteremined value of PSF_MOMENTS_RADIUS and SIGMA and scale up?
     231    // XXX increase the moments radius iteratively until the measured sigma / input < f?
     232    // XXX use the footprint somehow to judge both radius and aperture?
     233    if (!pmSourceMoments (source, radius, 0.0, 0.0)) return false;
    228234
    229235    psTrace ("psphot", 5, "trying blob...\n");
     
    277283
    278284    // both models failed; reject them both
     285    // XXX -- change type flags to psf in this case and keep original moments?
    279286    psFree (EXT);
    280287    psFree (DBL);
     
    287294    // save new model
    288295    source->modelEXT = EXT;
     296    source->modelEXT->radiusFit = radius;
    289297    source->type = PM_SOURCE_TYPE_EXTENDED;
    290298    source->mode |= PM_SOURCE_MODE_EXTMODEL;
     
    294302    pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    295303    source->tmpFlags |=  PM_SOURCE_TMPF_SUBTRACTED;
     304
     305# if (PS_TRACE_ON)   
    296306    psTrace ("psphot", 5, "blob as EXT: %f %f\n", EXT->params->data.F32[PM_PAR_XPOS], EXT->params->data.F32[PM_PAR_YPOS]);
     307    if (psTraceGetLevel("psphot") >= 6) {
     308        psLogMsg ("psphot", 1, "source 2:\n");
     309        for (int i = 0; i < source->modelEXT->params->n; i++) {
     310            psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelEXT->params->data.F32[i], source->modelEXT->dparams->data.F32[i]);
     311        }
     312    }
     313# endif
     314
    297315    return true;
    298316
     
    306324    source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    307325    source->mode     |= PM_SOURCE_MODE_PAIR;
     326    source->modelPSF->radiusFit = radius;
    308327
    309328    // copy most data from the primary source (modelEXT, blends stay NULL)
    310     // XXX use pmSourceCopy?
    311329    pmSource *newSrc = pmSourceCopy (source);
    312330    newSrc->modelPSF = psMemIncrRefCounter (DBL->data[1]);
     331    newSrc->modelPSF->radiusFit = radius;
    313332
    314333    // build cached models and subtract
     
    317336    pmSourceCacheModel (newSrc, maskVal);
    318337    pmSourceSub (newSrc, PM_MODEL_OP_FULL, maskVal);
     338
     339# if (PS_TRACE_ON)   
    319340    psTrace ("psphot", 5, "blob as DBL: %f %f\n", ONE->params->data.F32[PM_PAR_XPOS], ONE->params->data.F32[PM_PAR_YPOS]);
     341    if (psTraceGetLevel("psphot") >= 6) {
     342        psLogMsg ("psphot", 1, "source 1:\n");
     343        for (int i = 0; i < newSrc->modelPSF->params->n; i++) {
     344            psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, newSrc->modelPSF->params->data.F32[i], newSrc->modelPSF->dparams->data.F32[i]);
     345        }
     346        psLogMsg ("psphot", 1, "source 2:\n");
     347        for (int i = 0; i < source->modelPSF->params->n; i++) {
     348            psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelPSF->params->data.F32[i], source->modelPSF->dparams->data.F32[i]);
     349        }
     350        psphotVisualShowResidualImage (readout);
     351    }
     352# endif
    320353
    321354    psArrayAdd (newSources, 100, newSrc);
     
    356389    // save the PSF model from the Ensemble fit
    357390    PSF = source->modelPSF;
    358     psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0);
     391    // psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0);
    359392    if (isnan(PSF->params->data.F32[1])) psAbort("nan in dbl fit");
    360393
     
    390423
    391424    // if (isnan(EXT->params->data.F32[1])) psAbort("nan in ext fit");
    392 
    393     psphotCheckRadiusEXT (readout, source, EXT, markVal);
     425    // psphotCheckRadiusEXT (readout, source, EXT, markVal);
    394426
    395427    if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) {
     
    401433    return (EXT);
    402434}
    403 
Note: See TracChangeset for help on using the changeset viewer.