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 #include <tests.h>
00044
00045 #include <xsh_data_pre.h>
00046 #include <xsh_error.h>
00047 #include <xsh_msg.h>
00048 #include <xsh_data_instrument.h>
00049 #include <xsh_data_resid_tab.h>
00050 #include <xsh_model_io.h>
00051 #include <xsh_model_kernel.h>
00052 #include <xsh_drl.h>
00053 #include <xsh_pfits.h>
00054
00055 #include <cpl.h>
00056 #include <math.h>
00057
00058 #include <getopt.h>
00059
00060
00061
00062
00063
00064 #define MODULE_ID "XSH_CREATE_SPECTRALFORMAT"
00065 #define SYNTAX "Create a spectral format file from a model config file\n"\
00066 "use : ./the_xsh_create_spectralformat MODEL_CONFIG\n"\
00067 "MODEL_CONFIG => the model config frame\n"
00068
00069
00070
00071
00072
00073
00081 int main( int argc, char **argv)
00082 {
00083
00084 int ret = 0 ;
00085 xsh_instrument* instrument = NULL;
00086 xsh_xs_3 config;
00087 char* model_config_name = NULL;
00088 cpl_frame* model_config_frame = NULL;
00089 cpl_frame* spec_form_frame = NULL;
00090
00091 TESTS_INIT(MODULE_ID);
00092
00093 cpl_msg_set_level(CPL_MSG_DEBUG);
00094 xsh_debug_level_set(XSH_DEBUG_LEVEL_MEDIUM) ;
00095
00096
00097 if (argc > 1){
00098 model_config_name = argv[1];
00099 }
00100 else{
00101 printf(SYNTAX);
00102 return 0;
00103 }
00104
00105
00106 instrument = xsh_instrument_new() ;
00107 xsh_instrument_set_mode( instrument, XSH_MODE_IFU );
00108 xsh_instrument_set_arm( instrument, XSH_ARM_VIS);
00109
00110
00111 XSH_ASSURE_NOT_NULL( model_config_name);
00112 model_config_frame = cpl_frame_new();
00113 cpl_frame_set_filename( model_config_frame, model_config_name) ;
00114 cpl_frame_set_level( model_config_frame, CPL_FRAME_LEVEL_TEMPORARY);
00115 cpl_frame_set_group( model_config_frame, CPL_FRAME_GROUP_RAW ) ;
00116 cpl_frame_set_tag( model_config_frame, "MODEL_CONFIG_TAB_VIS");
00117 check( xsh_model_config_load_best( model_config_frame, &config));
00118 check(spec_form_frame= xsh_model_spectralformat_create( &config,"spectral_format.fits"));
00119
00120 cleanup:
00121 if (cpl_error_get_code() != CPL_ERROR_NONE) {
00122 xsh_error_dump(CPL_MSG_ERROR);
00123 return 1;
00124 }
00125 else return ret ;
00126 }
00127