VIRCAM Pipeline  2.3.10
imcore_radii-test.c
1 /* $Id: imcore_radii-test.c,v 1.1 2015/10/15 11:27:22 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/10/15 11:27:22 $
24  * $Revision: 1.1 $
25  * $Name: $
26  */
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 
31 #include <cpl_init.h>
32 #include <cpl_test.h>
33 #include <casu_tfits.h>
34 #include <casu_utils.h>
35 #include <casu_mods.h>
36 #include "../imcore.h"
37 #include "../imcore_radii.h"
38 
39 #define NRADII 13
40 
41 int main(void) {
42  float radii[] = {2.5,3.53553,5.0,7.07107,10,14,20,25,30,35,40,50,60};
43  float fluxes[] = {13670.3,19834.4,23923.2,25124.0,25332.3,25488.9,
44  25648.7,25842.8,25950.9,25893.9,25982,1,25297.6,
45  24919.1};
46  float halfrad = 2.35;
47  float kronrad = 6.18;
48  float petrrad = 12.45;
49  float halflight,rad;
50  float peak = 1007.07;
51  float areal = 120.0;
52 
53  /* Initialise */
54 
55  cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
56 
57  /* Test halflight */
58 
59  halflight = fluxes[4]/2.0;
60  rad = imcore_halflight(radii,fluxes,halflight,peak,NRADII);
61  cpl_test_rel(rad,halfrad,0.01);
62 
63  /* Test Kron */
64 
65  rad = imcore_kronrad(areal,radii,fluxes,NRADII);
66  cpl_test_rel(rad,kronrad,0.01);
67 
68  /* Test Petrosian */
69 
70  rad = imcore_petrad(areal,radii,fluxes,NRADII);
71  cpl_test_rel(rad,petrrad,0.01);
72 
73  /* Get out of here */
74 
75 
76  return(cpl_test_end(0));
77 
78 }
79 
80 /*
81 
82 $Log: imcore_radii-test.c,v $
83 Revision 1.1 2015/10/15 11:27:22 jim
84 new
85 
86 
87 */
float imcore_kronrad(float areal0, float rcores[], float cflux[], int naper)
Work out the Kron radius for an object.
Definition: imcore_radii.c:188
float imcore_petrad(float areal0, float rcores[], float cflux[], int naper)
Work out the Petrosian.
Definition: imcore_radii.c:242
float imcore_halflight(float rcores[], float cflux[], float halflight, float peak, int naper)
Work out the half-light radius for an object.
Definition: imcore_radii.c:76