areals.c

00001 /*
00002 
00003 $Id: areals.c,v 1.1 2005/09/13 13:25:27 jim Exp $
00004 
00005 */
00006 
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <string.h>
00010 
00011 #include "imcore.h"
00012 #include "util.h"
00013 #include "floatmath.h"
00014 
00015 extern void areals(ap_t *ap, int iareal[NAREAL]) {
00016     int i,nup,j,np;
00017     float t,thresh,fconst,offset;
00018     plstruct *plarray;
00019 
00020     /* Initialise some stuff */
00021 
00022     np = ap->npl_pix;
00023     plarray = ap->plarray;
00024     thresh = ap->thresh;
00025     fconst = ap->fconst;
00026     offset = ap->areal_offset;
00027 
00028     /* Zero the areal profile array */
00029 
00030     (void)memset(iareal,0,NAREAL*sizeof(int));
00031 
00032     /* Loop through the array and form the areal profiles */
00033 
00034     for (i = 0; i < np; i++) {
00035         t = plarray[i].z;
00036         if (t <= thresh) 
00037             continue;
00038         nup = MIN(NAREAL,(int)(logf(t)*fconst - offset)+1);
00039         nup = MAX(1,nup);
00040         for (j = 0; j < nup; j++)
00041             iareal[j]++;
00042     }
00043 }
00044                 
00045 /*
00046 
00047 $Log: areals.c,v $
00048 Revision 1.1  2005/09/13 13:25:27  jim
00049 Initial entry after modifications to make cpl compliant
00050 
00051 
00052 */

Generated on Sat Apr 6 04:03:06 2013 for VIRCAM Pipeline by  doxygen 1.5.1