VIRCAM Pipeline 2.3.15
casu_platesol-test.c
1/* $Id: casu_platesol-test.c,v 1.2 2015/08/07 13:06:54 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/07 13:06:54 $
24 * $Revision: 1.2 $
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_fits.h>
34#include <casu_utils.h>
35#include <casu_mods.h>
36
37int main(void) {
38 int status,retval,i;
39 cpl_propertylist *plist;
40 cpl_table *matched;
41 const char *reqcols[] = {"X_coordinate","Y_coordinate","xpredict",
42 "ypredict","RA","Dec"};
43 /* Initialise */
44
45 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
46
47 /* Checks here are limited. This needs a regression test. Check
48 inherited status first */
49
50 plist = cpl_propertylist_new();
51 matched = cpl_table_new(2);
52 cpl_table_new_column(matched,"yuk",CPL_TYPE_FLOAT);
53 status = CASU_FATAL;
54 retval = casu_platesol(plist,NULL,matched,6,0,&status);
55 cpl_test_eq(status,CASU_FATAL);
56 cpl_test_eq(retval,status);
57
58 /* Check that it fails if you don't have the right columns in the
59 input table */
60
61 status = CASU_OK;
62 retval = casu_platesol(plist,NULL,matched,4,0,&status);
63 cpl_test_eq(status,CASU_FATAL);
64 cpl_test_eq(retval,status);
65
66 /* Now put the correct columns in and see if it fails if we give it
67 the wrong number of coefficients */
68
69 for (i = 0; i < 6; i++)
70 cpl_table_new_column(matched,reqcols[i],CPL_TYPE_FLOAT);
71 status = CASU_OK;
72 retval = casu_platesol(plist,NULL,matched,3,0,&status);
73 cpl_test_eq(status,CASU_FATAL);
74 cpl_test_eq(retval,status);
75
76 /* Finally increase the coefficients to 6 and it should fail again
77 because there aren't enough standards in the table */
78
79 status = CASU_OK;
80 retval = casu_platesol(plist,NULL,matched,6,0,&status);
81 cpl_test_eq(status,CASU_FATAL);
82 cpl_test_eq(retval,status);
83
84 /* Tidy and exit */
85
86 cpl_table_delete(matched);
87 cpl_propertylist_delete(plist);
88 return(cpl_test_end(0));
89}
90
91/*
92
93$Log: casu_platesol-test.c,v $
94Revision 1.2 2015/08/07 13:06:54 jim
95Fixed copyright to ESO
96
97Revision 1.1.1.1 2015/06/12 10:44:32 jim
98Initial import
99
100Revision 1.1 2015/01/09 11:39:55 jim
101new entry
102
103
104*/
int casu_platesol(cpl_propertylist *plist, cpl_propertylist *tlist, cpl_table *matchedstds, int nconst, int shiftan, int *status)
Work out a WCS for an image.