VIRCAM Pipeline  2.3.12
casu_getstds-test.c
1 /* $Id: casu_getstds-test.c,v 1.3 2015/11/25 15:42:34 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/11/25 15:42:34 $
24  * $Revision: 1.3 $
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 <casu_utils.h>
35 
36 int main(void) {
37  int status,retval;
38  cpl_propertylist *plist;
39  cpl_table *tabout;
40 
41  /* Initialise */
42 
43  cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
44 
45  /* Check inherited status and situation where the propertylist is NULL */
46 
47  status = CASU_OK;
48  plist = NULL;
49  retval = casu_getstds(plist,0,"","",1,".",&tabout,&status);
50  cpl_test_eq(status,CASU_FATAL);
51  cpl_test_eq(status,retval);
52  cpl_test_null(tabout);
53  plist = cpl_propertylist_new();
54  status = CASU_FATAL;
55  retval = casu_getstds(plist,0,"","",1,".",&tabout,&status);
56  cpl_test_eq(status,CASU_FATAL);
57  cpl_test_eq(status,retval);
58  cpl_test_null(tabout);
59  status = CASU_OK;
60 
61  /* Fill the propertylist with some values */
62 
63  cpl_propertylist_update_string(plist,"CTYPE1","RA---ZPN");
64  cpl_propertylist_update_string(plist,"CTYPE2","DEC--ZPN");
65  cpl_propertylist_update_double(plist,"CRVAL1",81.0578935624986);
66  cpl_propertylist_update_double(plist,"CRVAL2",-24.5408992630551);
67  cpl_propertylist_update_double(plist,"CRPIX1",2159.65203390075);
68  cpl_propertylist_update_double(plist,"CRPIX2",2187.28057518062);
69  cpl_propertylist_update_double(plist,"CD1_1",-2.96100210581431E-05);
70  cpl_propertylist_update_double(plist,"CD2_1",-3.54397484069851E-08);
71  cpl_propertylist_update_double(plist,"CD1_2",-3.93573000440439E-08);
72  cpl_propertylist_update_double(plist,"CD2_2",2.96102853649076E-05);
73  cpl_propertylist_update_double(plist,"PV2_1",1.0);
74  cpl_propertylist_update_double(plist,"PV2_3",400.0);
75  cpl_propertylist_update_int(plist,"NAXIS",2);
76  cpl_propertylist_update_int(plist,"NAXIS1",2048);
77  cpl_propertylist_update_int(plist,"NAXIS2",2048);
78 
79  /* Now run it with these properties and see if you get a table out
80  with the right number of sources (2MASS PSC) */
81 
82 /*
83  * For the time deactivating this test as it needs internet connection and not
84  * all computer may have it at installation time
85  *
86  retval = casu_getstds(plist,0,"","",1,".",&tabout,&status);
87  cpl_test_eq(status,CASU_OK);
88  cpl_test_eq(status,retval);
89  cpl_test_nonnull(tabout);
90  cpl_test_eq(cpl_table_get_nrow(tabout),34);
91 */
92 
93  /* Tidy and exit */
94 
95  cpl_table_delete(tabout);
96  cpl_propertylist_delete(plist);
97  return(cpl_test_end(0));
98 }
99 
100 /*
101 
102 $Log: casu_getstds-test.c,v $
103 Revision 1.3 2015/11/25 15:42:34 jim
104 added cacheloc parameter to casu_getstds
105 
106 Revision 1.2 2015/08/07 13:06:54 jim
107 Fixed copyright to ESO
108 
109 Revision 1.1.1.1 2015/06/12 10:44:32 jim
110 Initial import
111 
112 Revision 1.1 2015/01/09 11:39:55 jim
113 new entry
114 
115 
116 */
int casu_getstds(cpl_propertylist *plist, int cache, char *path, char *catname, int cdssearch, char *cacheloc, cpl_table **stds, int *status)
Get a table of standard stars that appear on an image from a catalogue.
Definition: casu_getstds.c:159