MUSE Pipeline Reference Manual  0.18.5
muse_scipost_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_scipost_z.h" /* in turn includes muse.h */
36 
37 /*----------------------------------------------------------------------------*/
46 /*----------------------------------------------------------------------------*/
49 /*----------------------------------------------------------------------------*
50  * Static variables *
51  *----------------------------------------------------------------------------*/
52 static const char *muse_scipost_help =
53  "Merge pixel tables from all IFUs, apply on-sky calibrations, and resample the data from all exposures into the final datacube.";
54 
55 static const char *muse_scipost_help_esorex =
56  "\n\nInput frames for raw frame tag \"PIXTABLE_OBJECT\":\n"
57  "\n Frame tag Type Req #Fr Description"
58  "\n -------------------- ---- --- --- ------------"
59  "\n PIXTABLE_OBJECT raw Y Pixel table of a science object"
60  "\n EXTINCT_TABLE calib Y 1 Atmospheric extinction table"
61  "\n STD_RESPONSE calib Y 1 Response curve as derived from standard star(s)"
62  "\n STD_TELLURIC calib . 1 Telluric absorption as derived from standard star(s)"
63  "\n ASTROMETRY_WCS calib . 1 Astrometric solution derived from astrometric science frame"
64  "\n FILTER_LIST calib . 1 File to be used to create field-of-view images."
65  "\n OUTPUT_WCS calib . 1 WCS to override output cube location / dimensions"
66  "\n SKY_LINES calib . 1 List of OH transitions and other sky lines"
67  "\n SKY_CONTINUUM calib . 1 Sky continuum to use"
68  "\n LSF_TABLE calib . Slice specific LSF parameters."
69  "\n SKY_MASK calib . 1 Sky mask to use"
70  "\n\nProduct frames for raw frame tag \"PIXTABLE_OBJECT\":\n"
71  "\n Frame tag Level Description"
72  "\n -------------------- -------- ------------"
73  "\n DATACUBE_FINAL final Output datacube"
74  "\n IMAGE_FOV final Field-of-view images corresponding to the \"filter\" parameter."
75  "\n OBJECT_RESAMPLED final Stacked image (if --stacked=true)"
76  "\n PIXTABLE_REDUCED intermed Fully reduced pixel tables for each exposure (if --save_individual=true)"
77  "\n PIXTABLE_POSITIONED intermed Fully reduced and positioned pixel table for each individual exposure (if --save_positioned=true)"
78  "\n PIXTABLE_COMBINED intermed Fully reduced and combined pixel table for the full set of exposures (if --save_combined=true)"
79  "\n SKY_MASK intermed Created sky mask"
80  "\n SKY_SPECTRUM intermed Sky spectrum within the sky mask";
81 
82 /*----------------------------------------------------------------------------*/
90 /*----------------------------------------------------------------------------*/
91 static cpl_recipeconfig *
92 muse_scipost_new_recipeconfig(void)
93 {
94  cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
95  const char *tag;
96 
97  tag = "PIXTABLE_OBJECT";
98  cpl_recipeconfig_set_tag(recipeconfig, tag, 1, -1);
99  cpl_recipeconfig_set_input(recipeconfig, tag, "EXTINCT_TABLE", 1, 1);
100  cpl_recipeconfig_set_input(recipeconfig, tag, "STD_RESPONSE", 1, 1);
101  cpl_recipeconfig_set_input(recipeconfig, tag, "STD_TELLURIC", -1, 1);
102  cpl_recipeconfig_set_input(recipeconfig, tag, "ASTROMETRY_WCS", -1, 1);
103  cpl_recipeconfig_set_input(recipeconfig, tag, "FILTER_LIST", -1, 1);
104  cpl_recipeconfig_set_input(recipeconfig, tag, "OUTPUT_WCS", -1, 1);
105  cpl_recipeconfig_set_input(recipeconfig, tag, "SKY_LINES", 0, 1);
106  cpl_recipeconfig_set_input(recipeconfig, tag, "SKY_CONTINUUM", 0, 1);
107  cpl_recipeconfig_set_input(recipeconfig, tag, "LSF_TABLE", 0, -1);
108  cpl_recipeconfig_set_input(recipeconfig, tag, "SKY_MASK", 0, 1);
109  cpl_recipeconfig_set_output(recipeconfig, tag, "DATACUBE_FINAL");
110  cpl_recipeconfig_set_output(recipeconfig, tag, "IMAGE_FOV");
111  cpl_recipeconfig_set_output(recipeconfig, tag, "OBJECT_RESAMPLED");
112  cpl_recipeconfig_set_output(recipeconfig, tag, "PIXTABLE_REDUCED");
113  cpl_recipeconfig_set_output(recipeconfig, tag, "PIXTABLE_POSITIONED");
114  cpl_recipeconfig_set_output(recipeconfig, tag, "PIXTABLE_COMBINED");
115  cpl_recipeconfig_set_output(recipeconfig, tag, "SKY_MASK");
116  cpl_recipeconfig_set_output(recipeconfig, tag, "SKY_SPECTRUM");
117 
118  return recipeconfig;
119 } /* muse_scipost_new_recipeconfig() */
120 
121 /*----------------------------------------------------------------------------*/
131 /*----------------------------------------------------------------------------*/
132 static cpl_error_code
133 muse_scipost_prepare_header(const char *aFrametag, cpl_propertylist *aHeader)
134 {
135  cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
136  cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
137  if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
138  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST POS[0-9]+ X",
139  CPL_TYPE_FLOAT,
140  "[pix] Position of source k in x-direction in combined frame");
141  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST POS[0-9]+ Y",
142  CPL_TYPE_FLOAT,
143  "[pix] Position of source k in y-direction in combined frame");
144  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST FWHM[0-9]+ X",
145  CPL_TYPE_FLOAT,
146  "[arcsec] FWHM of source k in x-direction in combined frame");
147  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST FWHM[0-9]+ Y",
148  CPL_TYPE_FLOAT,
149  "[arcsec] FWHM of source k in y-direction in combined frame");
150  } else if (!strcmp(aFrametag, "IMAGE_FOV")) {
151  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST POS[0-9]+ X",
152  CPL_TYPE_FLOAT,
153  "[pix] Position of source k in x-direction in combined frame");
154  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST POS[0-9]+ Y",
155  CPL_TYPE_FLOAT,
156  "[pix] Position of source k in y-direction in combined frame");
157  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST FWHM[0-9]+ X",
158  CPL_TYPE_FLOAT,
159  "[arcsec] FWHM of source k in x-direction in combined frame");
160  muse_processing_prepare_property(aHeader, "ESO QC SCIPOST FWHM[0-9]+ Y",
161  CPL_TYPE_FLOAT,
162  "[arcsec] FWHM of source k in y-direction in combined frame");
163  } else if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
164  } else if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
165  } else if (!strcmp(aFrametag, "PIXTABLE_POSITIONED")) {
166  } else if (!strcmp(aFrametag, "PIXTABLE_COMBINED")) {
167  } else if (!strcmp(aFrametag, "SKY_MASK")) {
168  muse_processing_prepare_property(aHeader, "ESO QC SKY THRESHOLD",
169  CPL_TYPE_DOUBLE,
170  "Threshold in the white light considered as sky, used to create this mask");
171  } else if (!strcmp(aFrametag, "SKY_SPECTRUM")) {
172  } else {
173  cpl_msg_warning(__func__, "Frame tag %s is not defined", aFrametag);
174  return CPL_ERROR_ILLEGAL_INPUT;
175  }
176  return CPL_ERROR_NONE;
177 } /* muse_scipost_prepare_header() */
178 
179 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 static cpl_frame_level
190 muse_scipost_get_frame_level(const char *aFrametag)
191 {
192  if (!aFrametag) {
193  return CPL_FRAME_LEVEL_NONE;
194  }
195  if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
196  return CPL_FRAME_LEVEL_FINAL;
197  }
198  if (!strcmp(aFrametag, "IMAGE_FOV")) {
199  return CPL_FRAME_LEVEL_FINAL;
200  }
201  if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
202  return CPL_FRAME_LEVEL_FINAL;
203  }
204  if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
205  return CPL_FRAME_LEVEL_INTERMEDIATE;
206  }
207  if (!strcmp(aFrametag, "PIXTABLE_POSITIONED")) {
208  return CPL_FRAME_LEVEL_INTERMEDIATE;
209  }
210  if (!strcmp(aFrametag, "PIXTABLE_COMBINED")) {
211  return CPL_FRAME_LEVEL_INTERMEDIATE;
212  }
213  if (!strcmp(aFrametag, "SKY_MASK")) {
214  return CPL_FRAME_LEVEL_INTERMEDIATE;
215  }
216  if (!strcmp(aFrametag, "SKY_SPECTRUM")) {
217  return CPL_FRAME_LEVEL_INTERMEDIATE;
218  }
219  return CPL_FRAME_LEVEL_NONE;
220 } /* muse_scipost_get_frame_level() */
221 
222 /*----------------------------------------------------------------------------*/
231 /*----------------------------------------------------------------------------*/
232 static muse_frame_mode
233 muse_scipost_get_frame_mode(const char *aFrametag)
234 {
235  if (!aFrametag) {
236  return MUSE_FRAME_MODE_ALL;
237  }
238  if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
239  return MUSE_FRAME_MODE_MASTER;
240  }
241  if (!strcmp(aFrametag, "IMAGE_FOV")) {
243  }
244  if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
245  return MUSE_FRAME_MODE_MASTER;
246  }
247  if (!strcmp(aFrametag, "PIXTABLE_REDUCED")) {
249  }
250  if (!strcmp(aFrametag, "PIXTABLE_POSITIONED")) {
252  }
253  if (!strcmp(aFrametag, "PIXTABLE_COMBINED")) {
254  return MUSE_FRAME_MODE_MASTER;
255  }
256  if (!strcmp(aFrametag, "SKY_MASK")) {
257  return MUSE_FRAME_MODE_MASTER;
258  }
259  if (!strcmp(aFrametag, "SKY_SPECTRUM")) {
260  return MUSE_FRAME_MODE_MASTER;
261  }
262  return MUSE_FRAME_MODE_ALL;
263 } /* muse_scipost_get_frame_mode() */
264 
265 /*----------------------------------------------------------------------------*/
275 /*----------------------------------------------------------------------------*/
276 static int
277 muse_scipost_create(cpl_plugin *aPlugin)
278 {
279  /* Check that the plugin is part of a valid recipe */
280  cpl_recipe *recipe;
281  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
282  recipe = (cpl_recipe *)aPlugin;
283  } else {
284  return -1;
285  }
286 
287  /* register the extended processing information (new FITS header creation, *
288  * getting of the frame level for a certain tag) */
290  muse_scipost_new_recipeconfig(),
291  muse_scipost_prepare_header,
292  muse_scipost_get_frame_level,
293  muse_scipost_get_frame_mode);
294 
295  /* XXX initialize timing in messages *
296  * since at least esorex is too stupid to turn it on, we have to do it */
298  cpl_msg_set_time_on();
299  }
300 
301  /* Create the parameter list in the cpl_recipe object */
302  recipe->parameters = cpl_parameterlist_new();
303  /* Fill the parameters list */
304  cpl_parameter *p;
305 
306  /* --resample: The resampling technique to use for the final output cube. */
307  p = cpl_parameter_new_enum("muse.muse_scipost.resample",
308  CPL_TYPE_STRING,
309  "The resampling technique to use for the final output cube.",
310  "muse.muse_scipost",
311  (const char *)"drizzle",
312  6,
313  (const char *)"nearest",
314  (const char *)"linear",
315  (const char *)"quadratic",
316  (const char *)"renka",
317  (const char *)"drizzle",
318  (const char *)"lanczos");
319  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "resample");
320  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "resample");
321 
322  cpl_parameterlist_append(recipe->parameters, p);
323 
324  /* --dx: Horizontal step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units. */
325  p = cpl_parameter_new_value("muse.muse_scipost.dx",
326  CPL_TYPE_DOUBLE,
327  "Horizontal step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units.",
328  "muse.muse_scipost",
329  (double)0.0);
330  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dx");
331  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dx");
332 
333  cpl_parameterlist_append(recipe->parameters, p);
334 
335  /* --dy: Vertical step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units. */
336  p = cpl_parameter_new_value("muse.muse_scipost.dy",
337  CPL_TYPE_DOUBLE,
338  "Vertical step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units.",
339  "muse.muse_scipost",
340  (double)0.0);
341  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dy");
342  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dy");
343 
344  cpl_parameterlist_append(recipe->parameters, p);
345 
346  /* --dlambda: Wavelength step size (in Angstrom). Natural instrument sampling is used, if this is 0.0 */
347  p = cpl_parameter_new_value("muse.muse_scipost.dlambda",
348  CPL_TYPE_DOUBLE,
349  "Wavelength step size (in Angstrom). Natural instrument sampling is used, if this is 0.0",
350  "muse.muse_scipost",
351  (double)0.0);
352  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dlambda");
353  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dlambda");
354 
355  cpl_parameterlist_append(recipe->parameters, p);
356 
357  /* --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 median deviation statistics. */
358  p = cpl_parameter_new_enum("muse.muse_scipost.crtype",
359  CPL_TYPE_STRING,
360  "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 median deviation statistics.",
361  "muse.muse_scipost",
362  (const char *)"median",
363  3,
364  (const char *)"iraf",
365  (const char *)"mean",
366  (const char *)"median");
367  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crtype");
368  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crtype");
369 
370  cpl_parameterlist_append(recipe->parameters, p);
371 
372  /* --crsigma: Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative value switches cosmic ray rejection off. */
373  p = cpl_parameter_new_value("muse.muse_scipost.crsigma",
374  CPL_TYPE_DOUBLE,
375  "Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative value switches cosmic ray rejection off.",
376  "muse.muse_scipost",
377  (double)10.);
378  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crsigma");
379  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crsigma");
380 
381  cpl_parameterlist_append(recipe->parameters, p);
382 
383  /* --rc: Critical radius for the "renka" resampling method. */
384  p = cpl_parameter_new_value("muse.muse_scipost.rc",
385  CPL_TYPE_DOUBLE,
386  "Critical radius for the \"renka\" resampling method.",
387  "muse.muse_scipost",
388  (double)1.25);
389  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "rc");
390  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rc");
391 
392  cpl_parameterlist_append(recipe->parameters, p);
393 
394  /* --pixfrac: Pixel down-scaling factor for the "drizzle" resampling method. */
395  p = cpl_parameter_new_value("muse.muse_scipost.pixfrac",
396  CPL_TYPE_DOUBLE,
397  "Pixel down-scaling factor for the \"drizzle\" resampling method.",
398  "muse.muse_scipost",
399  (double)0.8);
400  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "pixfrac");
401  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "pixfrac");
402 
403  cpl_parameterlist_append(recipe->parameters, p);
404 
405  /* --ld: Number of adjacent pixels to take into account during resampling in all three directions (loop distance); this affects all resampling methods except "nearest". */
406  p = cpl_parameter_new_value("muse.muse_scipost.ld",
407  CPL_TYPE_INT,
408  "Number of adjacent pixels to take into account during resampling in all three directions (loop distance); this affects all resampling methods except \"nearest\".",
409  "muse.muse_scipost",
410  (int)1);
411  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "ld");
412  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ld");
413 
414  cpl_parameterlist_append(recipe->parameters, p);
415 
416  /* --format: Type of output file format, "Cube" is a standard FITS cube with NAXIS=3 and multiple extensions (for data and variance). The extended "x" formats include the reconstructed image(s) in FITS image extensions within the same file. */
417  p = cpl_parameter_new_enum("muse.muse_scipost.format",
418  CPL_TYPE_STRING,
419  "Type of output file format, \"Cube\" is a standard FITS cube with NAXIS=3 and multiple extensions (for data and variance). The extended \"x\" formats include the reconstructed image(s) in FITS image extensions within the same file.",
420  "muse.muse_scipost",
421  (const char *)"Cube",
422  4,
423  (const char *)"Cube",
424  (const char *)"Euro3D",
425  (const char *)"xCube",
426  (const char *)"xEuro3D");
427  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "format");
428  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "format");
429 
430  cpl_parameterlist_append(recipe->parameters, p);
431 
432  /* --weight: Type of weighting scheme to use when combining multiple exposures. */
433  p = cpl_parameter_new_enum("muse.muse_scipost.weight",
434  CPL_TYPE_STRING,
435  "Type of weighting scheme to use when combining multiple exposures.",
436  "muse.muse_scipost",
437  (const char *)"exptime",
438  2,
439  (const char *)"exptime",
440  (const char *)"fwhm");
441  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "weight");
442  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "weight");
443 
444  cpl_parameterlist_append(recipe->parameters, p);
445 
446  /* --filter: The filter name(s) to be used for the output field-of-view image. Each name has to correspond to an EXTNAME in an extension of the FILTER_LIST file. If an unsupported filter name is given, creation of the respective image is omitted. If multiple filter names are given, they have to be comma separated. */
447  p = cpl_parameter_new_value("muse.muse_scipost.filter",
448  CPL_TYPE_STRING,
449  "The filter name(s) to be used for the output field-of-view image. Each name has to correspond to an EXTNAME in an extension of the FILTER_LIST file. If an unsupported filter name is given, creation of the respective image is omitted. If multiple filter names are given, they have to be comma separated.",
450  "muse.muse_scipost",
451  (const char *)"white");
452  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "filter");
453  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "filter");
454 
455  cpl_parameterlist_append(recipe->parameters, p);
456 
457  /* --skymethod: The method used to subtract the sky background. "model" should work in all cases, it uses a global sky spectrum model with a local LSF; "row-by-row" works on the basis of single slices and needs sufficient sky in each slice. If "model" is selected, calibration frames for SKY_LINES and LSF_TABLE must be set; SKY_CONTINUUM and SKY_MASK are optional. If "subtract-model" is selected, precalculated sky lines may be subtracted if specified by SKY_LINES, SKY_CONTINUUM, and LSF_TABLE. */
458  p = cpl_parameter_new_enum("muse.muse_scipost.skymethod",
459  CPL_TYPE_STRING,
460  "The method used to subtract the sky background. \"model\" should work in all cases, it uses a global sky spectrum model with a local LSF; \"row-by-row\" works on the basis of single slices and needs sufficient sky in each slice. If \"model\" is selected, calibration frames for SKY_LINES and LSF_TABLE must be set; SKY_CONTINUUM and SKY_MASK are optional. If \"subtract-model\" is selected, precalculated sky lines may be subtracted if specified by SKY_LINES, SKY_CONTINUUM, and LSF_TABLE.",
461  "muse.muse_scipost",
462  (const char *)"model",
463  4,
464  (const char *)"none",
465  (const char *)"subtract-model",
466  (const char *)"model",
467  (const char *)"row-by-row");
468  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "skymethod");
469  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "skymethod");
470 
471  cpl_parameterlist_append(recipe->parameters, p);
472 
473  /* --lambdamin: Cut off the data below this wavelength after loading the pixel table(s). */
474  p = cpl_parameter_new_value("muse.muse_scipost.lambdamin",
475  CPL_TYPE_DOUBLE,
476  "Cut off the data below this wavelength after loading the pixel table(s).",
477  "muse.muse_scipost",
478  (double)4000.);
479  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamin");
480  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamin");
481 
482  cpl_parameterlist_append(recipe->parameters, p);
483 
484  /* --lambdamax: Cut off the data above this wavelength after loading the pixel table(s). */
485  p = cpl_parameter_new_value("muse.muse_scipost.lambdamax",
486  CPL_TYPE_DOUBLE,
487  "Cut off the data above this wavelength after loading the pixel table(s).",
488  "muse.muse_scipost",
489  (double)10000.);
490  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamax");
491  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamax");
492 
493  cpl_parameterlist_append(recipe->parameters, p);
494 
495  /* --lambdaref: Reference wavelength used for correction of differential atmospheric refraction. The R-band (peak wavelength ~7000 Angstrom) that is usually used for guiding, is close to the central wavelength of MUSE, so a value of 7000.0 Angstrom should be used if nothing else is known. A value less than zero switches DAR correction off. */
496  p = cpl_parameter_new_value("muse.muse_scipost.lambdaref",
497  CPL_TYPE_DOUBLE,
498  "Reference wavelength used for correction of differential atmospheric refraction. The R-band (peak wavelength ~7000 Angstrom) that is usually used for guiding, is close to the central wavelength of MUSE, so a value of 7000.0 Angstrom should be used if nothing else is known. A value less than zero switches DAR correction off.",
499  "muse.muse_scipost",
500  (double)7000.);
501  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdaref");
502  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdaref");
503 
504  cpl_parameterlist_append(recipe->parameters, p);
505 
506  /* --darcheck: Carry out a check of the theoretical DAR correction using source centroiding. If "correct" it will also apply an empirical correction. */
507  p = cpl_parameter_new_enum("muse.muse_scipost.darcheck",
508  CPL_TYPE_STRING,
509  "Carry out a check of the theoretical DAR correction using source centroiding. If \"correct\" it will also apply an empirical correction.",
510  "muse.muse_scipost",
511  (const char *)"none",
512  3,
513  (const char *)"none",
514  (const char *)"check",
515  (const char *)"correct");
516  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "darcheck");
517  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "darcheck");
518 
519  cpl_parameterlist_append(recipe->parameters, p);
520 
521  /* --save_individual: If true, save fully reduced pixel table for each individual exposure as output product. */
522  p = cpl_parameter_new_value("muse.muse_scipost.save_individual",
523  CPL_TYPE_BOOL,
524  "If true, save fully reduced pixel table for each individual exposure as output product.",
525  "muse.muse_scipost",
526  (int)FALSE);
527  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "save_individual");
528  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "save_individual");
529 
530  cpl_parameterlist_append(recipe->parameters, p);
531 
532  /* --save_positioned: If true, save fully reduced and positioned pixel table for each individual exposure as output product. The difference to save_individual is that here, the output pixel tables have coordinates in RA and DEC. This is useful, if both the relative exposure weighting and the final resampling are to be done externally. */
533  p = cpl_parameter_new_value("muse.muse_scipost.save_positioned",
534  CPL_TYPE_BOOL,
535  "If true, save fully reduced and positioned pixel table for each individual exposure as output product. The difference to save_individual is that here, the output pixel tables have coordinates in RA and DEC. This is useful, if both the relative exposure weighting and the final resampling are to be done externally.",
536  "muse.muse_scipost",
537  (int)FALSE);
538  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "save_positioned");
539  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "save_positioned");
540 
541  cpl_parameterlist_append(recipe->parameters, p);
542 
543  /* --save_combined: If true, save the fully reduced and combined pixel table for the full set of exposures. The difference to save_positioned is that here all pixel tables are combined into one, with an added "weight" column. This is useful, if only the final resampling step is to be done separately. */
544  p = cpl_parameter_new_value("muse.muse_scipost.save_combined",
545  CPL_TYPE_BOOL,
546  "If true, save the fully reduced and combined pixel table for the full set of exposures. The difference to save_positioned is that here all pixel tables are combined into one, with an added \"weight\" column. This is useful, if only the final resampling step is to be done separately.",
547  "muse.muse_scipost",
548  (int)FALSE);
549  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "save_combined");
550  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "save_combined");
551 
552  cpl_parameterlist_append(recipe->parameters, p);
553 
554  /* --skymodel_fraction: Fraction of the image to be considered as sky. If an input sky mask is provided, the fraction is applied to the regions within the mask. If the whole sky mask should be used, set this parameter to 1. */
555  p = cpl_parameter_new_value("muse.muse_scipost.skymodel_fraction",
556  CPL_TYPE_DOUBLE,
557  "Fraction of the image to be considered as sky. If an input sky mask is provided, the fraction is applied to the regions within the mask. If the whole sky mask should be used, set this parameter to 1.",
558  "muse.muse_scipost",
559  (double)0.05);
560  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "skymodel_fraction");
561  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "skymodel_fraction");
562 
563  cpl_parameterlist_append(recipe->parameters, p);
564 
565  /* --skymodel_sampling: Spectral sampling of the sky spectrum [Angstrom]. */
566  p = cpl_parameter_new_value("muse.muse_scipost.skymodel_sampling",
567  CPL_TYPE_DOUBLE,
568  "Spectral sampling of the sky spectrum [Angstrom].",
569  "muse.muse_scipost",
570  (double)1.25);
571  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "skymodel_sampling");
572  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "skymodel_sampling");
573 
574  cpl_parameterlist_append(recipe->parameters, p);
575 
576  /* --skymodel_csampling: Spectral sampling of the continuum spectrum [Angstrom]. */
577  p = cpl_parameter_new_value("muse.muse_scipost.skymodel_csampling",
578  CPL_TYPE_DOUBLE,
579  "Spectral sampling of the continuum spectrum [Angstrom].",
580  "muse.muse_scipost",
581  (double)20.);
582  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "skymodel_csampling");
583  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "skymodel_csampling");
584 
585  cpl_parameterlist_append(recipe->parameters, p);
586 
587  /* --astrometry: If false, skip any astrometric calibration, even if one was passed in the input set of files. This causes creation of an output cube with a linear WCS and may result in errors. If you want to use a sensible default, leave this true but do not pass an ASTROMETRY_WCS. */
588  p = cpl_parameter_new_value("muse.muse_scipost.astrometry",
589  CPL_TYPE_BOOL,
590  "If false, skip any astrometric calibration, even if one was passed in the input set of files. This causes creation of an output cube with a linear WCS and may result in errors. If you want to use a sensible default, leave this true but do not pass an ASTROMETRY_WCS.",
591  "muse.muse_scipost",
592  (int)TRUE);
593  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "astrometry");
594  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "astrometry");
595 
596  cpl_parameterlist_append(recipe->parameters, p);
597 
598  /* --stacked: If true, write an additional output file in form of a 2D stacked image (x direction is pseudo-spatial, y direction is wavelength). */
599  p = cpl_parameter_new_value("muse.muse_scipost.stacked",
600  CPL_TYPE_BOOL,
601  "If true, write an additional output file in form of a 2D stacked image (x direction is pseudo-spatial, y direction is wavelength).",
602  "muse.muse_scipost",
603  (int)FALSE);
604  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "stacked");
605  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "stacked");
606 
607  cpl_parameterlist_append(recipe->parameters, p);
608 
609  return 0;
610 } /* muse_scipost_create() */
611 
612 /*----------------------------------------------------------------------------*/
623 /*----------------------------------------------------------------------------*/
624 static int
625 muse_scipost_params_fill(muse_scipost_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_scipost.resample");
632  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
633  aParams->resample_s = cpl_parameter_get_string(p);
634  aParams->resample =
635  (!strcasecmp(aParams->resample_s, "nearest")) ? MUSE_SCIPOST_PARAM_RESAMPLE_NEAREST :
636  (!strcasecmp(aParams->resample_s, "linear")) ? MUSE_SCIPOST_PARAM_RESAMPLE_LINEAR :
637  (!strcasecmp(aParams->resample_s, "quadratic")) ? MUSE_SCIPOST_PARAM_RESAMPLE_QUADRATIC :
638  (!strcasecmp(aParams->resample_s, "renka")) ? MUSE_SCIPOST_PARAM_RESAMPLE_RENKA :
639  (!strcasecmp(aParams->resample_s, "drizzle")) ? MUSE_SCIPOST_PARAM_RESAMPLE_DRIZZLE :
640  (!strcasecmp(aParams->resample_s, "lanczos")) ? MUSE_SCIPOST_PARAM_RESAMPLE_LANCZOS :
641  MUSE_SCIPOST_PARAM_RESAMPLE_INVALID_VALUE;
642  cpl_ensure_code(aParams->resample != MUSE_SCIPOST_PARAM_RESAMPLE_INVALID_VALUE,
643  CPL_ERROR_ILLEGAL_INPUT);
644 
645  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.dx");
646  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
647  aParams->dx = cpl_parameter_get_double(p);
648 
649  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.dy");
650  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
651  aParams->dy = cpl_parameter_get_double(p);
652 
653  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.dlambda");
654  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
655  aParams->dlambda = cpl_parameter_get_double(p);
656 
657  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.crtype");
658  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
659  aParams->crtype_s = cpl_parameter_get_string(p);
660  aParams->crtype =
661  (!strcasecmp(aParams->crtype_s, "iraf")) ? MUSE_SCIPOST_PARAM_CRTYPE_IRAF :
662  (!strcasecmp(aParams->crtype_s, "mean")) ? MUSE_SCIPOST_PARAM_CRTYPE_MEAN :
663  (!strcasecmp(aParams->crtype_s, "median")) ? MUSE_SCIPOST_PARAM_CRTYPE_MEDIAN :
664  MUSE_SCIPOST_PARAM_CRTYPE_INVALID_VALUE;
665  cpl_ensure_code(aParams->crtype != MUSE_SCIPOST_PARAM_CRTYPE_INVALID_VALUE,
666  CPL_ERROR_ILLEGAL_INPUT);
667 
668  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.crsigma");
669  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
670  aParams->crsigma = cpl_parameter_get_double(p);
671 
672  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.rc");
673  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
674  aParams->rc = cpl_parameter_get_double(p);
675 
676  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.pixfrac");
677  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
678  aParams->pixfrac = cpl_parameter_get_double(p);
679 
680  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.ld");
681  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
682  aParams->ld = cpl_parameter_get_int(p);
683 
684  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.format");
685  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
686  aParams->format_s = cpl_parameter_get_string(p);
687  aParams->format =
688  (!strcasecmp(aParams->format_s, "Cube")) ? MUSE_SCIPOST_PARAM_FORMAT_CUBE :
689  (!strcasecmp(aParams->format_s, "Euro3D")) ? MUSE_SCIPOST_PARAM_FORMAT_EURO3D :
690  (!strcasecmp(aParams->format_s, "xCube")) ? MUSE_SCIPOST_PARAM_FORMAT_XCUBE :
691  (!strcasecmp(aParams->format_s, "xEuro3D")) ? MUSE_SCIPOST_PARAM_FORMAT_XEURO3D :
692  MUSE_SCIPOST_PARAM_FORMAT_INVALID_VALUE;
693  cpl_ensure_code(aParams->format != MUSE_SCIPOST_PARAM_FORMAT_INVALID_VALUE,
694  CPL_ERROR_ILLEGAL_INPUT);
695 
696  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.weight");
697  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
698  aParams->weight_s = cpl_parameter_get_string(p);
699  aParams->weight =
700  (!strcasecmp(aParams->weight_s, "exptime")) ? MUSE_SCIPOST_PARAM_WEIGHT_EXPTIME :
701  (!strcasecmp(aParams->weight_s, "fwhm")) ? MUSE_SCIPOST_PARAM_WEIGHT_FWHM :
702  MUSE_SCIPOST_PARAM_WEIGHT_INVALID_VALUE;
703  cpl_ensure_code(aParams->weight != MUSE_SCIPOST_PARAM_WEIGHT_INVALID_VALUE,
704  CPL_ERROR_ILLEGAL_INPUT);
705 
706  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.filter");
707  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
708  aParams->filter = cpl_parameter_get_string(p);
709 
710  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.skymethod");
711  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
712  aParams->skymethod_s = cpl_parameter_get_string(p);
713  aParams->skymethod =
714  (!strcasecmp(aParams->skymethod_s, "none")) ? MUSE_SCIPOST_PARAM_SKYMETHOD_NONE :
715  (!strcasecmp(aParams->skymethod_s, "subtract-model")) ? MUSE_SCIPOST_PARAM_SKYMETHOD_SUBTRACT_MODEL :
716  (!strcasecmp(aParams->skymethod_s, "model")) ? MUSE_SCIPOST_PARAM_SKYMETHOD_MODEL :
717  (!strcasecmp(aParams->skymethod_s, "row-by-row")) ? MUSE_SCIPOST_PARAM_SKYMETHOD_ROW_BY_ROW :
718  MUSE_SCIPOST_PARAM_SKYMETHOD_INVALID_VALUE;
719  cpl_ensure_code(aParams->skymethod != MUSE_SCIPOST_PARAM_SKYMETHOD_INVALID_VALUE,
720  CPL_ERROR_ILLEGAL_INPUT);
721 
722  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.lambdamin");
723  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
724  aParams->lambdamin = cpl_parameter_get_double(p);
725 
726  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.lambdamax");
727  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
728  aParams->lambdamax = cpl_parameter_get_double(p);
729 
730  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.lambdaref");
731  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
732  aParams->lambdaref = cpl_parameter_get_double(p);
733 
734  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.darcheck");
735  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
736  aParams->darcheck_s = cpl_parameter_get_string(p);
737  aParams->darcheck =
738  (!strcasecmp(aParams->darcheck_s, "none")) ? MUSE_SCIPOST_PARAM_DARCHECK_NONE :
739  (!strcasecmp(aParams->darcheck_s, "check")) ? MUSE_SCIPOST_PARAM_DARCHECK_CHECK :
740  (!strcasecmp(aParams->darcheck_s, "correct")) ? MUSE_SCIPOST_PARAM_DARCHECK_CORRECT :
741  MUSE_SCIPOST_PARAM_DARCHECK_INVALID_VALUE;
742  cpl_ensure_code(aParams->darcheck != MUSE_SCIPOST_PARAM_DARCHECK_INVALID_VALUE,
743  CPL_ERROR_ILLEGAL_INPUT);
744 
745  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.save_individual");
746  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
747  aParams->save_individual = cpl_parameter_get_bool(p);
748 
749  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.save_positioned");
750  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
751  aParams->save_positioned = cpl_parameter_get_bool(p);
752 
753  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.save_combined");
754  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
755  aParams->save_combined = cpl_parameter_get_bool(p);
756 
757  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.skymodel_fraction");
758  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
759  aParams->skymodel_fraction = cpl_parameter_get_double(p);
760 
761  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.skymodel_sampling");
762  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
763  aParams->skymodel_sampling = cpl_parameter_get_double(p);
764 
765  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.skymodel_csampling");
766  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
767  aParams->skymodel_csampling = cpl_parameter_get_double(p);
768 
769  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.astrometry");
770  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
771  aParams->astrometry = cpl_parameter_get_bool(p);
772 
773  p = cpl_parameterlist_find(aParameters, "muse.muse_scipost.stacked");
774  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
775  aParams->stacked = cpl_parameter_get_bool(p);
776 
777  return 0;
778 } /* muse_scipost_params_fill() */
779 
780 /*----------------------------------------------------------------------------*/
787 /*----------------------------------------------------------------------------*/
788 static int
789 muse_scipost_exec(cpl_plugin *aPlugin)
790 {
791  if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
792  return -1;
793  }
794  cpl_recipe *recipe = (cpl_recipe *)aPlugin;
795  cpl_msg_set_threadid_on();
796 
797  cpl_frameset *usedframes = cpl_frameset_new(),
798  *outframes = cpl_frameset_new();
799  muse_scipost_params_t params;
800  muse_scipost_params_fill(&params, recipe->parameters);
801 
802  cpl_errorstate prestate = cpl_errorstate_get();
803 
804  muse_processing *proc = muse_processing_new("muse_scipost",
805  recipe);
806  int rc = muse_scipost_compute(proc, &params);
807  cpl_frameset_join(usedframes, proc->usedFrames);
808  cpl_frameset_join(outframes, proc->outputFrames);
810 
811  if (!cpl_errorstate_is_equal(prestate)) {
812  /* dump all errors from this recipe in chronological order */
813  cpl_errorstate_dump(prestate, CPL_FALSE, muse_cplerrorstate_dump_some);
814  /* reset message level to not get the same errors displayed again by esorex */
815  cpl_msg_set_level(CPL_MSG_INFO);
816  }
817  /* clean up duplicates in framesets of used and output frames */
820  /* to get esorex to see our classification (frame groups etc.), *
821  * replace the original frameset with the list of used frames *
822  * before appending product output frames */
823  /* keep the same pointer, so just erase all frames, not delete the frameset */
824  muse_cplframeset_erase_all(recipe->frames);
825  cpl_frameset_join(recipe->frames, usedframes);
826  cpl_frameset_join(recipe->frames, outframes);
827  cpl_frameset_delete(usedframes);
828  cpl_frameset_delete(outframes);
829  return rc;
830 } /* muse_scipost_exec() */
831 
832 /*----------------------------------------------------------------------------*/
839 /*----------------------------------------------------------------------------*/
840 static int
841 muse_scipost_destroy(cpl_plugin *aPlugin)
842 {
843  /* Get the recipe from the plugin */
844  cpl_recipe *recipe;
845  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
846  recipe = (cpl_recipe *)aPlugin;
847  } else {
848  return -1;
849  }
850 
851  /* Clean up */
852  cpl_parameterlist_delete(recipe->parameters);
854  return 0;
855 } /* muse_scipost_destroy() */
856 
857 /*----------------------------------------------------------------------------*/
867 /*----------------------------------------------------------------------------*/
868 int
869 cpl_plugin_get_info(cpl_pluginlist *aList)
870 {
871  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
872  cpl_plugin *plugin = &recipe->interface;
873 
874  char *helptext;
876  helptext = cpl_sprintf("%s%s", muse_scipost_help,
877  muse_scipost_help_esorex);
878  } else {
879  helptext = cpl_sprintf("%s", muse_scipost_help);
880  }
881 
882  /* Initialize the CPL plugin stuff for this module */
883  cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
884  CPL_PLUGIN_TYPE_RECIPE,
885  "muse_scipost",
886  "Prepare reduced and combined science products.",
887  helptext,
888  "Peter Weilbacher",
889  "usd-help@eso.org",
891  muse_scipost_create,
892  muse_scipost_exec,
893  muse_scipost_destroy);
894  cpl_pluginlist_append(aList, plugin);
895  cpl_free(helptext);
896 
897  return 0;
898 } /* cpl_plugin_get_info() */
899 
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
double lambdamin
Cut off the data below this wavelength after loading the pixel table(s).
int save_combined
If true, save the fully reduced and combined pixel table for the full set of exposures. The difference to save_positioned is that here all pixel tables are combined into one, with an added "weight" column. This is useful, if only the final resampling step is to be done separately.
const char * skymethod_s
The method used to subtract the sky background. "model" should work in all cases, it uses a global sk...
const char * darcheck_s
Carry out a check of the theoretical DAR correction using source centroiding. If "correct" it will al...
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
int ld
Number of adjacent pixels to take into account during resampling in all three directions (loop distan...
const char * filter
The filter name(s) to be used for the output field-of-view image. Each name has to correspond to an E...
const char * weight_s
Type of weighting scheme to use when combining multiple exposures. (as string)
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
double dy
Vertical step size for resampling (in arcsec or pixel). The following defaults are taken when this va...
double pixfrac
Pixel down-scaling factor for the "drizzle" resampling method.
double lambdaref
Reference wavelength used for correction of differential atmospheric refraction. The R-band (peak wav...
double rc
Critical radius for the "renka" resampling method.
cpl_frameset * outputFrames
double skymodel_fraction
Fraction of the image to be considered as sky. If an input sky mask is provided, the fraction is appl...
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
const char * crtype_s
Type of statistics used for detection of cosmic rays during final resampling. "iraf" uses the varianc...
void muse_processinginfo_delete(cpl_recipe *)
Clear all information from the processing info and from the recipe config.
int darcheck
Carry out a check of the theoretical DAR correction using source centroiding. If "correct" it will al...
double skymodel_sampling
Spectral sampling of the sky spectrum [Angstrom].
int astrometry
If false, skip any astrometric calibration, even if one was passed in the input set of files...
double skymodel_csampling
Spectral sampling of the continuum spectrum [Angstrom].
int weight
Type of weighting scheme to use when combining multiple exposures.
const char * format_s
Type of output file format, "Cube" is a standard FITS cube with NAXIS=3 and multiple extensions (for ...
double lambdamax
Cut off the data above this wavelength after loading the pixel table(s).
cpl_error_code muse_cplframeset_erase_duplicate(cpl_frameset *aFrames)
Erase all duplicate frames from a frameset.
double dx
Horizontal step size for resampling (in arcsec or pixel). The following defaults are taken when this ...
cpl_error_code muse_cplframeset_erase_all(cpl_frameset *aFrames)
Erase all frames in a frameset.
int skymethod
The method used to subtract the sky background. "model" should work in all cases, it uses a global sk...
Structure to hold the parameters of the muse_scipost recipe.
double crsigma
Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative va...
int resample
The resampling technique to use for the final output cube.
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.
cpl_frameset * usedFrames
int save_individual
If true, save fully reduced pixel table for each individual exposure as output product.
int save_positioned
If true, save fully reduced and positioned pixel table for each individual exposure as output product...
double dlambda
Wavelength step size (in Angstrom). Natural instrument sampling is used, if this is 0...
int format
Type of output file format, "Cube" is a standard FITS cube with NAXIS=3 and multiple extensions (for ...
int stacked
If true, write an additional output file in form of a 2D stacked image (x direction is pseudo-spatial...
const char * resample_s
The resampling technique to use for the final output cube. (as string)
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.