MUSE Pipeline Reference Manual  0.18.5
muse_sky_lsf_z.c
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set sw=2 sts=2 et cin: */
3 /*
4  * This file is part of the MUSE Instrument Pipeline
5  * Copyright (C) 2005-2013 European Southern Observatory
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 /* This file was automatically generated */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 /*----------------------------------------------------------------------------*
29  * Includes *
30  *----------------------------------------------------------------------------*/
31 #include <string.h> /* strcmp(), strstr() */
32 #include <strings.h> /* strcasecmp() */
33 #include <cpl.h>
34 
35 #include "muse_sky_lsf_z.h" /* in turn includes muse.h */
36 
37 /*----------------------------------------------------------------------------*/
46 /*----------------------------------------------------------------------------*/
49 /*----------------------------------------------------------------------------*
50  * Static variables *
51  *----------------------------------------------------------------------------*/
52 static const char *muse_sky_lsf_help =
53  "Compute the LSF model of the slices from the response to a lines spectrum (ARC lamp).";
54 
55 static const char *muse_sky_lsf_help_esorex =
56  "\n\nInput frames for raw frame tag \"PIXTABLE_SKY\":\n"
57  "\n Frame tag Type Req #Fr Description"
58  "\n -------------------- ---- --- --- ------------"
59  "\n PIXTABLE_SKY raw Y 1 Input pixel table"
60  "\n SKY_LINES calib Y 1 Sky line list"
61  "\n SKY_CONTINUUM calib Y 1 Sky continuum spectrum"
62  "\n LSF_TABLE calib . First guess for slice parameters"
63  "\n THROUGHPUT_SKY calib . 1 Detector throughput spectrum"
64  "\n\nProduct frames for raw frame tag \"PIXTABLE_SKY\":\n"
65  "\n Frame tag Level Description"
66  "\n -------------------- -------- ------------"
67  "\n LSF_TABLE final Slice specific parameters"
68  "\n PIXTABLE_REDUCED final Subtracted pixel table (if --store_subtracted=true)";
69 
70 /*----------------------------------------------------------------------------*/
78 /*----------------------------------------------------------------------------*/
79 static cpl_recipeconfig *
80 muse_sky_lsf_new_recipeconfig(void)
81 {
82  cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
83  const char *tag;
84 
85  tag = "PIXTABLE_SKY";
86  cpl_recipeconfig_set_tag(recipeconfig, tag, 1, 1);
87  cpl_recipeconfig_set_input(recipeconfig, tag, "SKY_LINES", 1, 1);
88  cpl_recipeconfig_set_input(recipeconfig, tag, "SKY_CONTINUUM", 1, 1);
89  cpl_recipeconfig_set_input(recipeconfig, tag, "LSF_TABLE", 0, -1);
90  cpl_recipeconfig_set_input(recipeconfig, tag, "THROUGHPUT_SKY", 0, 1);
91  cpl_recipeconfig_set_output(recipeconfig, tag, "LSF_TABLE");
92  cpl_recipeconfig_set_output(recipeconfig, tag, "PIXTABLE_REDUCED");
93 
94  return recipeconfig;
95 } /* muse_sky_lsf_new_recipeconfig() */
96 
97 /*----------------------------------------------------------------------------*/
107 /*----------------------------------------------------------------------------*/
108 static cpl_error_code
109 muse_sky_lsf_prepare_header(const char *aFrametag, cpl_propertylist *aHeader)
110 {
111  cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
112  cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
113  if (!strcmp(aFrametag, "LSF_TABLE")) {
114  muse_processing_prepare_property(aHeader, "ESO QC LSF[0-9]+ AWAV",
115  CPL_TYPE_DOUBLE,
116  "[Angstrom] Wavelength of line l");
117  muse_processing_prepare_property(aHeader, "ESO QC IFU[0-9]+ SLICE[0-9]+ LSF[0-9]+ WIDTH",
118  CPL_TYPE_DOUBLE,
119  "[Angstrom] LSF width in IFU i, slice j at the wavelength of line l");
120  muse_processing_prepare_property(aHeader, "ESO QC IFU[0-9]+ SLICE[0-9]+ LSF[0-9]+ OFFSET",
121  CPL_TYPE_DOUBLE,
122  "[Angstrom] Wavelength calibration offset in IFU i, slice j at the wavelength of line l");
123  muse_processing_prepare_property(aHeader, "ESO QC IFU[0-9]+ SLICE[0-9]+ WAVECAL ERROR",
124  CPL_TYPE_DOUBLE,
125  "Relative error of wavelength calibration of IFU i, slice j");
126  muse_processing_prepare_property(aHeader, "ESO QC LSF RESIDUAL MAXERROR",
127  CPL_TYPE_DOUBLE,
128  "Maximum of the mean normalized error");
129  } else if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
130  } else {
131  cpl_msg_warning(__func__, "Frame tag %s is not defined", aFrametag);
132  return CPL_ERROR_ILLEGAL_INPUT;
133  }
134  return CPL_ERROR_NONE;
135 } /* muse_sky_lsf_prepare_header() */
136 
137 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 static cpl_frame_level
148 muse_sky_lsf_get_frame_level(const char *aFrametag)
149 {
150  if (!aFrametag) {
151  return CPL_FRAME_LEVEL_NONE;
152  }
153  if (!strcmp(aFrametag, "LSF_TABLE")) {
154  return CPL_FRAME_LEVEL_FINAL;
155  }
156  if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
157  return CPL_FRAME_LEVEL_FINAL;
158  }
159  return CPL_FRAME_LEVEL_NONE;
160 } /* muse_sky_lsf_get_frame_level() */
161 
162 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 static muse_frame_mode
173 muse_sky_lsf_get_frame_mode(const char *aFrametag)
174 {
175  if (!aFrametag) {
176  return MUSE_FRAME_MODE_ALL;
177  }
178  if (!strcmp(aFrametag, "LSF_TABLE")) {
179  return MUSE_FRAME_MODE_MASTER;
180  }
181  if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
182  return MUSE_FRAME_MODE_MASTER;
183  }
184  return MUSE_FRAME_MODE_ALL;
185 } /* muse_sky_lsf_get_frame_mode() */
186 
187 /*----------------------------------------------------------------------------*/
197 /*----------------------------------------------------------------------------*/
198 static int
199 muse_sky_lsf_create(cpl_plugin *aPlugin)
200 {
201  /* Check that the plugin is part of a valid recipe */
202  cpl_recipe *recipe;
203  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
204  recipe = (cpl_recipe *)aPlugin;
205  } else {
206  return -1;
207  }
208 
209  /* register the extended processing information (new FITS header creation, *
210  * getting of the frame level for a certain tag) */
212  muse_sky_lsf_new_recipeconfig(),
213  muse_sky_lsf_prepare_header,
214  muse_sky_lsf_get_frame_level,
215  muse_sky_lsf_get_frame_mode);
216 
217  /* XXX initialize timing in messages *
218  * since at least esorex is too stupid to turn it on, we have to do it */
220  cpl_msg_set_time_on();
221  }
222 
223  /* Create the parameter list in the cpl_recipe object */
224  recipe->parameters = cpl_parameterlist_new();
225  /* Fill the parameters list */
226  cpl_parameter *p;
227 
228  /* --lambdamin: Cut off the data below this wavelength after loading the pixel table(s). */
229  p = cpl_parameter_new_value("muse.muse_sky_lsf.lambdamin",
230  CPL_TYPE_DOUBLE,
231  "Cut off the data below this wavelength after loading the pixel table(s).",
232  "muse.muse_sky_lsf",
233  (double)4000.);
234  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamin");
235  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamin");
236 
237  cpl_parameterlist_append(recipe->parameters, p);
238 
239  /* --lambdamax: Cut off the data above this wavelength after loading the pixel table(s). */
240  p = cpl_parameter_new_value("muse.muse_sky_lsf.lambdamax",
241  CPL_TYPE_DOUBLE,
242  "Cut off the data above this wavelength after loading the pixel table(s).",
243  "muse.muse_sky_lsf",
244  (double)10000.);
245  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamax");
246  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamax");
247 
248  cpl_parameterlist_append(recipe->parameters, p);
249 
250  /* --max_iterations: Maximum number of minimization steps for the slice parameter fit. If set to zero, the slice parameter fit is omitted at all and the first guess is used. Note that this number is meant per degree of freedom, so the total number is 14 times higher. */
251  p = cpl_parameter_new_value("muse.muse_sky_lsf.max_iterations",
252  CPL_TYPE_INT,
253  "Maximum number of minimization steps for the slice parameter fit. If set to zero, the slice parameter fit is omitted at all and the first guess is used. Note that this number is meant per degree of freedom, so the total number is 14 times higher.",
254  "muse.muse_sky_lsf",
255  (int)20);
256  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "max_iterations");
257  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "max_iterations");
258 
259  cpl_parameterlist_append(recipe->parameters, p);
260 
261  /* --store_subtracted: Output the pixel table after the LSF subtraction. */
262  p = cpl_parameter_new_value("muse.muse_sky_lsf.store_subtracted",
263  CPL_TYPE_BOOL,
264  "Output the pixel table after the LSF subtraction.",
265  "muse.muse_sky_lsf",
266  (int)FALSE);
267  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "store_subtracted");
268  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "store_subtracted");
269 
270  cpl_parameterlist_append(recipe->parameters, p);
271 
272  /* --orig: If specified, write an additional column containing the
273  original data to the pixel table. */
274  p = cpl_parameter_new_value("muse.muse_sky_lsf.orig",
275  CPL_TYPE_STRING,
276  "If specified, write an additional column containing the original data to the pixel table.",
277  "muse.muse_sky_lsf",
278  (const char *)"");
279  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "orig");
280  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "orig");
281 
282  cpl_parameterlist_append(recipe->parameters, p);
283 
284  /* --slice_fit_offset: Use wavelength offset as slice dependent fit parameter. */
285  p = cpl_parameter_new_value("muse.muse_sky_lsf.slice_fit_offset",
286  CPL_TYPE_BOOL,
287  "Use wavelength offset as slice dependent fit parameter.",
288  "muse.muse_sky_lsf",
289  (int)TRUE);
290  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_offset");
291  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_offset");
292 
293  cpl_parameterlist_append(recipe->parameters, p);
294 
295  /* --slice_fit_refraction: Use the refraction index as slice dependent fit parameter. */
296  p = cpl_parameter_new_value("muse.muse_sky_lsf.slice_fit_refraction",
297  CPL_TYPE_BOOL,
298  "Use the refraction index as slice dependent fit parameter.",
299  "muse.muse_sky_lsf",
300  (int)FALSE);
301  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_refraction");
302  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_refraction");
303 
304  cpl_parameterlist_append(recipe->parameters, p);
305 
306  /* --slice_fit_slit_width: Use the slit width as fit parameter. */
307  p = cpl_parameter_new_value("muse.muse_sky_lsf.slice_fit_slit_width",
308  CPL_TYPE_BOOL,
309  "Use the slit width as fit parameter.",
310  "muse.muse_sky_lsf",
311  (int)TRUE);
312  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_slit_width");
313  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_slit_width");
314 
315  cpl_parameterlist_append(recipe->parameters, p);
316 
317  /* --slice_fit_bin_width: Use the bin width as fit parameter. */
318  p = cpl_parameter_new_value("muse.muse_sky_lsf.slice_fit_bin_width",
319  CPL_TYPE_BOOL,
320  "Use the bin width as fit parameter.",
321  "muse.muse_sky_lsf",
322  (int)TRUE);
323  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_bin_width");
324  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_bin_width");
325 
326  cpl_parameterlist_append(recipe->parameters, p);
327 
328  /* --slice_fit_lsf_width: Polynomial order for the LSF width fit parameter. Use -1 to not fit the LSF width. */
329  p = cpl_parameter_new_range("muse.muse_sky_lsf.slice_fit_lsf_width",
330  CPL_TYPE_INT,
331  "Polynomial order for the LSF width fit parameter. Use -1 to not fit the LSF width.",
332  "muse.muse_sky_lsf",
333  (int)1,
334  (int)-1,
335  (int)8);
336  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_lsf_width");
337  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_lsf_width");
338 
339  cpl_parameterlist_append(recipe->parameters, p);
340 
341  /* --slice_fit_h3: Polynomial order for the H3 fit parameter. Use -1 to not fit H3. */
342  p = cpl_parameter_new_range("muse.muse_sky_lsf.slice_fit_h3",
343  CPL_TYPE_INT,
344  "Polynomial order for the H3 fit parameter. Use -1 to not fit H3.",
345  "muse.muse_sky_lsf",
346  (int)0,
347  (int)-1,
348  (int)8);
349  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_h3");
350  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_h3");
351 
352  cpl_parameterlist_append(recipe->parameters, p);
353 
354  /* --slice_fit_h4: Polynomial order for the H4 fit parameter. Use -1 to not fit H4. */
355  p = cpl_parameter_new_range("muse.muse_sky_lsf.slice_fit_h4",
356  CPL_TYPE_INT,
357  "Polynomial order for the H4 fit parameter. Use -1 to not fit H4.",
358  "muse.muse_sky_lsf",
359  (int)1,
360  (int)-1,
361  (int)8);
362  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_h4");
363  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_h4");
364 
365  cpl_parameterlist_append(recipe->parameters, p);
366 
367  /* --slice_fit_h5: Polynomial order for the H5 fit parameter. Use -1 to not fit H5. */
368  p = cpl_parameter_new_range("muse.muse_sky_lsf.slice_fit_h5",
369  CPL_TYPE_INT,
370  "Polynomial order for the H5 fit parameter. Use -1 to not fit H5.",
371  "muse.muse_sky_lsf",
372  (int)0,
373  (int)-1,
374  (int)8);
375  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_h5");
376  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_h5");
377 
378  cpl_parameterlist_append(recipe->parameters, p);
379 
380  /* --slice_fit_h6: Polynomial order for the H6 fit parameter. Use -1 to not fit H6. */
381  p = cpl_parameter_new_range("muse.muse_sky_lsf.slice_fit_h6",
382  CPL_TYPE_INT,
383  "Polynomial order for the H6 fit parameter. Use -1 to not fit H6.",
384  "muse.muse_sky_lsf",
385  (int)1,
386  (int)-1,
387  (int)8);
388  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "slice_fit_h6");
389  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "slice_fit_h6");
390 
391  cpl_parameterlist_append(recipe->parameters, p);
392 
393  return 0;
394 } /* muse_sky_lsf_create() */
395 
396 /*----------------------------------------------------------------------------*/
407 /*----------------------------------------------------------------------------*/
408 static int
409 muse_sky_lsf_params_fill(muse_sky_lsf_params_t *aParams, cpl_parameterlist *aParameters)
410 {
411  cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
412  cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
413  cpl_parameter *p;
414 
415  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.lambdamin");
416  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
417  aParams->lambdamin = cpl_parameter_get_double(p);
418 
419  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.lambdamax");
420  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
421  aParams->lambdamax = cpl_parameter_get_double(p);
422 
423  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.max_iterations");
424  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
425  aParams->max_iterations = cpl_parameter_get_int(p);
426 
427  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.store_subtracted");
428  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
429  aParams->store_subtracted = cpl_parameter_get_bool(p);
430 
431  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.orig");
432  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
433  aParams->orig = cpl_parameter_get_string(p);
434 
435  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_offset");
436  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
437  aParams->slice_fit_offset = cpl_parameter_get_bool(p);
438 
439  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_refraction");
440  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
441  aParams->slice_fit_refraction = cpl_parameter_get_bool(p);
442 
443  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_slit_width");
444  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
445  aParams->slice_fit_slit_width = cpl_parameter_get_bool(p);
446 
447  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_bin_width");
448  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
449  aParams->slice_fit_bin_width = cpl_parameter_get_bool(p);
450 
451  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_lsf_width");
452  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
453  aParams->slice_fit_lsf_width = cpl_parameter_get_int(p);
454 
455  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_h3");
456  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
457  aParams->slice_fit_h3 = cpl_parameter_get_int(p);
458 
459  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_h4");
460  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
461  aParams->slice_fit_h4 = cpl_parameter_get_int(p);
462 
463  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_h5");
464  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
465  aParams->slice_fit_h5 = cpl_parameter_get_int(p);
466 
467  p = cpl_parameterlist_find(aParameters, "muse.muse_sky_lsf.slice_fit_h6");
468  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
469  aParams->slice_fit_h6 = cpl_parameter_get_int(p);
470 
471  return 0;
472 } /* muse_sky_lsf_params_fill() */
473 
474 /*----------------------------------------------------------------------------*/
481 /*----------------------------------------------------------------------------*/
482 static int
483 muse_sky_lsf_exec(cpl_plugin *aPlugin)
484 {
485  if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
486  return -1;
487  }
488  cpl_recipe *recipe = (cpl_recipe *)aPlugin;
489  cpl_msg_set_threadid_on();
490 
491  cpl_frameset *usedframes = cpl_frameset_new(),
492  *outframes = cpl_frameset_new();
493  muse_sky_lsf_params_t params;
494  muse_sky_lsf_params_fill(&params, recipe->parameters);
495 
496  cpl_errorstate prestate = cpl_errorstate_get();
497 
498  muse_processing *proc = muse_processing_new("muse_sky_lsf",
499  recipe);
500  int rc = muse_sky_lsf_compute(proc, &params);
501  cpl_frameset_join(usedframes, proc->usedFrames);
502  cpl_frameset_join(outframes, proc->outputFrames);
504 
505  if (!cpl_errorstate_is_equal(prestate)) {
506  /* dump all errors from this recipe in chronological order */
507  cpl_errorstate_dump(prestate, CPL_FALSE, muse_cplerrorstate_dump_some);
508  /* reset message level to not get the same errors displayed again by esorex */
509  cpl_msg_set_level(CPL_MSG_INFO);
510  }
511  /* clean up duplicates in framesets of used and output frames */
514  /* to get esorex to see our classification (frame groups etc.), *
515  * replace the original frameset with the list of used frames *
516  * before appending product output frames */
517  /* keep the same pointer, so just erase all frames, not delete the frameset */
518  muse_cplframeset_erase_all(recipe->frames);
519  cpl_frameset_join(recipe->frames, usedframes);
520  cpl_frameset_join(recipe->frames, outframes);
521  cpl_frameset_delete(usedframes);
522  cpl_frameset_delete(outframes);
523  return rc;
524 } /* muse_sky_lsf_exec() */
525 
526 /*----------------------------------------------------------------------------*/
533 /*----------------------------------------------------------------------------*/
534 static int
535 muse_sky_lsf_destroy(cpl_plugin *aPlugin)
536 {
537  /* Get the recipe from the plugin */
538  cpl_recipe *recipe;
539  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
540  recipe = (cpl_recipe *)aPlugin;
541  } else {
542  return -1;
543  }
544 
545  /* Clean up */
546  cpl_parameterlist_delete(recipe->parameters);
548  return 0;
549 } /* muse_sky_lsf_destroy() */
550 
551 /*----------------------------------------------------------------------------*/
561 /*----------------------------------------------------------------------------*/
562 int
563 cpl_plugin_get_info(cpl_pluginlist *aList)
564 {
565  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
566  cpl_plugin *plugin = &recipe->interface;
567 
568  char *helptext;
570  helptext = cpl_sprintf("%s%s", muse_sky_lsf_help,
571  muse_sky_lsf_help_esorex);
572  } else {
573  helptext = cpl_sprintf("%s", muse_sky_lsf_help);
574  }
575 
576  /* Initialize the CPL plugin stuff for this module */
577  cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
578  CPL_PLUGIN_TYPE_RECIPE,
579  "muse_sky_lsf",
580  "Compute the LSF",
581  helptext,
582  "Ole Streicher",
583  "usd-help@eso.org",
585  muse_sky_lsf_create,
586  muse_sky_lsf_exec,
587  muse_sky_lsf_destroy);
588  cpl_pluginlist_append(aList, plugin);
589  cpl_free(helptext);
590 
591  return 0;
592 } /* cpl_plugin_get_info() */
593 
int slice_fit_lsf_width
Polynomial order for the LSF width fit parameter. Use -1 to not fit the LSF width.
int store_subtracted
Output the pixel table after the LSF subtraction.
int slice_fit_slit_width
Use the slit width as fit parameter.
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
const char * orig
If specified, write an additional column containing the original data to the pixel table...
int max_iterations
Maximum number of minimization steps for the slice parameter fit. If set to zero, the slice parameter...
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
int slice_fit_h4
Polynomial order for the H4 fit parameter. Use -1 to not fit H4.
double lambdamin
Cut off the data below this wavelength after loading the pixel table(s).
int slice_fit_h5
Polynomial order for the H5 fit parameter. Use -1 to not fit H5.
int slice_fit_h3
Polynomial order for the H3 fit parameter. Use -1 to not fit H3.
const char * muse_get_license(void)
Get the pipeline copyright and license.
Definition: muse_utils.c:80
muse_processing * muse_processing_new(const char *aRecipeName, cpl_recipe *aRecipe)
Create a new processing structure.
muse_frame_mode
int slice_fit_refraction
Use the refraction index as slice dependent fit parameter.
cpl_frameset * outputFrames
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
void muse_processinginfo_delete(cpl_recipe *)
Clear all information from the processing info and from the recipe config.
int slice_fit_offset
Use wavelength offset as slice dependent fit parameter.
cpl_error_code muse_cplframeset_erase_duplicate(cpl_frameset *aFrames)
Erase all duplicate frames from a frameset.
cpl_error_code muse_cplframeset_erase_all(cpl_frameset *aFrames)
Erase all frames in a frameset.
Structure to hold the parameters of the muse_sky_lsf recipe.
int slice_fit_bin_width
Use the bin width as fit parameter.
void muse_processinginfo_register(cpl_recipe *, cpl_recipeconfig *, muse_processing_prepare_header_func *, muse_processing_get_frame_level_func *, muse_processing_get_frame_mode_func *)
Register extended functionalities for MUSE recipes.
int slice_fit_h6
Polynomial order for the H6 fit parameter. Use -1 to not fit H6.
double lambdamax
Cut off the data above this wavelength after loading the pixel table(s).
cpl_frameset * usedFrames
cpl_error_code muse_processing_prepare_property(cpl_propertylist *, const char *, cpl_type, const char *)
Prepare and check the specified property.