IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 27, 2007, 9:04:17 AM (19 years ago)
Author:
magnier
Message:

calculate radius for sersic correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/models/pmModel_SERSIC.c

    r14652 r14669  
    299299psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux)
    300300{
    301     psF64 z, f;
    302     int Nstep = 0;
    303301    psEllipseShape shape;
    304302
     
    321319    psF64 limit = flux / PAR[PM_PAR_I0];
    322320
    323     // use the fact that f is monotonically decreasing
    324     z = 0;
    325     Nstep = 0;
    326 
    327     // choose a z value guaranteed to be beyond our limit
    328     float z0 = pow((1.0 / limit), (1.0 / 2.25));
    329     float z1 = (1.0 / limit) / PAR[PM_PAR_7];
    330     z1 = PS_MAX (z0, z1);
    331     z0 = 0.0;
    332 
    333     // perform a type of bisection to find the value
    334     float f0 = 1.0 / (1 + PAR[PM_PAR_7]*z0 + pow(z0, 2.25));
    335     float f1 = 1.0 / (1 + PAR[PM_PAR_7]*z1 + pow(z1, 2.25));
    336     while ((Nstep < 10) && (fabs(z1 - z0) > 0.5)) {
    337         z = 0.5*(z0 + z1);
    338         f = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25));
    339         if (f > limit) {
    340             z0 = z;
    341             f0 = f;
    342         } else {
    343             z1 = z;
    344             f1 = f;
    345         }
    346         Nstep ++;
    347     }
     321    psF64 z = pow (-log(limit), (1.0 / PAR[PM_PAR_7]));
     322
    348323    psF64 radius = sigma * sqrt (2.0 * z);
    349324
Note: See TracChangeset for help on using the changeset viewer.