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
00035 #ifdef HAVE_CONFIG_H
00036 # include <config.h>
00037 #endif
00038
00039
00040
00041 #include <math.h>
00042
00043
00044 #include <irplib_stdstar.h>
00045 #include <sinfo_cpl_size.h>
00046 #include "irplib_utils.h"
00047 #include "sinfo_dfs.h"
00048 #include "sinfo_tpl_utils.h"
00049
00050 #include "sinfo_new_stdstar.h"
00051 #include "sinfo_standstar_ini_by_cpl.h"
00052 #include "sinfo_pro_save.h"
00053 #include "sinfo_pfits.h"
00054 #include "sinfo_utilities_scired.h"
00055 #include "sinfo_spectrum_ops.h"
00056 #include "sinfo_hidden.h"
00057 #include "sinfo_functions.h"
00058 #include "sinfo_utl_efficiency.h"
00059 #include "sinfo_error.h"
00060 #include "sinfo_utils_wrappers.h"
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 int
00098 sinfo_new_stdstar(const char* plugin_id,
00099 cpl_parameterlist* config,
00100 cpl_frameset* sof,cpl_frameset* ref_set)
00101 {
00102
00103 cpl_errorstate clean_state = cpl_errorstate_get();
00104 standstar_config * cfg=NULL ;
00105 cpl_imagelist * cube=NULL ;
00106
00107 cpl_imagelist * list_object=NULL ;
00108 cpl_image ** spectrum=NULL ;
00109 cpl_image * img_spct=NULL ;
00110
00111
00112
00113 cpl_frameset* raw=NULL;
00114 cpl_frame* frame=NULL;
00115 cpl_image* std_med_ima=NULL;
00116 cpl_image* std_med_dup=NULL;
00117
00118 cpl_table* qclog_tbl=NULL;
00119 cpl_table* tbl_spectrum=NULL;
00120 cpl_propertylist* plist=NULL;
00121
00122
00123 char * name=NULL ;
00124 int fra=0;
00125 float exptime=0 ;
00126 double convfactor=0;
00127 double cleanfactor=0;
00128 float* factor=NULL;
00129
00130 char std_med_filename[MAX_NAME_SIZE];
00131 char std_cub_filename[MAX_NAME_SIZE];
00132
00133 double max_ima_cx=0;
00134 double max_ima_cy=0;
00135 cpl_size max_ima_x=0;
00136 cpl_size max_ima_y=0;
00137 double norm=0;
00138 double xcen=0;
00139 double ycen=0;
00140 double sig_x=0;
00141 double sig_y=0;
00142 double fwhm_x=0;
00143 double fwhm_y=0;
00144 double disp=0;
00145 double dispersion=0;
00146 int i=0;
00147 int wllx=0;
00148 int wlly=0;
00149 int wurx=0;
00150 int wury=0;
00151 int psf_sz=40;
00152 int qc_info=0;
00153 int ima_szx=0;
00154 int ima_szy=0;
00155 int check1=0;
00156 int check2=0;
00157 int check3=0;
00158 int check4=0;
00159 double xshift=0;
00160 double yshift=0;
00161
00162 float cenpix = 0;
00163 float cenLambda = 0;
00164
00165 int no=0;
00166 double lo_cut=0.;
00167 double hi_cut=0.;
00168
00169 const char* stdstars=NULL;
00170 const char* sed=NULL;
00171 cpl_frame* frm_sci=NULL;
00172 cpl_frame* frm_atmext=NULL;
00173 cpl_frame* frm_std_cat=NULL;
00174 cpl_table* tot_eff=NULL;
00175 double fpar[7];
00176 double dpar[7];
00177 int mpar[7];
00178 int do_compute_eff=0;
00179 cpl_parameter* p=NULL;
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 check_nomsg(raw=cpl_frameset_new());
00194
00195 cknull(cfg=sinfo_parse_cpl_input_standstar(config,sof,&raw),
00196 "could not parse cpl input!") ;
00197
00198
00199 cknull_nomsg(p = cpl_parameterlist_find(config,
00200 "sinfoni.std_star.compute_eff"));
00201
00202 check_nomsg(do_compute_eff = cpl_parameter_get_bool(p));
00203 cknull(list_object = cpl_imagelist_new (),
00204 "could not allocate memory");
00205
00206
00207 sed = sinfo_extract_filename(sof, SINFO_CALIB_SED) ;
00208 stdstars = sinfo_extract_filename(sof, SINFO_CALIB_STDSTARS) ;
00209
00210
00211 if (cfg->convInd == 1) {
00212 factor = sinfo_new_floatarray(cfg->nframes);
00213 }
00214
00215 if(NULL != cpl_frameset_find(sof,PRO_COADD_STD)) {
00216 frame = cpl_frameset_find(sof,PRO_COADD_STD);
00217 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00218 } else if(NULL != cpl_frameset_find(sof,PRO_COADD_PSF)) {
00219 frame = cpl_frameset_find(sof,PRO_COADD_PSF);
00220 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00221 } else if(NULL != cpl_frameset_find(sof,PRO_COADD_OBJ)) {
00222 frame = cpl_frameset_find(sof,PRO_COADD_OBJ);
00223 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00224 } else if(NULL != cpl_frameset_find(sof,PRO_COADD_PUPIL)) {
00225 frame = cpl_frameset_find(sof,PRO_COADD_PUPIL);
00226 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00227 } else {
00228 sinfo_msg_error("Frame %s, %s, %s or %s not found! Exit!",
00229 PRO_COADD_STD,PRO_COADD_PSF,
00230 PRO_COADD_OBJ,PRO_COADD_PUPIL );
00231 goto cleanup;
00232 }
00233
00234
00235 cknull(plist = cpl_propertylist_load(std_cub_filename, 0),
00236 "getting header from reference ima frame %s",std_cub_filename);
00237
00238 cenpix = sinfo_pfits_get_crpix3(plist);
00239 cenLambda = sinfo_pfits_get_crval3(plist);
00240 dispersion = sinfo_pfits_get_cdelt3(plist);
00241
00242
00243 if (sinfo_propertylist_has(plist, KEY_NAME_CDELT3)) {
00244 disp=cpl_propertylist_get_double(plist, KEY_NAME_CDELT3);
00245 } else {
00246 sinfo_msg_warning("Keyword %s not found.",KEY_NAME_CDELT3);
00247 }
00248
00249
00250 sinfo_free_propertylist(&plist) ;
00251
00252
00253
00254
00255 if(NULL != cpl_frameset_find(sof,PRO_MED_COADD_STD)) {
00256 frame = cpl_frameset_find(sof,PRO_MED_COADD_STD);
00257 strcpy(std_med_filename,cpl_frame_get_filename(frame));
00258 check_nomsg(std_med_ima=cpl_image_load(std_med_filename,
00259 CPL_TYPE_FLOAT,0,0));
00260 } else if(NULL != cpl_frameset_find(sof,PRO_OBS_STD)) {
00261 check_nomsg(frame = cpl_frameset_find(sof,PRO_OBS_STD));
00262 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00263 check_nomsg(cube = cpl_imagelist_load(std_cub_filename,
00264 CPL_TYPE_FLOAT,0));
00265 strcpy(std_med_filename,STDSTAR_OUT_MED_CUBE);
00266 check_nomsg(std_med_ima=cpl_imagelist_collapse_median_create(cube));
00267 sinfo_free_imagelist(&cube);
00268
00269 ck0(sinfo_pro_save_ima(std_med_ima,ref_set,sof,STDSTAR_OUT_MED_CUBE,
00270 PRO_MED_OBS_PSF,NULL,plugin_id,config),
00271 "Error saving image %s tag %s",STDSTAR_OUT_MED_CUBE,PRO_MED_OBS_PSF);
00272
00273 } else if(NULL != cpl_frameset_find(sof,PRO_MED_COADD_PSF)) {
00274 check_nomsg(frame = cpl_frameset_find(sof,PRO_MED_COADD_PSF));
00275 strcpy(std_med_filename,cpl_frame_get_filename(frame));
00276 check_nomsg(std_med_ima=cpl_image_load(std_med_filename,
00277 CPL_TYPE_FLOAT,0,0));
00278 } else if(NULL != cpl_frameset_find(sof,PRO_OBS_PSF)) {
00279 check_nomsg(frame = cpl_frameset_find(sof,PRO_OBS_PSF));
00280 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00281 check_nomsg(cube=cpl_imagelist_load(std_cub_filename,CPL_TYPE_FLOAT,0));
00282 strcpy(std_med_filename,STDSTAR_OUT_MED_CUBE);
00283 check_nomsg(std_med_ima=cpl_imagelist_collapse_median_create(cube));
00284 sinfo_free_imagelist(&cube);
00285
00286 ck0(sinfo_pro_save_ima(std_med_ima,ref_set,sof,STDSTAR_OUT_MED_CUBE,
00287 PRO_MED_OBS_PSF,NULL,plugin_id,config),
00288 "Error saving image %s tag %s",STDSTAR_OUT_MED_CUBE,PRO_MED_OBS_PSF);
00289
00290 } else if(NULL != cpl_frameset_find(sof,PRO_MED_COADD_OBJ)) {
00291 check_nomsg(frame = cpl_frameset_find(sof,PRO_MED_COADD_OBJ));
00292 strcpy(std_med_filename,cpl_frame_get_filename(frame));
00293 check_nomsg(std_med_ima=cpl_image_load(std_med_filename,
00294 CPL_TYPE_FLOAT,0,0));
00295 } else if(NULL != cpl_frameset_find(sof,PRO_OBS_OBJ)) {
00296 check_nomsg(frame = cpl_frameset_find(sof,PRO_OBS_OBJ));
00297 strcpy(std_cub_filename,cpl_frame_get_filename(frame));
00298 check_nomsg(cube = cpl_imagelist_load(std_cub_filename,
00299 CPL_TYPE_FLOAT,0));
00300 strcpy(std_med_filename,STDSTAR_OUT_MED_CUBE);
00301 check_nomsg(std_med_ima=cpl_imagelist_collapse_median_create(cube));
00302 sinfo_free_imagelist(&cube);
00303
00304 ck0(sinfo_pro_save_ima(std_med_ima,ref_set,sof,STDSTAR_OUT_MED_CUBE,
00305 PRO_MED_OBS_OBJ,NULL,plugin_id,config),
00306 "Error saving image %s tag %s",STDSTAR_OUT_MED_CUBE,PRO_MED_OBS_OBJ);
00307 } else {
00308 sinfo_msg_error("Frame %s %s %s %s %s %s not found! Exit!",
00309 PRO_MED_COADD_STD, PRO_OBS_STD,
00310 PRO_MED_COADD_PSF, PRO_OBS_PSF,
00311 PRO_MED_COADD_OBJ, PRO_OBS_OBJ);
00312 goto cleanup;
00313 }
00314
00315
00316 check_nomsg(std_med_dup=cpl_image_duplicate(std_med_ima));
00317 sinfo_clean_nan(&std_med_dup);
00318 check_nomsg(cpl_image_get_maxpos(std_med_dup,&max_ima_x,&max_ima_y));
00319 sinfo_free_image(&std_med_dup);
00320
00321
00322 ima_szx=cpl_image_get_size_x(std_med_ima);
00323 ima_szy=cpl_image_get_size_y(std_med_ima);
00324 wllx= ((max_ima_x-psf_sz)>0) ? (max_ima_x-psf_sz) : 1;
00325 wlly= ((max_ima_y-psf_sz)>0) ? (max_ima_y-psf_sz) : 1;
00326 wurx= ((max_ima_x+psf_sz)<ima_szx) ? (max_ima_x+psf_sz) : ima_szx ;
00327 wury= ((max_ima_y+psf_sz)<ima_szy) ? (max_ima_y+psf_sz) : ima_szy ;
00328
00329
00330
00331
00332
00333 check_nomsg(qclog_tbl = sinfo_qclog_init());
00334 check_nomsg(max_ima_cx=cpl_image_get_centroid_x_window(std_med_ima,wllx,
00335 wlly,wurx,wury));
00336 check_nomsg(max_ima_cy=cpl_image_get_centroid_y_window(std_med_ima,wllx,
00337 wlly,wurx,wury));
00338
00339
00340 xshift=max_ima_cx-ima_szx/2;
00341 yshift=max_ima_cy-ima_szy/2;
00342
00343 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC SHIFTX",xshift,
00344 "X shift centroid - center image","%f"));
00345
00346 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC SHIFTY",yshift,
00347 "Y shift centroid - center image","%f"));
00348
00349 if(
00350 ((max_ima_x-psf_sz) < 1) ||
00351 ((max_ima_y-psf_sz) < 1) ||
00352 ((max_ima_x+psf_sz) > ima_szx) ||
00353 ((max_ima_x+psf_sz) > ima_szy)
00354 )
00355 {
00356 psf_sz = (psf_sz < (max_ima_x-1)) ? psf_sz : (max_ima_x-1);
00357 psf_sz = (psf_sz < (max_ima_y-1)) ? psf_sz : (max_ima_y-1);
00358 psf_sz = (psf_sz < ima_szx-max_ima_x) ? psf_sz : (ima_szx-max_ima_x);
00359 psf_sz = (psf_sz < ima_szy-max_ima_y) ? psf_sz : (ima_szy-max_ima_y);
00360
00361 psf_sz = (psf_sz > 4) ? psf_sz : 4;
00362 }
00363
00364
00365 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC FWHM LLX",cfg->llx,
00366 "STD star FWHM LLX","%d"));
00367 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC FWHM LLY",cfg->lly,
00368 "STD star FWHM LLY","%d"));
00369 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC FWHM HBX",cfg->halfbox_x,
00370 "STD star FWHM HBX","%d"));
00371 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC FWHM HBX",cfg->halfbox_y,
00372 "STD star FWHM HBY","%d"));
00373
00374
00375
00376 for ( i = 0 ; i < 7 ; i++ )
00377 {
00378 mpar[i] = 1 ;
00379 }
00380
00381
00382 if(-1 == sinfo_new_fit_2d_gaussian(std_med_ima,
00383 fpar,
00384 dpar,
00385 mpar,
00386 cfg->llx,
00387 cfg->lly,
00388 cfg->halfbox_x,
00389 cfg->halfbox_y,
00390 &check4 ) ) {
00391 irplib_error_recover(clean_state,"2d Gaussian fit failed");
00392
00393
00394 } else {
00395
00396 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC FWHM MAJ",fpar[4],
00397 "STD star FWHM on major axis","%f"));
00398 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC FWHM MIN",fpar[5],
00399 "STD star FWHM on minor axis","%f"));
00400 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC THETA",fpar[6],
00401 "STD star ellipsis angle theta","%f"));
00402
00403
00404 }
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414 if(CPL_ERROR_NONE == cpl_image_fit_gaussian(std_med_ima,
00415 max_ima_x,
00416 max_ima_y,
00417 psf_sz,
00418 &norm,
00419 &xcen,
00420 &ycen,
00421 &sig_x,
00422 &sig_y,
00423 &fwhm_x,
00424 &fwhm_y)) {
00425
00426
00427 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC FWHMX",fwhm_x,
00428 "STD star FWHM on X","%f"));
00429 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC FWHMY",fwhm_y,
00430 "STD star FWHM on Y","%f"));
00431
00432 cfg -> halfbox_x = (floor)(0.5*(fwhm_x+fwhm_y)*cfg->fwhm_factor+0.5);
00433
00434 cfg -> halfbox_y = (floor)(0.5*(fwhm_x+fwhm_y)*cfg->fwhm_factor+0.5);
00435
00436 } else {
00437
00438 irplib_error_recover(clean_state,"Problem fitting Gaussian");
00439 cpl_error_reset();
00440
00441 }
00442 sinfo_free_image(&std_med_ima);
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 cfg -> llx = (int)(xcen-cfg->halfbox_x);
00453 cfg -> llx = (cfg -> llx > 0 ) ? cfg -> llx : 1;
00454
00455 if((cfg->llx+2*cfg->halfbox_x) >= ima_szx) {
00456 cfg -> halfbox_x=(int) ((ima_szx-cfg->llx-1)/2);
00457 check1++;
00458 }
00459
00460 cfg -> lly = (int)(ycen-cfg->halfbox_y);
00461 cfg -> lly = (cfg -> lly > 0 ) ? cfg -> lly : 1;
00462 if((cfg->lly+2*cfg->halfbox_y) >= ima_szy) {
00463 cfg -> halfbox_y=(int) ((ima_szy-cfg->lly-1)/2);
00464 check1++;
00465 }
00466 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC CHECK1",check1,
00467 "Check on evaluation box","%d"));
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 sinfo_msg("Extraction");
00482 cknull(spectrum = (cpl_image**) cpl_calloc (cfg -> nframes,
00483 sizeof(cpl_image*)),
00484 "Could not allocate memory for spectrum image");
00485
00486 for (fra=0; fra < cfg->nframes; fra++) {
00487 name = cfg->inFrameList[fra];
00488 if(sinfo_is_fits_file(name) != 1) {
00489 sinfo_msg_error("Input file %s is not FITS",name);
00490 goto cleanup;
00491 }
00492 cknull(cube = cpl_imagelist_load(name,CPL_TYPE_FLOAT,0),
00493 "could not load data cube" );
00494
00495 if (exptime == FLAG) {
00496 sinfo_msg_error("could not find exposure time in the fits header");
00497 return -1;
00498 }
00499 exptime = sinfo_pfits_get_ditndit(name);
00500
00501 sinfo_msg("cfg->gain %f",cfg->gain);
00502 check_nomsg(tbl_spectrum=cpl_table_new(cpl_imagelist_get_size(cube)));
00503 if(NULL==(spectrum[fra]=sinfo_new_optimal_extraction_from_cube( cube,
00504 cfg->llx,
00505 cfg->lly,
00506 cfg->halfbox_x,
00507 cfg->halfbox_y,
00508 cfg->fwhm_factor,
00509 BKG_VARIANCE,
00510 SKY_FLUX,
00511 cfg->gain,
00512 exptime,
00513 name,
00514 &tbl_spectrum,
00515 qc_info,
00516 &check2))){
00517
00518 irplib_error_recover(clean_state,
00519 "could not do sinfo_optimalExtractionFromCube");
00520 } else {
00521 check_nomsg(cpl_imagelist_set(list_object,
00522 cpl_image_duplicate(spectrum[fra]), fra));
00523
00524 }
00525
00526
00527
00528 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC CHECK2",
00529 check2,"Check on evaluation box","%d"));
00530
00531
00532 ck0(sinfo_pro_save_tbl(tbl_spectrum,ref_set,sof,
00533 (char*)STDSTAR_OUT_TABLE,
00534 PRO_STD_STAR_SPECTRA,qclog_tbl,
00535 plugin_id,config),
00536 "cannot dump ima %s", "out_std_star_spectrum.fits");
00537
00538
00539 sinfo_free_table(&qclog_tbl);
00540
00541 if (do_compute_eff!=0 && frm_std_cat !=NULL && frm_atmext != NULL) {
00542 sinfo_msg("compute efficiency");
00543 frm_sci = cpl_frameset_find(sof,PRO_STD_STAR_SPECTRA);
00544 frm_std_cat = cpl_frameset_find(sof,FLUX_STD_CATALOG);
00545 frm_atmext = cpl_frameset_find(sof,EXTCOEFF_TABLE);
00546
00547
00548
00549 check_nomsg(tot_eff=sinfo_efficiency_compute(frm_sci,frm_std_cat,
00550 frm_atmext));
00551 ck0(sinfo_pro_save_tbl(tot_eff,ref_set,sof,(char*)EFFICIENCY_FILENAME,
00552 PRO_EFFICIENCY,qclog_tbl,plugin_id,config),
00553 "cannot dump ima %s", "out_.fits");
00554 }
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565 if (cfg->convInd == 1) {
00566 sinfo_msg("Determines convertion factor");
00567
00568 convfactor = sinfo_new_determine_conversion_factor( cube,
00569 cfg->mag,
00570 exptime,
00571 cfg->llx,
00572 cfg->lly,
00573 cfg->halfbox_x,
00574 cfg->halfbox_y,
00575 &check3 );
00576
00577
00578 if (convfactor < -100000.) {
00579 sinfo_msg_warning("could not do sinfo_determineConversionFactor!" );
00580
00581 } else {
00582 sinfo_new_array_set_value(factor, convfactor, fra);
00583 }
00584 }
00585 sinfo_free_imagelist(&cube);
00586 }
00587
00588 sinfo_free_table(&tbl_spectrum);
00589 sinfo_free_image_array(&spectrum,cfg->nframes);
00590 if (cfg->convInd == 1) {
00591 sinfo_msg("Determines clean factor");
00592 cleanfactor = sinfo_new_clean_mean(factor,
00593 cfg->nframes,
00594 cfg->lo_reject*100.,
00595 cfg->hi_reject*100.);
00596 }
00597 if (cleanfactor > 100000. || cleanfactor == FLAG) {
00598 sinfo_msg_error("could not do sinfo_clean_mean!" );
00599 goto cleanup;
00600 }
00601
00602
00603
00604 sinfo_msg("Average with rejection");
00605
00606 no=cpl_imagelist_get_size(list_object);
00607 lo_cut=(floor)(cfg->lo_reject*no+0.5);
00608 hi_cut=(floor)(cfg->hi_reject*no+0.5);
00609 if(no > 0) {
00610 cknull(img_spct=cpl_imagelist_collapse_minmax_create(list_object,
00611 lo_cut,hi_cut),
00612 "sinfo_average_with_rejection failed" );
00613 }
00614
00615 sinfo_free_imagelist(&list_object);
00616 if(no > 0) {
00617 check_nomsg(qclog_tbl = sinfo_qclog_init());
00618
00619 ck0_nomsg(sinfo_qclog_add_double(qclog_tbl,"QC CONVFCT",cleanfactor,
00620 "Conversion factor","%g"));
00621
00622 ck0_nomsg(sinfo_qclog_add_int(qclog_tbl,"QC CHECK3",check3,
00623 "Check evaluation box","%d"));
00624
00625
00626 ck0(sinfo_pro_save_ima(img_spct,ref_set,sof,cfg->outName,
00627 PRO_STD_STAR_SPECTRUM,qclog_tbl,
00628 plugin_id,config),
00629 "cannot dump ima %s", cfg->outName);
00630
00631 sinfo_new_set_wcs_spectrum(img_spct,cfg->outName,cenLambda,disp,cenpix);
00632 sinfo_free_table(&qclog_tbl);
00633 }
00634
00635 if(factor != NULL) sinfo_new_destroy_array(&factor);
00636 sinfo_free_image(&img_spct);
00637 sinfo_stdstar_free(&cfg);
00638 sinfo_free_frameset(&raw);
00639
00640 return 0;
00641
00642 cleanup:
00643 sinfo_free_table(&tbl_spectrum);
00644 sinfo_free_table(&qclog_tbl);
00645 sinfo_free_imagelist(&list_object);
00646 if(spectrum != NULL) sinfo_free_image_array(&spectrum,cfg->nframes);
00647 sinfo_free_image(&std_med_ima);
00648 sinfo_free_image(&std_med_dup);
00649 sinfo_free_imagelist(&cube);
00650 sinfo_free_propertylist(&plist) ;
00651 if(factor != NULL) sinfo_new_destroy_array(&factor);
00652 sinfo_free_image(&img_spct);
00653 sinfo_stdstar_free (&cfg);
00654 sinfo_free_frameset(&raw);
00655 return -1;
00656
00657 }
00658
00659