IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2009, 3:11:32 PM (17 years ago)
Author:
eugene
Message:

check in changes from genes development branch : extensive changes to moments calculation, psf model generation, aperture residuals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/models/pmModel_GAUSS.c

    r25738 r25754  
    11/******************************************************************************
    22 * this file defines the GAUSS source shape model.  Note that these model functions are loaded
    3  * by pmModelGroup.c using 'include', and thus need no 'include' statements of their own.  The
     3 * by pmModelClass.c using 'include', and thus need no 'include' statements of their own.  The
    44 * models use a psVector to represent the set of parameters, with the sequence used to specify
    55 * the meaning of the parameter.  The meaning of the parameters may thus vary depending on the
    6  * specifics of the model.  All models which are used a PSF representations share a few
     6 * specifics of the model.  All models which are used as a PSF representations share a few
    77 * parameters, for which # define names are listed in pmModel.h:
    88
     
    5454
    5555// the model is a function of the pixel coordinate (pixcoord[0,1] = x,y)
     56// 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords
     57// values need to be pixel coords
    5658psF32 PM_MODEL_FUNC(psVector *deriv,
    5759                    const psVector *params,
     
    163165
    164166// make an initial guess for parameters
     167// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    165168bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    166169{
     
    178181    psEllipseShape shape = psEllipseAxesToShape (axes);
    179182
    180     PAR[PM_PAR_SKY]  = moments->Sky;
     183    PAR[PM_PAR_SKY]  = 0.0;
    181184    PAR[PM_PAR_I0]   = peak->flux;
    182185    PAR[PM_PAR_XPOS] = peak->xf;
     
    230233    psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
    231234    psF64 radius = axes.major * sqrt (2.0 * log(PAR[PM_PAR_I0] / flux));
     235    psAssert (isfinite(radius), "fix this code: radius should not be nan for %f", PAR[PM_PAR_I0]);
     236
    232237    return (radius);
    233238}
     
    340345bool PM_MODEL_FIT_STATUS (pmModel *model)
    341346{
    342     psF32 dP;
    343347    bool  status;
    344348
     
    346350    psF32 *dPAR = model->dparams->data.F32;
    347351
    348     dP = 0;
    349     dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);
    350     dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);
    351     dP = sqrt (dP);
    352 
    353352    status = true;
    354     status &= (dP < 0.5);
    355353    status &= (PAR[PM_PAR_I0] > 0);
    356354    status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5);
    357355
    358     if (status)
    359         return true;
    360     return false;
     356    return status;
    361357}
    362358
Note: See TracChangeset for help on using the changeset viewer.