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_RGAUSS.c

    r25738 r25754  
    11/******************************************************************************
    22 * this file defines the RGAUSS source shape model (XXX need a better name!).  Note that these
    3  * model functions are loaded by pmModelGroup.c using 'include', and thus need no 'include'
     3 * model functions are loaded by pmModelClass.c using 'include', and thus need no 'include'
    44 * statements of their own.  The models use a psVector to represent the set of parameters, with
    55 * the sequence used to specify the meaning of the parameter.  The meaning of the parameters
    6  * may thus vary depending on the specifics of the model.  All models which are used a PSF
     6 * may thus vary depending on the specifics of the model.  All models which are used as a PSF
    77 * representations share a few parameters, for which # define names are listed in pmModel.h:
    88
     
    3939# define PM_MODEL_SET_LIMITS      pmModelSetLimits_RGAUSS
    4040
     41// the model is a function of the pixel coordinate (pixcoord[0,1] = x,y)
     42// 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords
     43// values need to be pixel coords
     44
    4145// Lax parameter limits
    4246static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.5, 0.5, -1.0, 1.25 };
     
    8791        dPAR[PM_PAR_SXY] = -q*X*Y;
    8892
    89         // this model derivative is undefined at z = 0.0, but is actually 0.0
     93        // this model derivative is undefined at z = 0.0, but the limit is zero as z -> 0.0
    9094        dPAR[PM_PAR_7] = (z == 0.0) ? 0.0 : -5.0*t*log(z)*p*z;
    9195    }
     
    172176
    173177// make an initial guess for parameters
     178// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    174179bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    175180{
     
    196201    if (!isfinite(shape.sxy)) return false;
    197202
    198     PAR[PM_PAR_SKY]  = moments->Sky;
     203    PAR[PM_PAR_SKY]  = 0.0;
    199204    PAR[PM_PAR_I0]   = peak->flux;
    200205    PAR[PM_PAR_XPOS] = peak->xf;
     
    276281    // choose a z value guaranteed to be beyond our limit
    277282    float z0 = pow((1.0 / limit), (1.0 / PAR[PM_PAR_7]));
     283    psAssert (isfinite(z0), "fix this code: z0 should not be nan for %f", PAR[PM_PAR_7]);
    278284    float z1 = (1.0 / limit);
     285    psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_7]);
    279286    z1 = PS_MAX (z0, z1);
    280287    z0 = 0.0;
     
    402409bool PM_MODEL_FIT_STATUS (pmModel *model)
    403410{
    404 
    405     psF32 dP;
    406411    bool  status;
    407412
     
    409414    psF32 *dPAR = model->dparams->data.F32;
    410415
    411     dP = 0;
    412     dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);
    413     dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);
    414     dP = sqrt (dP);
    415 
    416416    status = true;
    417     status &= (dP < 0.5);
    418417    status &= (PAR[PM_PAR_I0] > 0);
    419418    status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5);
Note: See TracChangeset for help on using the changeset viewer.