SINFONI Pipeline Reference Manual  2.5.2
sinfo_distortion_config.c
1 /* $Id: sinfo_distortion_config.c,v 1.6 2012-03-02 08:42:20 amodigli Exp $
2  *
3  * This file is part of the CPL (Common Pipeline Library)
4  * Copyright (C) 2002 European Southern Observatory
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 /*
21  * $Author: amodigli $
22  * $Date: 2012-03-02 08:42:20 $
23  * $Revision: 1.6 $
24  * $Name: not supported by cvs2svn $
25  */
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 /****************************************************************
31  * Wavecal Frames Data Reduction Parameter Initialization *
32  ****************************************************************/
33 
34 #include "sinfo_distortion_config.h"
35 #include "sinfo_globals.h"
37 /*---------------------------------------------------------------------------*/
41 /*---------------------------------------------------------------------------*/
42 
43 void
44 sinfo_distortion_config_add(cpl_parameterlist *list)
45 {
46 
47  cpl_parameter *p;
48 
49  if (!list) {
50  return;
51  }
52 
53  /* Output file name */
54  /* output name of resulting fits wavelength map */
55 
56 
57  /* Find Lines */
58  /* indicates if the dispersion relation is already determined or not */
59  p = cpl_parameter_new_value("sinfoni.distortion.calib_indicator",
60  CPL_TYPE_BOOL,
61  "Calib Indicator: "
62  "FALSE: if the dispersion relation is already "
63  "known, the routine can jump to the waveMap "
64  "section "
65  "TRUE: if the dispersion relation "
66  "must first be determined",
67  "sinfoni.distortion",
68  TRUE);
69 
70  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-calib_indicator");
71  cpl_parameterlist_append(list, p);
72 
73 
74  /* minimal difference of mean and sinfo_median column intensity */
75  p = cpl_parameter_new_value("sinfoni.distortion.min_diff_mean_med_col_int",
76  CPL_TYPE_DOUBLE,
77  "Minimum Of Difference: "
78  "minimum difference of mean and median column "
79  "intensity to carry out the cross correlation",
80  "sinfoni.distortion",
81  10.);
82 
83  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
84  "dist-min_diff_mean_med_col_int");
85  cpl_parameterlist_append(list, p);
86 
87  /* half width of a box within which the line must sit */
88  p = cpl_parameter_new_value("sinfoni.distortion.half_width",
89  CPL_TYPE_INT,
90  "Half Width: "
91  "half width of a box within which the line "
92  "must be placed",
93  "sinfoni.distortion",
94  7);
95 
96  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-hw");
97  cpl_parameterlist_append(list, p);
98 
99  /* sigma of Gaussian of artificial model spectra */
100  p = cpl_parameter_new_value("sinfoni.distortion.sigma",
101  CPL_TYPE_DOUBLE,
102  "Sigma: sigma of Gaussian which is convolved "
103  "with the artificial spectrum generated using "
104  "the line list",
105  "sinfoni.distortion",
106  2.);
107 
108  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-sigma");
109  cpl_parameterlist_append(list, p);
110 
111  /* Wavelength Calibration */
112  /* guess value for fwhm of emission lines */
113  p = cpl_parameter_new_value("sinfoni.distortion.fwhm",
114  CPL_TYPE_DOUBLE,
115  "FWHM: initial guess value for the fwhm of "
116  "the Gaussian used for the line fit",
117  "sinfoni.distortion",
118  2.83);
119 
120  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-fwhm");
121  cpl_parameterlist_append(list, p);
122 
123  /* minimum amplitude of a line to be fitted */
124  p = cpl_parameter_new_value("sinfoni.distortion.min_amplitude",
125  CPL_TYPE_DOUBLE,
126  "Minimum Of Amplitude: "
127  "of the Gaussian to do the fit",
128  "sinfoni.distortion",
129  5.);
130 
131  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-min_amplitude");
132  cpl_parameterlist_append(list, p);
133 
134  /* maximal residual value for a valid fit */
135  p = cpl_parameter_new_value("sinfoni.distortion.max_residual",
136  CPL_TYPE_DOUBLE,
137  "Maximum Residuals value: "
138  "beyond this value the fit is rejected",
139  "sinfoni.distortion",
140  0.5);
141 
142  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-max_residual");
143  cpl_parameterlist_append(list, p);
144 
145  /* # of polynomial coefficients used for the dispersion relation */
146  p = cpl_parameter_new_value("sinfoni.distortion.n_a_coefficients",
147  CPL_TYPE_INT,
148  "Number of A coefficients: number of "
149  "polynomial coefficients for the "
150  "dispersion relation",
151  "sinfoni.distortion",
152  4);
153 
154  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-n_a_coeffs");
155  cpl_parameterlist_append(list, p);
156 
157  /* # of polynomial coefficients used for the fit of the dispersion
158  coefficients */
159  p = cpl_parameter_new_value("sinfoni.distortion.n_b_coefficients",
160  CPL_TYPE_INT,
161  "Number of B coefficients: "
162  "number of polynomial coefficients for the "
163  "polynomial fit of the dispersion coefficients",
164  "sinfoni.distortion",
165  2);
166 
167  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-n_b_coeffs");
168  cpl_parameterlist_append(list, p);
169 
170  /* minimal factor of the standard deviation of the fit coefficients */
171  p = cpl_parameter_new_value("sinfoni.distortion.sigma_factor",
172  CPL_TYPE_DOUBLE,
173  "Sigma Factor: "
174  "Factor of the standard deviation of the "
175  "polynomial coefficients of the dispersion "
176  "relation beyond which the coefficients are "
177  "not used for the fit",
178  "sinfoni.distortion",
179  1.5);
180 
181  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-sigma_factor");
182  cpl_parameterlist_append(list, p);
183 
184  /* indicates if the parameterized dispersion relation coefficients
185  should be written into an ASCII file */
186  p = cpl_parameter_new_value("sinfoni.distortion.write_coeffs_ind",
187  CPL_TYPE_BOOL,
188  "Write Coefficients Index: "
189  "indicates if the coefficients should "
190  "be written into a file or not",
191  "sinfoni.distortion",
192  TRUE);
193 
194  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-wcoeff_ind");
195  cpl_parameterlist_append(list, p);
196 
197  /* indicates if the fit parameters should be written into an ASCII file */
198  p = cpl_parameter_new_value("sinfoni.distortion.write_par_ind",
199  CPL_TYPE_BOOL,
200  "Write Parameter Index: "
201  "indicates if the fit parameters should "
202  "be written into a file or not ",
203  "sinfoni.distortion",
204  TRUE);
205 
206  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-par_ind");
207  cpl_parameterlist_append(list, p);
208 
209 
210  /* minimal distance of the slitlets in spectral direction */
211  p = cpl_parameter_new_value("sinfoni.distortion.pixel_dist",
212  CPL_TYPE_INT,
213  "Minimal Slitlets's Distance in spectral direction",
214  "sinfoni.distortion",
215  15);
216 
217  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-pixel_dist");
218  cpl_parameterlist_append(list, p);
219 
220 
221 
222  /* allowed pixel position tolerance between estimated and fitted line
223  position
224  */
225  p = cpl_parameter_new_value("sinfoni.distortion.pixel_tol",
226  CPL_TYPE_DOUBLE,
227  "Pixel Tolerance: allowed pixel position "
228  "tolerance between estimated and fitted "
229  "line position",
230  "sinfoni.distortion",
231  5.0);
232 
233  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-pixel_tol");
234  cpl_parameterlist_append(list, p);
235 
236  /* Wavelength Map */
237  /* indicator if wavelength map should be generated or not */
238  p = cpl_parameter_new_value("sinfoni.distortion.wave_map_ind",
239  CPL_TYPE_BOOL,
240  "Wavelength Map Indicator: "
241  "indicates if the wavelength calibration map "
242  "should be generated (TRUE) or not (FALSE)",
243  "sinfoni.distortion",
244  FALSE);
245 
246  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-wave_map_ind");
247  cpl_parameterlist_append(list, p);
248 
249  /* magnifying factor for FFT */
250  p = cpl_parameter_new_value("sinfoni.distortion.mag_factor",
251  CPL_TYPE_INT,
252  "Magnificator Factor: "
253  "magnifying factor for the number of pixels "
254  "in the columns needed for FFT",
255  "sinfoni.distortion",
256  8);
257 
258  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-mag_factor");
259  cpl_parameterlist_append(list, p);
260 
261  /* Fits Slits */
262  /* indicator if the fit of the slit edge positions is carried through or not */
263  p = cpl_parameter_new_value("sinfoni.distortion.slit_pos_indicator",
264  CPL_TYPE_BOOL,
265  "Slit Position Indicator: "
266  "indicates if the fits of the slitlet "
267  "edge positions should be carried "
268  "through or not",
269  "sinfoni.distortion",
270  TRUE);
271 
272  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-slit_pos_ind");
273  cpl_parameterlist_append(list, p);
274 
275  /* indicator if the fit model function is a Boltzmann function or not */
276  p = cpl_parameter_new_value("sinfoni.distortion.fit_boltz_indicator",
277  CPL_TYPE_BOOL ,
278  "Fit Boltzmann Indicator: "
279  "indicates if the fits of the slitlet edge "
280  "positions is carried trough by using a "
281  "Boltzmann function as model function",
282  "sinfoni.distortion",
283  TRUE);
284 
285  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-fit_boltz_ind");
286  cpl_parameterlist_append(list, p);
287 
288  /* indicator if the fit model function is a simple edge function or not */
289  p = cpl_parameter_new_value("sinfoni.distortion.fit_edge_indicator",
290  CPL_TYPE_BOOL,
291  "Fit Edge Indicator: "
292  "indicates if the fits of the slitlet edge "
293  "positions is carried through by using a "
294  "simple edge function as model function",
295  "sinfoni.distortion",
296  FALSE);
297 
298  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-fit_edge_ind");
299  cpl_parameterlist_append(list, p);
300 
301  /* indicator if the fit guess position are user
302  given or calculated automatically */
303 
304  p = cpl_parameter_new_value("sinfoni.distortion.estimate_indicator",
305  CPL_TYPE_BOOL,
306  "Estimate Indicator: "
307  "indicates if the fits of the slitlet edge "
308  "positions is carried through by using a list "
309  "of estimated guess positions in a file (TRUE)"
310  "or if the initial positions are calculated "
311  "automatically (FALSE). The estimation case "
312  "is more stable",
313  "sinfoni.distortion",
314  FALSE);
315 
316  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-estimate_ind");
317  cpl_parameterlist_append(list, p);
318 
319  /* pixel length of the row box within which
320  the fit of the slitlet positions is carried out*/
321 
322  p = cpl_parameter_new_value("sinfoni.distortion.box_length",
323  CPL_TYPE_INT,
324  "Box Length: "
325  "pixel length of the row box within "
326  "which the fit is carried out",
327  "sinfoni.distortion",
328  32);
329 
330  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-box_len");
331  cpl_parameterlist_append(list, p);
332 
333  /* float box half width in spectral direction */
334  p = cpl_parameter_new_value("sinfoni.distortion.y_box",
335  CPL_TYPE_DOUBLE,
336  "Y Box: half width of a small box in "
337  "spectral direction within which the "
338  "maximal intensity pixel is searched",
339  "sinfoni.distortion",
340  5.);
341 
342  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-y_box");
343  cpl_parameterlist_append(list, p);
344 
345  /* maximal tolerable difference to the expected slitlet positions */
346  p = cpl_parameter_new_value("sinfoni.distortion.diff_tol",
347  CPL_TYPE_DOUBLE,
348  "Difference Tolearance: "
349  "maximal tolerable difference of the "
350  "resulting fit positions of the slitlet "
351  "edges with respect to the expected positions",
352  "sinfoni.distortion",
353  2.);
354 
355  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-diff_toll");
356  cpl_parameterlist_append(list, p);
357 
358 
359  p = cpl_parameter_new_value("sinfoni.distortion.qc_thresh_min",
360  CPL_TYPE_INT,
361  "qc_thresh_min",
362  "sinfoni.distortion",
363  0);
364 
365  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-qc_thresh_min");
366  cpl_parameterlist_append(list, p);
367 
368 
369  p = cpl_parameter_new_value("sinfoni.distortion.qc_thresh_max",
370  CPL_TYPE_INT,
371  "qc_thresh_max",
372  "sinfoni.distortion",
373  49000);
374 
375  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"dist-qc_thresh_max");
376  cpl_parameterlist_append(list, p);
377 
378 
379 
380 
381 
382 
383  /* NORD SOUTH TEST */
384 
385 
386 
387  /* Clean Mean */
388  p = cpl_parameter_new_range("sinfoni.distortion.lower_rejection",
389  CPL_TYPE_DOUBLE,
390  "lower rejection: "
391  "percentage of rejected low intensity pixels "
392  "before averaging",
393  "sinfoni.distortion",
394  0.1,0.0,1.0);
395 
396  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-lo_rejection");
397  cpl_parameterlist_append(list, p);
398 
399  p = cpl_parameter_new_range("sinfoni.distortion.higher_rejection",
400  CPL_TYPE_DOUBLE,
401  "higher rejection: "
402  "percentage of rejected high intensity pixels "
403  "before averaging",
404  "sinfoni.distortion",
405  0.1,0.0,1.0);
406 
407  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-hi_rejection");
408  cpl_parameterlist_append(list, p);
409 
410 
411  p = cpl_parameter_new_value("sinfoni.distortion.mask_ind",
412  CPL_TYPE_BOOL,
413  "Mask Index: "
414  "indicator if a bad pixel mask is applied or not",
415  "sinfoni.distortion",
416  FALSE);
417 
418  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-mask_ind");
419  cpl_parameterlist_append(list, p);
420 
421 
422  /* Gauss Convolution */
423  p = cpl_parameter_new_value("sinfoni.distortion.gauss_ind",
424  CPL_TYPE_BOOL,
425  "Gauss Index: ",
426  "sinfoni.distortion",
427  FALSE);
428 
429  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-gauss_ind");
430  cpl_parameterlist_append(list, p);
431 
432  p = cpl_parameter_new_value("sinfoni.distortion.kernel_half_width",
433  CPL_TYPE_INT,
434  "Kernel Half Width "
435  "kernel half width of the Gaussian "
436  "response function",
437  "sinfoni.distortion",
438  2);
439 
440  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-khw");
441  cpl_parameterlist_append(list, p);
442 
443 
444 
445  /* North South Test */
446 
447 
448 
449  p = cpl_parameter_new_value("sinfoni.distortion.ns_half_width",
450  CPL_TYPE_INT,
451  "Half Width",
452  "sinfoni.distortion",
453  4);
454 
455  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-hw");
456  cpl_parameterlist_append(list, p);
457 
458  p = cpl_parameter_new_value("sinfoni.distortion.ns_fwhm",
459  CPL_TYPE_DOUBLE,
460  "FWHM",
461  "sinfoni.distortion",
462  2.);
463 
464  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-fwhm");
465  cpl_parameterlist_append(list, p);
466 
467 
468  p = cpl_parameter_new_value("sinfoni.distortion.min_diff",
469  CPL_TYPE_DOUBLE,
470  "Minimum of Difference",
471  "sinfoni.distortion",
472  1.);
473 
474  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-min_diff");
475  cpl_parameterlist_append(list, p);
476 
477 
478  p = cpl_parameter_new_value("sinfoni.distortion.dev_tol",
479  CPL_TYPE_DOUBLE,
480  "Dev Tol",
481  "sinfoni.distortion",
482  20.);
483 
484 
485  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"ns-dev_tol");
486  cpl_parameterlist_append(list, p);
487 
488 
489  p = cpl_parameter_new_value("sinfoni.distortion.arcs_thresh_factor",
490  CPL_TYPE_DOUBLE,
491  "arcs threshold factor. "
492  "median_value(image)+ kappa*sigma is the "
493  "minimum intensity threshold of accepted image"
494  "pixels",
495  "sinfoni.distortion",
496  0.33333);
497 
498 
499  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"arcs_thresh_factor");
500  cpl_parameterlist_append(list, p);
501 
502 
503 
504  p = cpl_parameter_new_value("sinfoni.distortion.arcs_min_arclen_factor",
505  CPL_TYPE_DOUBLE,
506  "factor which sets minimum arc length (1.0-2)",
507  "sinfoni.distortion",
508  1.19);
509 
510 
511  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"arcs_min_arclen_factor");
512  cpl_parameterlist_append(list, p);
513 
514 
515  p = cpl_parameter_new_value("sinfoni.distortion.arcs_window_size",
516  CPL_TYPE_INT,
517  "Size of window for low pass fileter used in"
518  "an horizzontal low pass filter to remove "
519  "unwanted arcs (5-64)",
520  "sinfoni.distortion",
521  14);
522 
523 
524  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"arcs_window_size");
525  cpl_parameterlist_append(list, p);
526 
527 
528  p = cpl_parameter_new_value("sinfoni.distortion.smooth_rad",
529  CPL_TYPE_INT,
530  "Size of smoothing factor (1-11) used to "
531  "prevent for possible intensity drops from "
532  "detector electronics on fibre illuminated "
533  "slitlets (1-11)",
534  "sinfoni.distortion",
535  3);
536 
537 
538  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"smooth_rad");
539  cpl_parameterlist_append(list, p);
540 
541 }