IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30932


Ignore:
Timestamp:
Mar 16, 2011, 1:34:32 PM (15 years ago)
Author:
eugene
Message:

cull with the smoothed image; use the functinon pmSourcePositionUseMoments to check if we should use the moments or peaks for source positions

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

Legend:

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

    r30903 r30932  
    11# include "psphotInternal.h"
     2
     3# define CULL_WITH_SMOOTHED_IMAGE 1
    24
    35/*
     
    6163    float SAT_THRESHOLD  = 0.05*SATURATION;
    6264
     65# if (CULL_WITH_SMOOTHED_IMAGE)
     66    psLogMsg ("psphot", PS_LOG_INFO, "Culling peaks from footprints using the smoothed image");
     67# else
     68    psLogMsg ("psphot", PS_LOG_INFO, "Culling peaks from footprints using the raw (unsmoothed) image");
     69# endif
     70
    6371    for (int i = 0; i < footprints->n; i++) {
    6472        pmFootprint *fp = footprints->data[i];
     
    7886        }
    7987
    80         // if we cull using the significance image, then the thresholds are different
     88# if (CULL_WITH_SMOOTHED_IMAGE)
     89        // New (post r30869) style of culling using the smoothed image and variance (S/N)
     90        // if we cull using the significance image, then the definition of variance is different (thus the bool in arg 8)
     91        if (pmFootprintCullPeaks(signifR->image, signifR->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, false) != PS_ERR_NONE) {
     92            return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
     93        }
     94# else
     95        // Old (pre r30869) style of culling using the raw image and variance
     96        if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, true) != PS_ERR_NONE) {
     97             return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
     98        }
     99# endif
     100
     101// Alternate style of culling using the smoothed image and raw variance (probably a bad idea)
    81102# if (0)
    82103        if (pmFootprintCullPeaks(signifR->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, true) != PS_ERR_NONE) {
    83104            return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
    84         }
    85 # endif
    86 # if (1)
    87         if (pmFootprintCullPeaks(signifR->image, signifR->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, false) != PS_ERR_NONE) {
    88             return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
    89         }
    90 # endif
    91 # if (0)
    92         if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, true) != PS_ERR_NONE) {
    93              return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id);
    94105        }
    95106# endif
  • branches/eam_branches/ipp-20110213/psphot/src/psphotGuessModels.c

    r30867 r30932  
    182182        // moments
    183183
    184 # if (1)
    185         bool useMoments = true;
    186 # else
    187         bool useMoments = false;
    188         useMoments = (source->mode & PM_SOURCE_MODE_SATSTAR);  // we only want to try if SATSTAR is set, but..
    189 # endif
    190 
    191         float dX = source->moments->Mx - source->peak->xf;
    192         float dY = source->moments->My - source->peak->yf;
    193         float dR = hypot(dX, dY);
    194 
    195         useMoments = useMoments && source->moments;          // can't if there are no moments
    196         useMoments = useMoments && source->moments->nPixels; // can't if the moments were not measured
    197         useMoments = useMoments && !(source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE); // can't if the moments failed...
    198         useMoments = useMoments && ((dR < 1.5) || (source->mode & PM_SOURCE_MODE_SATSTAR));
    199         // only use the moments position if the moment-peak offset is small or the star is saturated
     184        bool useMoments = pmSourcePositionUseMoments(source);
    200185
    201186        float Xo, Yo;
  • branches/eam_branches/ipp-20110213/psphot/src/psphotRadialApertures.c

    r30720 r30932  
    176176    }
    177177
    178     // center of the apertures
    179     float xCM = source->moments->Mx - 0.5 - source->pixels->col0; // coord of peak in subimage
    180     float yCM = source->moments->My - 0.5 - source->pixels->row0; // coord of peak in subimage
     178    float xCM = NAN, yCM = NAN;
     179    if (pmSourcePositionUseMoments(source)) {
     180        xCM = source->moments->Mx - 0.5 - source->pixels->col0; // coord of peak in subimage
     181        yCM = source->moments->My - 0.5 - source->pixels->row0; // coord of peak in subimage
     182    } else {
     183        xCM = source->peak->xf - 0.5 - source->pixels->col0; // coord of peak in subimage
     184        yCM = source->peak->yf - 0.5 - source->pixels->row0; // coord of peak in subimage
     185    }
    181186
    182187    // one pass through the pixels to select the valid pixels and calculate R^2
Note: See TracChangeset for help on using the changeset viewer.