VIRCAM Pipeline  1.3.3
areals.c
1 /* $Id: areals.c,v 1.2 2010-09-09 12:09:57 jim Exp $
2  *
3  * This file is part of the VIRCAM Pipeline
4  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: jim $
23  * $Date: 2010-09-09 12:09:57 $
24  * $Revision: 1.2 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 
32 #include "imcore.h"
33 #include "util.h"
34 #include "floatmath.h"
35 
38 /*---------------------------------------------------------------------------*/
65 /*---------------------------------------------------------------------------*/
66 
67 extern void areals(ap_t *ap, int iareal[NAREAL]) {
68  int i,nup,j,np;
69  float t,thresh,fconst,offset;
70  plstruct *plarray;
71 
72  /* Initialise some stuff */
73 
74  np = ap->npl_pix;
75  plarray = ap->plarray;
76  thresh = ap->thresh;
77  fconst = ap->fconst;
78  offset = ap->areal_offset;
79 
80  /* Zero the areal profile array */
81 
82  (void)memset(iareal,0,NAREAL*sizeof(int));
83 
84  /* Loop through the array and form the areal profiles */
85 
86  for (i = 0; i < np; i++) {
87  t = plarray[i].z;
88  if (t <= thresh)
89  continue;
90  nup = MIN(NAREAL,(int)(logf(t)*fconst - offset)+1);
91  nup = MAX(1,nup);
92  for (j = 0; j < nup; j++)
93  iareal[j]++;
94  }
95 }
96 
99 /*
100 
101 $Log: not supported by cvs2svn $
102 Revision 1.1 2005/09/13 13:25:27 jim
103 Initial entry after modifications to make cpl compliant
104 
105 
106 */