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
00026 #ifdef HAVE_CONFIG_H
00027 # include <config.h>
00028 #endif
00029
00030
00036
00039
00040
00041
00042
00043
00044 #include <xsh_data_spectralformat.h>
00045 #include <xsh_error.h>
00046 #include <xsh_msg.h>
00047 #include <xsh_data_instrument.h>
00048 #include <xsh_dfs.h>
00049 #include <xsh_pfits.h>
00050 #include <tests.h>
00051 #include <cpl.h>
00052 #include <math.h>
00053 #include <getopt.h>
00054
00055
00056
00057 #define MODULE_ID "XSH_DATA_SPECTRALFORMAT"
00058
00059 #define SYNTAX \
00060 "Test the xsh_data_spectralformat function \n"\
00061 " analyse SPECTRAL_FORMAT tab frames\n"\
00062 "use : ./test_xsh_data_spectralformat SOF\n"\
00063 " SOF => [SPECTRAL_FORMAT, ORDER_TAB_EDGES, WAVE_TAB_2D|MODEL ]\n"
00064
00065
00066
00067
00068
00069
00076
00077
00078 int main(int argc, char** argv)
00079 {
00080 xsh_instrument *instrument = NULL ;
00081 const char *sof_name = NULL;
00082 cpl_frame *spectralformat_frame = NULL;
00083 cpl_frame *orderlist_frame = NULL;
00084 cpl_frame *wavesol_frame = NULL;
00085 cpl_frame *model_frame = NULL;
00086 cpl_frameset *set = NULL;
00087 int ret=0;
00088
00089
00090 TESTS_INIT(MODULE_ID);
00091 cpl_msg_set_level(CPL_MSG_DEBUG);
00092 xsh_debug_level_set(XSH_DEBUG_LEVEL_MEDIUM) ;
00093
00094
00095 if (argc > 1){
00096 sof_name = argv[1];
00097 }
00098 else{
00099 printf(SYNTAX);
00100 TEST_END();
00101 return 0;
00102 }
00103
00104
00105 check( set = sof_to_frameset( sof_name));
00106
00107
00108 check( instrument = xsh_dfs_set_groups( set));
00109
00110 check( spectralformat_frame = xsh_find_spectral_format( set, instrument));
00111 check( orderlist_frame = xsh_find_order_tab_edges( set, instrument));
00112 wavesol_frame = xsh_find_wave_tab_2d( set, instrument);
00113
00114
00115 xsh_msg("SPECTRALFORMAT : %s",
00116 cpl_frame_get_filename( spectralformat_frame));
00117 xsh_msg("ORDERLIST : %s",
00118 cpl_frame_get_filename( orderlist_frame));
00119 if (wavesol_frame != NULL){
00120 xsh_msg("WAVESOL : %s",
00121 cpl_frame_get_filename( wavesol_frame));
00122 }
00123 else{
00124 check( model_frame =
00125 xsh_find_frame_with_tag( set, XSH_MOD_CFG_TAB, instrument));
00126 xsh_msg("MODEL : %s",
00127 cpl_frame_get_filename( model_frame));
00128 }
00129 check( xsh_data_check_spectralformat( spectralformat_frame,
00130 orderlist_frame, wavesol_frame, model_frame, instrument));
00131
00132 cleanup:
00133 xsh_free_frameset( &set);
00134 xsh_instrument_free( &instrument);
00135
00136 if (cpl_error_get_code() != CPL_ERROR_NONE) {
00137 xsh_error_dump(CPL_MSG_ERROR);
00138 ret = 1;
00139 }
00140 TEST_END();
00141 return ret;
00142 }
00143