areals.c

00001 /* $Id: areals.c,v 1.2 2010/09/09 12:09:57 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: jim $
00023  * $Date: 2010/09/09 12:09:57 $
00024  * $Revision: 1.2 $
00025  * $Name: v1-1-0 $
00026  */
00027 
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <string.h>
00031 
00032 #include "imcore.h"
00033 #include "util.h"
00034 #include "floatmath.h"
00035 
00038 /*---------------------------------------------------------------------------*/
00065 /*---------------------------------------------------------------------------*/
00066 
00067 extern void areals(ap_t *ap, int iareal[NAREAL]) {
00068     int i,nup,j,np;
00069     float t,thresh,fconst,offset;
00070     plstruct *plarray;
00071 
00072     /* Initialise some stuff */
00073 
00074     np = ap->npl_pix;
00075     plarray = ap->plarray;
00076     thresh = ap->thresh;
00077     fconst = ap->fconst;
00078     offset = ap->areal_offset;
00079 
00080     /* Zero the areal profile array */
00081 
00082     (void)memset(iareal,0,NAREAL*sizeof(int));
00083 
00084     /* Loop through the array and form the areal profiles */
00085 
00086     for (i = 0; i < np; i++) {
00087         t = plarray[i].z;
00088         if (t <= thresh) 
00089             continue;
00090         nup = MIN(NAREAL,(int)(logf(t)*fconst - offset)+1);
00091         nup = MAX(1,nup);
00092         for (j = 0; j < nup; j++)
00093             iareal[j]++;
00094     }
00095 }
00096 
00099 /*
00100 
00101 $Log: areals.c,v $
00102 Revision 1.2  2010/09/09 12:09:57  jim
00103 Added docs
00104 
00105 Revision 1.1  2005/09/13 13:25:27  jim
00106 Initial entry after modifications to make cpl compliant
00107 
00108 
00109 */

Generated on 7 Feb 2011 for VIRCAM Pipeline by  doxygen 1.6.1