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_order.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 <xsh_utils_table.h>
00052 #include <cpl.h>
00053 #include <math.h>
00054 #include <getopt.h>
00055 #include <xsh_drl.h>
00056
00057
00058
00059
00060 #define XSH_FLOAT_PRECISION 0.000001
00061 #define MODULE_ID "XSH_DATA_SLITMAP"
00062
00063 enum {
00064 BINX_OPT, BINY_OPT,DEBUG_OPT, HELP_OPT
00065 } ;
00066
00067 static struct option LongOptions[] = {
00068 {"debug", required_argument, 0, DEBUG_OPT},
00069 {"help", 0, 0, HELP_OPT},
00070 {NULL, 0, 0, 0}
00071 } ;
00072
00073
00074 static void Help( void )
00075 {
00076 puts ("Computes the slilet sizes with Order Table and SLIT MAP");
00077 puts( "Usage : ./test_xsh_slitmap <sof>");
00078
00079 puts( "Options" ) ;
00080 puts( " --debug=<n> : Level of debug LOW | MEDIUM | HIGH [MEDIUM]" );
00081 puts( " --help : What you see" ) ;
00082
00083 puts( "The input files argument MUST be in this order:" ) ;
00084 puts( " 1. SOF [IFU_MAP|SLIT_MAP]");
00085
00086 TEST_END();
00087 exit(0);
00088 }
00089
00090 static void HandleOptions( int argc, char ** argv)
00091 {
00092 int opt ;
00093 int option_index = 0;
00094
00095 while( (opt = getopt_long( argc, argv, "debug:help",
00096 LongOptions, &option_index )) != EOF )
00097 switch( opt ) {
00098 case DEBUG_OPT:
00099 if ( strcmp( optarg, "LOW")==0){
00100 xsh_debug_level_set( XSH_DEBUG_LEVEL_LOW);
00101 }
00102 else if ( strcmp( optarg, "HIGH")==0){
00103 xsh_debug_level_set( XSH_DEBUG_LEVEL_HIGH);
00104 }
00105 break;
00106 case HELP_OPT:
00107 Help();
00108 break;
00109 default:
00110 break;
00111 }
00112 }
00113
00114
00122
00123 int main(int argc, char** argv)
00124 {
00125 int ret = 0;
00126 xsh_instrument *instrument = NULL ;
00127
00128 const char *sof_name = NULL;
00129 cpl_frameset *set = NULL;
00130 cpl_frame * slitmap_frame = NULL ;
00131 double sd, su, sld, slu;
00132
00133
00134 TESTS_INIT( MODULE_ID);
00135 cpl_msg_set_level( CPL_MSG_DEBUG);
00136 xsh_debug_level_set( XSH_DEBUG_LEVEL_MEDIUM) ;
00137
00138 HandleOptions( argc, argv);
00139
00140 if ( (argc-optind) >= 1 ) {
00141 sof_name = argv[optind];
00142 }
00143 else {
00144 Help();
00145 exit( 0);
00146 }
00147
00148
00149 check( set = sof_to_frameset( sof_name));
00150
00151
00152 check( instrument = xsh_dfs_set_groups( set));
00153
00154 check( slitmap_frame = xsh_find_slitmap( set, instrument));
00155 xsh_msg("SLITMAP : %s",
00156 cpl_frame_get_filename( slitmap_frame));
00157
00158 check( xsh_get_slit_edges( slitmap_frame, &sd, &su, &sld, &slu, instrument));
00159
00160 cleanup:
00161 if (cpl_error_get_code() != CPL_ERROR_NONE) {
00162 xsh_error_dump(CPL_MSG_ERROR);
00163 ret = 1;
00164 }
00165 xsh_free_frameset( &set);
00166 xsh_instrument_free( &instrument);
00167 TEST_END();
00168 return ret ;
00169 }
00170