X-shooter Pipeline Reference Manual 3.8.15
test-xsh_pix_convention.c
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: rhaigron $
22 * $Date: 2010-04-20 13:20:09 $
23 * $Revision: 1.5 $
24 */
25#ifdef HAVE_CONFIG_H
26# include <config.h>
27#endif
28
29/*--------------------------------------------------------------------------*/
35/*--------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------
39 Includes
40 ---------------------------------------------------------------------------*/
41
42
43#include <cpl.h>
44#include <xsh_data_instrument.h>
45#include <xsh_pfits.h>
46#include <xsh_msg.h>
47#include <xsh_utils.h>
48#include <xsh_data_order.h>
49#include <tests.h>
50#include <math.h>
51
52/*---------------------------------------------------------------------------
53 Defines
54 ---------------------------------------------------------------------------*/
55#define MODULE_ID "XSH_PIX_CONVENTION"
56/*---------------------------------------------------------------------------
57 Functions prototypes
58 ---------------------------------------------------------------------------*/
59
60/*--------------------------------------------------------------------------*/
67/*--------------------------------------------------------------------------*/
68
69
70int main(void)
71{
72 cpl_image* small=NULL;
73 int i=0;
74 int sx=5;
75 int sy=5;
76 float* pi=NULL;
77 cpl_propertylist* plist=NULL;
78 int ret=0;
79
82 xsh_msg("generate image");
83
84 small=cpl_image_new(sx,sy,CPL_TYPE_FLOAT);
85 pi=cpl_image_get_data_float(small);
86
87 for(i=0;i<sx*sy;i++){
88 pi[i]=i+1;
89 }
90 check(plist=cpl_propertylist_new());
91 cpl_propertylist_append_double(plist,XSH_CRPIX1,1.);
92 cpl_propertylist_append_double(plist,XSH_CRPIX2,1.);
93 cpl_propertylist_append_double(plist,XSH_CRVAL1,1.);
94 cpl_propertylist_append_double(plist,XSH_CRVAL2,1.);
95
96
97 cpl_image_save(small,"small.fits", CPL_BPP_IEEE_FLOAT,plist,
98 CPL_IO_DEFAULT);
99 cleanup:
100 xsh_free_image(&small);
101 xsh_free_propertylist(&plist);
102
103 if (cpl_error_get_code() != CPL_ERROR_NONE) {
104 xsh_error_dump(CPL_MSG_ERROR);
105 ret = 1;
106 }
108 TEST_END();
109 return ret;
110}
111
int main(void)
Unit test of XSH_BIN_CONVENTION.
#define MODULE_ID
#define check(COMMAND)
Definition: xsh_error.h:71
#define xsh_error_dump(level)
Definition: xsh_error.h:92
#define xsh_msg(...)
Print a message on info level.
Definition: xsh_msg.h:121
void xsh_free_image(cpl_image **i)
Deallocate an image and set the pointer to NULL.
Definition: xsh_utils.c:2116
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
Definition: xsh_utils.c:2179
#define TESTS_CLEAN_WORKSPACE(DRL_ID)
Definition: tests.h:139
#define TESTS_INIT_WORKSPACE(DRL_ID)
Definition: tests.h:133
#define TEST_END()
Definition: tests.h:111
#define TESTS_INIT(DRL_ID)
Definition: tests.h:105
#define XSH_CRVAL1
Definition: xsh_pfits.h:100
#define XSH_CRVAL2
Definition: xsh_pfits.h:101
#define XSH_CRPIX2
Definition: xsh_pfits.h:92
#define XSH_CRPIX1
Definition: xsh_pfits.h:91