CR2RE Pipeline Reference Manual 1.7.0
hdrl_cat_polynm-test.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2017 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <cpl_test.h>
25
26#include "../hdrl_cat_polynm.h"
27
28
29int main(void)
30{
31 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
32
33
34 /* Initialize */
35 double x[] = { 1. , 3. , 5. , -10.};
36 double y[] = {-0.5, -27.5, -86.5, -424.};
37
38 double coefs[3] = {1., 2.5, -4.};
39 double poly[3];
40
41 /* Do the test */
42 hdrl_polynm(y, x, 4, poly, 3, 0);
43
44 /* Check the results */
45 cpl_test_rel(poly[0], coefs[0], 0.01);
46 cpl_test_rel(poly[1], coefs[1], 0.01);
47 cpl_test_rel(poly[2], coefs[2], 0.01);
48
49
50 return cpl_test_end(0);
51}
cpl_error_code hdrl_polynm(double xdat[], double xcor[], cpl_size n, double polycf[], cpl_size m, cpl_size ilim)
Work out the median seeing.