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 <string.h>
00037 #include <math.h>
00038 #include <float.h>
00039 #include <assert.h>
00040 #include <cpl.h>
00041
00042 #include "irplib_utils.h"
00043
00044 #include "visir_parameter.h"
00045 #include "visir_dfs.h"
00046
00047
00048
00049
00050
00051
00052 #define VISIR_PARAMETER_SET(MASK, VARNAME, TYPE, MAN, DEFAULT, SHORT) \
00053 if (bitmask & MASK) { \
00054 char * paramname = irplib_sprintf(PACKAGE ".%s.%s", recipe, VARNAME); \
00055 assert( paramname != NULL ); \
00056 \
00057 bitmask ^= MASK; \
00058 \
00059 if (chkmask & MASK) \
00060 (void)cpl_error_set(cpl_func, CPL_ERROR_UNSPECIFIED); \
00061 chkmask |= MASK; \
00062 \
00063 p = cpl_parameter_new_value(paramname, TYPE, MAN, context, DEFAULT); \
00064 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, SHORT); \
00065 cpl_parameterlist_append(self, p); \
00066 \
00067 cpl_free(paramname); \
00068 \
00069 }
00070
00071
00072 #define VISIR_PARAMETER_GET_BOOL(MASK, VARNAME) \
00073 if (bitmask & MASK) { \
00074 value = irplib_parameterlist_get_bool(self, PACKAGE, recipe, VARNAME); \
00075 \
00076 cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), \
00077 return(CPL_FALSE), "mask=%llu", MASK); \
00078 \
00079 nbits++; \
00080 bitmask ^= MASK; \
00081 \
00082 }
00083
00084
00085 #define VISIR_PARAMETER_GET_INT(MASK, VARNAME) \
00086 if (bitmask & MASK) { \
00087 value = irplib_parameterlist_get_int(self, PACKAGE, recipe, VARNAME); \
00088 \
00089 cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), return(0), \
00090 "mask=%llu", MASK); \
00091 \
00092 nbits++; \
00093 bitmask ^= MASK; \
00094 \
00095 }
00096
00097
00098 #define VISIR_PARAMETER_GET_DOUBLE(MASK, VARNAME) \
00099 if (bitmask & MASK) { \
00100 value = irplib_parameterlist_get_double(self, PACKAGE, recipe, VARNAME); \
00101 \
00102 cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), return(0.0), \
00103 "mask=%llu", MASK); \
00104 \
00105 nbits++; \
00106 bitmask ^= MASK; \
00107 \
00108 }
00109
00110
00111 #define VISIR_PARAMETER_GET_STRING(MASK, VARNAME) \
00112 if (bitmask & MASK) { \
00113 value = irplib_parameterlist_get_string(self, PACKAGE, recipe, VARNAME); \
00114 \
00115 cpl_error_ensure(!cpl_error_get_code(), cpl_error_get_code(), return(NULL),\
00116 "mask=%llu", MASK); \
00117 \
00118 nbits++; \
00119 bitmask ^= MASK; \
00120 \
00121 }
00122
00123
00124
00130
00131
00135
00144
00145 cpl_error_code visir_parameter_set(cpl_parameterlist * self,
00146 const char * recipe,
00147 visir_parameter bitmask)
00148 {
00149
00150 cpl_parameter * p;
00151 char * context;
00152 visir_parameter chkmask = 0;
00153 cpl_boolean zerodist = CPL_FALSE;
00154 cpl_boolean dostrip = CPL_TRUE;
00155
00156
00157 cpl_ensure_code(self, CPL_ERROR_NULL_INPUT);
00158 cpl_ensure_code(recipe, CPL_ERROR_NULL_INPUT);
00159
00160 context = irplib_sprintf(PACKAGE ".%s", recipe);
00161
00162
00163 VISIR_PARAMETER_SET(VISIR_PARAM_NODPOS, "nodding", CPL_TYPE_STRING,
00164 "An optional ASCII specification of the nodding positions "
00165 "(in case they are missing from the FITS-file). "
00166 "The file must consist of one line per input FITS-file "
00167 "and each line must consist of an integer (which is "
00168 "ignored) followed by a 0 or 1 (to indicate object or sky). ",
00169 "", "nod");
00170
00171
00172 VISIR_PARAMETER_SET(VISIR_PARAM_AUTOBPM, "auto_bpm", CPL_TYPE_BOOL,
00173 "Automatic detection and correction of bad pixels",
00174 TRUE, "auto_bpm");
00175
00176
00177 VISIR_PARAMETER_SET(VISIR_PARAM_GLITCH, "rem_glitch", CPL_TYPE_BOOL,
00178 "Automatic filtering of glitches", FALSE, "g");
00179
00180
00181 VISIR_PARAMETER_SET(VISIR_PARAM_PURGE, "purge_bad", CPL_TYPE_BOOL,
00182 "Automatic purging of half-cycle images whose median "
00183 "deviates more than a factor three from the mean of "
00184 "the medians of half-cycle images or whose standard "
00185 "deviation deviates more than a factor three from the "
00186 "mean of their standard deviations", FALSE, "p");
00187
00188
00189 VISIR_PARAMETER_SET(VISIR_PARAM_UNION, "union", CPL_TYPE_BOOL,
00190 "Combine images using their union, as opposed to their "
00191 "intersection (deprecated and ignored, "
00192 "see --combine_method)", TRUE, "union");
00193
00194
00195 VISIR_PARAMETER_SET(VISIR_PARAM_REJECT, "rej", CPL_TYPE_STRING,
00196 "Each resulting pixel is the average of the "
00197 "corresponding (interpolated) pixel value in each "
00198 "jittered image. A positive value, n1, for the first "
00199 "of the two integers specifies that for each pixel the "
00200 "smallest n1 pixel values shall be ignored in the "
00201 "averaging. Similarly, a positive value, n2, for the "
00202 "second of the two integers specifies that for each "
00203 "pixel the largest n2 pixel values shall be ignored in "
00204 "the averaging.", "0 0", "rej");
00205
00206
00207 VISIR_PARAMETER_SET(VISIR_PARAM_PLOT, "plot", CPL_TYPE_INT,
00208 "The recipe can produce a number of predefined plots. "
00209 "Zero means that none of the plots are produced, while "
00210 "increasing values (e.g. 1 or 2) increases the number "
00211 "of plots produced. If the plotting fails a warning is "
00212 "produced, and the recipe continues. "
00213 "The default behaviour of the plotting is to use "
00214 "gnuplot (with option -persist). The recipe currently "
00215 "produces 1D-plots using gnuplot commands. The recipe "
00216 "user can control the actual plotting-command used by "
00217 "the recipe to create the plot by setting the "
00218 "environment variable IRPLIB_PLOTTER. Currently, if "
00219 "IRPLIB_PLOTTER "
00220 "is set it must contain the string 'gnuplot'. Setting "
00221 "it to 'cat > my_gnuplot_$$.txt' causes a number of "
00222 "ASCII-files to be created, which each produce a plot "
00223 "when given as standard input to gnuplot (e.g. later "
00224 "or on a different computer). A finer control of the "
00225 "plotting options can be obtained by writing an "
00226 "executable script, e.g. my_gnuplot.pl, that "
00227 "executes gnuplot after setting the desired gnuplot "
00228 "options (e.g. set terminal pslatex color) "
00229 "and then setting IRPLIB_PLOTTER to my_gnuplot.pl. "
00230 "The predefined plots include plotting of images. "
00231 "Images can be plotted not only with gnuplot, but also "
00232 "using the pnm format. This is controlled with the "
00233 "environment variable IRPLIB_IMAGER. If IRPLIB_IMAGER "
00234 "is set to a string that does not contain the word "
00235 "gnuplot, the recipe will generate the plot in pnm "
00236 "format. E.g. setting IRPLIB_IMAGER to "
00237 "'cat | display - &' will produce a gray-scale image "
00238 "using the image viewer display.", 0, "plot");
00239
00240 if (bitmask & VISIR_PARAM_ZERODIST) {
00241 bitmask ^= VISIR_PARAM_ZERODIST;
00242
00243
00244 zerodist = CPL_TRUE;
00245 }
00246
00247
00248
00249
00250
00251 VISIR_PARAMETER_SET(VISIR_PARAM_SLITSKEW, "phi", CPL_TYPE_DOUBLE,
00252 "Distortion correction: Skew of slit [degrees] "
00253 "(clockwise)", zerodist ? 0.0 : 1.6, "slit_skew");
00254
00255
00256
00257
00258 VISIR_PARAMETER_SET(VISIR_PARAM_SPECSKEW, "ksi", CPL_TYPE_DOUBLE,
00259 "Distortion correction: LMR Skew of spectrum [degrees] "
00260 "(counter-clockwise). Not used in High Resolution",
00261 zerodist ? 0.0 : 0.7, "spectrum_skew");
00262
00263
00264
00265 VISIR_PARAMETER_SET(VISIR_PARAM_VERTARC, "eps", CPL_TYPE_DOUBLE,
00266 "Distortion correction: LR Detector vertical curvature "
00267 "[pixel]. Reduced by a factor 4 in MR. Not used in HR "
00268 "A-side. Increased by a factor 115/52 in HR B-side",
00269 zerodist ? 0.0 : 1.04, "vert_arc");
00270
00271
00272
00273 VISIR_PARAMETER_SET(VISIR_PARAM_HORIARC, "delta", CPL_TYPE_DOUBLE,
00274 "Distortion correction: LMR Detector horizontal "
00275 "curvature [pixel]. Increased by a factor 1.5 in HR "
00276 "A-side. Reduced by a factor 2 in HR B-side",
00277 zerodist ? 0.0 : 0.08, "hori_arc");
00278
00279
00280 VISIR_PARAMETER_SET(VISIR_PARAM_ORDEROFF, "orderoffset", CPL_TYPE_INT,
00281 "Echelle order offset. The offset is relative to the "
00282 "main order. The allowed range of offsets depend on "
00283 "the selected grism. The offset can never exceed +/-4. "
00284 "If the main order is e.g. 8 an order offset of +1 "
00285 "will cause the recipe to base the data reduction on "
00286 "order 9. With a positive order offset the central "
00287 "wavelength becomes smaller while for a negative "
00288 "order offset the central wavelength becomes larger.", 0,
00289 "orderoffset");
00290
00291
00292 VISIR_PARAMETER_SET(VISIR_PARAM_OFFSETS, "offsets", CPL_TYPE_STRING,
00293 "An optional ASCII specification of the offsets "
00294 "in case they are missing from the FITS-file. "
00295 "The file must consist of one line per input pair of "
00296 "FITS-files, and each line must consist of two numbers, "
00297 "which represent the shift in pixel of that image. "
00298 "The reference point of the coordinates of the shift "
00299 "may be chosen by the user. A convenient reference "
00300 "point causes the offset of the first image to be (0,0) "
00301 "and the other offsets to be relative to the first "
00302 "image.", "", "off");
00303
00304 VISIR_PARAMETER_SET(VISIR_PARAM_REFINE, "refine", CPL_TYPE_BOOL,
00305 "User-defined refining of the image offsets. See options "
00306 "objs and xcorr", FALSE, "ref");
00307
00308 VISIR_PARAMETER_SET(VISIR_PARAM_OBJECTS, "objects", CPL_TYPE_STRING,
00309 "The shift and add of images needs anchor points that "
00310 "typically are bright objects. These are normally "
00311 "detected automatically but with user-defined refining "
00312 "of offsets enabled, they must be provided by the user "
00313 "through an ASCII file containing one line per anchor "
00314 "point with each line consisting of its x and y "
00315 "coordinate (in pixels). This file is ignored with "
00316 "user-defined refining of offsets disabled.",
00317 "", "objs");
00318
00319
00320
00321 VISIR_PARAMETER_SET(VISIR_PARAM_XCORR, "xcorr", CPL_TYPE_STRING,
00322 "If user-defined refining of offsets is enabled a "
00323 "cross-correlation of the images is performed. In "
00324 "order to speed up this process, this cross-"
00325 "correlation is performed only on smaller rectangles "
00326 "around the anchor points. The first two parameters "
00327 "is the half-size of this rectangle in pixels. The "
00328 "second pair is the maximum shift in x and y (pixels) "
00329 "evaluated by the cross-correlation on the rectangle. "
00330 "Used only if user-defined refining of offsets is enabled.",
00331 "10 10 25 25", "xcorr");
00332
00333
00334 VISIR_PARAMETER_SET(VISIR_PARAM_JYVAL, "jy_val", CPL_TYPE_DOUBLE,
00335 "The flux of the standard star in Jansky",
00336 -999.0, "jy_val");
00337
00338
00339 VISIR_PARAMETER_SET(VISIR_PARAM_RADII, "radii", CPL_TYPE_STRING,
00340 "Radii : star_max bg_int bg_ext",
00341 "20 20 30", "radii");
00342
00343
00344 VISIR_PARAMETER_SET(VISIR_PARAM_LOWLIM, "low", CPL_TYPE_DOUBLE,
00345 "Low threshold for the bad pixel map",
00346 0.2, "low");
00347
00348
00349 VISIR_PARAMETER_SET(VISIR_PARAM_HIGHLIM, "high", CPL_TYPE_DOUBLE,
00350 "High threshold for the bad pixel map",
00351 5.0, "high");
00352
00353
00354 VISIR_PARAMETER_SET(VISIR_PARAM_FIXCOMBI, "fixcombi", CPL_TYPE_BOOL,
00355 "Perform the distortion correction on the combined "
00356 "image, and not on each of the jittered images. "
00357 "This will reduce excution time and degrade the quality "
00358 "of the combined image",
00359 FALSE, "fixcombi");
00360
00361
00362 VISIR_PARAMETER_SET(VISIR_PARAM_EMIS_TOL, "emis_tol", CPL_TYPE_DOUBLE,
00363 "The computation of the mean and standard deviation "
00364 "of the sensitivity is done for wavelengths with an "
00365 "atmospheric emissivity of at most "
00366 "emis_min + emis_tol * (emis_max - emis_min), where "
00367 "emis_min is the minimum emissivity in the observed "
00368 "wavelength range and emis_max is the ditto maximum. "
00369 "Thus emis_tol = 1 means that all wavelengths are "
00370 "included.",
00371 1.0, "emis_tol");
00372
00373
00374 VISIR_PARAMETER_SET(VISIR_PARAM_QEFF, "qeff", CPL_TYPE_DOUBLE,
00375 "The overall Quantum-efficiency. The default value "
00376 "comes from PH. Galdemard measurements. This option "
00377 "is ignored for all but " VISIR_SPC_QEFF_ASCII
00378 "-tagged files, while the efficiencies in such files "
00379 "are multiplied by this overall efficiency",
00380 0.72, "qeff");
00381
00382
00383 VISIR_PARAMETER_SET(VISIR_PARAM_REJBORD, "rej_bord", CPL_TYPE_STRING,
00384 "Rejected left right bottom and top border [pixel]",
00385 "50 50 50 50", "r");
00386
00387
00388 VISIR_PARAMETER_SET(VISIR_PARAM_HOT_LIM, "hot_threshold", CPL_TYPE_DOUBLE,
00389 "Hot pixel map threshold", 10.0, "hot_t");
00390
00391
00392 VISIR_PARAMETER_SET(VISIR_PARAM_COLD_LIM, "cold_threshold", CPL_TYPE_DOUBLE,
00393 "Cold pixel map threshold", 6.0, "cold_t");
00394
00395
00396 VISIR_PARAMETER_SET(VISIR_PARAM_DEV_LIM, "dev_threshold", CPL_TYPE_DOUBLE,
00397 "Deviant pixel map threshold", 5.0, "dev_t");
00398
00399
00400 VISIR_PARAMETER_SET(VISIR_PARAM_NSAMPLES, "nsamples", CPL_TYPE_INT,
00401 "Number of samples for Read-Out Noise (RON) computation",
00402 100, "nsamples");
00403
00404
00405 VISIR_PARAMETER_SET(VISIR_PARAM_HALFSIZE, "hsize", CPL_TYPE_INT,
00406 "Half size of the window for Read-Out Noise (RON) "
00407 "computation", 2, "hsize");
00408
00409
00410
00411 VISIR_PARAMETER_SET(VISIR_PARAM_COMBINE, "comb_meth", CPL_TYPE_STRING,
00412 "Combine images using one of: 1) Onto the first image "
00413 "(first); 2) Their union (union); 3) Their intersection"
00414 " (inter). NB: Only the 'first'-method produces an "
00415 "image product with WCS coordinates. A successful "
00416 "'first'-method always produces a combined image with "
00417 "dimensions equal to those of the input images. "
00418 "For the 'union'-method the result image is at least "
00419 "as large as the input images while for the 'inter'-"
00420 "method the result image is at most as large as the "
00421 "input images", "union", "combine_method");
00422
00423 if (bitmask & VISIR_PARAM_STRIPNON) {
00424 bitmask ^= VISIR_PARAM_STRIPNON;
00425
00426
00427 dostrip = CPL_FALSE;
00428 }
00429
00430
00431 VISIR_PARAMETER_SET(VISIR_PARAM_STRIPITE, "nstripe",
00432 CPL_TYPE_INT, "Max number of destriping iterations "
00433 "(0 to disable destriping). Horizontal destriping is "
00434 "done first and if no horizontal striping is detected, "
00435 "vertical destriping is performed", dostrip ? 15 : 0,
00436 "destripe_iterations");
00437
00438
00439 VISIR_PARAMETER_SET(VISIR_PARAM_STRIPMOR, "mstripe", CPL_TYPE_BOOL,
00440 "Destripe with morphological cleaning", FALSE,
00441 "destripe_morpho");
00442
00443
00444 VISIR_PARAMETER_SET(VISIR_PARAM_REJLEFT, "reject_left", CPL_TYPE_INT,
00445 "Reject leftmost columns in spectrum extraction, zero "
00446 "means all columns on the left are used. In cross-"
00447 "dispersion mode a (small) negative number may be used "
00448 "[pixel]", 0, "rl");
00449
00450
00451 VISIR_PARAMETER_SET(VISIR_PARAM_REJRIGHT, "reject_right", CPL_TYPE_INT,
00452 "Reject rightmost columns in spectrum extraction, zero "
00453 "means all columns on the right are used. In cross-"
00454 "dispersion mode a (small) negative number may be used "
00455 "[pixel]", 0, "rr");
00456
00457 cpl_free(context);
00458
00459 cpl_ensure_code(!cpl_error_get_code(), cpl_error_get_code());
00460 cpl_ensure_code(bitmask == 0, CPL_ERROR_UNSUPPORTED_MODE);
00461
00462 return CPL_ERROR_NONE;
00463 }
00464
00465
00475
00476 cpl_boolean visir_parameterlist_get_bool(const cpl_parameterlist * self,
00477 const char * recipe,
00478 visir_parameter bitmask)
00479 {
00480
00481 int nbits = 0;
00482 cpl_boolean value = CPL_FALSE;
00483
00484
00485 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), CPL_FALSE);
00486 cpl_ensure(self, CPL_ERROR_NULL_INPUT, CPL_FALSE);
00487 cpl_ensure(recipe, CPL_ERROR_NULL_INPUT, CPL_FALSE);
00488
00489
00490 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_AUTOBPM, "auto_bpm");
00491
00492
00493 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_GLITCH, "rem_glitch");
00494
00495
00496 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_PURGE, "purge_bad");
00497
00498 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_REFINE, "refine");
00499
00500
00501 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_FIXCOMBI, "fixcombi");
00502
00503
00504 VISIR_PARAMETER_GET_BOOL(VISIR_PARAM_STRIPMOR, "mstripe");
00505
00506
00507 cpl_ensure(bitmask == 0, CPL_ERROR_UNSUPPORTED_MODE, CPL_FALSE);
00508 cpl_ensure(nbits == 1, CPL_ERROR_ILLEGAL_INPUT, CPL_FALSE);
00509
00510 return value;
00511
00512 }
00513
00514
00515
00525
00526 int visir_parameterlist_get_int(const cpl_parameterlist * self,
00527 const char * recipe,
00528 visir_parameter bitmask)
00529 {
00530
00531 int nbits = 0;
00532 int value = 0;
00533
00534
00535 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), 0);
00536 cpl_ensure(self, CPL_ERROR_NULL_INPUT, 0);
00537 cpl_ensure(recipe, CPL_ERROR_NULL_INPUT, 0);
00538
00539
00540
00541 VISIR_PARAMETER_GET_INT(VISIR_PARAM_PLOT, "plot");
00542
00543
00544 VISIR_PARAMETER_GET_INT(VISIR_PARAM_ORDEROFF, "orderoffset");
00545
00546
00547 VISIR_PARAMETER_GET_INT(VISIR_PARAM_NSAMPLES, "nsamples");
00548
00549
00550 VISIR_PARAMETER_GET_INT(VISIR_PARAM_HALFSIZE, "hsize");
00551
00552
00553 VISIR_PARAMETER_GET_INT(VISIR_PARAM_STRIPITE, "nstripe");
00554
00555
00556 VISIR_PARAMETER_GET_INT(VISIR_PARAM_REJLEFT, "reject_left");
00557
00558
00559 VISIR_PARAMETER_GET_INT(VISIR_PARAM_REJRIGHT, "reject_right");
00560
00561
00562 cpl_ensure(bitmask == 0, CPL_ERROR_UNSUPPORTED_MODE, 0);
00563 cpl_ensure(nbits == 1, CPL_ERROR_ILLEGAL_INPUT, 0);
00564
00565 return value;
00566
00567 }
00568
00569
00579
00580 double visir_parameterlist_get_double(const cpl_parameterlist * self,
00581 const char * recipe,
00582 visir_parameter bitmask)
00583 {
00584
00585 int nbits = 0;
00586 double value = DBL_MAX;
00587
00588
00589 cpl_ensure(!cpl_error_get_code(), cpl_error_get_code(), 0.0);
00590 cpl_ensure(self, CPL_ERROR_NULL_INPUT, 0.0);
00591 cpl_ensure(recipe, CPL_ERROR_NULL_INPUT, 0.0);
00592
00593
00594 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_SLITSKEW, "phi");
00595
00596
00597 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_SPECSKEW, "ksi");
00598
00599
00600 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_VERTARC, "eps");
00601
00602
00603 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_HORIARC, "delta");
00604
00605
00606 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_JYVAL, "jy_val");
00607
00608
00609 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_LOWLIM, "low");
00610
00611
00612 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_HIGHLIM, "high");
00613
00614
00615 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_EMIS_TOL, "emis_tol");
00616
00617
00618 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_QEFF, "qeff");
00619
00620
00621 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_HOT_LIM, "hot_threshold");
00622
00623
00624 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_COLD_LIM, "cold_threshold");
00625
00626
00627 VISIR_PARAMETER_GET_DOUBLE(VISIR_PARAM_DEV_LIM, "dev_threshold");
00628
00629 cpl_ensure(bitmask == 0, CPL_ERROR_UNSUPPORTED_MODE, 0.0);
00630 cpl_ensure(nbits == 1, CPL_ERROR_ILLEGAL_INPUT, 0.0);
00631
00632 return value;
00633
00634 }
00635
00636
00637
00638
00647
00648 const char * visir_parameterlist_get_string(const cpl_parameterlist * self,
00649 const char * recipe,
00650 visir_parameter bitmask)
00651 {
00652
00653 int nbits = 0;
00654 const char * value = NULL;
00655 const cpl_boolean is_combine
00656 = bitmask & VISIR_PARAM_COMBINE ? CPL_TRUE : CPL_FALSE;
00657
00658 cpl_ensure(self, CPL_ERROR_NULL_INPUT, NULL);
00659 cpl_ensure(recipe, CPL_ERROR_NULL_INPUT, NULL);
00660
00661
00662 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_NODPOS, "nodding");
00663
00664
00665 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_REJECT, "rej");
00666
00667
00668 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_OFFSETS, "offsets");
00669
00670 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_REFINE, "refine");
00671
00672 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_OBJECTS, "objects");
00673
00674
00675 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_XCORR, "xcorr");
00676
00677
00678 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_RADII, "radii");
00679
00680
00681 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_REJBORD, "rej_bord");
00682
00683
00684 VISIR_PARAMETER_GET_STRING(VISIR_PARAM_COMBINE, "comb_meth");
00685
00686 cpl_ensure(bitmask == 0, CPL_ERROR_UNSUPPORTED_MODE, NULL);
00687 cpl_ensure(nbits == 1, CPL_ERROR_ILLEGAL_INPUT, NULL);
00688
00689 assert(value != NULL);
00690
00691
00692 if (is_combine)
00693 cpl_ensure(strcmp(value, "first") == 0 || strcmp(value, "union") == 0 ||
00694 strcmp(value, "intersect") == 0, CPL_ERROR_UNSUPPORTED_MODE,
00695 NULL);
00696
00697 return value;
00698
00699 }
00700