00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023
00024
00025
00026
00027
00028 #include <irplib_detmon.h>
00029 #include <irplib_detmon_lg.h>
00030
00031
00032 #include <math.h>
00033
00034
00035
00036
00037
00038
00039 #define PI 3.141592653
00040
00041
00042
00043
00044 #ifndef IMAGESIZE
00045 #define IMAGESIZE 64
00046 #endif
00047
00048 #define IMAGELISTSIZE 10
00049
00050 #define NBADPIXS 10
00051
00052 #define ON_LEVEL 300.0
00053 #define OFF_LEVEL 100.0
00054
00055 #define NOISE_MIN 10.0
00056 #define NOISE_MAX 40.0
00057
00058 #define ON TRUE
00059 #define OFF FALSE
00060
00061
00062
00063
00064
00065
00066 static void irplib_detmon_lg_tests(void);
00067
00068 cpl_frameset * irplib_detmon_tests_fill_frameset(const char * tag_on,
00069 const char * tag_off,
00070 int non,
00071 cpl_boolean opt_nir,
00072 cpl_boolean with_exts,
00073 int nexts,
00074 int nsettings);
00075
00076 cpl_frameset * irplib_detmon_tests_fill_frameset_oct(const char * tag_on,
00077 const char * tag_off,
00078 int non,
00079 cpl_boolean opt_nir,
00080 cpl_boolean with_exts,
00081 int nexts);
00082
00083 int compare_settings(const cpl_frame * frame1, const cpl_frame * frame2);
00084
00085 cpl_imagelist * irplib_detmon_tests_imlist(int ndits, cpl_boolean onoff);
00086
00087
00088
00089
00090
00091
00092
00093 int main(void)
00094 {
00095
00096 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
00097
00098 irplib_detmon_lg_tests();
00099
00100 return cpl_test_end(0);
00101 }
00102
00103 static void irplib_detmon_lg_tests(void)
00104 {
00105
00106
00107 int px, py;
00108 cpl_image * image1;
00109 #ifdef HAVE_FFTW
00110 cpl_image * image2;
00111 #endif
00112 cpl_image * result;
00113
00114 cpl_parameterlist * parlist;
00115 cpl_frameset * frameset;
00116 cpl_frameset * set;
00117 cpl_propertylist * prolist;
00118
00119
00120 const char * tag_on;
00121 const char * tag_off;
00122
00123
00124 #ifdef HAVE_FFTW
00125
00126
00127
00128 result = irplib_detmon_image_correlate(NULL, NULL, 0, 0);
00129 cpl_test_error(CPL_ERROR_NULL_INPUT);
00130 cpl_error_reset();
00131 cpl_test_null(result);
00132 cpl_image_delete(result);
00133
00134
00135 image1 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00136 cpl_image_fill_gaussian(image1, (IMAGESIZE + 1)/2, (IMAGESIZE + 1)/2, 25, 40, 40);
00137
00138 image2 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00139 cpl_image_fill_gaussian(image2, (IMAGESIZE + 1)/2, (IMAGESIZE + 1)/2, 25, 40, 40);
00140
00141 px = -1;
00142 py = -1;
00143
00144 result = irplib_detmon_image_correlate(image1, image2, 13, 13);
00145
00146 cpl_image_get_maxpos(result, &px, &py);
00147 cpl_test(px == 13+1 && py == 13+1);
00148
00149 cpl_image_delete(image1);
00150 cpl_image_delete(image2);
00151 cpl_image_delete(result);
00152
00153
00154 image1 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00155 cpl_image_fill_gaussian(image1, (IMAGESIZE + 1)/2+30, (IMAGESIZE + 1)/2+30, 25, 40, 40);
00156
00157 image2 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00158 cpl_image_fill_gaussian(image2, (IMAGESIZE + 1)/2+30, (IMAGESIZE + 1)/2+30, 25, 40, 40);
00159
00160 px = -1;
00161 py = -1;
00162
00163 result = irplib_detmon_image_correlate(image1, image2, 13, 13);
00164
00165 cpl_image_get_maxpos(result, &px, &py);
00166 cpl_test(px == 13+1 && py == 13+1);
00167
00168 cpl_image_delete(image1);
00169 cpl_image_delete(image2);
00170 cpl_image_delete(result);
00171
00172
00173 image1 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00174 cpl_image_fill_gaussian(image1, (IMAGESIZE + 1)/2+30, (IMAGESIZE + 1)/2+30, 25, 40, 40);
00175
00176 image2 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00177 cpl_image_fill_gaussian(image2, (IMAGESIZE + 1)/2+40, (IMAGESIZE + 1)/2+40, 25, 40, 40);
00178
00179 px = -1;
00180 py = -1;
00181
00182 result = irplib_detmon_image_correlate(image1, image2, 13, 13);
00183
00184 cpl_image_get_maxpos(result, &px, &py);
00185
00186
00187
00188
00189
00190 cpl_image_delete(image1);
00191 cpl_image_delete(image2);
00192 cpl_image_delete(result);
00193 #else
00194
00195
00196
00197 result = irplib_detmon_autocorrelate(NULL, 0, 0);
00198 cpl_test_error(CPL_ERROR_NULL_INPUT);
00199 cpl_error_reset();
00200 cpl_test_null(result);
00201 cpl_image_delete(result);
00202
00203
00204 image1 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00205 cpl_image_fill_gaussian(image1, (IMAGESIZE + 1)/2, (IMAGESIZE + 1)/2, 25, 40, 40);
00206
00207 px = -1;
00208 py = -1;
00209
00210 result = irplib_detmon_autocorrelate(image1, 13, 13);
00211
00212 cpl_image_get_maxpos(result, &px, &py);
00213 cpl_test(px == 13+1 && py == 13+1);
00214
00215 cpl_image_delete(image1);
00216 cpl_image_delete(result);
00217
00218 #endif
00219
00220
00221
00222 tag_on = "FRAME_ON";
00223 tag_off = "FRAME_OFF";
00224
00225 set = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00226 20, TRUE, FALSE, 0, 1);
00227
00228 prolist = irplib_detmon_fill_prolist("PROCATG", "TYPE", "TECH", CPL_TRUE);
00229
00230
00231 irplib_detmon_lg(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
00232 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE);
00233 cpl_test_error(CPL_ERROR_NULL_INPUT);
00234 cpl_error_reset();
00235
00236
00237
00238 parlist = cpl_parameterlist_new();
00239 irplib_detmon_lg_fill_parlist_nir_default(parlist,
00240 "detmon_ir_lg", "detmon");
00241
00242 frameset = cpl_frameset_duplicate(set);
00243
00244 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00245 "detmon", REGEXP, prolist, prolist, prolist,
00246 prolist, prolist, prolist, "DETMON / 1.0",
00247 NULL, NULL, TRUE);
00248 cpl_test_error(CPL_ERROR_NONE);
00249 cpl_error_reset();
00250
00251 cpl_frameset_delete(frameset);
00252 cpl_parameterlist_delete(parlist);
00253
00254
00255
00256 parlist = cpl_parameterlist_new();
00257 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00258 "PTC",
00259 3,
00260 3,
00261 25,
00262 8,
00263 8,
00264 56,
00265 56,
00266 10000,
00267 "CPL_FALSE",
00268 "CPL_FALSE",
00269 "CPL_FALSE",
00270 "CPL_TRUE",
00271 "CPL_TRUE",
00272 "CPL_FALSE",
00273 -1,
00274 26,
00275 26,
00276 1e-3,
00277 "detmon_ir_lg",
00278 -1,
00279 -1,
00280 -1,
00281 -1,
00282 -1,
00283 -1,
00284 -1,
00285 -1,
00286 -1,
00287 -1,
00288 -1,
00289 -1,
00290 -1,
00291 -1,
00292 -1,
00293 -1,
00294 -1,
00295 -1,
00296 -1,
00297 -1,
00298 0,
00299 NIR);
00300
00301 frameset = cpl_frameset_duplicate(set);
00302
00303 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00304 "detmon", REGEXP, prolist, prolist, prolist,
00305 prolist, prolist, prolist, "DETMON / 1.0",
00306 NULL, NULL, TRUE);
00307 cpl_test_error(CPL_ERROR_NONE);
00308 cpl_error_reset();
00309
00310 cpl_frameset_delete(frameset);
00311 cpl_parameterlist_delete(parlist);
00312
00313
00314 parlist = cpl_parameterlist_new();
00315 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00316 "MED",
00317 3,
00318 3,
00319 25,
00320 -1,
00321 -1,
00322 -1,
00323 -1,
00324 10000,
00325 "CPL_FALSE",
00326 "CPL_FALSE",
00327 "CPL_FALSE",
00328 "CPL_TRUE",
00329 "CPL_TRUE",
00330 "CPL_FALSE",
00331 -1,
00332 26,
00333 26,
00334 1e-3,
00335 "detmon_ir_lg",
00336 -1,
00337 -1,
00338 -1,
00339 -1,
00340 -1,
00341 -1,
00342 -1,
00343 -1,
00344 -1,
00345 -1,
00346 -1,
00347 -1,
00348 -1,
00349 -1,
00350 -1,
00351 -1,
00352 -1,
00353 -1,
00354 -1,
00355 -1,
00356 0,
00357 NIR);
00358
00359 frameset = cpl_frameset_duplicate(set);
00360
00361 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00362 "detmon", REGEXP, prolist, prolist, prolist,
00363 prolist, prolist, prolist, "DETMON / 1.0",
00364 NULL, NULL, TRUE);
00365 cpl_test_error(CPL_ERROR_NONE);
00366 cpl_error_reset();
00367
00368 cpl_frameset_delete(frameset);
00369 cpl_parameterlist_delete(parlist);
00370
00371
00372
00373
00374
00375 parlist = cpl_parameterlist_new();
00376 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00377 "PTC",
00378 3,
00379 3,
00380 25,
00381 -1,
00382 -1,
00383 -1,
00384 -1,
00385 10000,
00386 "CPL_TRUE",
00387 "CPL_FALSE",
00388 "CPL_FALSE",
00389 "CPL_TRUE",
00390 "CPL_TRUE",
00391 "CPL_FALSE",
00392 -1,
00393 26,
00394 26,
00395 1e-3,
00396 "detmon_ir_lg",
00397 -1,
00398 -1,
00399 -1,
00400 -1,
00401 -1,
00402 -1,
00403 -1,
00404 -1,
00405 -1,
00406 -1,
00407 -1,
00408 -1,
00409 -1,
00410 -1,
00411 -1,
00412 -1,
00413 -1,
00414 -1,
00415 -1,
00416 -1,
00417 0,
00418 NIR);
00419
00420 frameset = cpl_frameset_duplicate(set);
00421
00422 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00423 "detmon", REGEXP, prolist, prolist, prolist,
00424 prolist, prolist, prolist, "DETMON / 1.0",
00425 NULL, NULL, TRUE);
00426 cpl_test_error(CPL_ERROR_NONE);
00427 cpl_error_reset();
00428
00429 cpl_frameset_delete(frameset);
00430 cpl_parameterlist_delete(parlist);
00431
00432
00433
00434
00435 parlist = cpl_parameterlist_new();
00436 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00437 "PTC",
00438 3,
00439 3,
00440 25,
00441 -1,
00442 -1,
00443 -1,
00444 -1,
00445 10000,
00446 "CPL_FALSE",
00447 "CPL_FALSE",
00448 "CPL_FALSE",
00449 "CPL_FALSE",
00450 "CPL_TRUE",
00451 "CPL_FALSE",
00452 -1,
00453 26,
00454 26,
00455 1e-3,
00456 "detmon_ir_lg",
00457 -1,
00458 -1,
00459 -1,
00460 -1,
00461 -1,
00462 -1,
00463 -1,
00464 -1,
00465 -1,
00466 -1,
00467 -1,
00468 -1,
00469 -1,
00470 -1,
00471 -1,
00472 -1,
00473 -1,
00474 -1,
00475 -1,
00476 -1,
00477 0,
00478 NIR);
00479
00480 frameset = cpl_frameset_duplicate(set);
00481
00482 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00483 "detmon", REGEXP, prolist, prolist, prolist,
00484 prolist, prolist, prolist, "DETMON / 1.0",
00485 NULL, NULL, TRUE);
00486 cpl_test_error(CPL_ERROR_NONE);
00487 cpl_error_reset();
00488
00489 cpl_frameset_delete(frameset);
00490 cpl_parameterlist_delete(parlist);
00491
00492
00493 parlist = cpl_parameterlist_new();
00494 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00495 "PTC",
00496 3,
00497 3,
00498 25,
00499 -1,
00500 -1,
00501 -1,
00502 -1,
00503 10000,
00504 "CPL_FALSE",
00505 "CPL_FALSE",
00506 "CPL_FALSE",
00507 "CPL_TRUE",
00508 "CPL_TRUE",
00509 "CPL_TRUE",
00510 -1,
00511 26,
00512 26,
00513 1e-3,
00514 "detmon_ir_lg",
00515 -1,
00516 -1,
00517 -1,
00518 -1,
00519 -1,
00520 -1,
00521 -1,
00522 -1,
00523 -1,
00524 -1,
00525 -1,
00526 -1,
00527 -1,
00528 -1,
00529 -1,
00530 -1,
00531 -1,
00532 -1,
00533 -1,
00534 -1,
00535 0,
00536 NIR);
00537
00538 frameset = cpl_frameset_duplicate(set);
00539
00540 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00541 "detmon", REGEXP, prolist, prolist, prolist,
00542 prolist, prolist, prolist, "DETMON / 1.0",
00543 NULL, NULL, TRUE);
00544 cpl_test_error(CPL_ERROR_NONE);
00545 cpl_error_reset();
00546
00547 {
00548
00549 cpl_image * bpm = cpl_image_load("detmon_ir_lg_bpm.fits",
00550 CPL_TYPE_INT, 0, 0);
00551
00552 cpl_mask * mask = cpl_mask_threshold_image_create(bpm, 0.5, 1.5);
00553
00554 int nbpixs = cpl_mask_count(mask);
00555
00556 int flux = (int)cpl_image_get_flux(bpm);
00557
00558 cpl_test_eq(flux, nbpixs);
00559
00560 cpl_image_delete(bpm);
00561 cpl_mask_delete(mask);
00562 }
00563
00564 cpl_frameset_delete(frameset);
00565 cpl_parameterlist_delete(parlist);
00566
00567
00568
00569
00570
00571
00572 parlist = cpl_parameterlist_new();
00573 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00574 "PTC",
00575 3,
00576 3,
00577 25,
00578 -1,
00579 -1,
00580 -1,
00581 -1,
00582 10000,
00583 "CPL_FALSE",
00584 "CPL_FALSE",
00585 "CPL_FALSE",
00586 "CPL_TRUE",
00587 "CPL_FALSE",
00588 "CPL_FALSE",
00589 -1,
00590 26,
00591 26,
00592 1e-3,
00593 "detmon_ir_lg",
00594 -1,
00595 -1,
00596 -1,
00597 -1,
00598 -1,
00599 -1,
00600 -1,
00601 -1,
00602 -1,
00603 -1,
00604 -1,
00605 -1,
00606 -1,
00607 -1,
00608 -1,
00609 -1,
00610 -1,
00611 -1,
00612 -1,
00613 -1,
00614 0,
00615 NIR);
00616
00617 frameset = cpl_frameset_duplicate(set);
00618
00619
00620
00621
00622
00623
00624
00625
00626 cpl_frameset_delete(frameset);
00627 cpl_parameterlist_delete(parlist);
00628
00629
00630
00631
00632 parlist = cpl_parameterlist_new();
00633 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00634 "PTC",
00635 3,
00636 3,
00637 25,
00638 -1,
00639 -1,
00640 -1,
00641 -1,
00642 10000,
00643 "CPL_FALSE",
00644 "CPL_FALSE",
00645 "CPL_FALSE",
00646 "CPL_TRUE",
00647 "CPL_TRUE",
00648 "CPL_FALSE",
00649 4000,
00650 26,
00651 26,
00652 1e-3,
00653 "detmon_ir_lg",
00654 -1,
00655 -1,
00656 -1,
00657 -1,
00658 -1,
00659 -1,
00660 -1,
00661 -1,
00662 -1,
00663 -1,
00664 -1,
00665 -1,
00666 -1,
00667 -1,
00668 -1,
00669 -1,
00670 -1,
00671 -1,
00672 -1,
00673 -1,
00674 0,
00675 NIR);
00676
00677 frameset = cpl_frameset_duplicate(set);
00678
00679 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg",
00680 "detmon", REGEXP, prolist, prolist, prolist,
00681 prolist, prolist, prolist, "DETMON / 1.0",
00682 NULL, NULL, TRUE);
00683 cpl_test_error(CPL_ERROR_NONE);
00684 cpl_error_reset();
00685
00686 cpl_frameset_delete(frameset);
00687 cpl_parameterlist_delete(parlist);
00688
00689
00690
00691 cpl_frameset_delete(set);
00692
00693
00694
00695
00696
00697
00698
00699 parlist = cpl_parameterlist_new();
00700 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00701 "PTC",
00702 3,
00703 3,
00704 25,
00705 -1,
00706 -1,
00707 -1,
00708 -1,
00709 10000,
00710 "CPL_FALSE",
00711 "CPL_FALSE",
00712 "CPL_FALSE",
00713 "CPL_TRUE",
00714 "CPL_TRUE",
00715 "CPL_FALSE",
00716 -1,
00717 26,
00718 26,
00719 1e-3,
00720 "detmon_ir_lg",
00721 -1,
00722 -1,
00723 -1,
00724 -1,
00725 -1,
00726 -1,
00727 -1,
00728 -1,
00729 -1,
00730 -1,
00731 -1,
00732 -1,
00733 -1,
00734 -1,
00735 -1,
00736 -1,
00737 -1,
00738 -1,
00739 -1,
00740 -1,
00741 0,
00742 NIR);
00743
00744 frameset = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00745 6, TRUE, FALSE, 0, 1);
00746
00747
00748
00749
00750
00751
00752
00753
00754 cpl_frameset_delete(frameset);
00755 cpl_parameterlist_delete(parlist);
00756
00757
00758
00759 parlist = cpl_parameterlist_new();
00760 irplib_detmon_lg_fill_parlist_opt_default(parlist,
00761 "detmon_opt_lg", "detmon");
00762
00763 frameset = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00764 20, FALSE, FALSE, 0, 1);
00765
00766
00767
00768
00769
00770
00771
00772
00773 cpl_frameset_delete(frameset);
00774 cpl_parameterlist_delete(parlist);
00775
00776 #if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(4, 1, 0)
00777
00778 parlist = cpl_parameterlist_new();
00779 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00780 "PTC",
00781 3,
00782 3,
00783 25,
00784 -1,
00785 -1,
00786 -1,
00787 -1,
00788 10000,
00789 "CPL_FALSE",
00790 "CPL_FALSE",
00791 "CPL_FALSE",
00792 "CPL_TRUE",
00793 "CPL_TRUE",
00794 "CPL_FALSE",
00795 -1,
00796 26,
00797 26,
00798 1e-3,
00799 "detmon_ir_lg",
00800 -1,
00801 -1,
00802 -1,
00803 -1,
00804 -1,
00805 -1,
00806 -1,
00807 -1,
00808 -1,
00809 -1,
00810 -1,
00811 -1,
00812 -1,
00813 -1,
00814 -1,
00815 -1,
00816 -1,
00817 -1,
00818 -1,
00819 -1,
00820 -1,
00821 NIR);
00822
00823
00824
00825
00826
00827
00828
00829
00830 frameset = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00831 20, TRUE, TRUE, 8, 1);
00832
00833 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg", "detmon", REGEXP,
00834 prolist, prolist, prolist, prolist, prolist, prolist, "DETMON / 1.0", NULL, NULL, TRUE);
00835 cpl_test(cpl_error_get_code() == CPL_ERROR_NONE ||
00836 cpl_error_get_code() == CPL_ERROR_UNSUPPORTED_MODE);
00837 cpl_error_reset();
00838
00839 cpl_parameterlist_delete(parlist);
00840 cpl_frameset_delete(frameset);
00841 #endif
00842
00843
00844
00845 parlist = cpl_parameterlist_new();
00846 irplib_detmon_lg_fill_parlist(parlist, "detmon_ir_lg", "detmon",
00847 "PTC",
00848 3,
00849 3,
00850 25,
00851 -1,
00852 -1,
00853 -1,
00854 -1,
00855 10000,
00856 "CPL_FALSE",
00857 "CPL_FALSE",
00858 "CPL_FALSE",
00859 "CPL_TRUE",
00860 "CPL_TRUE",
00861 "CPL_FALSE",
00862 -1,
00863 26,
00864 26,
00865 1e-3,
00866 "detmon_ir_lg",
00867 -1,
00868 -1,
00869 -1,
00870 -1,
00871 -1,
00872 -1,
00873 -1,
00874 -1,
00875 -1,
00876 -1,
00877 -1,
00878 -1,
00879 -1,
00880 -1,
00881 -1,
00882 -1,
00883 -1,
00884 -1,
00885 -1,
00886 -1,
00887 2,
00888 NIR);
00889
00890
00891
00892
00893
00894
00895
00896
00897 frameset = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00898 20, TRUE, TRUE, 8, 1);
00899
00900 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg", "detmon", REGEXP,
00901 prolist, prolist, prolist, prolist, prolist, prolist, "DETMON / 1.0", NULL, NULL, TRUE);
00902 cpl_test(cpl_error_get_code() == CPL_ERROR_NONE ||
00903 cpl_error_get_code() == CPL_ERROR_UNSUPPORTED_MODE);
00904 cpl_error_reset();
00905
00906 cpl_parameterlist_delete(parlist);
00907 cpl_frameset_delete(frameset);
00908
00909
00910
00911 parlist = cpl_parameterlist_new();
00912 irplib_detmon_lg_fill_parlist_nir_default(parlist, "detmon_ir_lg", "detmon");
00913
00914 frameset = irplib_detmon_tests_fill_frameset_oct(tag_on, tag_off, 20, TRUE, FALSE, 0);
00915
00916
00917
00918
00919
00920
00921
00922 cpl_parameterlist_delete(parlist);
00923 cpl_frameset_delete(frameset);
00924
00925
00926 parlist = cpl_parameterlist_new();
00927 irplib_detmon_lg_fill_parlist_nir_default(parlist, "detmon_ir_lg", "detmon");
00928
00929 frameset = irplib_detmon_tests_fill_frameset(tag_on, tag_off,
00930 20, TRUE, FALSE, 0, 3);
00931
00932 irplib_detmon_lg(frameset, parlist, tag_on, tag_off, "detmon_ir_lg", "detmon", REGEXP,
00933 prolist, prolist, prolist, prolist, prolist, prolist, "DETMON / 1.0", compare_settings, NULL, TRUE);
00934
00935 cpl_test_error(CPL_ERROR_NONE);
00936
00937 cpl_parameterlist_delete(parlist);
00938 cpl_frameset_delete(frameset);
00939
00940 cpl_propertylist_delete(prolist);
00941
00942 cpl_test_zero(system("rm *.paf *.fits"));
00943
00944
00945 {
00946
00947 cpl_table * gain_table;
00948 cpl_imagelist * imlist_on;
00949 cpl_imagelist * imlist_off;
00950 cpl_imagelist * diff;
00951 cpl_imagelist * corr;
00952 cpl_vector * exptimes;
00953 cpl_propertylist * qclist;
00954 int i;
00955 double gain;
00956
00957
00958 gain_table = irplib_detmon_gain(NULL, NULL, NULL, 0, 0, 0, 0, 0, 0.0,
00959 0, 0, 0, NULL, 0, NULL, NULL);
00960 cpl_test_null(gain_table);
00961 cpl_test_error(CPL_ERROR_NULL_INPUT);
00962
00963 imlist_on = irplib_detmon_tests_imlist(8, ON);
00964 imlist_off = irplib_detmon_tests_imlist(8, OFF);
00965
00966 exptimes = cpl_vector_new(16);
00967
00968 for(i = 0; i < 16; i++) {
00969 cpl_vector_set(exptimes, i, (double)(i/2 + 1));
00970 }
00971
00972 qclist = cpl_propertylist_new();
00973
00974 gain_table = irplib_detmon_gain(imlist_on, imlist_off, exptimes, 0.0,
00975 1, 1,
00976 IMAGESIZE, IMAGESIZE, 3.0, 25, 26, 26,
00977 qclist, IRPLIB_GAIN_NO_COLLAPSE |
00978 IRPLIB_GAIN_NIR,
00979 NULL, NULL);
00980 cpl_test_nonnull(gain_table);
00981 cpl_test_error(CPL_ERROR_NONE);
00982
00983
00984 gain = cpl_propertylist_get_double(qclist, DETMON_QC_GAIN);
00985 cpl_test(gain > 220.0 && gain < 240.0);
00986
00987 cpl_table_delete(gain_table);
00988 cpl_propertylist_delete(qclist);
00989
00990
00991 qclist = cpl_propertylist_new();
00992
00993 gain_table = irplib_detmon_gain(imlist_on, imlist_off, exptimes, 0.0,
00994 1, 1,
00995 IMAGESIZE, IMAGESIZE, 3.0, 25, 26, 26,
00996 qclist, IRPLIB_GAIN_NO_COLLAPSE |
00997 IRPLIB_GAIN_NIR |
00998 IRPLIB_GAIN_PTC,
00999 NULL, NULL);
01000 cpl_test_nonnull(gain_table);
01001 cpl_test_error(CPL_ERROR_NONE);
01002
01003
01004 gain = cpl_propertylist_get_double(qclist, DETMON_QC_GAIN);
01005 cpl_test(gain > 160.0 && gain < 180.0);
01006
01007 cpl_table_delete(gain_table);
01008 cpl_propertylist_delete(qclist);
01009
01010 qclist = cpl_propertylist_new();
01011
01012 diff = NULL;
01013 corr = NULL;
01014
01015 gain_table = irplib_detmon_gain(imlist_on, imlist_off, exptimes, 0.0,
01016 1, 1,
01017 IMAGESIZE, IMAGESIZE, 3.0, 25, 26, 26,
01018 qclist, IRPLIB_GAIN_NO_COLLAPSE |
01019 IRPLIB_GAIN_NIR |
01020 IRPLIB_GAIN_WITH_AUTOCORR, &diff, &corr);
01021 cpl_test_nonnull(gain_table);
01022 cpl_test_nonnull(diff);
01023 cpl_test_nonnull(corr);
01024 cpl_test_error(CPL_ERROR_NONE);
01025
01026 cpl_imagelist_delete(diff);
01027 cpl_imagelist_delete(corr);
01028 cpl_table_delete(gain_table);
01029 cpl_propertylist_delete(qclist);
01030
01031 qclist = cpl_propertylist_new();
01032
01033 gain_table = irplib_detmon_gain(imlist_on, imlist_off, exptimes, 0.0,
01034 1, 1,
01035 IMAGESIZE, IMAGESIZE, 3.0, 25, 26, 26,
01036 qclist, IRPLIB_GAIN_NO_COLLAPSE |
01037 IRPLIB_GAIN_NIR |
01038 IRPLIB_GAIN_WITH_AUTOCORR, NULL, NULL);
01039 cpl_test_nonnull(gain_table);
01040 cpl_test_error(CPL_ERROR_NONE);
01041
01042 cpl_imagelist_delete(imlist_on);
01043 cpl_imagelist_delete(imlist_off);
01044 cpl_propertylist_delete(qclist);
01045 cpl_vector_delete(exptimes);
01046 cpl_table_delete(gain_table);
01047 }
01048
01049
01050 {
01051 cpl_table * lin_table;
01052 cpl_imagelist * imlist_on;
01053 cpl_imagelist * imlist_off;
01054 cpl_vector * exptimes;
01055 cpl_propertylist * qclist;
01056 cpl_imagelist * coeffs_cube =NULL;
01057 cpl_image * bpm =NULL;
01058 double lincoeff1, lincoeff2, lincoeff3;
01059 int i;
01060
01061
01062 lin_table = irplib_detmon_lin(NULL, NULL, NULL, 0.0, 0, 0, 0, 0,
01063 0, 10000, 3, FALSE, NULL, 0, NULL, NULL);
01064
01065 cpl_test_null(lin_table);
01066 cpl_test_error(CPL_ERROR_NULL_INPUT);
01067
01068
01069 imlist_on = irplib_detmon_tests_imlist(8, ON);
01070 imlist_off = irplib_detmon_tests_imlist(8, OFF);
01071
01072 exptimes = cpl_vector_new(16);
01073
01074 for(i = 0; i < 16; i++) {
01075 cpl_vector_set(exptimes, i, (double)(i/2 + 1));
01076 }
01077
01078 qclist = cpl_propertylist_new();
01079
01080 lin_table = irplib_detmon_lin(imlist_on, imlist_off, exptimes, 0.0,
01081 1, 1, IMAGESIZE, IMAGESIZE,
01082 3, 10000, 3, FALSE, qclist,
01083 IRPLIB_LIN_NO_COLLAPSE |
01084 IRPLIB_LIN_NIR,
01085 NULL, NULL);
01086
01087 cpl_test_nonnull(lin_table);
01088 cpl_test_error(CPL_ERROR_NONE);
01089
01090
01091 lincoeff1 = cpl_propertylist_get_double(qclist, "ESO QC LIN COEF1");
01092 lincoeff2 = cpl_propertylist_get_double(qclist, "ESO QC LIN COEF2");
01093 lincoeff3 = cpl_propertylist_get_double(qclist, "ESO QC LIN COEF3");
01094
01095 cpl_test(lincoeff1 > 195.0 && lincoeff1 < 205.0);
01096 cpl_test(abs(lincoeff2) < 1);
01097 cpl_test(abs(lincoeff3) < 1);
01098
01099 cpl_table_delete(lin_table);
01100
01101 lin_table = irplib_detmon_lin(imlist_on, imlist_off, exptimes, 0.0,
01102 1, 1, IMAGESIZE, IMAGESIZE,
01103 3, 10000, 3, FALSE, qclist,
01104 IRPLIB_LIN_NO_COLLAPSE |
01105 IRPLIB_LIN_NIR | IRPLIB_LIN_PIX2PIX,
01106 &coeffs_cube, &bpm);
01107
01108 cpl_test_nonnull(lin_table);
01109 cpl_test_nonnull(coeffs_cube);
01110 cpl_test_nonnull(bpm);
01111 cpl_test_error(CPL_ERROR_NONE);
01112
01113 cpl_table_delete(lin_table);
01114 cpl_imagelist_delete(coeffs_cube);
01115 cpl_image_delete(bpm);
01116
01117 cpl_imagelist_delete(imlist_on);
01118 cpl_imagelist_delete(imlist_off);
01119 cpl_vector_delete(exptimes);
01120 cpl_propertylist_delete(qclist);
01121 }
01122 }
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135 cpl_frameset * irplib_detmon_tests_fill_frameset(const char * tag_on,
01136 const char * tag_off,
01137 int non,
01138 cpl_boolean opt_nir,
01139 cpl_boolean with_exts,
01140 int nexts,
01141 int nsettings)
01142 {
01143 cpl_frameset * frameset;
01144 cpl_frame * frame;
01145 int i, h;
01146 char frame_name[20];
01147 cpl_propertylist * plist;
01148 cpl_image * image;
01149 frameset = cpl_frameset_new();
01150
01151 for (h = 0; h < nsettings; h++) {
01152 for (i=0; i<non; i++) {
01153 frame = cpl_frame_new();
01154 sprintf(frame_name, "dummyon%d%d.fits",i,h);
01155 cpl_frame_set_filename(frame, frame_name);
01156 cpl_frame_set_tag(frame, tag_on);
01157 cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
01158 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
01159
01160 cpl_frameset_insert(frameset, frame);
01161
01162 plist = cpl_propertylist_new();
01163 if(opt_nir == TRUE) {
01164 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
01165 } else {
01166 cpl_propertylist_append_double(plist, "ESO DET WIN1 UIT1", (double)((i+1)/2));
01167 }
01168
01169 cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2 + 1) );
01170 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01171
01172 cpl_propertylist_append_double(plist, "SETTING", h+1);
01173 if(with_exts == TRUE) {
01174 int j;
01175 cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01176 for(j = 0; j < nexts; j++) {
01177 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01178 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01179 cpl_image_add_scalar(image,300* i);
01180 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01181
01182 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
01183 cpl_image_delete(image);
01184 }
01185 } else {
01186 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01187 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01188 cpl_image_add_scalar(image,300* i);
01189 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01190
01191 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01192
01193
01194 cpl_image_delete(image);
01195 }
01196 cpl_propertylist_delete(plist);
01197 }
01198 for (i=0; i<non; i++) {
01199
01200
01201 frame = cpl_frame_new();
01202 sprintf(frame_name, "dummyoff%d%d.fits",i,h);
01203 cpl_frame_set_filename(frame, frame_name);
01204 cpl_frame_set_tag(frame, tag_off);
01205 cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
01206 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
01207
01208 cpl_frameset_insert(frameset, frame);
01209
01210 plist = cpl_propertylist_new();
01211 if(opt_nir == TRUE) {
01212 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
01213 } else {
01214 cpl_propertylist_append_double(plist, "ESO DET WIN1 UIT1", (double)((i+1)/2));
01215 }
01216 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01217 cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2 + 1));
01218 cpl_propertylist_append_double(plist, "SETTING", h+1);
01219
01220 if(with_exts == TRUE) {
01221 int j;
01222 cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01223 for(j = 0; j < nexts; j++) {
01224 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01225 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01226 cpl_image_add_scalar(image, i);
01227 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01228
01229 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
01230 cpl_image_delete(image);
01231 }
01232 } else {
01233 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01234 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01235 cpl_image_add_scalar(image, i);
01236 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01237
01238 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01239
01240
01241 cpl_image_delete(image);
01242 }
01243 cpl_propertylist_delete(plist);
01244 }
01245 }
01246
01247 return frameset;
01248 }
01249
01250
01251 cpl_frameset * irplib_detmon_tests_fill_frameset_oct(const char * tag_on,
01252 const char * tag_off,
01253 int non,
01254 cpl_boolean opt_nir,
01255 cpl_boolean with_exts,
01256 int nexts)
01257 {
01258 cpl_frameset * frameset;
01259 cpl_frame * frame;
01260 int i;
01261 char frame_name[20];
01262 cpl_propertylist * plist;
01263 cpl_image * image;
01264 frameset = cpl_frameset_new();
01265
01266 for (i=0; i<non; i++) {
01267 frame = cpl_frame_new();
01268 sprintf(frame_name, "dummyon%d.fits",i);
01269 cpl_frame_set_filename(frame, frame_name);
01270 cpl_frame_set_tag(frame, tag_on);
01271 cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
01272 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
01273
01274 cpl_frameset_insert(frameset, frame);
01275
01276 plist = cpl_propertylist_new();
01277 if(opt_nir == TRUE) {
01278 if( i == 2 || i == 3) {
01279 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(1));
01280 cpl_propertylist_append_double(plist, "EXPTIME", (double)(1));
01281 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01282 } else {
01283 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
01284 cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2+1));
01285 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01286 }
01287 } else {
01288 cpl_propertylist_append_double(plist, "ESO DET WIN1 UIT1", (double)((i+1)/2));
01289 cpl_propertylist_append_double(plist, "EXPTIME", (double)((i+1)/2));
01290 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01291 }
01292
01293 if(with_exts == TRUE) {
01294 int j;
01295 cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01296 for(j = 0; j < nexts; j++) {
01297 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01298 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01299 if(i == 0 || i == 1 || i== 2 || i == 3) {
01300 cpl_image_add_scalar(image,300);
01301 } else
01302 cpl_image_add_scalar(image,300* i);
01303 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01304
01305 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
01306 cpl_image_delete(image);
01307 }
01308 } else {
01309 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01310 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01311 if(i == 0 || i == 1 || i== 2 || i == 3) {
01312 cpl_image_add_scalar(image,300);
01313 } else
01314 cpl_image_add_scalar(image,300* i);
01315
01316 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01317
01318 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01319
01320
01321 cpl_image_delete(image);
01322 }
01323 cpl_propertylist_delete(plist);
01324 }
01325
01326 for (i=0; i<non; i++) {
01327
01328
01329 frame = cpl_frame_new();
01330 sprintf(frame_name, "dummyoff%d.fits",i);
01331 cpl_frame_set_filename(frame, frame_name);
01332 cpl_frame_set_tag(frame, tag_off);
01333 cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
01334 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
01335
01336 cpl_frameset_insert(frameset, frame);
01337
01338 plist = cpl_propertylist_new();
01339 if(opt_nir == TRUE) {
01340 if( i == 2 || i == 3) {
01341 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(1));
01342 cpl_propertylist_append_double(plist, "EXPTIME", (double)(1));
01343 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01344 } else {
01345 cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
01346 cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2+1));
01347 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01348 }
01349 } else {
01350 cpl_propertylist_append_double(plist, "ESO DET WIN1 UIT1", (double)((i+1)/2));
01351 cpl_propertylist_append_double(plist, "EXPTIME", (double)((i+1)/2));
01352 cpl_propertylist_append_double(plist, "MJD-OBS", 0);
01353 }
01354
01355 if(with_exts == TRUE) {
01356 int j;
01357 cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01358 for(j = 0; j < nexts; j++) {
01359 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01360 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01361 if(i == 0 || i == 1 || i== 2 || i == 3) {
01362 cpl_image_add_scalar(image,300);
01363 } else
01364 cpl_image_add_scalar(image,300* i);
01365
01366 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01367
01368 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
01369 cpl_image_delete(image);
01370 }
01371 } else {
01372 image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01373 cpl_image_fill_noise_uniform(image, 5 - i, 10 + i);
01374 if(i == 0 || i == 1 || i== 2 || i == 3) {
01375 cpl_image_add_scalar(image,300);
01376 } else
01377 cpl_image_add_scalar(image,300* i);
01378
01379 cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
01380
01381 cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
01382
01383
01384 cpl_image_delete(image);
01385 }
01386 cpl_propertylist_delete(plist);
01387 }
01388
01389 return frameset;
01390 }
01391
01392
01393 int compare_settings(const cpl_frame * frame1, const cpl_frame * frame2)
01394 {
01395 int comparison;
01396 cpl_propertylist *plist1;
01397 cpl_propertylist *plist2;
01398 double dval1, dval2;
01399
01400
01401 if(frame1 == NULL || frame2 == NULL)
01402 return -1;
01403
01404
01405 if((plist1 = cpl_propertylist_load(cpl_frame_get_filename(frame1),
01406 0)) == NULL) {
01407 cpl_msg_error(cpl_func, "getting header from reference frame");
01408 return -1;
01409 }
01410 if((plist2 = cpl_propertylist_load(cpl_frame_get_filename(frame2),
01411 0)) == NULL) {
01412 cpl_msg_error(cpl_func, "getting header from reference frame");
01413 cpl_propertylist_delete(plist1);
01414 return -1;
01415 }
01416
01417
01418 if(cpl_error_get_code()) {
01419 cpl_propertylist_delete(plist1);
01420 cpl_propertylist_delete(plist2);
01421 return -1;
01422 }
01423
01424
01425 comparison = 1;
01426 dval1 = cpl_propertylist_get_double(plist1, "SETTING");
01427 dval2 = cpl_propertylist_get_double(plist2, "SETTING");
01428 if(cpl_error_get_code()) {
01429 cpl_msg_error(cpl_func, "cannot get exposure time");
01430 cpl_propertylist_delete(plist1);
01431 cpl_propertylist_delete(plist2);
01432 return -1;
01433 }
01434 if( dval1 != dval2)
01435 comparison = 0;
01436
01437
01438 cpl_propertylist_delete(plist1);
01439 cpl_propertylist_delete(plist2);
01440 return comparison;
01441
01442 }
01443
01444 cpl_imagelist * irplib_detmon_tests_imlist(int ndits, cpl_boolean onoff)
01445 {
01446 cpl_imagelist * imlist = cpl_imagelist_new();
01447 int i;
01448
01449 double levelstep = onoff ? ON_LEVEL : OFF_LEVEL;
01450 double factor = onoff ? 1.0 : 0.5;
01451
01452 for (i = 1; i <= ndits; i++) {
01453 cpl_image * im1 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01454 cpl_image * im2 = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
01455 double noise_min = NOISE_MIN * sqrt(i) / (double) ndits * factor;
01456 double noise_max = NOISE_MAX * sqrt(i) / (double) ndits * factor;
01457 cpl_image_fill_noise_uniform(im1, noise_min, noise_max);
01458 cpl_image_fill_noise_uniform(im2, noise_min, noise_max);
01459 cpl_image_add_scalar(im1, levelstep * i);
01460 cpl_image_add_scalar(im2, levelstep * i);
01461 cpl_imagelist_set(imlist, im1, 2 * (i - 1));
01462 cpl_imagelist_set(imlist, im2, 2 * (i - 1) + 1);
01463 }
01464
01465 return imlist;
01466 }
01467