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
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 #ifdef HAVE_CONFIG_H
00211 # include <config.h>
00212 #endif
00213
00214
00221
00222
00223
00224
00225
00226 #include <uves_mbias_impl.h>
00227
00228 #include <uves_utils.h>
00229 #include <uves_corrbadpix.h>
00230 #include <uves_parameters.h>
00231 #include <uves.h>
00232 #include <uves_dfs.h>
00233 #include <uves_pfits.h>
00234 #include <uves_qclog.h>
00235 #include <uves_recipe.h>
00236 #include <uves_utils_wrappers.h>
00237 #include <uves_error.h>
00238 #include <uves_msg.h>
00239
00240
00241 #include <cpl.h>
00242 #include <float.h>
00243 #include <ctype.h>
00244 #include <string.h>
00245
00246
00247
00248
00249 static void uves_mbias_qclog(const cpl_imagelist* raw_imgs,
00250 uves_propertylist **raw_headers,
00251 enum uves_chip chip,
00252 const cpl_image* mbia,
00253
00254
00255 cpl_table* qclog
00256 );
00257
00258 static void
00259 uves_mbias_qc_ron_raw(const cpl_image* rbia,
00260 enum uves_chip chip,
00261 const int x_cent_s,
00262 const int x_cent_e,
00263 const int y_cent_s,
00264 const int y_cent_e,
00265 cpl_table* qclog);
00266
00267 static int
00268 uves_mbias_define_parameters(cpl_parameterlist *parameters);
00269
00270
00271
00272
00273 #define cpl_plugin_get_info uves_mbias_get_info
00274 UVES_RECIPE_DEFINE(
00275 UVES_MBIAS_ID, UVES_MBIAS_DOM,
00276
00277
00278 uves_mbias_define_parameters,
00279 "Jonas M. Larsen", "cpl@eso.org",
00280 "Creates the master bias frame",
00281 "This recipe creates a master bias frame by computing the median of all input\n"
00282 "bias frames. All input frames must have same tag and size and must be either\n"
00283 "BIAS_BLUE or BIAS_RED.\n"
00284 "On blue input the recipe computes one master bias frame; on red input a \n"
00285 "master bias frame for each chip is produced. The average, standard deviation\n"
00286 "and median of the master bias image(s) are written to the FITS header(s)");
00287
00288
00289
00290
00291
00294
00301
00302 int uves_mbias_define_parameters_body(cpl_parameterlist *parameters,
00303 const char *recipe_id)
00304 {
00305
00306
00307
00308
00309 if (uves_define_global_parameters(parameters) != CPL_ERROR_NONE)
00310 {
00311 return -1;
00312 }
00313
00314
00315
00316
00317
00318 if (uves_corr_traps_define_parameters(parameters,recipe_id)
00319 != CPL_ERROR_NONE)
00320 {
00321 return -1;
00322 }
00323
00324
00325
00326
00327
00328 if (uves_master_stack_define_parameters(parameters,recipe_id)
00329 != CPL_ERROR_NONE)
00330 {
00331 return -1;
00332 }
00333
00334 return (cpl_error_get_code() != CPL_ERROR_NONE);
00335 }
00336
00337
00338
00339
00345
00346 static int
00347 uves_mbias_define_parameters(cpl_parameterlist *parameters)
00348 {
00349 return uves_mbias_define_parameters_body(parameters, make_str(UVES_MBIAS_ID));
00350 }
00351
00352
00353
00354
00355
00356
00373
00374 static cpl_image *
00375 uves_mbias_process_chip(const cpl_imagelist *raw_images,
00376 uves_propertylist **raw_headers,
00377 uves_propertylist *mbias_header,
00378 int binx, int biny,
00379 enum uves_chip chip,
00380 bool CLEAN_TRAPS,
00381 const char* STACK_METHOD,
00382 const double STACK_KLOW,
00383 const double STACK_KHIGH,
00384 const int STACK_NITER)
00385 {
00386 cpl_image *master_bias = NULL;
00387 double exposure_time = 0;
00388 int badpixels_cleaned;
00389 int i;
00390 int nraw=0;
00391 bool red_ccd_is_new=false;
00392 cpl_vector* bias_levels=NULL;
00393 double bias_mean=0;
00394 cpl_imagelist* tmp_images=NULL;
00395
00396 uves_msg("Calculating master bias...");
00397
00398 check_nomsg(red_ccd_is_new=uves_ccd_is_new(raw_headers[0]));
00399 check_nomsg(tmp_images=cpl_imagelist_duplicate(raw_images));
00400
00401 if(strcmp(STACK_METHOD,"MEDIAN")==0) {
00402 uves_msg("method median");
00403
00404 check_nomsg(bias_levels=uves_imagelist_get_clean_mean_levels(tmp_images,
00405 5.));
00406 bias_mean=cpl_vector_get_mean(bias_levels);
00407 uves_msg("Master bias mean level: %g",bias_mean);
00408 check_nomsg(uves_imagelist_subtract_values(&tmp_images,bias_levels));
00409
00410
00411 check( master_bias = cpl_imagelist_collapse_median_create(tmp_images),
00412 "Error computing median");
00413 cpl_image_add_scalar(master_bias,bias_mean);
00414 } else {
00415 uves_msg("method mean");
00416
00417 check_nomsg(bias_levels=uves_imagelist_get_clean_mean_levels(tmp_images,
00418 5.));
00419 bias_mean=cpl_vector_get_mean(bias_levels);
00420 uves_msg("Master bias mean level: %g",bias_mean);
00421 check_nomsg(uves_imagelist_subtract_values(&tmp_images,bias_levels));
00422
00423 check( master_bias = uves_ksigma_stack(tmp_images,STACK_KLOW,STACK_KHIGH,
00424 STACK_NITER),
00425 "Error computing master bias");
00426 cpl_image_add_scalar(master_bias,bias_mean);
00427 }
00428 uves_free_vector(&bias_levels);
00429 uves_free_imagelist(&tmp_images);
00430
00431
00432 exposure_time = 0;
00433 nraw=cpl_imagelist_get_size(raw_images);
00434 for (i = 0; i < nraw; i++)
00435 {
00436 check( exposure_time += uves_pfits_get_exptime(raw_headers[i]),
00437 "Error reading exposure time");
00438 }
00439 exposure_time /= nraw;
00440
00441 check( uves_pfits_set_exptime(mbias_header, exposure_time),
00442 "Error setting master bias exposure time");
00443 if(CLEAN_TRAPS) {
00444 check( badpixels_cleaned =
00445 uves_correct_badpix_all(master_bias, mbias_header,
00446 chip, binx, biny, false,red_ccd_is_new),
00447 "Error replacing bad pixels");
00448
00449 uves_msg("%d bad pixels replaced", badpixels_cleaned);
00450 }
00451
00452 cleanup:
00453 if (cpl_error_get_code() != CPL_ERROR_NONE)
00454 {
00455 uves_free_image(&master_bias);
00456 }
00457 uves_free_imagelist(&tmp_images);
00458
00459 return master_bias;
00460 }
00461
00462
00469
00470 static void
00471 UVES_CONCAT2X(UVES_MBIAS_ID,exe)(cpl_frameset *frames,
00472 const cpl_parameterlist *parameters,
00473 const char *starttime)
00474 {
00475 uves_mbias_exe_body(frames, parameters, starttime, make_str(UVES_MBIAS_ID));
00476 return;
00477 }
00478
00479
00490
00491 void
00492 uves_mbias_exe_body(cpl_frameset *frames,
00493 const cpl_parameterlist *parameters,
00494 const char *starttime,
00495 const char *recipe_id)
00496 {
00497
00498 cpl_imagelist *raw_images[2] = {NULL, NULL};
00499 uves_propertylist **raw_headers[2] = {NULL, NULL};
00500
00501 cpl_table* qclog[2] = {NULL, NULL};
00502
00503
00504 uves_propertylist *product_header[2] = {NULL, NULL};
00505 cpl_image *master_bias = NULL;
00506 cpl_stats *mbias_stats = NULL;
00507
00508
00509 char *product_filename = NULL;
00510 bool blue;
00511 enum uves_chip chip;
00512 int binx, biny;
00513 const char* PROCESS_CHIP=NULL;
00514 bool CLEAN_TRAPS;
00515 int raw_index = 0;
00516 int i=0;
00517
00518 const char* STACK_METHOD=NULL;
00519 double STACK_KLOW=0;
00520 double STACK_KHIGH=0;
00521 int STACK_NITER=0;
00522
00523
00524
00525 check( uves_load_raw_imagelist(frames,
00526 false,
00527 UVES_BIAS(true), UVES_BIAS(false),
00528 CPL_TYPE_DOUBLE,
00529 raw_images, raw_headers, product_header,
00530 &blue), "Error loading raw frames");
00531
00532
00533 check( binx = uves_pfits_get_binx(raw_headers[0][0]),
00534 "Could not get raw frame x-binning");
00535 check( biny = uves_pfits_get_biny(raw_headers[0][0]),
00536 "Could not get raw frame y-binning");
00537 check( uves_get_parameter(parameters, NULL, "uves", "process_chip", CPL_TYPE_STRING, &PROCESS_CHIP),
00538 "Could not read parameter");
00539 uves_string_toupper((char*)PROCESS_CHIP);
00540
00541 check( uves_get_parameter(parameters, NULL, recipe_id, "clean_traps", CPL_TYPE_BOOL, &CLEAN_TRAPS),
00542 "Could not read parameter");
00543
00544 check( uves_get_parameter(parameters, NULL, recipe_id, "stack_method", CPL_TYPE_STRING, &STACK_METHOD),
00545 "Could not read parameter");
00546 uves_string_toupper((char*)STACK_METHOD);
00547
00548 check( uves_get_parameter(parameters, NULL, recipe_id, "klow", CPL_TYPE_DOUBLE, &STACK_KLOW),
00549 "Could not read parameter");
00550 check( uves_get_parameter(parameters, NULL, recipe_id, "khigh", CPL_TYPE_DOUBLE, &STACK_KHIGH),
00551 "Could not read parameter");
00552 check( uves_get_parameter(parameters, NULL, recipe_id, "niter", CPL_TYPE_INT, &STACK_NITER),
00553 "Could not read parameter");
00554
00555
00556 for (chip = uves_chip_get_first(blue);
00557 chip != UVES_CHIP_INVALID;
00558 chip = uves_chip_get_next(chip))
00559 {
00560 if(strcmp(PROCESS_CHIP,"REDU") == 0) {
00561 chip = uves_chip_get_next(chip);
00562 }
00563 raw_index = uves_chip_get_index(chip);
00564
00565 uves_msg("Processing %s chip",
00566 uves_chip_tostring_upper(chip));
00567
00568 uves_msg_debug("Binning = %dx%d", binx, biny);
00569
00570
00571 uves_free_image(&master_bias);
00572 check( master_bias = uves_mbias_process_chip(raw_images[raw_index],
00573 raw_headers[raw_index],
00574 product_header[raw_index],
00575 binx, biny,
00576 chip,CLEAN_TRAPS,
00577 STACK_METHOD,
00578 STACK_KLOW,
00579 STACK_KHIGH,
00580 STACK_NITER),
00581 "Error processing chip");
00582
00583
00584 cpl_free(product_filename);
00585 check( product_filename = uves_masterbias_filename(chip),
00586 "Error getting filename");
00587
00588
00589 uves_msg("Calculating QC parameters");
00590 uves_qclog_delete(&qclog[0]);
00591 qclog[0] = uves_qclog_init(raw_headers[raw_index][0], chip);
00592 check(uves_mbias_qclog(raw_images[raw_index],
00593 raw_headers[raw_index],
00594 chip,
00595 master_bias,
00596
00597 qclog[0]),"error computing qclog");
00598
00599
00600 uves_msg("Saving product...");
00601
00602 check( uves_frameset_insert(frames,
00603 master_bias,
00604 CPL_FRAME_GROUP_PRODUCT,
00605 CPL_FRAME_TYPE_IMAGE,
00606 CPL_FRAME_LEVEL_INTERMEDIATE,
00607 product_filename,
00608 UVES_MASTER_BIAS(chip),
00609 raw_headers[raw_index][0],
00610 product_header[raw_index],
00611 NULL,
00612 parameters,
00613 recipe_id,
00614 PACKAGE "/" PACKAGE_VERSION,qclog,
00615 starttime, true,
00616 UVES_ALL_STATS),
00617 "Could not add master bias %s to frameset", product_filename);
00618 uves_qclog_delete(&qclog[0]);
00619 uves_msg("Master bias '%s' added to frameset", product_filename);
00620
00621 if(strcmp(PROCESS_CHIP,"REDL") == 0) {
00622 chip = uves_chip_get_next(chip);
00623 }
00624
00625
00626 }
00627
00628 cleanup:
00629
00630 if (raw_images[0] != NULL)
00631 {
00632
00633 for (i = 0; i < cpl_imagelist_get_size(raw_images[0]); i++)
00634 {
00635 if (raw_headers[0] != NULL) uves_free_propertylist(&raw_headers[0][i]);
00636 if (raw_headers[1] != NULL) uves_free_propertylist(&raw_headers[1][i]);
00637 }
00638 cpl_free(raw_headers[0]); raw_headers[0] = NULL;
00639 cpl_free(raw_headers[1]); raw_headers[1] = NULL;
00640 }
00641 uves_free_imagelist(&raw_images[0]);
00642 uves_free_imagelist(&raw_images[1]);
00643
00644
00645 uves_qclog_delete(&qclog[0]);
00646 uves_free_image(&master_bias);
00647 uves_free_propertylist(&product_header[0]);
00648 uves_free_propertylist(&product_header[1]);
00649 cpl_free(product_filename);
00650 uves_free_stats(&mbias_stats);
00651
00652 return;
00653 }
00654
00655
00656
00657 static int
00658 count_good(const cpl_image *image)
00659 {
00660 return
00661 cpl_image_get_size_x(image) * cpl_image_get_size_y(image) -
00662 cpl_image_count_rejected(image);
00663 }
00664
00671
00672 static void
00673 reject_lo_hi(cpl_image *image, double min, double max)
00674 {
00675 cpl_mask *mask_lo = NULL;
00676 cpl_mask *mask_hi = NULL;
00677
00678 mask_lo = cpl_mask_threshold_image_create(image, -DBL_MAX, min);
00679 mask_hi = cpl_mask_threshold_image_create(image, max, DBL_MAX);
00680 assure_mem( mask_lo );
00681 assure_mem( mask_hi );
00682
00683 cpl_mask_or(mask_lo, mask_hi);
00684
00685 cpl_image_reject_from_mask(image, mask_lo);
00686
00687 cleanup:
00688 uves_free_mask(&mask_lo);
00689 uves_free_mask(&mask_hi);
00690 return;
00691 }
00692
00703 static void uves_mbias_qclog(const cpl_imagelist* raw_imgs,
00704 uves_propertylist **raw_headers,
00705 enum uves_chip chip,
00706 const cpl_image* mbia,
00707
00708
00709 cpl_table* qclog
00710 )
00711 {
00712 int nx_pix= 0;
00713 int ny_pix= 0;
00714
00715 int sample_x= 100;
00716 int sample_y= 100;
00717 int x_cent_s= 0;
00718 int x_cent_e= 0;
00719 int y_cent_s= 0;
00720 int y_cent_e= 0;
00721
00722
00723
00724
00725
00726 double upp_threshold= 0.0;
00727 double low_threshold= 0.0;
00728 double extra=0.1;
00729 double qc_ron_master= 0.0;
00730
00731 double master_median=0.0;
00732 int pn= 0;
00733
00734
00735 double min=0.0;
00736 double max=0.0;
00737 double struct_col=0.0;
00738 double struct_row=0.0;
00739
00740 double time_s=+9999999.0;
00741 double time_e=-9999999.0;
00742 int nraw=0;
00743 double qc_duty_cycle=0.;
00744 double exposure_time=0;
00745 int i=0;
00746 char key_name[80];
00747
00748 const cpl_image* rbia=NULL;
00749 cpl_image* tima=NULL;
00750 cpl_image* avg_col=NULL;
00751 cpl_image* avg_row=NULL;
00752
00753 uves_qclog_add_string(qclog,
00754 "QC TEST1 ID",
00755 "Test-on-Master-Bias",
00756 "Name of QC test",
00757 "%s");
00758
00759 uves_msg("Computing duty cycle...");
00760
00761
00762 exposure_time = 0;
00763 nraw = cpl_imagelist_get_size(raw_imgs);
00764 check_nomsg(uves_qclog_add_int(qclog,
00765 "PRO DATANCOM",
00766 nraw,
00767 "Number of frames combined",
00768 "%d"));
00769
00770
00771 for (i = 0; i < nraw; i++)
00772 {
00773 check( exposure_time = uves_pfits_get_mjdobs(raw_headers[i]),
00774 "Error reading exposure time");
00775 if(exposure_time >= time_e) time_e = exposure_time;
00776 if(exposure_time <= time_s) time_s = exposure_time;
00777 }
00778 if(nraw > 1) {
00779 qc_duty_cycle = (time_e-time_s)/ (nraw-1);
00780 }
00781 else
00782 {
00783 qc_duty_cycle = 0;
00784 }
00785
00786 check_nomsg(uves_qclog_add_double(qclog,
00787 "QC DUTYCYCL",
00788 qc_duty_cycle,
00789 "Time to store a frame",
00790 "%.5e"));
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 nx_pix = cpl_image_get_size_x(mbia);
00803 ny_pix = cpl_image_get_size_y(mbia);
00804
00805
00806 x_cent_s = (nx_pix - sample_x)/2;
00807 x_cent_e = (nx_pix + sample_x)/2;
00808 y_cent_s = (ny_pix - sample_y)/2;
00809 y_cent_e = (ny_pix + sample_y)/2;
00810
00811
00812 check_nomsg(upp_threshold =
00813 cpl_image_get_median_window(mbia,
00814 x_cent_s,
00815 y_cent_s,
00816 x_cent_e,
00817 y_cent_e)*(1 + extra));
00818 check_nomsg(low_threshold =
00819 cpl_image_get_median_window(mbia,
00820 x_cent_s,
00821 y_cent_s,
00822 x_cent_e,
00823 y_cent_e)*(1 - extra));
00824
00825
00826
00827
00828 check_nomsg(pn = PORT_ID(chip));
00829 uves_msg_debug("Port number = %d", pn);
00830
00831 rbia = cpl_imagelist_get_const(raw_imgs,0);
00832 check_nomsg(uves_mbias_qc_ron_raw(rbia, chip,
00833 x_cent_s,x_cent_e,y_cent_s,y_cent_e,qclog));
00834
00835
00836
00837
00838
00839 check_nomsg(tima=cpl_image_duplicate(mbia));
00840
00841 check_nomsg( reject_lo_hi(tima, low_threshold, upp_threshold) );
00842 if (count_good(tima) >= 2)
00843 {
00844 check_nomsg(master_median = cpl_image_get_median(tima));
00845 check_nomsg(qc_ron_master = cpl_image_get_stdev(tima));
00846 }
00847 else
00848 {
00849 master_median = -1;
00850 qc_ron_master = -1;
00851 uves_msg_warning("Only %d good pixels in image. Setting QC parameters to -1",
00852 count_good(tima));
00853 }
00854 uves_free_image(&tima);
00855
00856 check_nomsg(uves_qclog_add_double(qclog,
00857 "PRO DATAMED",
00858 master_median,
00859 "Median of pixel values",
00860 "%7.3f"));
00861
00862 sprintf(key_name, "QC OUT%d RON MASTER", pn);
00863 check_nomsg(uves_qclog_add_double(qclog,
00864 key_name,
00865 qc_ron_master,
00866 "Read noise frame in ADU",
00867 "%8.4f"));
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882 check_nomsg(tima=cpl_image_duplicate(mbia));
00883 if (chip != UVES_CHIP_BLUE) {
00884
00885
00886
00887 check_nomsg(cpl_image_threshold(tima,
00888 -DBL_MAX,300,
00889 -DBL_MAX,300));
00890 }
00891
00892
00893 check_nomsg(avg_col = cpl_image_collapse_create(tima,1));
00894 check_nomsg(cpl_image_divide_scalar(avg_col,cpl_image_get_size_x(tima)));
00895
00896
00897 min = cpl_image_get_mean(avg_col) - 2;
00898 max = cpl_image_get_mean(avg_col) + 2;
00899
00900
00901
00902
00903 check_nomsg( reject_lo_hi(avg_col, min, max) );
00904 if (count_good(avg_col) >= 2)
00905 {
00906 check_nomsg(struct_col = cpl_image_get_stdev(avg_col));
00907 }
00908 else
00909 {
00910 struct_col = -1;
00911 uves_msg_warning("Only %d good pixels in image. Setting QC parameter to -1",
00912 count_good(avg_col));
00913 }
00914
00915 sprintf(key_name,"%s%d%s","QC OUT",pn," STRUCTY");
00916 check_nomsg(uves_qclog_add_double(qclog,
00917 key_name,
00918 struct_col,
00919 "structure in Y (bias slope)",
00920 "%8.4f"));
00921
00922
00923
00924 check_nomsg(avg_row = cpl_image_collapse_create(tima,0));
00925 check_nomsg(cpl_image_divide_scalar(avg_row,cpl_image_get_size_y(tima)));
00926
00927
00928 min = cpl_image_get_mean(avg_row) - 2;
00929 max = cpl_image_get_mean(avg_row) + 2;
00930
00931
00932
00933
00934 check_nomsg( reject_lo_hi(avg_row, min, max) );
00935 if (count_good(avg_row) >= 2)
00936 {
00937 check_nomsg(struct_row = cpl_image_get_stdev(avg_row));
00938 }
00939 else
00940 {
00941 struct_row = -1;
00942 uves_msg_warning("Only %d good pixels in image. Setting QC parameter to -1",
00943 count_good(avg_row));
00944 }
00945
00946
00947 sprintf(key_name,"%s%d%s","QC OUT",pn," STRUCTX");
00948 check_nomsg(uves_qclog_add_double(qclog,
00949 key_name,
00950 struct_row,
00951 "structure in X (bias slope)",
00952 "%8.4f"));
00953
00954
00955
00956
00957 cleanup:
00958 uves_free_image(&avg_col);
00959 uves_free_image(&avg_row);
00960 uves_free_image(&tima);
00961
00962 return;
00963
00964 }
00978 static void
00979 uves_mbias_qc_ron_raw(const cpl_image* rbia,
00980 enum uves_chip chip,
00981 const int x_cent_s,
00982 const int x_cent_e,
00983 const int y_cent_s,
00984 const int y_cent_e,
00985 cpl_table* qclog)
00986 {
00987
00988 double qc_ron_raw=0.0;
00989 double upp_threshold=0.0;
00990 double low_threshold=0.0;
00991 double extra=0.1;
00992 char key_name[80];
00993 int pn=0;
00994 cpl_image* tima=NULL;
00995
00996
00997
00998
00999
01000 check_nomsg(upp_threshold =
01001 cpl_image_get_median_window(rbia,
01002 x_cent_s,
01003 y_cent_s,
01004 x_cent_e,
01005 y_cent_e)*(1 + extra));
01006
01007 check_nomsg(low_threshold =
01008 cpl_image_get_median_window(rbia,
01009 x_cent_s,
01010 y_cent_s,
01011 x_cent_e,
01012 y_cent_e)*(1 - extra));
01013
01014
01015
01016
01017
01018
01019 check_nomsg(tima=cpl_image_duplicate(rbia));
01020
01021 check_nomsg( reject_lo_hi(tima, low_threshold, upp_threshold) );
01022 if (count_good(tima) >= 2)
01023 {
01024 check_nomsg(qc_ron_raw = cpl_image_get_stdev(tima));
01025 }
01026 else
01027 {
01028 qc_ron_raw = -1;
01029 uves_msg_warning("Only %d good pixels in image. Setting QC parameter to -1",
01030 count_good(tima));
01031 }
01032
01033
01034
01035
01036
01037 check_nomsg(pn = PORT_ID(chip));
01038
01039
01040 sprintf(key_name,"%s%d%s","QC OUT",pn," RON RAW");
01041 check_nomsg(uves_qclog_add_double(qclog,
01042 key_name,
01043 qc_ron_raw,
01044 "Read noise frame in ADU",
01045 "%8.4f"));
01046
01047 cleanup:
01048 uves_free_image(&tima);
01049 return;
01050 }
01051