57#define MODULE_ID "XSH_DETECT_ARCLINES"
59#define SYNTAX "Test the detect_arclines function\n"\
60 "use : ./test_xsh_detect_arclines OPTIONS FMTCHK_FRAME LINE_LIST THEMAP "\
62 "FMTCHK_FRAME => the frame to detect arclines (PRE format)\n"\
63 "LINE_LIST => the line list\n"\
64 "THEMAP => the theoretical map\n"\
65 "GUESS_WAVE_TAB => the guess wave solution\n"\
66 "SPECTRAL_FORMAT_TAB => the spectral format table \n"\
68 " --half_window_size : half window size (HWS) in pixel around the"\
69 " position to fit the gaussian (total window size = 2*HWS+1)\n"\
70 " --half_window_size_for_max : half window size (HWS) in pixel around the"\
71 " theoritical position to find the maximum flux\n"\
72 " --half_window_size_running_median : half window size of running "\
74 " --deg_lambda : lambda degree in polynomial wavelength solution fit\n"\
75 " --deg_order : order degree in polynomial wavelength solution fit\n"\
76 " --deg_slit : slit degree in polynomial wavelength solution fit\n"\
77 " --poly_degree : Polynomial degree\n"\
78 " --min_sn : minimal S/N allowed\n"\
79 " --clip_sigma : multiple of sigma in sigma clipping\n"\
80 " --clip_niter : number of iterations in sigma clipping\n"\
81 " --clip_frac : minimal fractions of bad pixel allowed\n"
92 {
"half_window_size_for_max", required_argument, 0,
94 {
"half_window_size_running_median", required_argument, 0,
111 int option_index = 0;
121 det_arc_par->
min_sn = 0.2;
122 clip_par->
sigma = 1.0;
124 clip_par->
frac = 0.7;
127 while (( opt = getopt_long (argc, argv,
"half_window_size:deg_lambda:"\
128 "deg_order:deg_slit:poly_degree:min_sn:"\
129 "clip_sigma:clip_niter:clip_frac:half_window_size_for_max:"\
130 "half_window_size_running_median",
156 det_arc_par->
min_sn = atof(optarg);
159 clip_par->
sigma = atof(optarg);
162 clip_par->
niter = atoi(optarg);
165 clip_par->
frac = atof(optarg);
190 cpl_frame* predict = NULL;
191 cpl_frame* theoretical_map = NULL;
192 cpl_frame* arclines = NULL;
193 cpl_frame* clean_arclines = NULL;
195 cpl_frame* resid_tab_orders=NULL;
196 cpl_frame* guess_tab = NULL;
197 cpl_frame* wave_sol = NULL;
198 cpl_frame* twodmap_resid = NULL;
199 cpl_frame* spectral_format = NULL;
203 char *fmtchk_name = NULL;
204 char *linelist_name = NULL;
205 char *themap_name = NULL;
206 char *guess_tab_name = NULL;
207 char *spectral_format_name = NULL;
213 cpl_msg_set_level(CPL_MSG_DEBUG);
219 nb_frames = argc - optind;
220 if ( nb_frames > 2 ) {
221 fmtchk_name = argv[optind];
222 linelist_name = argv[optind+1];
223 themap_name = argv[optind+2];
225 guess_tab_name = argv[optind+3];
229 spectral_format_name = argv[optind+4];
231 spectral_format_name);
237 xsh_msg(
"********** NOT ENOUGH INPUT FRAMES **********" ) ;
250 xsh_msg(
"--------------------------------------------------------");
252 xsh_msg(
"--------------------------------------------------------");
264 xsh_msg(
"--------------------------------------------------------");
266 xsh_msg(
"--------------------------------------------------------");
267 xsh_msg(
" FMTCHK frame : %s", fmtchk_name);
268 xsh_msg(
" LINE_LIST frame : %s", linelist_name);
269 xsh_msg(
" THEMAP frame : %s", themap_name);
270 if (guess_tab_name != NULL){
271 xsh_msg(
" GUESS_TAB frame : %s", guess_tab_name);
273 if (spectral_format_name != NULL){
274 xsh_msg(
" SPECTRAL FORMAT TAB frame : %s", spectral_format_name);
276 xsh_msg(
"--------------------------------------------------------");
278 xsh_msg(
"--------------------------------------------------------");
287 &resid_tab_orders, &clean_arclines,
288 &wave_sol, &twodmap_resid,
292 "xsh_predict",decode_bp,0));
295 xsh_msg(
"--------------------------------------------------------");
297 xsh_msg(
"--------------------------------------------------------");
299 cpl_frame_delete(predict);
300 cpl_frame_delete(theoretical_map);
301 cpl_frame_delete(arclines);
302 if (cpl_error_get_code() != CPL_ERROR_NONE) {
int main()
Unit test of xsh_bspline_interpol.
static void HandleOptions(int argc, char **argv, xsh_detect_arclines_param *det_arc_par, xsh_clipping_param *clip_par)
static struct option long_options[]
@ HALF_WINDOW_SIZE_FOR_MAX_OPT
@ HALF_WINDOW_SIZE_RUNNING_MEDIAN_OPT
static xsh_instrument * instrument
void xsh_detect_arclines(cpl_frame *frame, cpl_frame *theo_tab_frame, cpl_frame *arc_lines_tab_frame, cpl_frame *wave_tab_guess_frame, cpl_frame *order_tab_recov_frame, cpl_frame *config_model_frame, cpl_frame *spectralformat_frame, cpl_frame **resid_tab_orders_frame, cpl_frame **arc_lines_clean_tab_frame, cpl_frame **wave_tab_frame, cpl_frame **resid_tab_frame, xsh_sol_wavelength solwave_type, xsh_detect_arclines_param *da, xsh_clipping_param *dac, xsh_instrument *instr, const char *rec_id, const int clean_tmp, const int resid_tab_name_sw)
detect the position on the detector of emission lines listed in a catalogue, from expected position v...
#define xsh_error_dump(level)
#define xsh_msg(...)
Print a message on info level.
int xsh_debug_level_set(int level)
set debug level
#define TESTS_XSH_INSTRUMENT_CREATE(instr, mode, arm, lamp, recipe)
#define TESTS_XSH_FRAME_CREATE(frame, tag, name)
#define TESTS_INIT(DRL_ID)
#define QFLAG_OUTSIDE_DATA_RANGE