IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30753


Ignore:
Timestamp:
Feb 24, 2011, 12:49:04 PM (15 years ago)
Author:
eugene
Message:

correct typo in logic for GuessModels; test option for large object moments (try harder); updates to visuals

Location:
branches/eam_branches/ipp-20110213/psphot/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c

    r30624 r30753  
    335335        return NULL;
    336336    }
     337
     338    // XXX does this work here?
     339    psphotVisualShowPSFStars (recipe, try->psf, try->sources);
    337340
    338341    // build the flux-to-magnitude conversion information
  • branches/eam_branches/ipp-20110213/psphot/src/psphotGuessModels.c

    r30038 r30753  
    160160        pmSource *source = sources->data[i];
    161161
     162        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) {
     163            fprintf (stderr, "moment failure\n");
     164        }
     165
    162166        // this is used to mark sources for which the model is measured. We check later that
    163167        // all are used.
     
    187191        useMoments = (useMoments && source->moments);          // can't if there are no moments
    188192        useMoments = (useMoments && source->moments->nPixels); // can't if the moments were not measured
    189         useMoments = (useMoments && !(source->mode && PM_SOURCE_MODE_MOMENTS_FAILURE)); // can't if the moments failed...
     193        useMoments = (useMoments && !(source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE)); // can't if the moments failed...
    190194
    191195        float Xo, Yo;
     
    198202        }
    199203
     204        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     205            fprintf (stderr, "satstar: %f,%f vs %f,%f : %c\n",
     206                     source->moments->Mx, source->moments->My,
     207                     source->peak->xf, source->peak->yf,
     208                     (useMoments ? 'T' : 'F'));
     209        }
     210
    200211        // set PSF parameters for this model (apply 2D shape model to coordinates Xo, Yo)
    201212        pmModel *modelPSF = pmModelFromPSFforXY(psf, Xo, Yo, Io);
  • branches/eam_branches/ipp-20110213/psphot/src/psphotSourceStats.c

    r29936 r30753  
    122122        // allocate space for moments
    123123        source->moments = pmMomentsAlloc();
     124
     125        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) {
     126            fprintf (stderr, "moment failure\n");
     127        }
    124128
    125129        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
     
    361365
    362366    bool status = false;
    363     float BIG_RADIUS;
    364367    psScalar *scalar = NULL;
    365368
     
    415418            continue;
    416419        }
     420
     421        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     422            fprintf (stderr, "satstar: %f,%f\n", source->peak->xf, source->peak->yf);
     423        }
    417424
    418425        // measure basic source moments (no S/N clipping on input pixels)
     
    431438            psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
    432439        }           
    433         if (status) {
     440        if (status && (source->moments->Mrf < 2.0*SIGMA)) {
    434441            Nmoments ++;
    435442            continue;
    436443        }
    437444
    438         // if no valid pixels, or massive swing, likely saturated source,
     445        // if no valid pixels, massive swing or very large Mrf, likely saturated source,
    439446        // try a much larger box
    440         BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);
     447        float BIG_RADIUS = 3.0*RADIUS;
     448        float BIG_SIGMA  = 3.0*SIGMA;
     449
     450        {
     451            // NOTE this is slightly sleazy, but only slightly: pmSourceRedefinePixels uses the readout
     452            // to pass the pointers to the parent image data.  I guess the API could be simplified:
     453            // we could recover this from the source in the function
     454
     455            pmReadout tmpReadout;
     456            tmpReadout.image    = (psImage *)source->pixels->parent;
     457            tmpReadout.mask     = (psImage *)source->maskView->parent;
     458            tmpReadout.variance = (psImage *)source->variance->parent;
     459
     460            // re-allocate image, weight, mask arrays for each peak (square of radius OUTER)
     461            pmSourceRedefinePixels (source, &tmpReadout, source->peak->x, source->peak->y, BIG_RADIUS + 2);
     462        }
     463
    441464        psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);
    442         status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, 0.0, maskVal);
     465        status = pmSourceMoments (source, BIG_RADIUS, BIG_SIGMA, 0.0, maskVal);
    443466        if (status) {
    444467            source->mode |= PM_SOURCE_MODE_BIG_RADIUS;
  • branches/eam_branches/ipp-20110213/psphot/src/psphotVisual.c

    r30749 r30753  
    218218}
    219219
    220 bool psphotVisualScaleImage (int kapaFD, psImage *inImage, psImage *inMask, const char *name, int channel) {
     220bool psphotVisualScaleImage (int kapaFD, psImage *inImage, psImage *inMask, const char *name, float factor, int channel) {
    221221
    222222    KiiImage image;
     
    239239    strcpy (data.name, name);
    240240    strcpy (data.file, name);
    241     data.zero = stats->robustMedian - stats->robustStdev;
    242     data.range = 5*stats->robustStdev;
     241    data.zero = stats->robustMedian - factor*stats->robustStdev;
     242
     243    // XXX I we have a smoothed image, this make a much-too-tight display range
     244    data.range = 5*factor*stats->robustStdev;
    243245    data.logflux = 0;
    244246
     
    283285    if (kapa == -1) return false;
    284286
     287    float factor = 1.0;
     288    if (readout->covariance) {
     289        factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0);
     290    }
     291
    285292    psphotVisualShowMask (kapa, readout->mask, "mask", 2);
    286     psphotVisualScaleImage (kapa, readout->variance, readout->mask, "variance", 1);
    287     psphotVisualScaleImage (kapa, readout->image, readout->mask, "image", 0);
     293    psphotVisualScaleImage (kapa, readout->variance, readout->mask, "variance", 1.0, 1);
     294    psphotVisualScaleImage (kapa, readout->image, readout->mask, "image", sqrt(factor), 0);
    288295
    289296    pmVisualAskUser(NULL);
     
    303310    pmReadout *backgnd = READOUT_OR_INTERNAL(view, file);
    304311
    305     psphotVisualScaleImage (kapa, backgnd->image, readout->mask, "backgnd", 2);
    306     psphotVisualScaleImage (kapa, readout->image, readout->mask, "backsub", 0);
     312    float factor = 1.0;
     313    if (readout->covariance) {
     314        factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0);
     315    }
     316
     317    psphotVisualScaleImage (kapa, backgnd->image, readout->mask, "backgnd", 1.0, 2);
     318    psphotVisualScaleImage (kapa, readout->image, readout->mask, "backsub", sqrt(factor), 0);
    307319
    308320    pmVisualAskUser(NULL);
     
    12211233    }
    12221234
    1223     psphotVisualScaleImage (myKapa, outsat, NULL, "satstar", 2);
     1235    psphotVisualScaleImage (myKapa, outsat, NULL, "satstar", 1.0, 2);
    12241236
    12251237    pmVisualAskUser(NULL);
     
    24902502    if (myKapa == -1) return false;
    24912503
     2504    float factor = 1.0;
     2505    if (readout->covariance) {
     2506        factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0);
     2507    }
     2508
    24922509    if (reshow) {
    24932510        psphotVisualShowMask (myKapa, readout->mask, "mask", 2);
    2494         psphotVisualScaleImage (myKapa, readout->variance, readout->mask, "variance", 1);
    2495     }
    2496     psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", 0);
     2511        psphotVisualScaleImage (myKapa, readout->variance, readout->mask, "variance", 1.0, 1);
     2512    }
     2513    psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", sqrt(factor), 0);
    24972514
    24982515    pmVisualAskUser(NULL);
Note: See TracChangeset for help on using the changeset viewer.