IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 6, 2011, 1:02:53 PM (15 years ago)
Author:
eugene
Message:
  • add concept of saddlePoints to peaks (not actually used in the end)
  • add tmp flags to mark sources for analysis or not in psphotStack
  • autocode the pmSourceIO_CMF_PS1_* functions
  • use 1D gauss approx for convolution in PCM fitting
  • added pmSourceExtFitPars (not actually used)
  • in model guess, use 1st radial moments to define size (if it exists)
  • include PSF_INST_MAG, AP_MAG, KRON_MAG in xfit output
  • fix the position for extended source fits (avoid instability)
  • Sersic-like models (incl. Exp and Dev) use Reff, not sigma; conversion tools need to respect this
  • only use a single pass on the centroid (unwindowed, but limited to 1.5 sigma radius) - this avoids moving the centroid because of nearby neighbors
  • use symmetrical averaging (geometric mean) to calculated 1st radial moment (and avoid neighbor biases), do not use symm. averaging for the flux
  • fix the integration of the sersic, pgauss, and related model functions.
  • fix the central pixel to have the full flux for sersic-like models (interpolated value)
Location:
trunk/psModules/src/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects

    • Property svn:ignore
      •  

        old new  
        55*.la
        66*.lo
         7pmSourceIO_CMF_PS1_V1.c
         8pmSourceIO_CMF_PS1_V2.c
         9pmSourceIO_CMF_PS1_V3.c
  • trunk/psModules/src/objects/pmPCMdata.c

    r31451 r32347  
    4141#include "pmPCMdata.h"
    4242
     43# define USE_DELTA_PSF 0
     44# define USE_1D_GAUSS 1
     45
    4346static void pmPCMdataFree (pmPCMdata *pcm) {
    4447
     
    8891    pcm->constraint = NULL;
    8992    pcm->nDOF = 0;
     93
     94    // full convolution with the PSF is expensive.  if we have to save time, we can do a 1D
     95    // convolution with a Gaussian approximation to the kernel
     96    pcm->use1Dgauss = false;
     97    pcm->nsigma = 3.0;
     98    pcm->sigma = 1.0; // this should be set to something sensible when the psf is known
    9099
    91100    return pcm;
     
    257266    pcm->nDOF = nPix - nParams;
    258267
     268# if (USE_1D_GAUSS)
     269    pmModel *modelPSF = source->modelPSF;
     270    psAssert (modelPSF, "psf model must be defined");
     271   
     272    psEllipseShape shape;
     273    psEllipseAxes axes;
     274
     275    shape.sx  = modelPSF->params->data.F32[PM_PAR_SXX];
     276    shape.sy  = modelPSF->params->data.F32[PM_PAR_SYY];
     277    shape.sxy = modelPSF->params->data.F32[PM_PAR_SXY];
     278    axes = psEllipseShapeToAxes (shape, 20.0);
     279   
     280    float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5*modelPSF->params->data.F32[PM_PAR_I0]);
     281    float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
     282
     283    pcm->use1Dgauss = true;
     284    pcm->sigma = 0.5 * (FWHM_MAJOR + FWHM_MINOR) / 2.35;
     285    pcm->nsigma = 2.0;
     286# endif
     287
    259288    return pcm;
    260289}
     
    368397    return true;
    369398}
     399
     400// construct a realization of the source model
     401bool pmPCMCacheModel (pmSource *source, psImageMaskType maskVal, int psfSize) {
     402
     403    PS_ASSERT_PTR_NON_NULL(source, false);
     404
     405    // select appropriate model
     406    pmModel *model = pmSourceGetModel (NULL, source);
     407    if (model == NULL) return false;  // model must be defined
     408
     409    // if we already have a cached image, re-use that memory
     410    source->modelFlux = psImageCopy (source->modelFlux, source->pixels, PS_TYPE_F32);
     411    psImageInit (source->modelFlux, 0.0);
     412
     413    // modelFlux always has unity normalization (I0 = 1.0)
     414    pmModelAdd (source->modelFlux, source->maskObj, model, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal);
     415
     416    // convolve the model image with the PSF
     417    if (USE_1D_GAUSS) {
     418        // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
     419        // * the model flux is not masked
     420        // * threading takes place above this level
     421       
     422        // define the Gauss parameters from the psf
     423        pmModel *modelPSF = source->modelPSF;
     424        psAssert (modelPSF, "psf model must be defined");
     425   
     426        psEllipseShape shape;
     427        psEllipseAxes axes;
     428
     429        shape.sx  = modelPSF->params->data.F32[PM_PAR_SXX];
     430        shape.sy  = modelPSF->params->data.F32[PM_PAR_SYY];
     431        shape.sxy = modelPSF->params->data.F32[PM_PAR_SXY];
     432        axes = psEllipseShapeToAxes (shape, 20.0);
     433   
     434        float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5*modelPSF->params->data.F32[PM_PAR_I0]);
     435        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
     436
     437        float sigma = 0.5 * (FWHM_MAJOR + FWHM_MINOR) / 2.35;
     438        float nsigma = 2.0;
     439
     440        psImageSmooth (source->modelFlux, sigma, nsigma);
     441    } else {
     442        // make sure we save a cached copy of the psf flux
     443        pmSourceCachePSF (source, maskVal);
     444
     445        // convert the cached cached psf model for this source to a psKernel
     446        psKernel *psf = pmPCMkernelFromPSF (source, psfSize);
     447        if (!psf) {
     448            // NOTE: this only happens if the source is too close to an edge
     449            model->flags |= PM_MODEL_STATUS_BADARGS;
     450            return NULL;
     451        }
     452
     453        // XXX not sure if I can place the output on top of the input
     454        psImageConvolveFFT (source->modelFlux, source->modelFlux, NULL, 0, psf);
     455    }
     456    return true;
     457}
     458
Note: See TracChangeset for help on using the changeset viewer.