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
00027
00028
00029 #ifdef HAVE_CONFIG_H
00030 #include <config.h>
00031 #endif
00032
00033
00041
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #include <xsh_error.h>
00054
00055 #include <xsh_utils.h>
00056 #include <xsh_msg.h>
00057
00058 #include <xsh_dfs.h>
00059
00060 #include <xsh_pfits.h>
00061 #include <xsh_data_order.h>
00062 #include <xsh_data_instrument.h>
00063 #include <xsh_drl.h>
00064 #include <xsh_model_kernel.h>
00065
00066 #include <cpl.h>
00067
00068
00069
00070
00071
00072 #define RECIPE_ID "xsh_flexcomp"
00073 #define RECIPE_AUTHOR "P.Goldoni, L.Guglielmi, R. Haigron, F. Royer"
00074 #define RECIPE_CONTACT "amodigli@eso.org"
00075
00076 #define XSH_AFC_UVB_XMIN 573
00077 #define XSH_AFC_UVB_YMIN 1501
00078 #define XSH_AFC_UVB_XMAX 1572
00079 #define XSH_AFC_UVB_YMAX 2500
00080 #define XSH_AFC_UVB_ORDER 18
00081
00082 #define XSH_AFC_VIS_XMIN 534
00083 #define XSH_AFC_VIS_YMIN 2301
00084 #define XSH_AFC_VIS_XMAX 1533
00085 #define XSH_AFC_VIS_YMAX 3300
00086 #define XSH_AFC_VIS_ORDER 26
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 static int xsh_flexcomp_create(cpl_plugin *);
00097 static int xsh_flexcomp_exec(cpl_plugin *);
00098 static int xsh_flexcomp_destroy(cpl_plugin *);
00099
00100
00101 static void xsh_flexcomp(cpl_parameterlist *, cpl_frameset *);
00102
00103
00104
00105
00106 static char xsh_flexcomp_description_short[] =
00107 "Compute the flexure of the instrument";
00108
00109 static char xsh_flexcomp_description[] =
00110 "This recipe computes the flexure of the instrument and correct CAL files.\n\
00111 Input Frames :\n\
00112 - [UVB, VIS] One RAW frame (Format = RAW, Tag = AFF_ATT_arm)\n\
00113 - [NIR] Two RAW frames ((Format = RAW, Tag = AFC_ATT_arm_ON,\
00114 AFC_ATT_arm_OFF)\n\
00115 - An arc line list (Format = TABLE, Tag = ARC_LINE_LIST_AFC_arm)\n\
00116 - A spectral format table frame (Format = TABLE, Tag = SPECTRAL_FORMAT_TAB_arm)\n\
00117 - [UVB,VIS] A master bias (Format = PRE, Tag = MASTER_BIAS_arm)\n\
00118 - [UVB,VIS] A master dark (Format = PRE, Tag = MASTER_DARK_arm)\n\
00119 - An order table frame (Format = TABLE, Tag = ORDER_TAB_EDGES_IFU_arm)\n\
00120 - [OPTIONAL] A badpixel map (Format = QUP, Tag = BADPIXEL_MAP_arm)\n\
00121 - [poly mode] A wave solution frame (Format = TABLE, Tag = WAVE_TAB_2D_arm)\n\
00122 - [physical model mode] A model cfg table (Format = TABLE, Tag = XSH_MOD_CFG_OPT_2D_arm)\n\
00123 Products : \n\
00124 - [poly mode] An updated wave solution frame (Format = TABLE, Tag = WAVE_TAB_AFC_arm)\n\
00125 - [physical model mode] An updated model cfg table (Format = TABLE, Tag = XSH_MOD_CFG_OPT_AFC_arm)\n\
00126 - An updated order table frame (Format = TABLE, Tag = ORDER_TAB_AFC_IFU_arm)\n\
00127 - [poly mode] A dispersion table frame (Format = TABLE, Tag = DISP_TAB_AFC_arm)\n";
00128
00129
00130
00131
00132
00141
00142
00143 int cpl_plugin_get_info(cpl_pluginlist *list) {
00144 cpl_recipe *recipe = NULL;
00145 cpl_plugin *plugin = NULL;
00146
00147 recipe = cpl_calloc(1, sizeof(*recipe));
00148 if ( recipe == NULL ){
00149 return -1;
00150 }
00151
00152 plugin = &recipe->interface ;
00153
00154 cpl_plugin_init(plugin,
00155 CPL_PLUGIN_API,
00156 XSH_BINARY_VERSION,
00157 CPL_PLUGIN_TYPE_RECIPE,
00158 RECIPE_ID,
00159 xsh_flexcomp_description_short,
00160 xsh_flexcomp_description,
00161 RECIPE_AUTHOR,
00162 RECIPE_CONTACT,
00163 xsh_get_license(),
00164 xsh_flexcomp_create,
00165 xsh_flexcomp_exec,
00166 xsh_flexcomp_destroy);
00167
00168 cpl_pluginlist_append(list, plugin);
00169
00170 return (cpl_error_get_code() != CPL_ERROR_NONE);
00171 }
00172
00173
00183
00184
00185 static int xsh_flexcomp_create(cpl_plugin *plugin){
00186 cpl_recipe *recipe = NULL;
00187 xsh_clipping_param detarc_clip_param = { 2.0, 10, 0.7, 0, 0.3};
00188 xsh_detect_arclines_param detarc_param = { 8, 2, 0, 5, 5, 0, 2, 3.0,
00189 XSH_GAUSSIAN_METHOD, FALSE};
00190 xsh_dispersol_param dispsol_param = { 5, 5 } ;
00191 char paramname[256];
00192 cpl_parameter* p=NULL;
00193
00194
00195 xsh_init();
00196
00197
00198 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
00199
00200
00201 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
00202 CPL_ERROR_TYPE_MISMATCH,
00203 "Plugin is not a recipe");
00204
00205 recipe = (cpl_recipe *)plugin;
00206
00207
00208 recipe->parameters = cpl_parameterlist_new();
00209 assure( recipe->parameters != NULL,
00210 CPL_ERROR_ILLEGAL_OUTPUT,
00211 "Memory allocation failed!");
00212
00213
00214 check( xsh_parameters_generic( RECIPE_ID, recipe->parameters ) ) ;
00215 check( xsh_parameters_pre_overscan( RECIPE_ID, recipe->parameters ) ) ;
00216
00217 check( xsh_parameters_new_boolean( recipe->parameters, RECIPE_ID,
00218 "compute-disptab",
00219 FALSE,
00220 "Compute the wavemap and the slitmap and the dispersion table."));
00221
00222
00223 check(xsh_parameters_detect_arclines_create(RECIPE_ID,recipe->parameters,
00224 detarc_param));
00225 check(xsh_parameters_clipping_detect_arclines_create(RECIPE_ID,
00226 recipe->parameters, detarc_clip_param));
00227
00228 check(xsh_parameters_dispersol_create(RECIPE_ID,
00229 recipe->parameters,
00230 dispsol_param ));
00231
00232
00233 check( xsh_parameters_new_int( recipe->parameters, RECIPE_ID,
00234 "model-maxit",1000,
00235 "Number/10 of annealing iterations "
00236 "if in physical model mode."));
00237
00238 check( xsh_parameters_new_double( recipe->parameters, RECIPE_ID,
00239 "model-anneal-factor",1.0,
00240 "Multiplier applied to the automatic "
00241 "parameter ranges (i.e. when scenario!=0). "
00242 "For routine operations should be 1.0. "
00243 "(physical model mode)."));
00244
00245
00246 sprintf(paramname,"xsh.%s.%s",RECIPE_ID,"model-scenario");
00247
00248 check(p=cpl_parameter_new_enum(paramname,CPL_TYPE_INT,
00249 "selects preset flag and range combinations "
00250 "appropriate to common scenarios: "
00251 "-1 - Only the position across the slit and"
00252 " camera focal length are open\n"
00253 " 0 - No scenario, input cfg flags and limits"
00254 " used."
00255 " 1 - scenario appropriate for the startup"
00256 " recipe (large ranges for parameters "
00257 " affecting single ph exposures, dist "
00258 " coeff fixed)"
00259 " 2 - Like 1, but includes parameters "
00260 " affecting all ph positions"
00261 " 3 - Scenario for use in fine tuning cfg"
00262 " to match routine wavecal exposures. All"
00263 " parameters affecting 1ph exposures"
00264 " except dist coeffs are included and"
00265 " parameter ranges are small. (For use by"
00266 " flexcomp in 1ph case)."
00267 " 4 - Like 3 but includes parameters"
00268 " affecting all ph positions (Standard for"
00269 " use by flexcomp in 9ph case and 2dmap)."
00270 " 5 - Like 4 but includes also dist coeffs"
00271 " 6 - Just dist coeffs (and chipx, chipy)",
00272 RECIPE_ID,3,9,-1,0,1,2,3,4,5,6,8));
00273
00274
00275 check(cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
00276 "model-scenario"));
00277 check(cpl_parameterlist_append(recipe->parameters,p));
00278
00279
00280 cleanup:
00281 if ( cpl_error_get_code() != CPL_ERROR_NONE ){
00282 xsh_error_dump(CPL_MSG_ERROR);
00283 return 1;
00284 }
00285 else {
00286 return 0;
00287 }
00288 }
00289
00290
00296
00297
00298 static int xsh_flexcomp_exec(cpl_plugin *plugin) {
00299 cpl_recipe *recipe = NULL;
00300
00301
00302 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
00303
00304
00305 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
00306 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
00307
00308 recipe = (cpl_recipe *)plugin;
00309
00310
00311 xsh_flexcomp(recipe->parameters, recipe->frames);
00312
00313 cleanup:
00314 if ( cpl_error_get_code() != CPL_ERROR_NONE ) {
00315 xsh_error_dump(CPL_MSG_ERROR);
00316 cpl_error_reset();
00317 return 1;
00318 }
00319 else {
00320 return 0;
00321 }
00322 }
00323
00324
00330
00331 static int xsh_flexcomp_destroy(cpl_plugin *plugin)
00332 {
00333 cpl_recipe *recipe = NULL;
00334
00335
00336 assure( plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin" );
00337
00338
00339 assure( cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
00340 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
00341
00342 recipe = (cpl_recipe *)plugin;
00343
00344 xsh_free_parameterlist(&recipe->parameters);
00345
00346 cleanup:
00347 if (cpl_error_get_code() != CPL_ERROR_NONE)
00348 {
00349 return 1;
00350 }
00351 else
00352 {
00353 return 0;
00354 }
00355 }
00356
00357 static cpl_error_code
00358 xsh_params_set_defaults(cpl_parameterlist* pars,
00359 xsh_instrument* inst,
00360 xsh_detect_arclines_param* detect_arclines_p)
00361 {
00362 cpl_parameter* p=NULL;
00363
00364 if (xsh_instrument_get_arm(inst) == XSH_ARM_NIR){
00365 check(p=xsh_parameters_find(pars,RECIPE_ID,"detectarclines-min-sn"));
00366 if(xsh_parameter_get_default_flag(p) == 0) {
00367
00368 detect_arclines_p->min_sn=4;
00369 }
00370 }
00371
00372 cleanup:
00373
00374 return cpl_error_get_code();
00375
00376 }
00377
00378 static cpl_error_code
00379 xsh_frame_check_is_right_afcatt(cpl_frame* afcatt_frame,
00380 xsh_instrument* instrument)
00381 {
00382 cpl_propertylist* plist=NULL;
00383 const char* name=NULL;
00384 char* slit_value=NULL;
00385 name=cpl_frame_get_filename(afcatt_frame);
00386 plist=cpl_propertylist_load(name,0);
00387 check(slit_value=xsh_pfits_get_slit_value (plist,instrument));
00388 if (strcmp(slit_value,"Pin_0.5") != 0 ) {
00389 xsh_msg_error("INS OPTIi NAME value=%s",slit_value);
00390 xsh_msg_error("Your input AFC frame should be the 1st of the AFC sequence");
00391 xsh_msg_error("Its INS OPTIi NAME key value should be 'Pin_0.5'");
00392 cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
00393 }
00394
00395 cleanup:
00396 xsh_free_propertylist(&plist);
00397
00398 return cpl_error_get_code();
00399
00400
00401 }
00402
00403
00404
00412
00413 static void xsh_flexcomp(cpl_parameterlist* parameters, cpl_frameset* frameset)
00414 {
00415 const char* recipe_tags[1] = {XSH_AFC_ATT};
00416 int recipe_tags_size = 1;
00417
00418
00419 xsh_clipping_param* detect_arclines_clipping = NULL;
00420 xsh_detect_arclines_param* detect_arclines_p = NULL;
00421 xsh_dispersol_param *dispsol_param = NULL ;
00422
00423
00424 cpl_frameset* raws = NULL;
00425 cpl_frameset* calib = NULL;
00426 xsh_instrument* instrument = NULL;
00427
00428 cpl_frame* arclist_frame = NULL;
00429 cpl_frame* afcatt_frame = NULL;
00430 cpl_frame* spectralformat_frame = NULL;
00431 cpl_frame* order_tab_edges_frame = NULL;
00432 cpl_frame* wave_tab_frame = NULL;
00433
00434 cpl_frame* wave_map_frame = NULL;
00435 cpl_frame* slit_map_frame = NULL;
00436
00437 cpl_frame* model_config_frame = NULL;
00438 cpl_frame* masterbias_frame = NULL;
00439 cpl_frame* masterdark_frame = NULL;
00440 cpl_frame* bpmap_frame = NULL;
00441
00442 cpl_frame *subbias_frame = NULL;
00443 cpl_frame *subdark_frame = NULL;
00444 int afc_xmin=1;
00445 int afc_xmax=1;
00446 int afc_ymin=1;
00447 int afc_ymax=1;
00448 int afc_order=0;
00449 cpl_frame* afcatt_rmbias = NULL;
00450 cpl_frame* afcatt_rmdark = NULL;
00451 cpl_frame* att_cleanlines = NULL;
00452 cpl_frame* att_resid_tab = NULL;
00453 cpl_frame *afcthetab_frame = NULL;
00454 const char *tag = NULL;
00455 char filename [256];
00456 cpl_frame *afc_wave_tab_frame = NULL;
00457 cpl_frame *afc_order_tab_edges_frame = NULL;
00458 cpl_frame *afc_disp_tab_frame = NULL;
00459 cpl_frame *afc_config_tab_frame = NULL;
00460 XSH_ARM arm = XSH_ARM_UNDEFINED;
00461 int pre_overscan_corr=0;
00462
00463 char wave_map_tag[80];
00464 char slit_map_tag[80];
00465 int compute_disp_tab=0;
00466
00467 check( xsh_begin( frameset, parameters, &instrument, &raws, &calib,
00468 recipe_tags, recipe_tags_size,
00469 RECIPE_ID, XSH_BINARY_VERSION,
00470 xsh_flexcomp_description_short));
00471
00472
00473
00474
00475 check( arclist_frame = xsh_find_frame_with_tag( calib,
00476 XSH_ARC_LINE_LIST_AFC,
00477 instrument));
00478 XSH_ASSURE_NOT_NULL_MSG( arclist_frame,
00479 "No arclines list provided");
00480 check( spectralformat_frame = xsh_find_frame_with_tag( calib,
00481 XSH_SPECTRAL_FORMAT, instrument));
00482 XSH_ASSURE_NOT_NULL_MSG( spectralformat_frame,
00483 "No spectral format provided");
00484 check( order_tab_edges_frame = xsh_find_order_tab_edges( calib,instrument));
00485 XSH_ASSURE_NOT_NULL_MSG( order_tab_edges_frame,
00486 "No order table provided");
00487
00488
00489 wave_tab_frame = xsh_find_wave_tab( calib, instrument);
00490 xsh_error_reset();
00491
00492 if ( (model_config_frame = xsh_find_frame_with_tag( calib,
00493 XSH_MOD_CFG_OPT_2D, instrument)) == NULL) {
00494 xsh_error_reset();
00495 if ((model_config_frame = xsh_find_frame_with_tag(calib,
00496 XSH_MOD_CFG_TAB, instrument)) == NULL) {
00497 xsh_error_reset();
00498 }
00499 }
00500
00501 if( (model_config_frame!=NULL) && (wave_tab_frame != NULL) ) {
00502
00503 xsh_msg_error("You cannot provide both a %s and a %s frame. Decide if you are in poly or physical model mode. We exit",
00504 XSH_WAVE_TAB_2D , XSH_MOD_CFG_TAB);
00505 goto cleanup;
00506 }
00507
00508 if((model_config_frame==NULL) && ( wave_tab_frame == NULL) ) {
00509 xsh_msg_error("You must provide either a %s or a %s frame",
00510 XSH_WAVE_TAB_2D, XSH_MOD_CFG_TAB);
00511 goto cleanup;
00512 }
00513
00514 check( arm = xsh_instrument_get_arm(instrument));
00515
00516 if ( arm != XSH_ARM_NIR){
00517 if((masterbias_frame = xsh_find_frame_with_tag(calib,XSH_MASTER_BIAS,
00518 instrument)) == NULL) {
00519
00520 xsh_msg_warning("Frame %s not provided",XSH_MASTER_BIAS);
00521 xsh_error_reset();
00522 }
00523
00524 if((masterdark_frame = xsh_find_frame_with_tag(calib,XSH_MASTER_DARK,
00525 instrument)) == NULL){
00526 xsh_msg_warning("Frame %s not provided",XSH_MASTER_DARK);
00527 xsh_error_reset();
00528 }
00529 }
00530 check( xsh_instrument_update_from_spectralformat( instrument,
00531 spectralformat_frame));
00532 check( pre_overscan_corr = xsh_parameters_get_int( parameters, RECIPE_ID,
00533 "pre-overscan-corr"));
00534
00535
00536
00537
00538 check(detect_arclines_clipping =
00539 xsh_parameters_clipping_detect_arclines_get(RECIPE_ID, parameters));
00540 check(detect_arclines_p = xsh_parameters_detect_arclines_get(RECIPE_ID,
00541 parameters));
00542 check( dispsol_param = xsh_parameters_dispersol_get( RECIPE_ID, parameters));
00543 check(xsh_params_set_defaults(parameters,instrument,detect_arclines_p));
00544
00545 check(compute_disp_tab = xsh_parameters_get_boolean( parameters,
00546 RECIPE_ID,
00547 "compute-disptab"));
00548
00549
00550
00551
00552
00553 if (arm != XSH_ARM_NIR){
00554
00555 if ( arm == XSH_ARM_VIS){
00556 afc_xmin = XSH_AFC_VIS_XMIN-10;
00557 afc_xmax = XSH_AFC_VIS_XMAX-10;
00558 afc_ymin = XSH_AFC_VIS_YMIN;
00559 afc_ymax = XSH_AFC_VIS_YMAX;
00560 afc_order = XSH_AFC_VIS_ORDER;
00561 }
00562 else {
00563 afc_xmin = 2145-XSH_AFC_UVB_XMAX-48;
00564 afc_xmax = 2145-XSH_AFC_UVB_XMIN-48;
00565 afc_ymin = 3001-XSH_AFC_UVB_YMAX;
00566 afc_ymax = 3001-XSH_AFC_UVB_YMIN;
00567 afc_order = XSH_AFC_UVB_ORDER;
00568 }
00569 xsh_msg("AFC pre coordinates (%d,%d, %d,%d)",afc_xmin,afc_ymin,
00570 afc_xmax,afc_ymax);
00571
00572 if ( masterbias_frame != NULL){
00573 check( subbias_frame = xsh_preframe_extract( masterbias_frame,
00574 afc_xmin, afc_ymin, afc_xmax, afc_ymax,
00575 "TEST_SUBBIAS.fits", instrument));
00576 }
00577
00578 if ( masterdark_frame != NULL){
00579 check( subdark_frame = xsh_preframe_extract( masterdark_frame,
00580 afc_xmin, afc_ymin, afc_xmax, afc_ymax,
00581 "TEST_SUBDARK.fits", instrument));
00582
00583 }
00584 }
00585 check( xsh_prepare( raws, bpmap_frame, subbias_frame, XSH_AFC_ATT,
00586 instrument,pre_overscan_corr));
00587
00588 check( afcatt_frame = cpl_frameset_get_first( raws));
00589 check( xsh_frame_check_is_right_afcatt(afcatt_frame,instrument));
00590
00591 if( subbias_frame != NULL) {
00592
00593 check( afcatt_rmbias = xsh_subtract_bias( afcatt_frame, subbias_frame,
00594 instrument,"AFC_ATT_",
00595 pre_overscan_corr));
00596 }
00597 else {
00598 afcatt_rmbias =cpl_frame_duplicate( afcatt_frame);
00599 }
00600
00601 if( subdark_frame != NULL) {
00602
00603 sprintf( filename, "AFCATT_DARK_%s.fits",
00604 xsh_instrument_arm_tostring( instrument));
00605 check( afcatt_rmdark = xsh_subtract_dark( afcatt_rmbias, subdark_frame,
00606 filename, instrument));
00607 }
00608 else {
00609 afcatt_rmdark =cpl_frame_duplicate( afcatt_rmbias);
00610 }
00611 check( afcthetab_frame = xsh_afcthetab_create( wave_tab_frame,
00612 model_config_frame, afc_order, spectralformat_frame,
00613 arclist_frame, afc_xmin, afc_ymin,
00614 instrument));
00615
00616
00617 check( xsh_detect_arclines( afcatt_rmdark, afcthetab_frame,
00618 arclist_frame, NULL, NULL,
00619 NULL, spectralformat_frame, NULL,
00620 &att_cleanlines, NULL, &att_resid_tab, XSH_SOLUTION_RELATIVE,
00621 detect_arclines_p, detect_arclines_clipping, instrument,RECIPE_ID));
00622
00623
00624 check( afc_wave_tab_frame = xsh_flexcor( afcatt_frame, wave_tab_frame,
00625 model_config_frame,
00626 order_tab_edges_frame, att_resid_tab,
00627 afc_xmin, afc_ymin, instrument,
00628 &afc_order_tab_edges_frame,
00629 &afc_config_tab_frame));
00630
00631 if(compute_disp_tab) {
00632 if(model_config_frame == NULL) {
00633
00634
00635 if ( wave_tab_frame != NULL){
00636 check( xsh_create_poly_wavemap( NULL, wave_tab_frame,
00637 afc_order_tab_edges_frame,
00638 spectralformat_frame,
00639 dispsol_param,
00640 instrument,
00641 "AFC_",
00642 &afc_disp_tab_frame, NULL));
00643
00644 tag = XSH_GET_TAG_FROM_ARM( XSH_DISP_TAB_AFC, instrument);
00645 check( cpl_frame_set_tag( afc_disp_tab_frame, tag));
00646 }
00647
00648 } else {
00649
00650 sprintf(slit_map_tag,"SLIT_MAP_%s",
00651 xsh_instrument_arm_tostring( instrument )) ;
00652
00653 sprintf(wave_map_tag,"WAVE_MAP_%s",
00654 xsh_instrument_arm_tostring( instrument )) ;
00655 check(xsh_create_model_map(model_config_frame,instrument,
00656 wave_map_tag,slit_map_tag,
00657 &wave_map_frame, &slit_map_frame));
00658
00659 check(afc_disp_tab_frame=xsh_create_dispersol_physmod(afcatt_rmdark,
00660 afc_order_tab_edges_frame,
00661 model_config_frame,
00662 wave_map_frame,
00663 slit_map_frame,
00664 dispsol_param,
00665 spectralformat_frame,
00666 instrument));
00667
00668 }
00669 }
00670
00671
00672
00673 xsh_msg("Saving products");
00674
00675 if ( afc_wave_tab_frame != NULL){
00676 check(xsh_add_product_table_multi( afc_wave_tab_frame, frameset,
00677 parameters, RECIPE_ID, instrument));
00678 }
00679 if ( afc_config_tab_frame != NULL){
00680 check(xsh_add_product_table_multi( afc_config_tab_frame, frameset,
00681 parameters, RECIPE_ID, instrument));
00682 }
00683
00684 if ( afc_order_tab_edges_frame != NULL){
00685 check(xsh_add_product_table_multi( afc_order_tab_edges_frame, frameset,
00686 parameters, RECIPE_ID, instrument));
00687 }
00688 if (afc_disp_tab_frame != NULL){
00689 check( xsh_add_product_table_multi( afc_disp_tab_frame, frameset,
00690 parameters, RECIPE_ID, instrument));
00691 }
00692
00693 xsh_msg("xsh_flexcomp success !!");
00694
00695 cleanup:
00696 xsh_end( RECIPE_ID, frameset, parameters);
00697
00698 XSH_FREE( detect_arclines_clipping);
00699 XSH_FREE( detect_arclines_p);
00700 XSH_FREE( dispsol_param);
00701
00702 xsh_free_frameset( &raws);
00703 xsh_free_frameset( &calib);
00704 xsh_free_frame( &subbias_frame);
00705 xsh_free_frame( &subdark_frame);
00706 xsh_free_frame( &afcatt_rmbias);
00707 xsh_free_frame( &afcatt_rmdark);
00708 xsh_free_frame( &att_resid_tab);
00709 xsh_free_frame( &att_cleanlines);
00710 xsh_free_frame( &afc_wave_tab_frame);
00711 xsh_free_frame( &afc_config_tab_frame);
00712 xsh_free_frame( &afc_order_tab_edges_frame);
00713 xsh_free_frame( &afc_disp_tab_frame);
00714 xsh_free_frame( &afcthetab_frame);
00715 xsh_instrument_free( &instrument);
00716 return;
00717 }
00718