VIRCAM Pipeline 2.3.15
areals.c
1/* $Id: areals.c,v 1.3 2015/08/12 11:16:55 jim Exp $
2 *
3 * This file is part of the CASU Pipeline utilities
4 * Copyright (C) 2015 European Southern Observatory
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: 2015/08/12 11:16:55 $
24 * $Revision: 1.3 $
25 * $Name: $
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
67extern void imcore_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: areals.c,v $
102Revision 1.3 2015/08/12 11:16:55 jim
103Modified procedure names to protect namespace
104
105Revision 1.2 2015/08/07 13:06:54 jim
106Fixed copyright to ESO
107
108Revision 1.1.1.1 2015/06/12 10:44:32 jim
109Initial import
110
111Revision 1.2 2014/04/09 09:09:51 jim
112Detabbed
113
114Revision 1.1.1.1 2013/08/27 12:07:48 jim
115Imported
116
117
118*/
void imcore_areals(ap_t *ap, int iareal[NAREAL])
Work out the areal profiles for an object.
Definition: areals.c:67