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
00030
00031
00032
00033
00034 #ifdef HAVE_CONFIG_H
00035 #include <config.h>
00036 #endif
00037
00038
00039
00040
00041 #include <string.h>
00042 #include <math.h>
00043
00044
00045 #include <cpl.h>
00046
00047 #include <xsh_dfs.h>
00048 #include <xsh_data_pre.h>
00049 #include <xsh_parameters.h>
00050 #include <xsh_drl.h>
00051 #include <xsh_msg.h>
00052 #include <xsh_pfits.h>
00053 #include <xsh_pfits_qc.h>
00054 #include <xsh_error.h>
00055 #include <xsh_utils_image.h>
00056 #include <xsh_data_atmos_ext.h>
00057
00058
00059
00060
00061
00062 #define RECIPE_ID "xsh_util_efficiency2d"
00063 #define RECIPE_AUTHOR "A.Modigliani"
00064 #define RECIPE_CONTACT "Andrea.Modigliani@eso.org"
00065 #define PRO_IMA "PRO_IMA_UVB"
00066 #define KEY_VALUE_HPRO_DID "PRO-1.15"
00067
00068 #define SPEED_LIGHT 2.99792458*1.E8
00069 #define TEL_AREA 51.2e4
00070
00071
00072
00073
00074 static int xsh_util_efficiency2d_create(cpl_plugin *) ;
00075 static int xsh_util_efficiency2d_exec(cpl_plugin *) ;
00076 static int xsh_util_efficiency2d_destroy(cpl_plugin *) ;
00077 static int xsh_util_efficiency2d(cpl_parameterlist *, cpl_frameset *) ;
00078
00079
00080
00081
00082
00083 static char
00084 xsh_util_efficiency2d_description_short[] = "Compute efficiency";
00085 static char xsh_util_efficiency2d_description[] =
00086 "This recipe compute efficiency.\n"
00087 "The input files should be tagged as: \n"
00088 "input observed spectrum: RAW_IMA_SLIT_arm,\n"
00089 "input reference spectrum: FLUX_STD_TABLE_arm,\n"
00090 "input atmospheric extintion table: EXTCOEFF_TABLE_arm)\n"
00091 "The output is a table with efficiency as function of wavelength\n"
00092 "Information on relevant parameters can be found with\n"
00093 "esorex --params xsh_util_efficiency2d\n"
00094 "esorex --help xsh_util_efficiency2d\n"
00095 "\n";
00096
00097
00098
00099
00100
00105
00106
00108
00116
00117 int cpl_plugin_get_info(cpl_pluginlist * list)
00118 {
00119 cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
00120 cpl_plugin * plugin = &recipe->interface ;
00121
00122 cpl_plugin_init(plugin,
00123 CPL_PLUGIN_API,
00124 XSH_BINARY_VERSION,
00125 CPL_PLUGIN_TYPE_RECIPE,
00126 RECIPE_ID,
00127 xsh_util_efficiency2d_description_short,
00128 xsh_util_efficiency2d_description,
00129 RECIPE_AUTHOR,
00130 RECIPE_CONTACT,
00131 xsh_get_license(),
00132 xsh_util_efficiency2d_create,
00133 xsh_util_efficiency2d_exec,
00134 xsh_util_efficiency2d_destroy) ;
00135
00136 cpl_pluginlist_append(list, plugin) ;
00137
00138 return 0;
00139 }
00140
00141
00150
00151 static int xsh_util_efficiency2d_create(cpl_plugin * plugin)
00152 {
00153 cpl_recipe * recipe ;
00154 cpl_parameter * p ;
00155
00156
00157 xsh_init();
00158
00159
00160 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00161 recipe = (cpl_recipe *)plugin ;
00162 else return -1 ;
00163 cpl_error_reset();
00164
00165
00166
00167 recipe->parameters = cpl_parameterlist_new() ;
00168
00169
00170
00171 check( xsh_parameters_generic(RECIPE_ID,
00172 recipe->parameters ) ) ;
00173 xsh_parameters_decode_bp(RECIPE_ID,recipe->parameters,-1);
00174
00175 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.sky1_lly",
00176 CPL_TYPE_INT,
00177 "Sky1 lly",
00178 "xsh.xsh_util_efficiency2d",2);
00179 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sky1_lly") ;
00180 cpl_parameterlist_append(recipe->parameters, p) ;
00181
00182
00183
00184
00185 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.sky1_ury",
00186 CPL_TYPE_INT,
00187 "Sky1 ury",
00188 "xsh.xsh_util_efficiency2d",20);
00189 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sky1_ury") ;
00190 cpl_parameterlist_append(recipe->parameters, p) ;
00191
00192
00193
00194
00195
00196 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.sky2_lly",
00197 CPL_TYPE_INT,
00198 "Sky2 lly",
00199 "xsh.xsh_util_efficiency2d",75);
00200 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sky2_lly") ;
00201 cpl_parameterlist_append(recipe->parameters, p) ;
00202
00203
00204
00205
00206 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.sky2_ury",
00207 CPL_TYPE_INT,
00208 "Sky ury",
00209 "xsh.xsh_util_efficiency2d",100);
00210 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sky2_ury") ;
00211 cpl_parameterlist_append(recipe->parameters, p) ;
00212
00213
00214
00215
00216
00217
00218 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.obj_lly",
00219 CPL_TYPE_INT,
00220 "Sky2 lly",
00221 "xsh.xsh_util_efficiency2d",22);
00222 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "obj_lly") ;
00223 cpl_parameterlist_append(recipe->parameters, p) ;
00224
00225
00226
00227
00228 p = cpl_parameter_new_value("xsh.xsh_util_efficiency2d.obj_ury",
00229 CPL_TYPE_INT,
00230 "Sky ury",
00231 "xsh.xsh_util_efficiency2d",70);
00232 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "obj_ury") ;
00233 cpl_parameterlist_append(recipe->parameters, p) ;
00234
00235
00236
00237
00238 cleanup:
00239
00240
00241 return 0;
00242 }
00243
00244
00250
00251 static int xsh_util_efficiency2d_exec(cpl_plugin * plugin)
00252 {
00253 cpl_recipe * recipe ;
00254 int code=0;
00255 cpl_errorstate initial_errorstate = cpl_errorstate_get();
00256
00257
00258 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00259 recipe = (cpl_recipe *)plugin ;
00260 else return -1 ;
00261 cpl_error_reset();
00262
00263 code = xsh_util_efficiency2d(recipe->parameters, recipe->frames) ;
00264
00265
00266 if (!cpl_errorstate_is_equal(initial_errorstate)) {
00267
00268
00269 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
00270 }
00271
00272 return code ;
00273 }
00274
00275
00281
00282 static int xsh_util_efficiency2d_destroy(cpl_plugin * plugin)
00283 {
00284 cpl_recipe * recipe ;
00285
00286
00287 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00288 recipe = (cpl_recipe *)plugin ;
00289 else return -1 ;
00290
00291 cpl_parameterlist_delete(recipe->parameters) ;
00292 return 0 ;
00293 }
00294
00295 static double
00296 xsh_table_get_interpolated(cpl_table* tbl,
00297 double wav,
00298 const char* colx,
00299 const char* coly)
00300 {
00301
00302 double y=0;
00303 double w1=0;
00304 double w2=0;
00305 double pos_y1=0;
00306 double pos_y2=0;
00307 float* pe=NULL;
00308 float* pw=NULL;
00309 int nrow=0;
00310 int i=0;
00311
00312
00313 w1=cpl_table_get_column_min(tbl,colx);
00314 w2=cpl_table_get_column_max(tbl,colx);
00315 pos_y1=cpl_table_get_column_min(tbl,coly);
00316 pos_y2=cpl_table_get_column_max(tbl,coly);
00317
00318
00319 pw=cpl_table_get_data_float(tbl,colx);
00320 pe=cpl_table_get_data_float(tbl,coly);
00321 nrow=cpl_table_get_nrow(tbl);
00322
00323
00324 for(i=0;i<nrow-1;i++) {
00325 if(pw[i]<wav) {
00326 w1=pw[i];
00327 w2=pw[i+1];
00328 pos_y1=pe[i];
00329 pos_y2=pe[i+1];
00330 }
00331 }
00332
00333 y=pos_y1+(pos_y2-pos_y1)/(w2-w1)*(wav-w1);
00334
00335
00336 return y;
00337
00338 }
00339
00340
00341
00348
00349 static int
00350 xsh_util_efficiency2d( cpl_parameterlist * parlist,
00351 cpl_frameset * frames)
00352 {
00353 const char* recipe_tags[1] = {XSH_RAW_IMA_SLIT};
00354 int recipe_tags_size = 1;
00355
00356 xsh_instrument* instrument=NULL;
00357 cpl_parameter * param= NULL ;
00358 cpl_frame* frm_sci=NULL;
00359 cpl_frame* frm_ref=NULL;
00360 cpl_frame* frm_atmext=NULL;
00361
00362 cpl_frameset* raws=NULL;
00363 cpl_frameset* calib=NULL;
00364
00365 cpl_image* ima_sci=NULL;
00366 cpl_table* tbl_ref=NULL;
00367 cpl_table* tbl_ext=NULL;
00368 cpl_table* tbl_atmext=NULL;
00369
00370 const char* name=NULL;
00371 double ref_wmin=0;
00372 double ref_wmax=0;
00373 double ext_wmin=0;
00374 double ext_wmax=0;
00375
00376 cpl_propertylist* plist=NULL;
00377 double crval1=0;
00378 double cdelt1=0;
00379 int naxis1=0;
00380 int nrow=0;
00381 double* pext=NULL;
00382 double* pcor=NULL;
00383 double* pref=NULL;
00384 double* peph=NULL;
00385 double aimprim=1.446;
00386
00387
00388 double exptime=600;
00389 cpl_vector* rec_profile=NULL;
00390 int i=0;
00391 double airmass=0;
00392 double airmass_start=0;
00393 double airmass_end=0;
00394
00395 double nm2AA=10.;
00396 int next=0;
00397 int nord=0;
00398 cpl_image* ima_ord=0;
00399 cpl_image* ima_obj=0;
00400 cpl_image* ima_sky1=0;
00401 cpl_image* ima_sky2=0;
00402 cpl_image* ima_sky=0;
00403 int sx=0;
00404 int obj_lly=37;
00405 int obj_ury=85;
00406
00407 int sky1_lly=20;
00408 int sky1_ury=35;
00409
00410
00411 int sky2_lly=90;
00412 int sky2_ury=105;
00413 cpl_table* obj_tab=NULL;
00414
00415 double * pobj=NULL;
00416 double * pw=NULL;
00417 double * pf=NULL;
00418 int * po=NULL;
00419 int k=0;
00420 int j=0;
00421 double wav=0;
00422 double gain=0;
00423 cpl_table* tbl_sel=NULL;
00424 int biny=1;
00425
00426 xsh_msg("Welcome to XSHOOTER Pipeline release %d.%d.%d",
00427 XSH_MAJOR_VERSION,XSH_MINOR_VERSION,XSH_MICRO_VERSION);
00428
00429
00430 check( xsh_begin( frames, parlist, &instrument, &raws, &calib,
00431 recipe_tags, recipe_tags_size,
00432 RECIPE_ID, XSH_BINARY_VERSION,
00433 xsh_util_efficiency2d_description_short ) ) ;
00434
00435
00436
00437 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.sky1_lly"));
00438 check(sky1_lly=cpl_parameter_get_int(param));
00439
00440 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.sky1_ury"));
00441 check(sky1_ury=cpl_parameter_get_int(param));
00442
00443
00444 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.sky2_lly"));
00445 check(sky2_lly=cpl_parameter_get_int(param));
00446
00447 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.sky2_ury"));
00448 check(sky2_ury=cpl_parameter_get_int(param));
00449
00450
00451
00452
00453 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.obj_lly"));
00454 check(obj_lly=cpl_parameter_get_int(param));
00455
00456 check(param=cpl_parameterlist_find(parlist,"xsh.xsh_util_efficiency2d.obj_ury"));
00457 check(obj_ury=cpl_parameter_get_int(param));
00458 xsh_msg("Obj extraction window: %d %d",obj_lly,obj_ury);
00459 xsh_msg("Sky1 extraction window: %d %d",sky1_lly,sky1_ury);
00460 xsh_msg("Sky2 extraction window: %d %d",sky2_lly,sky2_ury);
00461
00462
00463
00464
00465 check(frm_sci=xsh_find_frame_with_tag(raws,XSH_RAW_IMA_SLIT, instrument));
00466 check(frm_ref=xsh_find_frame_with_tag(calib,XSH_FLUX_STD_TAB,instrument));
00467 check(frm_atmext=xsh_find_frame_with_tag(calib,XSH_EXTCOEFF_TAB,instrument));
00468 check(next = cpl_frame_get_nextensions(frm_sci));
00469
00470 xsh_msg("next=%d",next);
00471 nord=(next+1)/3;
00472 name=cpl_frame_get_filename(frm_sci);
00473
00474 check(plist=cpl_propertylist_load(name,0));
00475 check(naxis1=xsh_pfits_get_naxis1(plist));
00476 check(airmass_start=xsh_pfits_get_airm_start(plist));
00477 check(airmass_end=xsh_pfits_get_airm_end(plist));
00478 if( xsh_instrument_get_arm(instrument) == XSH_ARM_NIR){
00479 gain=2.12;
00480 biny=1;
00481 check(exptime=xsh_pfits_get_dit(plist));
00482 } else {
00483 check(gain=xsh_pfits_get_conad(plist));
00484 check(biny=xsh_pfits_get_biny(plist));
00485 check(exptime=xsh_pfits_get_win1_dit1(plist));
00486 }
00487
00488 xsh_free_propertylist(&plist);
00489 airmass=0.5*(airmass_start+airmass_end);
00490
00491 xsh_msg("gain=%g airm=%g exptime=%g",gain,airmass,exptime);
00492
00493 xsh_msg("name=%s",name);
00494 nrow=naxis1*nord;
00495 obj_tab=cpl_table_new(nrow);
00496 cpl_table_new_column(obj_tab,"ORD",CPL_TYPE_INT);
00497 cpl_table_new_column(obj_tab,"WAVELENGTH",CPL_TYPE_DOUBLE);
00498 cpl_table_new_column(obj_tab,"FLUX",CPL_TYPE_DOUBLE);
00499
00500 check(po=cpl_table_get_data_int(obj_tab,"ORD"));
00501 check(pw=cpl_table_get_data_double(obj_tab,"WAVELENGTH"));
00502 check(pf=cpl_table_get_data_double(obj_tab,"FLUX"));
00503
00504 check(cpl_table_fill_column_window_int(obj_tab,"ORD",0,nrow,-1));
00505 check(cpl_table_fill_column_window_double(obj_tab,"WAVELENGTH",0,nrow,-1));
00506 check(cpl_table_fill_column_window_double(obj_tab,"FLUX",0,nrow,-1));
00507
00508
00509
00510
00511
00512
00513
00514
00515 xsh_msg("extract object");
00516 k=0;
00517 for(i=0;i<next;i+=3) {
00518 xsh_msg("processing extension %d",i);
00519 check(ima_ord=cpl_image_load(name,CPL_TYPE_DOUBLE,0,i));
00520 check(plist=cpl_propertylist_load(name,i));
00521 check(sx=cpl_image_get_size_x(ima_ord));
00522 check(ima_obj=cpl_image_collapse_window_create(ima_ord,1,obj_lly,
00523 sx,obj_ury,0));
00524 check(ima_sky1=cpl_image_collapse_window_create(ima_ord,1,sky1_lly,
00525 sx,sky1_ury,0));
00526 check(ima_sky2=cpl_image_collapse_window_create(ima_ord,1,sky2_lly,
00527 sx,sky2_ury,0));
00528 check(cpl_image_divide_scalar(ima_sky1,sky1_ury-sky1_lly+1));
00529 check(cpl_image_divide_scalar(ima_sky2,sky2_ury-sky2_lly+1));
00530
00531
00532 check(ima_sky=cpl_image_duplicate(ima_sky1));
00533 check(cpl_image_add(ima_sky,ima_sky2));
00534 check(cpl_image_divide_scalar(ima_sky,2));
00535 check(cpl_image_multiply_scalar(ima_sky,obj_ury-obj_lly+1));
00536 check(cpl_image_subtract(ima_obj,ima_sky));
00537
00538 check(pobj=cpl_image_get_data_double(ima_obj));
00539 check(crval1=xsh_pfits_get_crval1(plist));
00540 check(cdelt1=xsh_pfits_get_cdelt1(plist));
00541
00542
00543
00544 for(j=0;j<naxis1;j++) {
00545
00546 wav=crval1+cdelt1*j;
00547 pw[k+j]=wav;
00548 po[k+j]=i/3;
00549 if( ( xsh_instrument_get_arm(instrument) == XSH_ARM_NIR) &&
00550 ( (po[k+j]==3) ||(po[k+j]==8) ) ) {
00551 pf[k+j]=0;
00552 } else {
00553 pf[k+j]=pobj[j];
00554 }
00555 }
00556
00557 k+=naxis1;
00558 xsh_free_image(&ima_ord);
00559 xsh_free_image(&ima_obj);
00560 xsh_free_image(&ima_sky);
00561 xsh_free_image(&ima_sky);
00562 xsh_free_image(&ima_sky1);
00563 xsh_free_image(&ima_sky2);
00564 xsh_free_propertylist(&plist);
00565
00566
00567
00568 }
00569 xsh_msg("Extracted spectrum sampling bin=%g [nm]",cdelt1);
00570 check(name=cpl_frame_get_filename(frm_ref));
00571 check(tbl_ref=cpl_table_load(name,1,0));
00572
00573
00574
00575
00576
00577
00578
00579
00580 cpl_table_multiply_scalar(obj_tab,"WAVELENGTH",nm2AA);
00581
00582
00583 check(ref_wmin=cpl_table_get_column_min(tbl_ref,"WAVELENGTH"));
00584 check(ref_wmax=cpl_table_get_column_max(tbl_ref,"WAVELENGTH"));
00585 xsh_msg("Ref spectrum wmin=%g [A] wmax=%g [A]",ref_wmin,ref_wmax);
00586
00587 check(name=cpl_frame_get_filename(frm_atmext));
00588 check(tbl_atmext=cpl_table_load(name,1,0));
00589
00590
00591 check(ext_wmin=cpl_table_get_column_min(tbl_atmext,"LAMBDA"));
00592 check(ext_wmax=cpl_table_get_column_max(tbl_atmext,"LAMBDA"));
00593 xsh_msg("extinction wmin=%g [A] wmax=%g [A]",ext_wmin,ext_wmax);
00594
00595
00596 check(cpl_table_new_column(obj_tab,"REF",CPL_TYPE_DOUBLE));
00597 check(cpl_table_fill_column_window_double(obj_tab,"REF",0,nrow,-1));
00598
00599 check(cpl_table_new_column(obj_tab,"EXT",CPL_TYPE_DOUBLE));
00600 check(cpl_table_fill_column_window_double(obj_tab,"EXT",0,nrow,-1));
00601
00602 check(cpl_table_new_column(obj_tab,"COR",CPL_TYPE_DOUBLE));
00603 check(cpl_table_fill_column_window_double(obj_tab,"COR",0,nrow,-1));
00604
00605 check(cpl_table_new_column(obj_tab,"EPHOT",CPL_TYPE_DOUBLE));
00606 check(cpl_table_fill_column_window_double(obj_tab,"EPHOT",0,nrow,-1));
00607
00608
00609 check(pref=cpl_table_get_data_double(obj_tab,"REF"));
00610 check(pext=cpl_table_get_data_double(obj_tab,"EXT"));
00611 check(pcor=cpl_table_get_data_double(obj_tab,"COR"));
00612 check(peph=cpl_table_get_data_double(obj_tab,"EPHOT"));
00613
00614 check(pw=cpl_table_get_data_double(obj_tab,"WAVELENGTH"));
00615 check(pf=cpl_table_get_data_double(obj_tab,"FLUX"));
00616 xsh_msg("Resample atmosphere and std star");
00617 for(i=0;i<nrow;i++) {
00618
00619
00620 check(pext[i]=xsh_table_get_interpolated(tbl_atmext,pw[i],"LAMBDA",
00621 XSH_ATMOS_EXT_LIST_COLNAME_K));
00622
00623 check(pref[i]=xsh_table_get_interpolated(tbl_ref,pw[i],
00624 "WAVELENGTH","FLUX"));
00625
00626 pcor[i]=pow(10,(0.4*pext[i]*aimprim));
00627 if(airmass != 0) pcor[i]/=pow(10,(0.4*pext[i]*airmass));
00628 peph[i]=1.e7*1.986e-19/(pw[i]*1e-4);
00629
00630
00631 }
00632 xsh_msg("apply corrections");
00633 check(cpl_table_duplicate_column(obj_tab,"SRC_COR",obj_tab,"FLUX"));
00634 check(cpl_table_multiply_columns(obj_tab,"SRC_COR","COR"));
00635
00636
00637 cpl_table_divide_scalar(obj_tab,"SRC_COR",nm2AA);
00638 cpl_table_divide_scalar(obj_tab,"SRC_COR",cdelt1);
00639 cpl_table_divide_scalar(obj_tab,"SRC_COR",biny);
00640
00641 check(cpl_table_duplicate_column(obj_tab,"EFF",obj_tab,"SRC_COR"));
00642
00643 check(cpl_table_multiply_scalar(obj_tab,"EFF",gain));
00644 check(cpl_table_multiply_columns(obj_tab,"EFF","EPHOT"));
00645 check(cpl_table_divide_scalar(obj_tab,"EFF",exptime));
00646 check(cpl_table_divide_scalar(obj_tab,"EFF",TEL_AREA));
00647 check(cpl_table_divide_columns(obj_tab,"EFF","REF"));
00648
00649
00650 cpl_table_and_selected_double(obj_tab,"EFF",CPL_GREATER_THAN,1.e-5);
00651 cpl_table_and_selected_double(obj_tab,"EFF",CPL_LESS_THAN,1.);
00652 tbl_sel=cpl_table_extract_selected(obj_tab);
00653
00654
00655 check( cpl_table_save(tbl_sel, NULL, NULL,"eff.fits", CPL_IO_DEFAULT));
00656
00657
00658 xsh_free_table(&obj_tab);
00659
00660 cleanup:
00661 xsh_free_table(&tbl_sel);
00662 xsh_free_image(&ima_sci);
00663 xsh_free_table(&obj_tab);
00664 xsh_free_table(&tbl_ref);
00665 xsh_free_table(&tbl_ext);
00666 xsh_free_table(&tbl_atmext);
00667 xsh_free_vector(&rec_profile);
00668
00669 xsh_free_image(&ima_ord);
00670 xsh_free_image(&ima_obj);
00671 xsh_free_image(&ima_sky);
00672 xsh_free_image(&ima_sky);
00673 xsh_free_image(&ima_sky1);
00674 xsh_free_image(&ima_sky2);
00675 xsh_free_propertylist(&plist);
00676 xsh_free_frameset(&raws);
00677 xsh_free_frameset(&calib);
00678 xsh_instrument_free( &instrument);
00679
00680 if (cpl_error_get_code()) {
00681 return -1 ;
00682 } else {
00683 return 0 ;
00684 }
00685
00686 }