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/pmModelUtils.c

    r34403 r35768  
    118118}
    119119
    120 bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments) {
     120bool pmModelUseReff (pmModelType type) {
     121    bool useReff = false;
     122    useReff |= (type == pmModelClassGetType ("PS_MODEL_SERSIC"));
     123    useReff |= (type == pmModelClassGetType ("PS_MODEL_DEV"));
     124    useReff |= (type == pmModelClassGetType ("PS_MODEL_EXP"));
     125    return useReff;
     126}
     127
     128// this function and the one below handle the two cases, where the model shape is uses R_eff or Sigma
     129bool pmModelAxesToParams (float *Sxx, float *Sxy, float *Syy, psEllipseAxes axes, bool useReff)  {
     130
     131    psEllipseShape shape = psEllipseAxesToShape (axes);
     132
     133    if (!isfinite(shape.sx))  return false;
     134    if (!isfinite(shape.sy))  return false;
     135    if (!isfinite(shape.sxy)) return false;
     136
     137    // set the shape parameters
     138    if (useReff) {
     139        *Sxx  = PS_MAX(0.5, shape.sx);
     140        *Syy  = PS_MAX(0.5, shape.sy);
     141        *Sxy  = shape.sxy * 2.0;
     142    } else {
     143        *Sxx  = PS_MAX(0.5, M_SQRT2*shape.sx);
     144        *Syy  = PS_MAX(0.5, M_SQRT2*shape.sy);
     145        *Sxy  = shape.sxy;
     146    }
     147
     148    return true;
     149}
     150
     151bool pmModelParamsToAxes (psEllipseAxes *axes, float Sxx, float Sxy, float Syy, bool useReff)  {
     152
     153    psEllipseShape shape;
     154
     155    // set the shape parameters
     156    if (useReff) {
     157        shape.sx  = Sxx;
     158        shape.sy  = Syy;
     159        shape.sxy = Sxy / 2.0;
     160    } else {
     161        shape.sx  = Sxx / M_SQRT2;
     162        shape.sy  = Syy / M_SQRT2;
     163        shape.sxy = Sxy;
     164    }
     165
     166    if ((shape.sx == 0) || (shape.sy == 0)) {
     167        axes->major = 0.0;
     168        axes->minor = 0.0;
     169        axes->theta = 0.0;
     170    } else {
     171        // axes ratio < 20
     172        // replace with maxAR argument?
     173        *axes = psEllipseShapeToAxes (shape, 20.0);
     174    }
     175
     176    return true;
     177}
     178
     179// Reff says if this is a model which uses R_eff (like exp or dev) instead of Sigma
     180// set the parameter values SXX, SXY, SYY
     181bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments, bool useReff) {
    121182
    122183    psEllipseMoments emoments;
     
    137198    axes.minor *= scale;
    138199
    139     psEllipseShape shape = psEllipseAxesToShape (axes);
    140 
    141     if (!isfinite(shape.sx))  return false;
    142     if (!isfinite(shape.sy))  return false;
    143     if (!isfinite(shape.sxy)) return false;
    144 
    145     // set the shape parameters
    146     *Sxx  = PS_MAX(0.5, M_SQRT2*shape.sx);
    147     *Syy  = PS_MAX(0.5, M_SQRT2*shape.sy);
    148     *Sxy  = shape.sxy;
     200    pmModelAxesToParams (Sxx, Sxy, Syy, axes, useReff);
    149201
    150202    return true;
Note: See TracChangeset for help on using the changeset viewer.