MUSE Pipeline Reference Manual  2.5.2
muse_twilight_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-2015 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_twilight_z.h" /* in turn includes muse.h */
36 
37 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
91 /*----------------------------------------------------------------------------*
92  * Static variables *
93  *----------------------------------------------------------------------------*/
94 static const char *muse_twilight_help =
95  "Processing first handles each raw input image separately: it trims the raw data and records the overscan statistics, subtracts the bias (taking account of the overscan, if --overscan is not \"none\"), converts the images from adu to count, subtracts the dark, divides by the flat-field and combines all the exposures using input parameters. The input calibrations geometry table, trace table, and wavelength calibration table are used to assign 3D coordinates to each CCD-based pixel, thereby creating a pixel table from the master sky-flat. These pixel tables are then cut in wavelength using the --lambdamin and --lambdamax parameters. The integrated flux in each IFU is computed as the sum of the data in the pixel table, and saved in the header, to be used later as estimate for the relative throughput of each IFU. If an ILLUM exposure was given as input, it is then used to correct the relative illumination between all slices of one IFU. For this, the data of each slice within the pixel table of each IFU is multiplied by the normalized median flux of that slice in the ILLUM exposure. The pixel tables of all IFUs are then merged, using the integrated fluxes as inverse scaling factors, and a cube is reconstructed from the merged dataset, using given parameters. A white-light image is created from the cube. This skyflat cube is then saved to disk, with the white-light image as one extension. To construct a smooth 3D illumination correction, the cube is post-processed in the following way: the white-light image is used to create a mask of the illuminated area. From this area, the optional vignetting mask is removed. The smoothing is then computed for each plane of the cube: the illuminated area is smoothed (by a 5x7 median filter), normalized, fit with a 2D polynomial (of given polynomial orders), and normalized again. A smooth white image is then created by collapsing the smooth cube. If a vignetting mask was given or NFM data is processed, an area close to the edge of the MUSE field is used to compute a 2D correction for the vignetted area: the original unsmoothed white-light image is corrected for large scale gradients by dividing it with the smooth white image. The residuals in the edge area (as defined by the input mask or hardcoded for NRM) are then smoothed using input parameters. This smoothed vignetting correction is the multiplied onto each plane of the smooth cube, normalizing each plane again. This twilight cube is then saved to disk.";
96 
97 static const char *muse_twilight_help_esorex =
98  "\n\nInput frames for raw frame tag \"SKYFLAT\":\n"
99  "\n Frame tag Type Req #Fr Description"
100  "\n -------------------- ---- --- --- ------------"
101  "\n SKYFLAT raw Y >=3 Raw twilight skyflat"
102  "\n ILLUM raw . 1 Single optional raw (attached/illumination) flat-field exposure"
103  "\n MASTER_BIAS calib Y 1 Master bias"
104  "\n MASTER_DARK calib . 1 Master dark"
105  "\n MASTER_FLAT calib Y 1 Master flat"
106  "\n BADPIX_TABLE calib . Known bad pixels"
107  "\n TRACE_TABLE calib Y 1 Tracing table for all slices"
108  "\n WAVECAL_TABLE calib Y 1 Wavelength calibration table"
109  "\n GEOMETRY_TABLE calib Y 1 Relative positions of the slices in the field of view"
110  "\n VIGNETTING_MASK calib . 1 Mask to mark vignetted regions in the MUSE field of view"
111  "\n\nProduct frames for raw frame tag \"SKYFLAT\":\n"
112  "\n Frame tag Level Description"
113  "\n -------------------- -------- ------------"
114  "\n DATACUBE_SKYFLAT final Cube of combined twilight skyflat exposures"
115  "\n TWILIGHT_CUBE final Smoothed cube of twilight sky";
116 
117 /*----------------------------------------------------------------------------*/
125 /*----------------------------------------------------------------------------*/
126 static cpl_recipeconfig *
127 muse_twilight_new_recipeconfig(void)
128 {
129  cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
130 
131  cpl_recipeconfig_set_tag(recipeconfig, "SKYFLAT", 3, -1);
132  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "MASTER_BIAS", 1, 1);
133  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "MASTER_DARK", -1, 1);
134  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "MASTER_FLAT", 1, 1);
135  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "BADPIX_TABLE", -1, -1);
136  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "TRACE_TABLE", 1, 1);
137  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "WAVECAL_TABLE", 1, 1);
138  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "GEOMETRY_TABLE", 1, 1);
139  cpl_recipeconfig_set_input(recipeconfig, "SKYFLAT", "VIGNETTING_MASK", -1, 1);
140  cpl_recipeconfig_set_output(recipeconfig, "SKYFLAT", "DATACUBE_SKYFLAT");
141  cpl_recipeconfig_set_output(recipeconfig, "SKYFLAT", "TWILIGHT_CUBE");
142  cpl_recipeconfig_set_tag(recipeconfig, "ILLUM", -1, 1);
143  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "MASTER_BIAS", 1, 1);
144  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "MASTER_DARK", -1, 1);
145  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "MASTER_FLAT", 1, 1);
146  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "BADPIX_TABLE", -1, -1);
147  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "TRACE_TABLE", 1, 1);
148  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "WAVECAL_TABLE", 1, 1);
149  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "GEOMETRY_TABLE", 1, 1);
150  cpl_recipeconfig_set_input(recipeconfig, "ILLUM", "VIGNETTING_MASK", -1, 1);
151 
152  return recipeconfig;
153 } /* muse_twilight_new_recipeconfig() */
154 
155 /*----------------------------------------------------------------------------*/
165 /*----------------------------------------------------------------------------*/
166 static cpl_error_code
167 muse_twilight_prepare_header(const char *aFrametag, cpl_propertylist *aHeader)
168 {
169  cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
170  cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
171  if (!strcmp(aFrametag, "DATACUBE_SKYFLAT")) {
172  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ MEDIAN",
173  CPL_TYPE_FLOAT,
174  "Median value of raw exposure i of IFU m in input list");
175  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ MEAN",
176  CPL_TYPE_FLOAT,
177  "Mean value of raw exposure i of IFU m in input list");
178  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ STDEV",
179  CPL_TYPE_FLOAT,
180  "Standard deviation of raw exposure i of IFU m in input list");
181  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ MIN",
182  CPL_TYPE_FLOAT,
183  "Minimum value of raw exposure i of IFU m in input list");
184  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ MAX",
185  CPL_TYPE_FLOAT,
186  "Maximum value of raw exposure i of IFU m in input list");
187  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INPUT[0-9]+ NSATURATED",
188  CPL_TYPE_INT,
189  "Number of saturated pixels in raw exposure i of IFU m in input list");
190  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER MEDIAN",
191  CPL_TYPE_FLOAT,
192  "Median value of the combined exposures in IFU m");
193  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER MEAN",
194  CPL_TYPE_FLOAT,
195  "Mean value of the combined exposures in IFU m");
196  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER STDEV",
197  CPL_TYPE_FLOAT,
198  "Standard deviation of the combined exposures in IFU m");
199  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER MIN",
200  CPL_TYPE_FLOAT,
201  "Minimum value of the combined exposures in IFU m");
202  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER MAX",
203  CPL_TYPE_FLOAT,
204  "Maximum value of the combined exposures in IFU m");
205  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ MASTER INTFLUX",
206  CPL_TYPE_FLOAT,
207  "Flux integrated over the whole CCD of the combined exposures of IFU m");
208  muse_processing_prepare_property(aHeader, "ESO QC TWILIGHT[0-9]+ INTFLUX",
209  CPL_TYPE_FLOAT,
210  "Flux integrated over all slices of IFU m. Computed using the pixel table of the exposure.");
211  } else if (!strcmp(aFrametag, "TWILIGHT_CUBE")) {
212  } else {
213  cpl_msg_warning(__func__, "Frame tag %s is not defined", aFrametag);
214  return CPL_ERROR_ILLEGAL_INPUT;
215  }
216  return CPL_ERROR_NONE;
217 } /* muse_twilight_prepare_header() */
218 
219 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 static cpl_frame_level
230 muse_twilight_get_frame_level(const char *aFrametag)
231 {
232  if (!aFrametag) {
233  return CPL_FRAME_LEVEL_NONE;
234  }
235  if (!strcmp(aFrametag, "DATACUBE_SKYFLAT")) {
236  return CPL_FRAME_LEVEL_FINAL;
237  }
238  if (!strcmp(aFrametag, "TWILIGHT_CUBE")) {
239  return CPL_FRAME_LEVEL_FINAL;
240  }
241  return CPL_FRAME_LEVEL_NONE;
242 } /* muse_twilight_get_frame_level() */
243 
244 /*----------------------------------------------------------------------------*/
253 /*----------------------------------------------------------------------------*/
254 static muse_frame_mode
255 muse_twilight_get_frame_mode(const char *aFrametag)
256 {
257  if (!aFrametag) {
258  return MUSE_FRAME_MODE_ALL;
259  }
260  if (!strcmp(aFrametag, "DATACUBE_SKYFLAT")) {
261  return MUSE_FRAME_MODE_MASTER;
262  }
263  if (!strcmp(aFrametag, "TWILIGHT_CUBE")) {
264  return MUSE_FRAME_MODE_MASTER;
265  }
266  return MUSE_FRAME_MODE_ALL;
267 } /* muse_twilight_get_frame_mode() */
268 
269 /*----------------------------------------------------------------------------*/
279 /*----------------------------------------------------------------------------*/
280 static int
281 muse_twilight_create(cpl_plugin *aPlugin)
282 {
283  /* Check that the plugin is part of a valid recipe */
284  cpl_recipe *recipe;
285  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
286  recipe = (cpl_recipe *)aPlugin;
287  } else {
288  return -1;
289  }
290 
291  /* register the extended processing information (new FITS header creation, *
292  * getting of the frame level for a certain tag) */
294  muse_twilight_new_recipeconfig(),
295  muse_twilight_prepare_header,
296  muse_twilight_get_frame_level,
297  muse_twilight_get_frame_mode);
298 
299  /* XXX initialize timing in messages *
300  * since at least esorex is too stupid to turn it on, we have to do it */
302  cpl_msg_set_time_on();
303  }
304 
305  /* Create the parameter list in the cpl_recipe object */
306  recipe->parameters = cpl_parameterlist_new();
307  /* Fill the parameters list */
308  cpl_parameter *p;
309 
310  /* --overscan: If this is "none", stop when detecting discrepant overscan levels (see ovscsigma), for "offset" it assumes that the mean overscan level represents the real offset in the bias levels of the exposures involved, and adjusts the data accordingly; for "vpoly", a polynomial is fit to the vertical overscan and subtracted from the whole quadrant. */
311  p = cpl_parameter_new_value("muse.muse_twilight.overscan",
312  CPL_TYPE_STRING,
313  "If this is \"none\", stop when detecting discrepant overscan levels (see ovscsigma), for \"offset\" it assumes that the mean overscan level represents the real offset in the bias levels of the exposures involved, and adjusts the data accordingly; for \"vpoly\", a polynomial is fit to the vertical overscan and subtracted from the whole quadrant.",
314  "muse.muse_twilight",
315  (const char *)"vpoly");
316  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "overscan");
317  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "overscan");
318 
319  cpl_parameterlist_append(recipe->parameters, p);
320 
321  /* --ovscreject: This influences how values are rejected when computing overscan statistics. Either no rejection at all ("none"), rejection using the DCR algorithm ("dcr"), or rejection using an iterative constant fit ("fit"). */
322  p = cpl_parameter_new_value("muse.muse_twilight.ovscreject",
323  CPL_TYPE_STRING,
324  "This influences how values are rejected when computing overscan statistics. Either no rejection at all (\"none\"), rejection using the DCR algorithm (\"dcr\"), or rejection using an iterative constant fit (\"fit\").",
325  "muse.muse_twilight",
326  (const char *)"dcr");
327  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "ovscreject");
328  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ovscreject");
329 
330  cpl_parameterlist_append(recipe->parameters, p);
331 
332  /* --ovscsigma: If the deviation of mean overscan levels between a raw input image and the reference image is higher than |ovscsigma x stdev|, stop the processing. If overscan="vpoly", this is used as sigma rejection level for the iterative polynomial fit (the level comparison is then done afterwards with |100 x stdev| to guard against incompatible settings). Has no effect for overscan="offset". */
333  p = cpl_parameter_new_value("muse.muse_twilight.ovscsigma",
334  CPL_TYPE_DOUBLE,
335  "If the deviation of mean overscan levels between a raw input image and the reference image is higher than |ovscsigma x stdev|, stop the processing. If overscan=\"vpoly\", this is used as sigma rejection level for the iterative polynomial fit (the level comparison is then done afterwards with |100 x stdev| to guard against incompatible settings). Has no effect for overscan=\"offset\".",
336  "muse.muse_twilight",
337  (double)30.);
338  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "ovscsigma");
339  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ovscsigma");
340 
341  cpl_parameterlist_append(recipe->parameters, p);
342 
343  /* --ovscignore: The number of pixels of the overscan adjacent to the data section of the CCD that are ignored when computing statistics or fits. */
344  p = cpl_parameter_new_value("muse.muse_twilight.ovscignore",
345  CPL_TYPE_INT,
346  "The number of pixels of the overscan adjacent to the data section of the CCD that are ignored when computing statistics or fits.",
347  "muse.muse_twilight",
348  (int)3);
349  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "ovscignore");
350  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ovscignore");
351 
352  cpl_parameterlist_append(recipe->parameters, p);
353 
354  /* --combine: Type of combination to use */
355  p = cpl_parameter_new_enum("muse.muse_twilight.combine",
356  CPL_TYPE_STRING,
357  "Type of combination to use",
358  "muse.muse_twilight",
359  (const char *)"sigclip",
360  4,
361  (const char *)"average",
362  (const char *)"median",
363  (const char *)"minmax",
364  (const char *)"sigclip");
365  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "combine");
366  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "combine");
367 
368  cpl_parameterlist_append(recipe->parameters, p);
369 
370  /* --nlow: Number of minimum pixels to reject with minmax */
371  p = cpl_parameter_new_value("muse.muse_twilight.nlow",
372  CPL_TYPE_INT,
373  "Number of minimum pixels to reject with minmax",
374  "muse.muse_twilight",
375  (int)1);
376  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "nlow");
377  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nlow");
378 
379  cpl_parameterlist_append(recipe->parameters, p);
380 
381  /* --nhigh: Number of maximum pixels to reject with minmax */
382  p = cpl_parameter_new_value("muse.muse_twilight.nhigh",
383  CPL_TYPE_INT,
384  "Number of maximum pixels to reject with minmax",
385  "muse.muse_twilight",
386  (int)1);
387  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "nhigh");
388  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nhigh");
389 
390  cpl_parameterlist_append(recipe->parameters, p);
391 
392  /* --nkeep: Number of pixels to keep with minmax */
393  p = cpl_parameter_new_value("muse.muse_twilight.nkeep",
394  CPL_TYPE_INT,
395  "Number of pixels to keep with minmax",
396  "muse.muse_twilight",
397  (int)1);
398  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "nkeep");
399  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nkeep");
400 
401  cpl_parameterlist_append(recipe->parameters, p);
402 
403  /* --lsigma: Low sigma for pixel rejection with sigclip */
404  p = cpl_parameter_new_value("muse.muse_twilight.lsigma",
405  CPL_TYPE_DOUBLE,
406  "Low sigma for pixel rejection with sigclip",
407  "muse.muse_twilight",
408  (double)3);
409  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lsigma");
410  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lsigma");
411 
412  cpl_parameterlist_append(recipe->parameters, p);
413 
414  /* --hsigma: High sigma for pixel rejection with sigclip */
415  p = cpl_parameter_new_value("muse.muse_twilight.hsigma",
416  CPL_TYPE_DOUBLE,
417  "High sigma for pixel rejection with sigclip",
418  "muse.muse_twilight",
419  (double)3);
420  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "hsigma");
421  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "hsigma");
422 
423  cpl_parameterlist_append(recipe->parameters, p);
424 
425  /* --scale: Scale the individual images to a common exposure time before combining them. */
426  p = cpl_parameter_new_value("muse.muse_twilight.scale",
427  CPL_TYPE_BOOL,
428  "Scale the individual images to a common exposure time before combining them.",
429  "muse.muse_twilight",
430  (int)FALSE);
431  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "scale");
432  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "scale");
433 
434  cpl_parameterlist_append(recipe->parameters, p);
435 
436  /* --resample: The resampling technique to use for the final output cube. */
437  p = cpl_parameter_new_enum("muse.muse_twilight.resample",
438  CPL_TYPE_STRING,
439  "The resampling technique to use for the final output cube.",
440  "muse.muse_twilight",
441  (const char *)"drizzle",
442  6,
443  (const char *)"nearest",
444  (const char *)"linear",
445  (const char *)"quadratic",
446  (const char *)"renka",
447  (const char *)"drizzle",
448  (const char *)"lanczos");
449  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "resample");
450  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "resample");
451 
452  cpl_parameterlist_append(recipe->parameters, p);
453 
454  /* --crtype: Type of statistics used for detection of cosmic rays during final resampling. "iraf" uses the variance information, "mean" uses standard (mean/stdev) statistics, "median" uses median and the median median of the absolute median deviation. */
455  p = cpl_parameter_new_enum("muse.muse_twilight.crtype",
456  CPL_TYPE_STRING,
457  "Type of statistics used for detection of cosmic rays during final resampling. \"iraf\" uses the variance information, \"mean\" uses standard (mean/stdev) statistics, \"median\" uses median and the median median of the absolute median deviation.",
458  "muse.muse_twilight",
459  (const char *)"median",
460  3,
461  (const char *)"iraf",
462  (const char *)"mean",
463  (const char *)"median");
464  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crtype");
465  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crtype");
466 
467  cpl_parameterlist_append(recipe->parameters, p);
468 
469  /* --crsigma: Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative value switches cosmic ray rejection off. */
470  p = cpl_parameter_new_value("muse.muse_twilight.crsigma",
471  CPL_TYPE_DOUBLE,
472  "Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative value switches cosmic ray rejection off.",
473  "muse.muse_twilight",
474  (double)50.);
475  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crsigma");
476  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crsigma");
477 
478  cpl_parameterlist_append(recipe->parameters, p);
479 
480  /* --lambdamin: Minimum wavelength for twilight reconstruction. */
481  p = cpl_parameter_new_value("muse.muse_twilight.lambdamin",
482  CPL_TYPE_DOUBLE,
483  "Minimum wavelength for twilight reconstruction.",
484  "muse.muse_twilight",
485  (double)5000.);
486  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamin");
487  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamin");
488 
489  cpl_parameterlist_append(recipe->parameters, p);
490 
491  /* --lambdamax: Maximum wavelength for twilight reconstruction. */
492  p = cpl_parameter_new_value("muse.muse_twilight.lambdamax",
493  CPL_TYPE_DOUBLE,
494  "Maximum wavelength for twilight reconstruction.",
495  "muse.muse_twilight",
496  (double)9000.);
497  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamax");
498  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamax");
499 
500  cpl_parameterlist_append(recipe->parameters, p);
501 
502  /* --dlambda: Sampling for twilight reconstruction, this should result in planes of equal wavelength coverage. */
503  p = cpl_parameter_new_value("muse.muse_twilight.dlambda",
504  CPL_TYPE_DOUBLE,
505  "Sampling for twilight reconstruction, this should result in planes of equal wavelength coverage.",
506  "muse.muse_twilight",
507  (double)250.);
508  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dlambda");
509  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dlambda");
510 
511  cpl_parameterlist_append(recipe->parameters, p);
512 
513  /* --xorder: Polynomial order to use in x direction to fit the full field of view. */
514  p = cpl_parameter_new_value("muse.muse_twilight.xorder",
515  CPL_TYPE_INT,
516  "Polynomial order to use in x direction to fit the full field of view.",
517  "muse.muse_twilight",
518  (int)2);
519  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "xorder");
520  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xorder");
521 
522  cpl_parameterlist_append(recipe->parameters, p);
523 
524  /* --yorder: Polynomial order to use in y direction to fit the full field of view. */
525  p = cpl_parameter_new_value("muse.muse_twilight.yorder",
526  CPL_TYPE_INT,
527  "Polynomial order to use in y direction to fit the full field of view.",
528  "muse.muse_twilight",
529  (int)2);
530  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "yorder");
531  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "yorder");
532 
533  cpl_parameterlist_append(recipe->parameters, p);
534 
535  /* --vignmaskedges: Pixels on edges stronger than this fraction in the normalized image are excluded from the fit to the vignetted area. Set to non-positive number to include them in the fit. This has no effect for NFM skyflats. */
536  p = cpl_parameter_new_value("muse.muse_twilight.vignmaskedges",
537  CPL_TYPE_DOUBLE,
538  "Pixels on edges stronger than this fraction in the normalized image are excluded from the fit to the vignetted area. Set to non-positive number to include them in the fit. This has no effect for NFM skyflats.",
539  "muse.muse_twilight",
540  (double)0.02);
541  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "vignmaskedges");
542  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "vignmaskedges");
543  if (!getenv("MUSE_EXPERT_USER")) {
544  cpl_parameter_disable(p, CPL_PARAMETER_MODE_CLI);
545  }
546 
547  cpl_parameterlist_append(recipe->parameters, p);
548 
549  /* --vignsmooth: Type of smoothing to use for the vignetted region given by the VIGNETTING_MASK (for WFM, or the internal mask, for NFM); gaussian uses (vignxpar + vignypar)/2 as FWHM. */
550  p = cpl_parameter_new_enum("muse.muse_twilight.vignsmooth",
551  CPL_TYPE_STRING,
552  "Type of smoothing to use for the vignetted region given by the VIGNETTING_MASK (for WFM, or the internal mask, for NFM); gaussian uses (vignxpar + vignypar)/2 as FWHM.",
553  "muse.muse_twilight",
554  (const char *)"polyfit",
555  3,
556  (const char *)"polyfit",
557  (const char *)"gaussian",
558  (const char *)"median");
559  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "vignsmooth");
560  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "vignsmooth");
561  if (!getenv("MUSE_EXPERT_USER")) {
562  cpl_parameter_disable(p, CPL_PARAMETER_MODE_CLI);
563  }
564 
565  cpl_parameterlist_append(recipe->parameters, p);
566 
567  /* --vignxpar: Parameter used by the vignetting smoothing: x order for polyfit (default, recommended 4), parameter that influences the FWHM for the gaussian (recommended: 10), or x dimension of median filter (recommended 5). If a negative value is found, the default is taken. */
568  p = cpl_parameter_new_value("muse.muse_twilight.vignxpar",
569  CPL_TYPE_INT,
570  "Parameter used by the vignetting smoothing: x order for polyfit (default, recommended 4), parameter that influences the FWHM for the gaussian (recommended: 10), or x dimension of median filter (recommended 5). If a negative value is found, the default is taken.",
571  "muse.muse_twilight",
572  (int)-1);
573  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "vignxpar");
574  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "vignxpar");
575  if (!getenv("MUSE_EXPERT_USER")) {
576  cpl_parameter_disable(p, CPL_PARAMETER_MODE_CLI);
577  }
578 
579  cpl_parameterlist_append(recipe->parameters, p);
580 
581  /* --vignypar: Parameter used by the vignetting smoothing: y order for polyfit (default, recommended 4), parameter that influences the FWHM for the gaussian (recommended: 10), or y dimension of median filter (recommended 5). If a negative value is found, the default is taken. */
582  p = cpl_parameter_new_value("muse.muse_twilight.vignypar",
583  CPL_TYPE_INT,
584  "Parameter used by the vignetting smoothing: y order for polyfit (default, recommended 4), parameter that influences the FWHM for the gaussian (recommended: 10), or y dimension of median filter (recommended 5). If a negative value is found, the default is taken.",
585  "muse.muse_twilight",
586  (int)-1);
587  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "vignypar");
588  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "vignypar");
589  if (!getenv("MUSE_EXPERT_USER")) {
590  cpl_parameter_disable(p, CPL_PARAMETER_MODE_CLI);
591  }
592 
593  cpl_parameterlist_append(recipe->parameters, p);
594 
595  /* --vignnfmmask: The height of the vignetted region at the top of the MUSE field in NFM. This is the region modeled separately (the final vignetting model might be smaller). */
596  p = cpl_parameter_new_value("muse.muse_twilight.vignnfmmask",
597  CPL_TYPE_INT,
598  "The height of the vignetted region at the top of the MUSE field in NFM. This is the region modeled separately (the final vignetting model might be smaller).",
599  "muse.muse_twilight",
600  (int)22);
601  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "vignnfmmask");
602  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "vignnfmmask");
603  if (!getenv("MUSE_EXPERT_USER")) {
604  cpl_parameter_disable(p, CPL_PARAMETER_MODE_CLI);
605  }
606 
607  cpl_parameterlist_append(recipe->parameters, p);
608 
609  return 0;
610 } /* muse_twilight_create() */
611 
612 /*----------------------------------------------------------------------------*/
623 /*----------------------------------------------------------------------------*/
624 static int
625 muse_twilight_params_fill(muse_twilight_params_t *aParams, cpl_parameterlist *aParameters)
626 {
627  cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
628  cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
629  cpl_parameter *p;
630 
631  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.overscan");
632  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
633  aParams->overscan = cpl_parameter_get_string(p);
634 
635  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.ovscreject");
636  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
637  aParams->ovscreject = cpl_parameter_get_string(p);
638 
639  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.ovscsigma");
640  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
641  aParams->ovscsigma = cpl_parameter_get_double(p);
642 
643  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.ovscignore");
644  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
645  aParams->ovscignore = cpl_parameter_get_int(p);
646 
647  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.combine");
648  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
649  aParams->combine_s = cpl_parameter_get_string(p);
650  aParams->combine =
651  (!strcasecmp(aParams->combine_s, "average")) ? MUSE_TWILIGHT_PARAM_COMBINE_AVERAGE :
652  (!strcasecmp(aParams->combine_s, "median")) ? MUSE_TWILIGHT_PARAM_COMBINE_MEDIAN :
653  (!strcasecmp(aParams->combine_s, "minmax")) ? MUSE_TWILIGHT_PARAM_COMBINE_MINMAX :
654  (!strcasecmp(aParams->combine_s, "sigclip")) ? MUSE_TWILIGHT_PARAM_COMBINE_SIGCLIP :
655  MUSE_TWILIGHT_PARAM_COMBINE_INVALID_VALUE;
656  cpl_ensure_code(aParams->combine != MUSE_TWILIGHT_PARAM_COMBINE_INVALID_VALUE,
657  CPL_ERROR_ILLEGAL_INPUT);
658 
659  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.nlow");
660  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
661  aParams->nlow = cpl_parameter_get_int(p);
662 
663  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.nhigh");
664  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
665  aParams->nhigh = cpl_parameter_get_int(p);
666 
667  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.nkeep");
668  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
669  aParams->nkeep = cpl_parameter_get_int(p);
670 
671  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.lsigma");
672  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
673  aParams->lsigma = cpl_parameter_get_double(p);
674 
675  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.hsigma");
676  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
677  aParams->hsigma = cpl_parameter_get_double(p);
678 
679  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.scale");
680  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
681  aParams->scale = cpl_parameter_get_bool(p);
682 
683  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.resample");
684  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
685  aParams->resample_s = cpl_parameter_get_string(p);
686  aParams->resample =
687  (!strcasecmp(aParams->resample_s, "nearest")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_NEAREST :
688  (!strcasecmp(aParams->resample_s, "linear")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_LINEAR :
689  (!strcasecmp(aParams->resample_s, "quadratic")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_QUADRATIC :
690  (!strcasecmp(aParams->resample_s, "renka")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_RENKA :
691  (!strcasecmp(aParams->resample_s, "drizzle")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_DRIZZLE :
692  (!strcasecmp(aParams->resample_s, "lanczos")) ? MUSE_TWILIGHT_PARAM_RESAMPLE_LANCZOS :
693  MUSE_TWILIGHT_PARAM_RESAMPLE_INVALID_VALUE;
694  cpl_ensure_code(aParams->resample != MUSE_TWILIGHT_PARAM_RESAMPLE_INVALID_VALUE,
695  CPL_ERROR_ILLEGAL_INPUT);
696 
697  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.crtype");
698  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
699  aParams->crtype_s = cpl_parameter_get_string(p);
700  aParams->crtype =
701  (!strcasecmp(aParams->crtype_s, "iraf")) ? MUSE_TWILIGHT_PARAM_CRTYPE_IRAF :
702  (!strcasecmp(aParams->crtype_s, "mean")) ? MUSE_TWILIGHT_PARAM_CRTYPE_MEAN :
703  (!strcasecmp(aParams->crtype_s, "median")) ? MUSE_TWILIGHT_PARAM_CRTYPE_MEDIAN :
704  MUSE_TWILIGHT_PARAM_CRTYPE_INVALID_VALUE;
705  cpl_ensure_code(aParams->crtype != MUSE_TWILIGHT_PARAM_CRTYPE_INVALID_VALUE,
706  CPL_ERROR_ILLEGAL_INPUT);
707 
708  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.crsigma");
709  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
710  aParams->crsigma = cpl_parameter_get_double(p);
711 
712  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.lambdamin");
713  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
714  aParams->lambdamin = cpl_parameter_get_double(p);
715 
716  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.lambdamax");
717  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
718  aParams->lambdamax = cpl_parameter_get_double(p);
719 
720  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.dlambda");
721  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
722  aParams->dlambda = cpl_parameter_get_double(p);
723 
724  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.xorder");
725  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
726  aParams->xorder = cpl_parameter_get_int(p);
727 
728  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.yorder");
729  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
730  aParams->yorder = cpl_parameter_get_int(p);
731 
732  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.vignmaskedges");
733  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
734  aParams->vignmaskedges = cpl_parameter_get_double(p);
735 
736  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.vignsmooth");
737  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
738  aParams->vignsmooth_s = cpl_parameter_get_string(p);
739  aParams->vignsmooth =
740  (!strcasecmp(aParams->vignsmooth_s, "polyfit")) ? MUSE_TWILIGHT_PARAM_VIGNSMOOTH_POLYFIT :
741  (!strcasecmp(aParams->vignsmooth_s, "gaussian")) ? MUSE_TWILIGHT_PARAM_VIGNSMOOTH_GAUSSIAN :
742  (!strcasecmp(aParams->vignsmooth_s, "median")) ? MUSE_TWILIGHT_PARAM_VIGNSMOOTH_MEDIAN :
743  MUSE_TWILIGHT_PARAM_VIGNSMOOTH_INVALID_VALUE;
744  cpl_ensure_code(aParams->vignsmooth != MUSE_TWILIGHT_PARAM_VIGNSMOOTH_INVALID_VALUE,
745  CPL_ERROR_ILLEGAL_INPUT);
746 
747  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.vignxpar");
748  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
749  aParams->vignxpar = cpl_parameter_get_int(p);
750 
751  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.vignypar");
752  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
753  aParams->vignypar = cpl_parameter_get_int(p);
754 
755  p = cpl_parameterlist_find(aParameters, "muse.muse_twilight.vignnfmmask");
756  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
757  aParams->vignnfmmask = cpl_parameter_get_int(p);
758 
759  return 0;
760 } /* muse_twilight_params_fill() */
761 
762 /*----------------------------------------------------------------------------*/
769 /*----------------------------------------------------------------------------*/
770 static int
771 muse_twilight_exec(cpl_plugin *aPlugin)
772 {
773  if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
774  return -1;
775  }
777  cpl_recipe *recipe = (cpl_recipe *)aPlugin;
778  cpl_msg_set_threadid_on();
779 
780  cpl_frameset *usedframes = cpl_frameset_new(),
781  *outframes = cpl_frameset_new();
782  muse_twilight_params_t params;
783  muse_twilight_params_fill(&params, recipe->parameters);
784 
785  cpl_errorstate prestate = cpl_errorstate_get();
786 
787  muse_processing *proc = muse_processing_new("muse_twilight",
788  recipe);
789  int rc = muse_twilight_compute(proc, &params);
790  cpl_frameset_join(usedframes, proc->usedframes);
791  cpl_frameset_join(outframes, proc->outframes);
793 
794  if (!cpl_errorstate_is_equal(prestate)) {
795  /* dump all errors from this recipe in chronological order */
796  cpl_errorstate_dump(prestate, CPL_FALSE, muse_cplerrorstate_dump_some);
797  /* reset message level to not get the same errors displayed again by esorex */
798  cpl_msg_set_level(CPL_MSG_INFO);
799  }
800  /* clean up duplicates in framesets of used and output frames */
803 
804  /* to get esorex to see our classification (frame groups etc.), *
805  * replace the original frameset with the list of used frames *
806  * before appending product output frames */
807  /* keep the same pointer, so just erase all frames, not delete the frameset */
808  muse_cplframeset_erase_all(recipe->frames);
809  cpl_frameset_join(recipe->frames, usedframes);
810  cpl_frameset_join(recipe->frames, outframes);
811  cpl_frameset_delete(usedframes);
812  cpl_frameset_delete(outframes);
813  return rc;
814 } /* muse_twilight_exec() */
815 
816 /*----------------------------------------------------------------------------*/
823 /*----------------------------------------------------------------------------*/
824 static int
825 muse_twilight_destroy(cpl_plugin *aPlugin)
826 {
827  /* Get the recipe from the plugin */
828  cpl_recipe *recipe;
829  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
830  recipe = (cpl_recipe *)aPlugin;
831  } else {
832  return -1;
833  }
834 
835  /* Clean up */
836  cpl_parameterlist_delete(recipe->parameters);
838  return 0;
839 } /* muse_twilight_destroy() */
840 
841 /*----------------------------------------------------------------------------*/
851 /*----------------------------------------------------------------------------*/
852 int
853 cpl_plugin_get_info(cpl_pluginlist *aList)
854 {
855  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
856  cpl_plugin *plugin = &recipe->interface;
857 
858  char *helptext;
860  helptext = cpl_sprintf("%s%s", muse_twilight_help,
861  muse_twilight_help_esorex);
862  } else {
863  helptext = cpl_sprintf("%s", muse_twilight_help);
864  }
865 
866  /* Initialize the CPL plugin stuff for this module */
867  cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
868  CPL_PLUGIN_TYPE_RECIPE,
869  "muse_twilight",
870  "Combine several twilight skyflats into one cube, compute correction factors for each IFU, and create a smooth 3D illumination correction.",
871  helptext,
872  "Peter Weilbacher",
873  "usd-help@eso.org",
875  muse_twilight_create,
876  muse_twilight_exec,
877  muse_twilight_destroy);
878  cpl_pluginlist_append(aList, plugin);
879  cpl_free(helptext);
880 
881  return 0;
882 } /* cpl_plugin_get_info() */
883 
double crsigma
Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative va...
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
int vignnfmmask
The height of the vignetted region at the top of the MUSE field in NFM. This is the region modeled se...
const char * vignsmooth_s
Type of smoothing to use for the vignetted region given by the VIGNETTING_MASK (for WFM...
int scale
Scale the individual images to a common exposure time before combining them.
double lsigma
Low sigma for pixel rejection with sigclip.
int nkeep
Number of pixels to keep with minmax.
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
double ovscsigma
If the deviation of mean overscan levels between a raw input image and the reference image is higher ...
const char * crtype_s
Type of statistics used for detection of cosmic rays during final resampling. "iraf" uses the varianc...
const char * overscan
If this is "none", stop when detecting discrepant overscan levels (see ovscsigma), for "offset" it assumes that the mean overscan level represents the real offset in the bias levels of the exposures involved, and adjusts the data accordingly; for "vpoly", a polynomial is fit to the vertical overscan and subtracted from the whole quadrant.
cpl_frameset * usedframes
muse_processing * muse_processing_new(const char *aName, cpl_recipe *aRecipe)
Create a new processing structure.
int nhigh
Number of maximum pixels to reject with minmax.
const char * muse_get_license(void)
Get the pipeline copyright and license.
Definition: muse_utils.c:83
int vignxpar
Parameter used by the vignetting smoothing: x order for polyfit (default, recommended 4)...
double vignmaskedges
Pixels on edges stronger than this fraction in the normalized image are excluded from the fit to the ...
muse_frame_mode
int vignypar
Parameter used by the vignetting smoothing: y order for polyfit (default, recommended 4)...
cpl_frameset * outframes
const char * combine_s
Type of combination to use (as string)
Structure to hold the parameters of the muse_twilight recipe.
double dlambda
Sampling for twilight reconstruction, this should result in planes of equal wavelength coverage...
int vignsmooth
Type of smoothing to use for the vignetted region given by the VIGNETTING_MASK (for WFM...
int resample
The resampling technique to use for the final output cube.
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
double lambdamin
Minimum wavelength for twilight reconstruction.
void muse_processinginfo_delete(cpl_recipe *)
Clear all information from the processing info and from the recipe config.
int combine
Type of combination to use.
double hsigma
High sigma for pixel rejection with sigclip.
int yorder
Polynomial order to use in y direction to fit the full field of view.
int xorder
Polynomial order to use in x direction to fit the full field of view.
const char * ovscreject
This influences how values are rejected when computing overscan statistics. Either no rejection at al...
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.
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 ovscignore
The number of pixels of the overscan adjacent to the data section of the CCD that are ignored when co...
double lambdamax
Maximum wavelength for twilight reconstruction.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.
int nlow
Number of minimum pixels to reject with minmax.
int crtype
Type of statistics used for detection of cosmic rays during final resampling. "iraf" uses the varianc...
cpl_error_code muse_processing_prepare_property(cpl_propertylist *, const char *, cpl_type, const char *)
Prepare and check the specified property.
const char * resample_s
The resampling technique to use for the final output cube. (as string)