VIRCAM Pipeline 2.3.15
imcore_seeing-test.c
1/* $Id: imcore_seeing-test.c,v 1.1 2015/10/15 16:18:25 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 16:18:25 $
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_mods.h>
34#include "../imcore.h"
35
36
37int main(void) {
38 ap_t ap;
39 float ell[] = {0.009,0.050,0.025,0.033,0.010,0.012,0.014,0.005,0.011,0.011};
40 float pk[] = {1007.065,101.293,204.195,493.250,559.111,609.799,642.603,
41 698.117,740.227,797.222};
42 int iareal[][10] = {{120, 53, 73, 104, 97, 109, 104, 107, 110, 110},
43 {100, 39, 60, 75, 80, 81, 86, 90, 94, 95},
44 {75, 21, 42, 63, 66, 64, 68, 69, 69, 70},
45 {63, 2, 21, 45, 45, 45, 45, 47, 56, 56},
46 {45, 0, 4, 25, 29, 29, 37, 37, 37, 37},
47 {25, 0, 0, 9, 9, 13, 14, 21, 21, 21},
48 {9, 0, 0, 0, 0, 0, 0, 1, 1, 0},
49 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
50
51 float *work,fwhm,**areals;
52 int i,j;
53
54 /* Initialise */
55
56 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
57
58 /* Set up apm structure */
59
60 ap.lsiz = 2048;
61 ap.csiz = 2048;
62 ap.xtnum = 0;
63 ap.thresh = 11.0936;
64
65 /* Areals */
66
67 areals = cpl_malloc(8*sizeof(float *));
68 for (i = 0; i < 8; i++) {
69 areals[i] = cpl_malloc(10*sizeof(float));
70 for (j = 0; j < 10; j++)
71 areals[i][j] = (float)iareal[i][j];
72 }
73
74 /* Run the test */
75
76 work = cpl_malloc(10*sizeof(float));
77 imcore_seeing(&ap,10,ell,pk,areals,work,&fwhm);
78 cpl_free(work);
79 for (i = 0; i < 8; i++)
80 cpl_free(areals[i]);
81 cpl_free(areals);
82 cpl_test_rel(fwhm,4.50384,0.01);
83
84 /* Get out of here */
85
86 return(cpl_test_end(0));
87
88}
89
90/*
91
92$Log: imcore_seeing-test.c,v $
93Revision 1.1 2015/10/15 16:18:25 jim
94New
95
96
97*/
void imcore_seeing(ap_t *ap, int nrows, float *ellipt, float *pkht, float **areal, float *work, float *fwhm)
Work out the median seeing.
Definition: seeing.c:80