IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 25, 2013, 12:08:56 PM (13 years ago)
Author:
eugene
Message:

convert SERSIC to use pmModelCP_SersicSubpix; clean up DEV and EXP versions; add pmPCMMakeModel, pmSersicKappa, pmSersicNorm functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/psModules/src/objects/models/pmModel_DEV.c

    r35966 r36021  
    6363# define PM_MODEL_SET_LIMITS      pmModelSetLimits_DEV
    6464
    65 // f = exp(-z^0.125)
     65// f = exp(-kappa*r^(1/index))
     66// f = exp(-kappa*z^(0.5/index))
     67// index = 4, 0.5/index = 0.125
    6668# define ALPHA 0.125
    67 // # define ALPHA 0.25
    6869
    6970// the model is a function of the pixel coordinate (pixcoord[0,1] = x,y)
     
    8687static float *paramsMinUse = paramsMinLax;
    8788static float *paramsMaxUse = paramsMaxLax;
    88 static float betaUse[] = { 2, 3e6, 5, 5, 3.0, 3.0, 0.5 };
     89static float betaUse[] = { 2, 3e6, 5, 5, 10.0, 10.0, 0.5 };
    8990
    9091static bool limitsApply = true;         // Apply limits?
     
    113114    // r = sqrt(z)
    114115    float q = kappa*pow(z,ALPHA);
    115     psF32 f0 = exp(-q);
    116 
    117     psF32 f1 = PAR[PM_PAR_I0]*f0;
    118     psF32 f = PAR[PM_PAR_SKY] + f1;
     116    float f0 = exp(-q);
    119117
    120118    assert (isfinite(q));
    121119    assert (isfinite(f0));
    122     assert (isfinite(f1));
    123     assert (isfinite(f));
    124 
    125     // only worry about the central 4 pixels at most
    126     // If I use DELTA = 0.2, I'm way off for the total flux
    127     // If I use DELTA = 0.02, I'm totally good (but I am under on the total flux for R = 30 by 0.2 mags -- aperture failure)
    128     // For DELTA = 0.02 & Rmin/Rmaj = 0.25, I'm over flux by 0.15 mags (due to the central pixel)
    129     psF32 radius = hypot(X, Y);
     120
     121    // only worry about the central pixels at most
     122    float radius = hypot(X, Y);
    130123    if (radius <= 1.5) {
    131124        // Nsub ~ 10*index^2 + 1
     
    135128        Nsub = PS_MAX (Nsub, 11);
    136129        f0 = pmModelCP_SersicSubpix (X, Y, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], 4.0, Nsub);
    137         f1 = PAR[PM_PAR_I0]*f0;
    138         f = PAR[PM_PAR_SKY] + f1;
    139130    }   
     131
     132    float f1 = PAR[PM_PAR_I0]*f0;
     133    float f = PAR[PM_PAR_SKY] + f1;
     134
     135    assert (isfinite(f1));
     136    assert (isfinite(f));
    140137
    141138    if (deriv != NULL) {
     
    304301    // f = Io exp(-kappa*z^n) -> z^n = ln(Io/f) / kappa
    305302    psF64 zn = log(PAR[PM_PAR_I0] / flux) / kappa;
    306     psF64 radius = axes.major * sqrt (2.0) * pow(zn, 0.5 / ALPHA);
     303    psF64 radius = axes.major * pow(zn, 0.5 / ALPHA);
    307304
    308305    psAssert (isfinite(radius), "fix this code: radius should not be nan for Io = %f, flux = %f, major = %f (%f, %f, %f)",
Note: See TracChangeset for help on using the changeset viewer.