00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifdef HAVE_CONFIG_H
00026 # include <config.h>
00027 #endif
00028
00029
00035
00038
00039
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
00054
00055 #define MODULE_ID "XSH_PIXEL_CONVENTION"
00056
00057
00058
00059
00060
00067
00068
00069
00070 int main(void)
00071 {
00072 cpl_image* ima=NULL;
00073 cpl_imagelist* iml=NULL;
00074 int i=0;
00075 int j=0;
00076 int ret=0;
00077 int k=0;
00078 int sx=5;
00079 int sy=5;
00080 int nlist=3;
00081 int nima=3;
00082 float* pi=NULL;
00083 cpl_propertylist* plist=NULL;
00084
00085 TESTS_INIT(MODULE_ID);
00086 xsh_msg("generate several imagelist and save them in multi-ext file");
00087 for(k=0;k<nlist;k++){
00088 iml=cpl_imagelist_new();
00089 for(j=0;j<nima;j++){
00090 ima=cpl_image_new(sx,sy,CPL_TYPE_FLOAT);
00091 pi=cpl_image_get_data_float(ima);
00092
00093 for(i=0;i<sx*sy;i++){
00094 pi[i]=k*j*i+1;
00095 }
00096 cpl_imagelist_set(iml,ima,j);
00097 }
00098 if(k==0) {
00099 check(cpl_imagelist_save(iml,"cube.fits", CPL_BPP_IEEE_FLOAT,plist,
00100 CPL_IO_DEFAULT));
00101 } else {
00102 check(cpl_imagelist_save(iml,"cube.fits", CPL_BPP_IEEE_FLOAT,plist,
00103 CPL_IO_EXTEND));
00104 }
00105 xsh_free_imagelist(&iml);
00106 }
00107
00108 cleanup:
00109
00110 xsh_free_propertylist(&plist);
00111 xsh_free_imagelist(&iml);
00112
00113 if (cpl_error_get_code() != CPL_ERROR_NONE) {
00114 xsh_error_dump(CPL_MSG_ERROR);
00115 ret = 1;
00116 }
00117 TEST_END();
00118 return ret;
00119 }
00120