00001 /* * 00002 * This file is part of the ESO X-shooter Pipeline * 00003 * Copyright (C) 2006 European Southern Observatory * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA * 00018 * */ 00019 00020 /* 00021 * $Author: rhaigron $ 00022 * $Date: 2010/04/20 13:20:09 $ 00023 * $Revision: 1.5 $ 00024 */ 00025 #ifdef HAVE_CONFIG_H 00026 # include <config.h> 00027 #endif 00028 00029 /*--------------------------------------------------------------------------*/ 00035 /*--------------------------------------------------------------------------*/ 00038 /*--------------------------------------------------------------------------- 00039 Includes 00040 ---------------------------------------------------------------------------*/ 00041 00042 00043 #include <cpl.h> 00044 #include <xsh_data_instrument.h> 00045 #include <xsh_pfits.h> 00046 #include <xsh_msg.h> 00047 #include <xsh_utils.h> 00048 #include <xsh_data_order.h> 00049 #include <tests.h> 00050 #include <math.h> 00051 00052 /*--------------------------------------------------------------------------- 00053 Defines 00054 ---------------------------------------------------------------------------*/ 00055 #define MODULE_ID "XSH_PIXEL_CONVENTION" 00056 /*--------------------------------------------------------------------------- 00057 Functions prototypes 00058 ---------------------------------------------------------------------------*/ 00059 00060 /*--------------------------------------------------------------------------*/ 00067 /*--------------------------------------------------------------------------*/ 00068 00069 00070 int main(void) 00071 { 00072 cpl_image* small=NULL; 00073 int i=0; 00074 int sx=5; 00075 int sy=5; 00076 float* pi=NULL; 00077 cpl_propertylist* plist=NULL; 00078 int ret=0; 00079 00080 TESTS_INIT(MODULE_ID); 00081 xsh_msg("generate image"); 00082 00083 small=cpl_image_new(sx,sy,CPL_TYPE_FLOAT); 00084 pi=cpl_image_get_data_float(small); 00085 00086 for(i=0;i<sx*sy;i++){ 00087 pi[i]=i+1; 00088 } 00089 check(plist=cpl_propertylist_new()); 00090 cpl_propertylist_append_double(plist,XSH_CRPIX1,1.); 00091 cpl_propertylist_append_double(plist,XSH_CRPIX2,1.); 00092 cpl_propertylist_append_double(plist,XSH_CRVAL1,1.); 00093 cpl_propertylist_append_double(plist,XSH_CRVAL2,1.); 00094 00095 00096 cpl_image_save(small,"small.fits", CPL_BPP_IEEE_FLOAT,plist, 00097 CPL_IO_DEFAULT); 00098 cleanup: 00099 xsh_free_image(&small); 00100 xsh_free_propertylist(&plist); 00101 00102 if (cpl_error_get_code() != CPL_ERROR_NONE) { 00103 xsh_error_dump(CPL_MSG_ERROR); 00104 ret = 1; 00105 } 00106 TEST_END(); 00107 return ret; 00108 } 00109