FORS Pipeline Reference Manual  4.12.5
fors_subtract_sky.c
1 /* $Id: fors_subtract_sky.c,v 1.8 2013-04-24 14:14:13 cgarcia Exp $
2  *
3  * This file is part of the FORS Data Reduction Pipeline
4  * Copyright (C) 2002-2010 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: cgarcia $
23  * $Date: 2013-04-24 14:14:13 $
24  * $Revision: 1.8 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 #include <math.h>
33 #include <cpl.h>
34 #include <moses.h>
35 #include <fors_dfs.h>
36 
37 static int fors_subtract_sky_create(cpl_plugin *);
38 static int fors_subtract_sky_exec(cpl_plugin *);
39 static int fors_subtract_sky_destroy(cpl_plugin *);
40 static int fors_subtract_sky(cpl_parameterlist *, cpl_frameset *);
41 
42 static char fors_subtract_sky_description[] =
43 "This recipe is used to subtract the sky emission from unrebinned slit\n"
44 "spectra. This is obtained by robust fitting (i.e., excluding the signal\n"
45 "from possible point-like objects in slit) of the emission along the CCD\n"
46 "columns within each spectrum). This method doesn't work if extended\n"
47 "objects are in slit (it really destroys the object spectra), and is\n"
48 "not applicable to LSS data. The input scientific frames are produced\n"
49 "by the recipes fors_remove_bias and fors_flatfield.\n"
50 "\n"
51 "This recipe cannot be applied to LSS or long-slit like data (MOS/MXU with\n"
52 "all slits at the same offset). No automatic recipe is available for this.\n"
53 "Please refer to the FORS Pipeline User's Manual for more details.\n"
54 "\n"
55 "In the table below the MXU acronym can be alternatively read as MOS, and\n"
56 "SCI as STD.\n\n"
57 "Input files:\n\n"
58 " DO category: Type: Explanation: Required:\n"
59 " SCIENCE_UNBIAS_MXU\n"
60 " or SCIENCE_UNFLAT_MXU\n"
61 " or STANDARD_UNBIAS_MXU\n"
62 " or STANDARD_UNFLAT_MXU Calib Frame with sky lines Y\n"
63 " CURV_COEFF_MXU Calib Spectral curvature Y\n"
64 " SLIT_LOCATION_MXU Calib Slit location on CCD Y\n"
65 " GRISM_TABLE Calib Grism table .\n\n"
66 "Output files:\n\n"
67 " DO category: Data type: Explanation:\n"
68 " UNMAPPED_SCI_MXU\n"
69 " or UNMAPPED_STD_MXU FITS image Sky subtracted scientific frame\n"
70 " UNMAPPED_SKY_SCI_MXU\n"
71 " or UNMAPPED_SKY_STD_MXU FITS image Subtracted sky frame\n\n";
72 
73 #define fors_subtract_sky_exit(message) \
74 { \
75 if (message) cpl_msg_error(recipe, message); \
76 cpl_image_delete(spectra); \
77 cpl_image_delete(skymap); \
78 cpl_table_delete(grism_table); \
79 cpl_table_delete(maskslits); \
80 cpl_table_delete(slits); \
81 cpl_table_delete(polytraces); \
82 cpl_propertylist_delete(header); \
83 cpl_msg_indent_less(); \
84 return -1; \
85 }
86 
87 #define fors_subtract_sky_exit_memcheck(message) \
88 { \
89 if (message) cpl_msg_info(recipe, message); \
90 printf("free spectra (%p)\n", spectra); \
91 cpl_image_delete(spectra); \
92 printf("free skymap (%p)\n", skymap); \
93 cpl_image_delete(skymap); \
94 printf("free grism_table (%p)\n", grism_table); \
95 cpl_table_delete(grism_table); \
96 printf("free maskslits (%p)\n", maskslits); \
97 cpl_table_delete(maskslits); \
98 printf("free slits (%p)\n", slits); \
99 cpl_table_delete(slits); \
100 printf("free polytraces (%p)\n", polytraces); \
101 cpl_table_delete(polytraces); \
102 printf("free header (%p)\n", header); \
103 cpl_propertylist_delete(header); \
104 cpl_msg_indent_less(); \
105 return 0; \
106 }
107 
108 
120 int cpl_plugin_get_info(cpl_pluginlist *list)
121 {
122  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe );
123  cpl_plugin *plugin = &recipe->interface;
124 
125  cpl_plugin_init(plugin,
126  CPL_PLUGIN_API,
127  FORS_BINARY_VERSION,
128  CPL_PLUGIN_TYPE_RECIPE,
129  "fors_subtract_sky",
130  "Subtract sky from scientific spectra",
131  fors_subtract_sky_description,
132  "Carlo Izzo",
133  PACKAGE_BUGREPORT,
134  "This file is currently part of the FORS Instrument Pipeline\n"
135  "Copyright (C) 2002-2010 European Southern Observatory\n\n"
136  "This program is free software; you can redistribute it and/or modify\n"
137  "it under the terms of the GNU General Public License as published by\n"
138  "the Free Software Foundation; either version 2 of the License, or\n"
139  "(at your option) any later version.\n\n"
140  "This program is distributed in the hope that it will be useful,\n"
141  "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
142  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
143  "GNU General Public License for more details.\n\n"
144  "You should have received a copy of the GNU General Public License\n"
145  "along with this program; if not, write to the Free Software Foundation,\n"
146  "Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n",
147  fors_subtract_sky_create,
148  fors_subtract_sky_exec,
149  fors_subtract_sky_destroy);
150 
151  cpl_pluginlist_append(list, plugin);
152 
153  return 0;
154 }
155 
156 
167 static int fors_subtract_sky_create(cpl_plugin *plugin)
168 {
169  cpl_recipe *recipe;
170  cpl_parameter *p;
171 
172  /*
173  * Check that the plugin is part of a valid recipe
174  */
175 
176  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
177  recipe = (cpl_recipe *)plugin;
178  else
179  return -1;
180 
181  /*
182  * Create the (empty) parameters list in the cpl_recipe object
183  */
184 
185  recipe->parameters = cpl_parameterlist_new();
186 
187  /*
188  * Dispersion
189  */
190 
191  p = cpl_parameter_new_value("fors.fors_subtract_sky.dispersion",
192  CPL_TYPE_DOUBLE,
193  "Expected spectral dispersion (Angstrom/pixel)",
194  "fors.fors_subtract_sky",
195  0.0);
196  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dispersion");
197  cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
198  cpl_parameterlist_append(recipe->parameters, p);
199 
200  /*
201  * Start wavelength for spectral extraction
202  */
203 
204  p = cpl_parameter_new_value("fors.fors_subtract_sky.startwavelength",
205  CPL_TYPE_DOUBLE,
206  "Start wavelength in spectral extraction",
207  "fors.fors_subtract_sky",
208  0.0);
209  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "startwavelength");
210  cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
211  cpl_parameterlist_append(recipe->parameters, p);
212 
213  /*
214  * End wavelength for spectral extraction
215  */
216 
217  p = cpl_parameter_new_value("fors.fors_subtract_sky.endwavelength",
218  CPL_TYPE_DOUBLE,
219  "End wavelength in spectral extraction",
220  "fors.fors_subtract_sky",
221  0.0);
222  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "endwavelength");
223  cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
224  cpl_parameterlist_append(recipe->parameters, p);
225 
226  /*
227  * Cosmic rays removal
228  */
229 
230  p = cpl_parameter_new_value("fors.fors_subtract_sky.cosmics",
231  CPL_TYPE_BOOL,
232  "Eliminate cosmic rays hits",
233  "fors.fors_subtract_sky",
234  FALSE);
235  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "cosmics");
236  cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
237  cpl_parameterlist_append(recipe->parameters, p);
238 
239  return 0;
240 }
241 
242 
251 static int fors_subtract_sky_exec(cpl_plugin *plugin)
252 {
253  cpl_recipe *recipe;
254 
255  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
256  recipe = (cpl_recipe *)plugin;
257  else
258  return -1;
259 
260  return fors_subtract_sky(recipe->parameters, recipe->frames);
261 }
262 
263 
272 static int fors_subtract_sky_destroy(cpl_plugin *plugin)
273 {
274  cpl_recipe *recipe;
275 
276  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
277  recipe = (cpl_recipe *)plugin;
278  else
279  return -1;
280 
281  cpl_parameterlist_delete(recipe->parameters);
282 
283  return 0;
284 }
285 
286 
296 static int fors_subtract_sky(cpl_parameterlist *parlist,
297  cpl_frameset *frameset)
298 {
299 
300  const char *recipe = "fors_subtract_sky";
301 
302 
303  /*
304  * Input parameters
305  */
306 
307  double dispersion;
308  double startwavelength;
309  double endwavelength;
310  int cosmics;
311 
312  /*
313  * CPL objects
314  */
315 
316  cpl_image *spectra = NULL;
317  cpl_image *skymap = NULL;
318  cpl_table *grism_table = NULL;
319  cpl_table *polytraces = NULL;
320  cpl_table *slits = NULL;
321  cpl_table *maskslits = NULL;
322  cpl_propertylist *header = NULL;
323 
324  /*
325  * Auxiliary variables
326  */
327 
328  char version[80];
329  const char *slit_location_tag;
330  const char *input_tag;
331  const char *curv_coeff_tag;
332  const char *unmapped_tag;
333  const char *unmapped_sky_tag;
334  int nframes;
335  int rebin;
336  int nslits;
337  int treat_as_lss;
338  int i;
339  double reference;
340  double gain;
341  double *xpos;
342  double mxpos;
343  int mxu, mos, lss;
344  int rec_scib;
345  int rec_stdb;
346  int rec_scif;
347  int rec_stdf;
348  int nslits_out_det = 0;
349 
350  char *instrume = NULL;
351 
352 
353  cpl_msg_set_indentation(2);
354 
355 
356  /*
357  * Get configuration parameters
358  */
359 
360  cpl_msg_info(recipe, "Recipe %s configuration parameters:", recipe);
361  cpl_msg_indent_more();
362 
363  if (cpl_frameset_count_tags(frameset, "GRISM_TABLE") > 1)
364  fors_subtract_sky_exit("Too many in input: GRISM_TABLE");
365 
366  grism_table = dfs_load_table(frameset, "GRISM_TABLE", 1);
367 
368  dispersion = dfs_get_parameter_double(parlist,
369  "fors.fors_subtract_sky.dispersion", grism_table);
370 
371  if (dispersion <= 0.0)
372  fors_subtract_sky_exit("Invalid spectral dispersion value");
373 
374  startwavelength = dfs_get_parameter_double(parlist,
375  "fors.fors_subtract_sky.startwavelength", grism_table);
376  if (startwavelength > 1.0)
377  if (startwavelength < 3000.0 || startwavelength > 13000.0)
378  fors_subtract_sky_exit("Invalid wavelength");
379 
380  endwavelength = dfs_get_parameter_double(parlist,
381  "fors.fors_subtract_sky.endwavelength", grism_table);
382  if (endwavelength > 1.0) {
383  if (endwavelength < 3000.0 || endwavelength > 13000.0)
384  fors_subtract_sky_exit("Invalid wavelength");
385  if (startwavelength < 1.0)
386  fors_subtract_sky_exit("Invalid wavelength interval");
387  }
388 
389  if (startwavelength > 1.0)
390  if (endwavelength - startwavelength <= 0.0)
391  fors_subtract_sky_exit("Invalid wavelength interval");
392 
393  cosmics = dfs_get_parameter_bool(parlist,
394  "fors.fors_subtract_sky.cosmics", NULL);
395 
396  cpl_table_delete(grism_table); grism_table = NULL;
397 
398  if (cpl_error_get_code())
399  fors_subtract_sky_exit("Failure reading the configuration parameters");
400 
401 
402  cpl_msg_indent_less();
403  cpl_msg_info(recipe, "Check input set-of-frames:");
404  cpl_msg_indent_more();
405 
406  mxu = cpl_frameset_count_tags(frameset, "SLIT_LOCATION_MXU");
407  mos = cpl_frameset_count_tags(frameset, "SLIT_LOCATION_MOS");
408  lss = cpl_frameset_count_tags(frameset, "SLIT_LOCATION_LSS");
409 
410  if (lss)
411  fors_subtract_sky_exit("Use this recipe just with MOS/MXU data.");
412 
413  nframes = mos + mxu;
414 
415  if (nframes == 0) {
416  fors_subtract_sky_exit("Missing input slit location table");
417  }
418  if (nframes > 1) {
419  cpl_msg_error(recipe,
420  "Too many input slit location tables (%d > 1)", nframes);
421  fors_subtract_sky_exit(NULL);
422  }
423 
424  if (mxu)
425  curv_coeff_tag = "CURV_COEFF_MXU";
426  else
427  curv_coeff_tag = "CURV_COEFF_MXU";
428 
429 
430  nframes = cpl_frameset_count_tags(frameset, curv_coeff_tag);
431 
432  if (nframes == 0) {
433  cpl_msg_error(recipe, "Missing input %s", curv_coeff_tag);
434  fors_subtract_sky_exit(NULL);
435  }
436  if (nframes > 1) {
437  cpl_msg_error(recipe, "Too many input %s (%d > 1)", curv_coeff_tag,
438  nframes);
439  fors_subtract_sky_exit(NULL);
440  }
441 
442  if (mxu) {
443  rec_scib = cpl_frameset_count_tags(frameset, "SCIENCE_UNBIAS_MXU");
444  rec_stdb = cpl_frameset_count_tags(frameset, "STANDARD_UNBIAS_MXU");
445  rec_scif = cpl_frameset_count_tags(frameset, "SCIENCE_UNFLAT_MXU");
446  rec_stdf = cpl_frameset_count_tags(frameset, "STANDARD_UNFLAT_MXU");
447  }
448  else {
449  rec_scib = cpl_frameset_count_tags(frameset, "SCIENCE_UNBIAS_MOS");
450  rec_stdb = cpl_frameset_count_tags(frameset, "STANDARD_UNBIAS_MOS");
451  rec_scif = cpl_frameset_count_tags(frameset, "SCIENCE_UNFLAT_MOS");
452  rec_stdf = cpl_frameset_count_tags(frameset, "STANDARD_UNFLAT_MOS");
453  }
454 
455  nframes = rec_scib + rec_stdb + rec_scif + rec_stdf;
456 
457  if (nframes == 0) {
458  fors_subtract_sky_exit("Missing input scientific spectra");
459  }
460  if (nframes > 1) {
461  cpl_msg_error(recipe, "Too many input scientific spectra (%d > 1)",
462  nframes);
463  fors_subtract_sky_exit(NULL);
464  }
465 
466  if (rec_scib) {
467  if (mxu) {
468  input_tag = "SCIENCE_UNBIAS_MXU";
469  slit_location_tag = "SLIT_LOCATION_MXU";
470  unmapped_tag = "UNMAPPED_SCI_MXU";
471  unmapped_sky_tag = "UNMAPPED_SKY_SCI_MXU";
472  }
473  else {
474  input_tag = "SCIENCE_UNBIAS_MOS";
475  slit_location_tag = "SLIT_LOCATION_MOS";
476  unmapped_tag = "UNMAPPED_SCI_MOS";
477  unmapped_sky_tag = "UNMAPPED_SKY_SCI_MOS";
478  }
479  }
480  else if (rec_stdb) {
481  if (mxu) {
482  input_tag = "STANDARD_UNBIAS_MXU";
483  slit_location_tag = "SLIT_LOCATION_MXU";
484  unmapped_tag = "UNMAPPED_STD_MXU";
485  unmapped_sky_tag = "UNMAPPED_SKY_STD_MXU";
486  }
487  else {
488  input_tag = "STANDARD_UNBIAS_MOS";
489  slit_location_tag = "SLIT_LOCATION_MOS";
490  unmapped_tag = "UNMAPPED_STD_MOS";
491  unmapped_sky_tag = "UNMAPPED_SKY_STD_MOS";
492  }
493  }
494  else if (rec_scif) {
495  if (mxu) {
496  input_tag = "SCIENCE_UNFLAT_MXU";
497  slit_location_tag = "SLIT_LOCATION_MXU";
498  unmapped_tag = "UNMAPPED_SCI_MXU";
499  unmapped_sky_tag = "UNMAPPED_SKY_SCI_MXU";
500  }
501  else {
502  input_tag = "SCIENCE_UNFLAT_MOS";
503  slit_location_tag = "SLIT_LOCATION_MOS";
504  unmapped_tag = "UNMAPPED_SCI_MOS";
505  unmapped_sky_tag = "UNMAPPED_SKY_SCI_MOS";
506  }
507  }
508  else if (rec_stdf) {
509  if (mxu) {
510  input_tag = "STANDARD_UNFLAT_MXU";
511  slit_location_tag = "SLIT_LOCATION_MXU";
512  unmapped_tag = "UNMAPPED_STD_MXU";
513  unmapped_sky_tag = "UNMAPPED_SKY_STD_MXU";
514  }
515  else {
516  input_tag = "STANDARD_UNFLAT_MOS";
517  slit_location_tag = "SLIT_LOCATION_MOS";
518  unmapped_tag = "UNMAPPED_STD_MOS";
519  unmapped_sky_tag = "UNMAPPED_SKY_STD_MOS";
520  }
521  }
522 
523 
524  header = dfs_load_header(frameset, input_tag, 0);
525 
526  if (header == NULL)
527  fors_subtract_sky_exit("Cannot load scientific frame header");
528 
529  if (mos)
530  maskslits = mos_load_slits_fors_mos(header, &nslits_out_det);
531  else
532  maskslits = mos_load_slits_fors_mxu(header);
533 
534  /*
535  * Check if all slits have the same X offset: if not, abort!
536  */
537 
538  treat_as_lss = fors_mos_is_lss_like(maskslits, nslits_out_det);
539 
540  cpl_table_delete(maskslits); maskslits = NULL;
541 
542  if (treat_as_lss)
543  fors_subtract_sky_exit("This recipe cannot process MOS/MXU "
544  "data with all slits at the same offset.");
545 
546 
547  if (!dfs_equal_keyword(frameset, "ESO INS GRIS1 ID"))
548  fors_subtract_sky_exit("Input frames are not from the same grism");
549 
550  if (!dfs_equal_keyword(frameset, "ESO INS FILT1 ID"))
551  fors_subtract_sky_exit("Input frames are not from the same filter");
552 
553  if (!dfs_equal_keyword(frameset, "ESO DET CHIP1 ID"))
554  fors_subtract_sky_exit("Input frames are not from the same chip");
555 
556 
557  /*
558  * Get the reference wavelength and the rebin factor along the
559  * dispersion direction from the reference frame
560  */
561 
562  instrume = (char *)cpl_propertylist_get_string(header, "INSTRUME");
563  if (instrume == NULL)
564  fors_subtract_sky_exit("Missing keyword INSTRUME in reference frame "
565  "header");
566 
567  if (instrume[4] == '1')
568  snprintf(version, 80, "%s/%s", "fors1", VERSION);
569  if (instrume[4] == '2')
570  snprintf(version, 80, "%s/%s", "fors2", VERSION);
571 
572  reference = cpl_propertylist_get_double(header, "ESO INS GRIS1 WLEN");
573 
574  if (cpl_error_get_code() != CPL_ERROR_NONE)
575  fors_subtract_sky_exit("Missing keyword ESO INS GRIS1 WLEN "
576  "in reference frame header");
577 
578  if (reference < 3000.0) /* Perhaps in nanometers... */
579  reference *= 10;
580 
581  if (reference < 3000.0 || reference > 13000.0) {
582  cpl_msg_error(recipe, "Invalid central wavelength %.2f read from "
583  "keyword ESO INS GRIS1 WLEN in reference frame header",
584  reference);
585  fors_subtract_sky_exit(NULL);
586  }
587 
588  cpl_msg_info(recipe, "The central wavelength is: %.2f", reference);
589 
590  rebin = cpl_propertylist_get_int(header, "ESO DET WIN1 BINX");
591 
592  if (cpl_error_get_code() != CPL_ERROR_NONE)
593  fors_subtract_sky_exit("Missing keyword ESO DET WIN1 BINX "
594  "in reference frame header");
595 
596  if (rebin != 1) {
597  dispersion *= rebin;
598  cpl_msg_warning(recipe, "The rebin factor is %d, and therefore the "
599  "working dispersion used is %f A/pixel", rebin,
600  dispersion);
601  }
602 
603  if (cosmics) {
604  gain = cpl_propertylist_get_double(header, "ESO DET OUT1 CONAD");
605 
606  if (cpl_error_get_code() != CPL_ERROR_NONE)
607  fors_subtract_sky_exit("Missing keyword ESO DET OUT1 CONAD in "
608  "scientific frame header");
609 
610  cpl_msg_info(recipe, "The gain factor is: %.2f e-/ADU", gain);
611  }
612 
613 
614  cpl_msg_indent_less();
615  cpl_msg_info(recipe, "Load input frames...");
616  cpl_msg_indent_more();
617 
618  spectra = dfs_load_image(frameset, input_tag, CPL_TYPE_FLOAT, 0, 0);
619  if (spectra == NULL)
620  fors_subtract_sky_exit("Cannot load input scientific frame");
621 
622  slits = dfs_load_table(frameset, slit_location_tag, 1);
623  if (slits == NULL)
624  fors_subtract_sky_exit("Cannot load slits location table");
625 
626  polytraces = dfs_load_table(frameset, curv_coeff_tag, 1);
627  if (polytraces == NULL)
628  fors_subtract_sky_exit("Cannot load spectral curvature table");
629 
630  cpl_msg_indent_less();
631  cpl_msg_info(recipe, "Local sky determination...");
632  cpl_msg_indent_more();
633  skymap = mos_subtract_sky(spectra, slits, polytraces, reference,
634  startwavelength, endwavelength, dispersion);
635 
636  cpl_table_delete(polytraces); polytraces = NULL;
637  cpl_table_delete(slits); slits = NULL;
638 
639  if (cosmics) {
640  cpl_msg_info(recipe, "Removing cosmic rays...");
641  mos_clean_cosmics(spectra, gain, -1., -1.);
642  }
643 
644  if (dfs_save_image(frameset, spectra, unmapped_tag,
645  header, parlist, recipe, version))
646  fors_subtract_sky_exit(NULL);
647 
648  cpl_image_delete(spectra); spectra = NULL;
649 
650  if (dfs_save_image(frameset, skymap, unmapped_sky_tag,
651  header, parlist, recipe, version))
652  fors_subtract_sky_exit(NULL);
653 
654  cpl_image_delete(skymap); skymap = NULL;
655 
656  cpl_propertylist_delete(header); header = NULL;
657 
658  return 0;
659 }
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
Definition: fors_bias.c:62
cpl_image * dfs_load_image(cpl_frameset *frameset, const char *category, cpl_type type, int ext, int calib)
Loading image data of given category.
Definition: fors_dfs.c:845
cpl_propertylist * dfs_load_header(cpl_frameset *frameset, const char *category, int ext)
Loading header associated to data of given category.
Definition: fors_dfs.c:951
cpl_table * mos_load_slits_fors_mxu(cpl_propertylist *header)
Create slit location table from FITS header of FORS2-MXU data.
Definition: moses.c:14561
cpl_table * mos_load_slits_fors_mos(cpl_propertylist *header, int *nslits_out_det)
Create slit location table from FITS header of FORS1/2 MOS data.
Definition: moses.c:14801
int dfs_get_parameter_bool(cpl_parameterlist *parlist, const char *name, const cpl_table *defaults)
Reading a recipe boolean parameter value.
Definition: fors_dfs.c:686
int dfs_equal_keyword(cpl_frameset *frameset, const char *keyword)
Saving table data of given category.
Definition: fors_dfs.c:1685
cpl_image * mos_subtract_sky(cpl_image *science, cpl_table *slits, cpl_table *polytraces, double reference, double blue, double red, double dispersion)
Subtract the sky from the scientific CCD exposure.
Definition: moses.c:1969
int dfs_save_image(cpl_frameset *frameset, const cpl_image *image, const char *category, cpl_propertylist *header, const cpl_parameterlist *parlist, const char *recipename, const char *version)
Saving image data of given category.
Definition: fors_dfs.c:1447
cpl_table * dfs_load_table(cpl_frameset *frameset, const char *category, int ext)
Loading table data of given category.
Definition: fors_dfs.c:901
Definition: list.c:74
cpl_error_code mos_clean_cosmics(cpl_image *image, float gain, float threshold, float ratio)
Remove cosmic rays from sky-subtracted CCD spectral exposure.
Definition: moses.c:12881
double dfs_get_parameter_double(cpl_parameterlist *parlist, const char *name, const cpl_table *defaults)
Reading a recipe double parameter value.
Definition: fors_dfs.c:489