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

    r25738 r25754  
    11/******************************************************************************
    2  * this file defines the PS1_V1 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'
    4  * statements of their own.  The models use a psVector to represent the set of parameters, with
    5  * 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
    7  * representations share a few parameters, for which # define names are listed in pmModel.h:
     2 * this file defines the PS1_V1 source shape model.  Note that these model functions are loaded
     3 * by pmModelClass.c using 'include', and thus need no 'include' statements of their own.  The
     4 * models use a psVector to represent the set of parameters, with the sequence used to specify
     5 * 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 as a PSF representations share a few
     7 * parameters, for which # define names are listed in pmModel.h:
    88
    99   power-law with fitted linear term
     
    4242# define ALPHA_M 0.666
    4343
     44// the model is a function of the pixel coordinate (pixcoord[0,1] = x,y)
     45// 0.5 PIX: the parameters are defined in terms of pixel coords, so the incoming pixcoords
     46// values need to be pixel coords
     47
    4448// Lax parameter limits
    4549static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.5, 0.5, -1.0, -1.0 };
     
    5761
    5862static bool limitsApply = true;         // Apply limits?
    59 
    6063
    6164psF32 PM_MODEL_FUNC (psVector *deriv,
     
    182185
    183186// make an initial guess for parameters
     187// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    184188bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
    185189{
     
    206210    if (!isfinite(shape.sxy)) return false;
    207211
    208     // XXX turn this off here for now PAR[PM_PAR_SKY]  = moments->Sky;
    209212    PAR[PM_PAR_SKY]  = 0.0;
    210213    PAR[PM_PAR_I0]   = peak->flux;
     
    292295
    293296    // choose a z value guaranteed to be beyond our limit
    294     float z0 = pow((1.0 / limit), (1.0 / ALPHA));
    295     float z1 = (1.0 / limit) / PAR[PM_PAR_7];
    296     z1 = PS_MAX (z0, z1);
    297     z0 = 0.0;
     297    float z0 = 0.0;
     298    float z1 = pow((1.0 / limit), (1.0 / ALPHA));
     299    psAssert (isfinite(z1), "fix this code: z1 should not be nan for %f", PAR[PM_PAR_7]);
     300    if (PAR[PM_PAR_7] < 0.0) z1 *= 2.0;
    298301
    299302    // perform a type of bisection to find the value
     
    420423bool PM_MODEL_FIT_STATUS (pmModel *model)
    421424{
    422 
    423     psF32 dP;
    424425    bool  status;
    425426
     
    427428    psF32 *dPAR = model->dparams->data.F32;
    428429
    429     dP = 0;
    430     dP += PS_SQR(dPAR[PM_PAR_SXX] / PAR[PM_PAR_SXX]);
    431     dP += PS_SQR(dPAR[PM_PAR_SYY] / PAR[PM_PAR_SYY]);
    432     dP = sqrt (dP);
    433 
    434430    status = true;
    435 //    status &= (dP < 0.5);
    436431    status &= (PAR[PM_PAR_I0] > 0);
    437432    status &= ((dPAR[PM_PAR_I0]/PAR[PM_PAR_I0]) < 0.5);
Note: See TracChangeset for help on using the changeset viewer.