IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 17, 2008, 12:58:23 PM (18 years ago)
Author:
eugene
Message:

generate log-spaced radii

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmGrowthCurve.c

    r15165 r20232  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-10-03 00:42:40 $
     7 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-10-17 22:58:23 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646}
    4747
     48# define NPTS 25
    4849pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius)
    4950{
     
    5253    psMemSetDeallocator(growth, (psFreeFunc) pmGrowthCurveFree);
    5354
    54     // fractional pixel radii are not well defined; use integer steps
    55     growth->radius = psVectorCreate (NULL, minRadius, maxRadius, 1.0, PS_TYPE_F32);
     55    // set the scaling factor
     56    float dR = log10(maxRadius / minRadius) / (float) NPTS;
     57    float fR = pow (10.0, dR);
     58
     59    // Fractional pixel radii are not well defined; use integer pixel radii.  Use 1 pixel steps
     60    // until the scaling factor steps in intervals larger than 1 pixel
     61    float Rlin = 1.0 / (fR - 1.0);
     62
     63    growth->radius = psVectorAllocEmpty (NPTS, PS_DATA_F32);
     64   
     65    // there will be NPTS radii + a few extras
     66    float radius = minRadius;
     67    while (radius < Rlin) {
     68        // fprintf (stderr, "r: %f\n", radius);
     69        psVectorAppend (growth->radius, radius);
     70        radius += 1.0;
     71    }   
     72    while (radius < maxRadius) {
     73        // fprintf (stderr, "r: %f\n", radius);
     74        psVectorAppend (growth->radius, radius);
     75        radius *= fR;
     76        radius = (int) (radius + 0.5);
     77    }   
     78    psVectorAppend (growth->radius, radius);
    5679    growth->apMag  = psVectorAlloc (growth->radius->n, PS_TYPE_F32);
    5780
Note: See TracChangeset for help on using the changeset viewer.