64#define MODULE_ID "XSH_MODEL_MAPS_CREATE"
65#define SYNTAX "Create a wave and a slit map from model\n"\
66 "use : ./test_xsh_model_maps_create SOF\n"\
67 "SOF => model config and arclist\n"\
69 " --binx=<n> : binning in X (default 1)\n"\
70 " --biny=<n> : binning in Y (default 1)\n"
94 {
"binx", required_argument, 0,
BINX_OPT},
95 {
"biny", required_argument, 0,
BINY_OPT},
106 int option_index = 0;
109 strcpy(
mode,
"SLIT" ) ;
111 while( (opt = getopt_long( argc, argv,
Options,
132int main(
int argc,
char **argv)
136 const char *sof_name = NULL;
137 const char *model_config_name = NULL;
138 const char *lines_list_name = NULL;
139 cpl_frame *model_config_frame = NULL;
140 cpl_frame *lines_list_frame = NULL;
141 cpl_frameset *set = NULL;
142 cpl_frameset *raws = NULL;
143 cpl_frameset *calib = NULL;
145 FILE* sof_file = NULL;
148 cpl_frame* wmap_frame=NULL;
149 cpl_frame* smap_frame=NULL;
151 char *pre_name = NULL;
156 cpl_msg_set_level(CPL_MSG_DEBUG);
163 if ((argc-optind) <= 2){
164 pre_name = argv[optind];
165 sof_name = argv[optind];
176 check( set = cpl_frameset_new());
177 sof_file = fopen( sof_name,
"r");
179 while ( fgets( sof_line, 200, sof_file)){
182 cpl_frame *raw_frame = NULL;
185 sscanf( sof_line,
"%199s %199s", raw_name, raw_tag);
186 check( raw_frame = cpl_frame_new());
187 check( cpl_frame_set_filename( raw_frame, raw_name));
188 check( cpl_frame_set_tag( raw_frame, raw_tag));
189 check( cpl_frameset_insert(set, raw_frame));
202 check( lines_list_name = cpl_frame_get_filename( lines_list_frame));
203 check( model_config_name = cpl_frame_get_filename( model_config_frame));
205 xsh_msg(
" Find model %s\n", model_config_name);
206 xsh_msg(
" Find lines list %s\n", lines_list_name);
212 "WAVE_MAP_TEST",
"SLIT_MAP_TEST",
213 &wmap_frame,&smap_frame,0));
228 if (cpl_error_get_code() != CPL_ERROR_NONE) {
int main()
Unit test of xsh_bspline_interpol.
static void HandleOptions(int argc, char **argv)
static const char * Options
Unit test of xsh_model_maps_create.
static struct option LongOptions[]
static xsh_instrument * instrument
#define xsh_error_dump(level)
#define XSH_ASSURE_NOT_NULL(pointer)
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
cpl_error_code xsh_model_config_load_best(cpl_frame *config_frame, xsh_xs_3 *p_xs_3)
Load the config model table and fill the struct.
void xsh_model_binxy(xsh_xs_3 *p_xs_3, int bin_X, int bin_Y)
corrects model for detector's binning
cpl_error_code xsh_model_maps_create(xsh_xs_3 *p_xs_3, xsh_instrument *instr, const char *wtag, const char *stag, cpl_frame **wmap_frame, cpl_frame **smap_frame, const int save_tmp)
Compute the wavelength and slit maps.
#define xsh_msg(...)
Print a message on info level.
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
int xsh_debug_level_set(int level)
set debug level
#define TESTS_INIT(DRL_ID)
void xsh_dfs_split_in_group(cpl_frameset *input, cpl_frameset *raws, cpl_frameset *calib)
split input sof in groups: raw and calib
xsh_instrument * xsh_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset and return the instrument detected.
cpl_frame * xsh_find_model_config_tab(cpl_frameset *frames, xsh_instrument *instr)
Find a model configuration table frame.
cpl_frame * xsh_find_arc_line_list(cpl_frameset *frames, xsh_instrument *instr)
Find an arc line list frame.
#define XSH_NEW_FRAMESET(POINTER)