IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2013, 2:37:22 PM (13 years ago)
Author:
eugene
Message:

deprecate KiiOpen,KiiClose (now KapaOpen,etc); major rework of psEllipse translations : use common functions pmModelAxesToParams and pmModelParamsToAxes ; use new convergence method in pmPCM_MinimizeChisq; add convergence crerition options to psMinimization; threaded versions of pmPSFtryFitEXT and pmPSFtryFitPSF

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

  • trunk/psModules/src/objects/models/pmModel_PS1_V1.c

    r35560 r35768  
    11/******************************************************************************
    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:
     2 * this file defines the PS1_V1 source shape model.  Note that these model functions are
     3 * loaded by pmModelClass.c using 'include', and thus need no 'include' statements of
     4 * their own.  The models use a psVector to represent the set of parameters, with the
     5 * 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 as a
     7 * PSF representations share a few parameters, for which # define names are listed in
     8 * pmModel.h:
    89
    910   power-law with fitted linear term
     
    148149    float q2 = NAN;
    149150    if (nParam == PM_PAR_SXY) {
    150         float f1 = 1.0 / PS_SQR(params[PM_PAR_SYY]) + 1.0 / PS_SQR(params[PM_PAR_SXX]);
    151         float f2 = 1.0 / PS_SQR(params[PM_PAR_SYY]) - 1.0 / PS_SQR(params[PM_PAR_SXX]);
     151        float f1 = 2.0 / PS_SQR(params[PM_PAR_SYY]) + 2.0 / PS_SQR(params[PM_PAR_SXX]);
     152        float f2 = 2.0 / PS_SQR(params[PM_PAR_SYY]) - 2.0 / PS_SQR(params[PM_PAR_SXX]);
    152153        float q1 = PS_SQR(f1)*AR_RATIO - PS_SQR(f2);
    153154        q1 = (q1 < 0.0) ? 0.0 : q1;
     
    220221
    221222    // set the shape parameters
    222     if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) {
     223    if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) {
    223224      return false;
    224225    }
     
    244245{
    245246    float z, norm;
    246     psEllipseShape shape;
    247247
    248248    psF32 *PAR = params->data.F32;
    249249
    250     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    251     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    252     shape.sxy = PAR[PM_PAR_SXY];
    253 
    254     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     250    psEllipseAxes axes;
     251    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
    255252    float AspectRatio = axes.minor / axes.major;
    256253
     
    284281{
    285282    psF64 z;
    286     psEllipseShape shape;
    287283
    288284    psF32 *PAR = params->data.F32;
     
    292288    if (flux >= PAR[PM_PAR_I0]) return 1.0;
    293289
    294     shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
    295     shape.sy  = PAR[PM_PAR_SYY] / M_SQRT2;
    296     shape.sxy = PAR[PM_PAR_SXY];
    297 
    298     psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
     290    psEllipseAxes axes;
     291    pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false);
    299292    psF64 sigma = axes.major;
    300293
     
    363356    // the 2D PSF model fits polarization terms (E0,E1,E2)
    364357    // convert to shape terms (SXX,SYY,SXY)
    365     if (!pmPSF_FitToModel (out, 0.1)) {
     358    bool useReff = pmModelUseReff (modelPSF->type);
     359    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    366360        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
    367361        return false;
     
    416410    // convert to shape terms (SXX,SYY,SXY)
    417411    // XXX user-defined value for limit?
    418     if (!pmPSF_FitToModel (PAR, 0.1)) {
     412    bool useReff = pmModelUseReff (model->type);
     413    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    419414        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
    420415        return false;
Note: See TracChangeset for help on using the changeset viewer.