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 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036 #include "crires_recipe.h"
00037
00038 #include "irplib_wlxcorr.h"
00039
00040
00041
00042
00043
00044 #define RECIPE_STRING "crires_util_plot"
00045
00046
00047
00048
00049
00050 static int crires_util_plot_diff(const cpl_table *,const char *, const char *) ;
00051 static int crires_util_plot_spec_pix(cpl_table *, cpl_table *, int) ;
00052 static int crires_util_plot_spec_pix_one(cpl_table *, cpl_table *, int,
00053 const char *, const char *, const char *) ;
00054 static int crires_util_plot_spec_wl(cpl_table *, cpl_table *,
00055 const char *, int) ;
00056 static int crires_util_plot_convers(cpl_table *, cpl_table *,
00057 const char *, int) ;
00058 static int crires_util_plot_sensit(cpl_table *, cpl_table *,
00059 const char *, int) ;
00060 static int crires_util_plot_spec_wl_one(cpl_table *, cpl_table *,
00061 const char *, int, const char *, const char *, const char *) ;
00062
00063 static char crires_util_plot_description[] = "Plot the CRIRES tables.\n"
00064 "For MEF, specify the extension with --display=extension_number.\n"
00065 "This recipe accepts possibly 2 parameter:\n"
00066 "First parameter: the table to plot.\n"
00067 " (PRO TYPE = "CRIRES_PROTYPE_CATALOG") or\n"
00068 " (PRO TYPE = "CRIRES_PROTYPE_PHO_FLUX") or\n"
00069 " (PRO TYPE = "CRIRES_PROTYPE_SPEC_PIX") or\n"
00070 " (PRO TYPE = "CRIRES_PROTYPE_SPEC_WL") or\n"
00071 " (PRO TYPE = "CRIRES_PROTYPE_XCORR") or\n"
00072 " (PRO TYPE = "CRIRES_PROTYPE_CONVERS") or\n"
00073 " (PRO TYPE = "CRIRES_PROTYPE_SENSIT") or\n"
00074 " (PRO TYPE = "CRIRES_PROTYPE_FWHM")\n"
00075 "Second parameter is optional and must be of the same type and same\n"
00076 " table length as the first one. If provided, the two\n"
00077 " signals are overplotted. In this case, --adjust can \n"
00078 " be used to adjust the second plot average level to \n"
00079 " the first one.\n" ;
00080
00081 CRIRES_RECIPE_DEFINE(crires_util_plot,
00082 CRIRES_PARAM_PMIN |
00083 CRIRES_PARAM_PMAX |
00084 CRIRES_PARAM_DISPLAY |
00085 CRIRES_PARAM_WL_MODEL |
00086 CRIRES_PARAM_ADJUST,
00087 "Plotting tool for the CRIRES tables",
00088 crires_util_plot_description) ;
00089
00090
00091
00092
00093
00094 static struct {
00095
00096 int pmin ;
00097 int pmax ;
00098 int chip ;
00099 int use_model ;
00100 int adjust_level ;
00101 } crires_util_plot_config ;
00102
00103
00104
00105
00106
00107
00114
00115 static int crires_util_plot(
00116 cpl_frameset * frameset,
00117 const cpl_parameterlist * parlist)
00118 {
00119 const char * fname ;
00120 const char * fname_opt ;
00121 const char * title ;
00122 const char * sval ;
00123 cpl_propertylist * plist ;
00124 cpl_table * tab ;
00125 cpl_table * tab_opt ;
00126 cpl_array * wave ;
00127 cpl_array * flux ;
00128 cpl_vector * wave_vec ;
00129 cpl_vector * flux_vec ;
00130 cpl_bivector * flux_biv ;
00131 const char * wave_col ;
00132 int i ;
00133
00134
00135 crires_util_plot_config.pmin = crires_parameterlist_get_int(parlist,
00136 RECIPE_STRING, CRIRES_PARAM_PMIN) ;
00137 crires_util_plot_config.pmax = crires_parameterlist_get_int(parlist,
00138 RECIPE_STRING, CRIRES_PARAM_PMAX) ;
00139 crires_util_plot_config.chip = crires_parameterlist_get_int(parlist,
00140 RECIPE_STRING, CRIRES_PARAM_DISPLAY) ;
00141 crires_util_plot_config.use_model = crires_parameterlist_get_bool(parlist,
00142 RECIPE_STRING, CRIRES_PARAM_WL_MODEL) ;
00143 crires_util_plot_config.adjust_level=crires_parameterlist_get_bool(parlist,
00144 RECIPE_STRING, CRIRES_PARAM_ADJUST) ;
00145
00146
00147 if (crires_util_plot_config.use_model)
00148 wave_col = CRIRES_COL_WAVELENGTH_MODEL ;
00149 else
00150 wave_col = CRIRES_COL_WAVELENGTH ;
00151
00152
00153 if (crires_dfs_set_groups(frameset, NULL)) {
00154 cpl_msg_error(__func__, "Cannot identify RAW and CALIB frames") ;
00155 return -1 ;
00156 }
00157
00158
00159 fname = cpl_frame_get_filename(cpl_frameset_get_frame(frameset, 0)) ;
00160 if (cpl_frameset_get_size(frameset) > 1) {
00161 fname_opt = cpl_frame_get_filename(
00162 cpl_frameset_get_frame(frameset, 1)) ;
00163 } else {
00164 fname_opt = NULL ;
00165 }
00166
00167
00168 tab = crires_load_table_check(fname, 1, CRIRES_PROTYPE_CATALOG,
00169 crires_util_plot_config.pmin,
00170 crires_util_plot_config.pmax,
00171 crires_util_plot_config.use_model) ;
00172 if (tab != NULL) {
00173 plist = cpl_propertylist_load(fname, 0) ;
00174 sval = crires_pfits_get_procatg(plist) ;
00175
00176 if (!strcmp(sval, CRIRES_CALPRO_THAR_CAT))
00177 title = "t 'Thorium/Argon lines' w lines" ;
00178
00179 else if (!strcmp(sval, CRIRES_CALPRO_N2O_CAT))
00180 title = "t 'N2O gas cell lines' w lines" ;
00181
00182 else if (!strcmp(sval, CRIRES_CALPRO_OH_CAT))
00183 title = "t 'OH lines' w lines" ;
00184
00185 else if (!strcmp(sval, CRIRES_CALPRO_HITRAN_CAT))
00186 title = "t 'Hitran Spectrum' w lines" ;
00187
00188 else
00189 title = "t 'signal' w lines" ;
00190 cpl_propertylist_delete(plist) ;
00191
00192
00193 cpl_plot_column(
00194 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Emission';",
00195 title, "", tab, CRIRES_COL_WAVELENGTH, CRIRES_COL_EMISSION) ;
00196 cpl_table_delete(tab) ;
00197 }
00198
00199
00200 tab = crires_load_table_check(fname, 1, CRIRES_PROTYPE_PHO_FLUX,
00201 crires_util_plot_config.pmin,
00202 crires_util_plot_config.pmax,
00203 crires_util_plot_config.use_model) ;
00204 if (tab != NULL) {
00205 for (i=1 ; i<cpl_table_get_nrow(tab) ; i++) {
00206 wave=cpl_array_duplicate(
00207 cpl_table_get_array(tab, CRIRES_COL_PHOTOFLUX, 0));
00208 wave_vec = cpl_vector_wrap(cpl_array_get_size(wave),
00209 cpl_array_get_data_double(wave)) ;
00210 cpl_array_unwrap(wave) ;
00211 flux=cpl_array_duplicate(
00212 cpl_table_get_array(tab, CRIRES_COL_PHOTOFLUX, i));
00213 flux_vec = cpl_vector_wrap(cpl_array_get_size(flux),
00214 cpl_array_get_data_double(flux)) ;
00215 cpl_array_unwrap(flux) ;
00216 flux_biv=cpl_bivector_wrap_vectors(wave_vec, flux_vec) ;
00217
00218 cpl_plot_bivector(
00219 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Flux (Jy)';",
00220 "t 'Photspheric flux' w lines", "", flux_biv) ;
00221 cpl_bivector_delete(flux_biv) ;
00222 }
00223 cpl_table_delete(tab) ;
00224 }
00225
00226 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00227 CRIRES_PROTYPE_SPEC_PIX, crires_util_plot_config.pmin,
00228 crires_util_plot_config.pmax, crires_util_plot_config.use_model) ;
00229 if (fname_opt != NULL) {
00230 tab_opt = crires_load_table_check(fname_opt,
00231 crires_util_plot_config.chip, CRIRES_PROTYPE_SPEC_PIX,
00232 crires_util_plot_config.pmin, crires_util_plot_config.pmax,
00233 crires_util_plot_config.use_model);
00234 } else {
00235 tab_opt = NULL ;
00236 }
00237 if (tab != NULL) {
00238 crires_util_plot_spec_pix(tab, tab_opt,
00239 crires_util_plot_config.adjust_level) ;
00240 cpl_table_delete(tab) ;
00241 if (tab_opt != NULL) cpl_table_delete(tab_opt) ;
00242 }
00243
00244
00245 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00246 CRIRES_PROTYPE_SPEC_WL, crires_util_plot_config.pmin,
00247 crires_util_plot_config.pmax, crires_util_plot_config.use_model) ;
00248 if (fname_opt != NULL) {
00249 tab_opt = crires_load_table_check(fname_opt,
00250 crires_util_plot_config.chip, CRIRES_PROTYPE_SPEC_WL,
00251 crires_util_plot_config.pmin, crires_util_plot_config.pmax,
00252 crires_util_plot_config.use_model);
00253 } else {
00254 tab_opt = NULL ;
00255 }
00256 if (tab != NULL) {
00257 crires_util_plot_spec_wl(tab, tab_opt, wave_col,
00258 crires_util_plot_config.adjust_level) ;
00259 cpl_table_delete(tab) ;
00260 if (tab_opt != NULL) cpl_table_delete(tab_opt) ;
00261 }
00262
00263
00264 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00265 CRIRES_PROTYPE_XCORR,
00266 crires_util_plot_config.pmin,
00267 crires_util_plot_config.pmax,
00268 crires_util_plot_config.use_model) ;
00269 if (tab != NULL) {
00270 irplib_wlxcorr_plot_spc_table(tab, "", 1, 5) ;
00271 }
00272
00273
00274 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00275 CRIRES_PROTYPE_CONVERS, crires_util_plot_config.pmin,
00276 crires_util_plot_config.pmax, crires_util_plot_config.use_model) ;
00277 if (fname_opt != NULL) {
00278 tab_opt = crires_load_table_check(fname_opt,
00279 crires_util_plot_config.chip, CRIRES_PROTYPE_CONVERS,
00280 crires_util_plot_config.pmin, crires_util_plot_config.pmax,
00281 crires_util_plot_config.use_model);
00282 } else {
00283 tab_opt = NULL ;
00284 }
00285 if (tab != NULL) {
00286 crires_util_plot_convers(tab, tab_opt, wave_col,
00287 crires_util_plot_config.adjust_level) ;
00288 cpl_table_delete(tab) ;
00289 if (tab_opt != NULL) cpl_table_delete(tab_opt) ;
00290 }
00291
00292
00293 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00294 CRIRES_PROTYPE_SENSIT, crires_util_plot_config.pmin,
00295 crires_util_plot_config.pmax, crires_util_plot_config.use_model) ;
00296 if (fname_opt != NULL) {
00297 tab_opt = crires_load_table_check(fname_opt,
00298 crires_util_plot_config.chip, CRIRES_PROTYPE_SENSIT,
00299 crires_util_plot_config.pmin, crires_util_plot_config.pmax,
00300 crires_util_plot_config.use_model);
00301 } else {
00302 tab_opt = NULL ;
00303 }
00304 if (tab != NULL) {
00305 crires_util_plot_sensit(tab, tab_opt, wave_col,
00306 crires_util_plot_config.adjust_level) ;
00307 cpl_table_delete(tab) ;
00308 if (tab_opt != NULL) cpl_table_delete(tab_opt) ;
00309 }
00310
00311
00312 tab = crires_load_table_check(fname, crires_util_plot_config.chip,
00313 CRIRES_PROTYPE_FWHM, crires_util_plot_config.pmin,
00314 crires_util_plot_config.pmax, crires_util_plot_config.use_model) ;
00315 if (tab != NULL) {
00316 cpl_plot_column(
00317 "set grid;set xlabel 'Position (pixels)';set ylabel 'FWHM (pixels)';",
00318 "t 'FWHM' w lines", "", tab,
00319 CRIRES_COL_WL_DETPOSX, CRIRES_COL_FWHM) ;
00320 cpl_plot_column(
00321 "set grid;set xlabel 'Position (pixels)';set ylabel 'Y position (pixels)';",
00322 "t 'Y position' w lines", "", tab,
00323 CRIRES_COL_WL_DETPOSX, CRIRES_COL_DETPOSY) ;
00324 cpl_table_delete(tab) ;
00325 }
00326
00327
00328 if (cpl_error_get_code())
00329 return -1 ;
00330 else
00331 return 0 ;
00332 }
00333
00334 static int crires_util_plot_diff(
00335 const cpl_table * tab,
00336 const char * col1,
00337 const char * col2)
00338 {
00339 cpl_bivector * toplot ;
00340 cpl_vector * vec_x ;
00341 cpl_vector * vec_tmp ;
00342 cpl_vector * vec_y ;
00343 int nrows ;
00344 double val ;
00345 int i ;
00346
00347
00348 if (tab == NULL) return -1 ;
00349 if (!cpl_table_has_column(tab, col1)) return -1 ;
00350 if (!cpl_table_has_column(tab, col2)) return -1 ;
00351
00352
00353 nrows = cpl_table_get_nrow(tab) ;
00354
00355
00356 vec_x = cpl_vector_wrap(nrows,
00357 cpl_table_get_data_double((cpl_table*)tab, col1)) ;
00358 vec_tmp = cpl_vector_wrap(nrows,
00359 cpl_table_get_data_double((cpl_table*)tab, col2)) ;
00360
00361
00362 vec_y = cpl_vector_duplicate(vec_x) ;
00363 cpl_vector_subtract(vec_y, vec_tmp) ;
00364 cpl_vector_unwrap(vec_tmp) ;
00365
00366
00367 for (i=0 ; i<cpl_vector_get_size(vec_y) ; i++) {
00368 if (fabs(cpl_vector_get(vec_y, i)) > 100) {
00369 if (i==0) val = cpl_vector_get(vec_y, 10) ;
00370 else val = cpl_vector_get(vec_y, i-1) ;
00371 cpl_vector_set(vec_y, i, val) ;
00372 }
00373 }
00374
00375 toplot = cpl_bivector_wrap_vectors(vec_x, vec_y) ;
00376
00377
00378 cpl_plot_bivector(
00379 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Wave diff (nm)';",
00380 "t 'Wavelength difference XC-model' w lines", "", toplot) ;
00381
00382
00383 cpl_bivector_unwrap_vectors(toplot) ;
00384 cpl_vector_unwrap(vec_x) ;
00385 cpl_vector_delete(vec_y) ;
00386
00387 return 0 ;
00388 }
00389
00390 static int crires_util_plot_spec_pix(
00391 cpl_table * tab,
00392 cpl_table * tab_opt,
00393 int adjust_level)
00394 {
00395
00396 if (cpl_table_get_nrow(tab) == 0) {
00397 return 0 ;
00398 }
00399
00400
00401 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00402 CRIRES_COL_EXTRACT_INT_OPT,
00403 "set grid;set xlabel 'Position (pixels)';set ylabel 'Intensity OPT (ADU/sec)';",
00404 "t 'Extracted Spectrum OPT' w lines") ;
00405
00406
00407 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00408 CRIRES_COL_EXTRACT_INT_RECT,
00409 "set grid;set xlabel 'Position (pixels)';set ylabel 'Intensity RECT (ADU/sec)';",
00410 "t 'Extracted Spectrum RECT' w lines") ;
00411
00412
00413 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00414 CRIRES_COL_EXTRACT_ERR_OPT,
00415 "set grid;set xlabel 'Position (pixels)';set ylabel 'Error OPT (ADU/sec)';",
00416 "t 'Error OPT' w lines") ;
00417
00418
00419 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00420 CRIRES_COL_EXTRACT_ERR_RECT,
00421 "set grid;set xlabel 'Position (pixels)';set ylabel 'Error RECT (ADU/sec)';",
00422 "t 'Error RECT' w lines") ;
00423
00424
00425 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00426 CRIRES_COL_EXTRACT_WN_OPT,
00427 "set grid;set xlabel 'Position (pixels)';set ylabel 'Weight Norm OPT';",
00428 "t 'Weight norm OPT' w lines") ;
00429
00430
00431 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00432 CRIRES_COL_EXTRACT_WN_RECT,
00433 "set grid;set xlabel 'position (pixels)';set ylabel 'weight norm rect';",
00434 "t 'weight norm rect' w lines") ;
00435
00436
00437 crires_util_plot_spec_pix_one(tab, tab_opt, adjust_level,
00438 CRIRES_COL_EXTRACT_BG_NOISE,
00439 "set grid;set xlabel 'Position (pixels)';set ylabel 'Background noise';",
00440 "t 'Background noise' w lines") ;
00441
00442 return 0 ;
00443 }
00444
00445 static int crires_util_plot_spec_pix_one(
00446 cpl_table * tab,
00447 cpl_table * tab_opt,
00448 int adjust_level,
00449 const char * y_col,
00450 const char * options,
00451 const char * title)
00452 {
00453 double mean1, mean2 ;
00454 int nrows ;
00455 cpl_vector ** vectors ;
00456
00457
00458 if (tab == NULL) return -1 ;
00459 nrows = cpl_table_get_nrow(tab) ;
00460 if (tab_opt != NULL) {
00461 if (cpl_table_get_nrow(tab_opt) != nrows) {
00462 cpl_msg_error(__func__,
00463 "The two tables must have the same number of rows") ;
00464 return -1 ;
00465 }
00466 }
00467
00468 vectors = cpl_malloc(3*sizeof(cpl_vector*)) ;
00469 vectors[0] = NULL ;
00470 vectors[1] = cpl_vector_wrap(nrows, cpl_table_get_data_double(tab, y_col)) ;
00471 if (tab_opt != NULL) {
00472 vectors[2] = cpl_vector_wrap(nrows,
00473 cpl_table_get_data_double(tab_opt, y_col));
00474 if (adjust_level) {
00475 mean1 = cpl_vector_get_mean(vectors[1]) ;
00476 mean2 = cpl_vector_get_mean(vectors[2]) ;
00477 cpl_vector_multiply_scalar(vectors[2], fabs(mean1/mean2)) ;
00478 }
00479 cpl_plot_vectors(options, title, "", (const cpl_vector **)vectors, 3);
00480 cpl_vector_unwrap(vectors[2]) ;
00481 } else {
00482 cpl_plot_vector(options, title, "", vectors[1]) ;
00483 }
00484 cpl_vector_unwrap(vectors[1]) ;
00485 cpl_free(vectors) ;
00486 return 0 ;
00487 }
00488
00489 static int crires_util_plot_spec_wl(
00490 cpl_table * tab,
00491 cpl_table * tab_opt,
00492 const char * wave_col,
00493 int adjust_level)
00494 {
00495
00496 if (cpl_table_get_nrow(tab) == 0) {
00497 return 0 ;
00498 }
00499
00500
00501 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00502 CRIRES_COL_EXTRACT_INT_OPT,
00503 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Intensity OPT (ADU/sec)';",
00504 "t 'Extracted Spectrum OPT' w lines") ;
00505
00506
00507 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00508 CRIRES_COL_EXTRACT_INT_RECT,
00509 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Intensity RECT (ADU/sec)';",
00510 "t 'Extracted Spectrum RECT' w lines") ;
00511
00512
00513 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00514 CRIRES_COL_EXTRACT_ERR_OPT,
00515 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Error OPT (ADU/sec)';",
00516 "t 'Error OPT' w lines") ;
00517
00518
00519 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00520 CRIRES_COL_EXTRACT_ERR_RECT,
00521 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Error RECT (ADU/sec)';",
00522 "t 'Error RECT' w lines") ;
00523
00524
00525 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00526 CRIRES_COL_EXTRACT_WN_OPT,
00527 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Weight Norm OPT';",
00528 "t 'Weight Norm OPT' w lines") ;
00529
00530
00531 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00532 CRIRES_COL_EXTRACT_WN_RECT,
00533 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Weight Norm RECT';",
00534 "t 'Weight Norm RECT' w lines") ;
00535
00536
00537 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00538 CRIRES_COL_EXTRACT_BG_NOISE,
00539 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Background noise';",
00540 "t 'Background noise' w lines") ;
00541
00542
00543 crires_util_plot_diff(tab, CRIRES_COL_WAVELENGTH,
00544 CRIRES_COL_WAVELENGTH_MODEL) ;
00545
00546 return 0 ;
00547 }
00548
00549 static int crires_util_plot_spec_wl_one(
00550 cpl_table * tab,
00551 cpl_table * tab_opt,
00552 const char * wave_col,
00553 int adjust_level,
00554 const char * y_col,
00555 const char * options,
00556 const char * title)
00557 {
00558 double mean1, mean2 ;
00559 int nrows ;
00560 cpl_vector ** vectors ;
00561
00562
00563 if (tab == NULL) return -1 ;
00564 nrows = cpl_table_get_nrow(tab) ;
00565 if (tab_opt != NULL) {
00566 if (cpl_table_get_nrow(tab_opt) != nrows) {
00567 cpl_msg_error(__func__,
00568 "The two tables must have the same number of rows") ;
00569 return -1 ;
00570 }
00571 }
00572
00573 if (tab_opt != NULL) {
00574 vectors = cpl_malloc(3*sizeof(cpl_vector*)) ;
00575 vectors[0]=cpl_vector_wrap(nrows,cpl_table_get_data_double(tab,
00576 wave_col));
00577 vectors[1] = cpl_vector_wrap(nrows,
00578 cpl_table_get_data_double(tab, y_col)) ;
00579 vectors[2] = cpl_vector_wrap(nrows,
00580 cpl_table_get_data_double(tab_opt, y_col));
00581 if (adjust_level) {
00582 mean1 = cpl_vector_get_mean(vectors[1]) ;
00583 mean2 = cpl_vector_get_mean(vectors[2]) ;
00584 cpl_vector_multiply_scalar(vectors[2], fabs(mean1/mean2)) ;
00585 }
00586 cpl_plot_vectors(options, title, "", (const cpl_vector **)vectors, 3);
00587 cpl_vector_unwrap(vectors[0]) ;
00588 cpl_vector_unwrap(vectors[1]) ;
00589 cpl_vector_unwrap(vectors[2]) ;
00590 cpl_free(vectors) ;
00591 } else {
00592 cpl_plot_column(options, title, "", tab, wave_col, y_col) ;
00593 }
00594 return 0 ;
00595 }
00596
00597 static int crires_util_plot_convers(
00598 cpl_table * tab,
00599 cpl_table * tab_opt,
00600 const char * wave_col,
00601 int adjust_level)
00602 {
00603
00604 if (cpl_table_get_nrow(tab) == 0) {
00605 return 0 ;
00606 }
00607
00608
00609 if (crires_util_plot_spec_wl(tab, tab_opt, wave_col, adjust_level) == -1)
00610 return -1 ;
00611
00612
00613 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00614 CRIRES_COL_CONVERSION_OPT,
00615 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Conversion OPT (ADU/sec/Jy)';",
00616 "t 'Conversion factor OPT' w lines") ;
00617
00618
00619 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00620 CRIRES_COL_CONVERSION_RECT,
00621 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Conversion RECT (ADU/sec/Jy)';",
00622 "t 'Conversion factor RECT' w lines") ;
00623
00624
00625 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00626 CRIRES_COL_THROUGHPUT,
00627 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Throughput (e-/phot)';",
00628 "t 'Throughput' w lines") ;
00629 return 0 ;
00630 }
00631
00632 static int crires_util_plot_sensit(
00633 cpl_table * tab,
00634 cpl_table * tab_opt,
00635 const char * wave_col,
00636 int adjust_level)
00637 {
00638
00639 if (cpl_table_get_nrow(tab) == 0) {
00640 return 0 ;
00641 }
00642
00643
00644 if (crires_util_plot_convers(tab, tab_opt, wave_col, adjust_level) == -1)
00645 return -1 ;
00646
00647
00648 crires_util_plot_spec_wl_one(tab, tab_opt, wave_col, adjust_level,
00649 CRIRES_COL_SENSITIVITY,
00650 "set grid;set xlabel 'Wavelength (nm)';set ylabel 'Sensitivity (Jy/10sig/hour)';",
00651 "t 'Sensitivity' w lines") ;
00652 return 0 ;
00653 }
00654