UVES Pipeline Reference Manual  5.4.0
uves_scired_impl.c
1 /* *
2  * This file is part of the ESO UVES Pipeline *
3  * Copyright (C) 2004,2005 European Southern Observatory *
4  * *
5  * This library is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the Free Software *
17  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18  * */
19 
20 /*
21  * $Author: amodigli $
22  * $Date: 2010-09-24 09:32:07 $
23  * $Revision: 1.44 $
24  * $Name: not supported by cvs2svn $
25  * $Log: not supported by cvs2svn $
26  * Revision 1.42 2008/03/28 08:54:39 amodigli
27  * IRPLIB_CONCAT2X-->UVES_CONCAT2X
28  *
29  * Revision 1.41 2007/06/11 13:28:26 jmlarsen
30  * Changed recipe contact address to cpl at eso.org
31  *
32  * Revision 1.40 2007/06/08 13:06:16 jmlarsen
33  * Send bug reports to Andrea
34  *
35  * Revision 1.39 2007/06/06 08:17:33 amodigli
36  * replace tab with 4 spaces
37  *
38  * Revision 1.38 2007/02/09 13:44:15 jmlarsen
39  * Moved code to reduce_scired to enable calling from uves_obs_spatred
40  *
41  * Revision 1.37 2006/11/06 15:19:42 jmlarsen
42  * Removed unused include directives
43  *
44  * Revision 1.36 2006/10/17 12:33:02 jmlarsen
45  * Added semicolon at UVES_RECIPE_DEFINE invocation
46  *
47  * Revision 1.35 2006/10/09 13:01:13 jmlarsen
48  * Use macro to define recipe interface functions
49  *
50  * Revision 1.34 2006/09/27 15:08:45 jmlarsen
51  * Fixed doc. bug
52  *
53  * Revision 1.33 2006/09/27 13:19:00 jmlarsen
54  * Factored out scired body to enable calling it from other recipes
55  *
56  * Revision 1.32 2006/09/20 15:42:18 jmlarsen
57  * Implemented MASTER_RESPONSE support
58  *
59  * Revision 1.31 2006/09/20 12:53:57 jmlarsen
60  * Replaced stringcat functions with uves_sprintf()
61  *
62  * Revision 1.30 2006/09/20 07:26:43 jmlarsen
63  * Shortened max line length
64  *
65  * Revision 1.29 2006/09/19 14:25:26 jmlarsen
66  * Propagate FITS keywords from master flat, not science, to WCALIB_FLAT_OBJ
67  *
68  * Revision 1.28 2006/09/19 06:55:31 jmlarsen
69  * Changed interface of uves_frameset to optionally write image statistics kewwords
70  *
71  * Revision 1.27 2006/09/06 14:47:05 jmlarsen
72  * Added commented out code to skip one chip
73  *
74  * Revision 1.26 2006/08/24 11:36:37 jmlarsen
75  * Write recipe start/stop time to header
76  *
77  * Revision 1.25 2006/08/22 15:13:15 amodigli
78  * fix typo
79  *
80  * Revision 1.24 2006/08/22 14:18:59 amodigli
81  * new format for SCI QC key
82  *
83  * Revision 1.23 2006/08/18 13:35:42 jmlarsen
84  * Fixed/changed QC parameter formats
85  *
86  * Revision 1.22 2006/08/17 13:56:53 jmlarsen
87  * Reduced max line length
88  *
89  * Revision 1.21 2006/08/17 09:19:19 jmlarsen
90  * Removed CPL2 code
91  *
92  * Revision 1.20 2006/08/11 14:56:05 amodigli
93  * removed Doxygen warnings
94  *
95  * Revision 1.19 2006/08/11 09:00:21 jmlarsen
96  * Take into account the different meanings of line table 'Y' column
97  *
98  * Revision 1.18 2006/08/10 12:35:15 amodigli
99  * added QC log
100  *
101  * Revision 1.17 2006/08/07 14:42:02 jmlarsen
102  * Implemented on-the-fly correction of a line table when its order numbering
103  * is inconsistent with the order table (DFS02694)
104  *
105  * Revision 1.16 2006/07/14 12:30:34 jmlarsen
106  * Compute PRO CATG depending on DO CATG
107  *
108  * Revision 1.15 2006/07/03 12:46:34 amodigli
109  * updated description
110  *
111  * Revision 1.14 2006/06/16 08:25:45 jmlarsen
112  * Manually propagate ESO.DET. keywords from 1st/2nd input header
113  *
114  * Revision 1.13 2006/06/13 11:57:02 jmlarsen
115  * Check that calibration frames are from the same chip ID
116  *
117  * Revision 1.12 2006/06/06 08:40:10 jmlarsen
118  * Shortened max line length
119  *
120  * Revision 1.11 2006/05/16 12:13:07 amodigli
121  * added QC log
122  *
123  * Revision 1.10 2006/05/12 15:11:15 jmlarsen
124  * Implemented bad pixel propagation for flux calibration
125  *
126  * Revision 1.9 2006/04/24 09:25:34 jmlarsen
127  * Use FITS convention for coordinates in QC calculation
128  *
129  * Revision 1.8 2006/04/20 10:47:39 amodigli
130  * added qclog
131  *
132  * Revision 1.7 2006/04/06 09:48:15 amodigli
133  * changed uves_frameset_insert interface to have QC log
134  *
135  * Revision 1.6 2006/04/06 08:51:04 jmlarsen
136  * Added flux-calibrated science products
137  *
138  * Revision 1.5 2006/03/24 14:46:39 jmlarsen
139  * Doc. bugfix
140  *
141  * Revision 1.4 2006/03/24 13:51:50 jmlarsen
142  * Changed meaning of VARIANCE_SCIENCE to match MIDAS
143  *
144  * Revision 1.3 2006/03/06 09:22:43 jmlarsen
145  * Added support for reading MIDAS line tables with MIDAS tags
146  *
147  * Revision 1.2 2006/03/03 13:54:11 jmlarsen
148  * Changed syntax of check macro
149  *
150  * Revision 1.1 2006/02/03 07:51:04 jmlarsen
151  * Moved recipe implementations to ./uves directory
152  *
153  * Revision 1.48 2006/01/19 08:47:24 jmlarsen
154  * Inserted missing doxygen end tag
155  *
156  * Revision 1.47 2005/12/20 16:10:32 jmlarsen
157  * Added some documentation
158  *
159  * Revision 1.46 2005/12/20 10:33:20 jmlarsen
160  * Added some doxygen doc.
161  *
162  * Revision 1.45 2005/12/19 16:17:55 jmlarsen
163  * Replaced bool -> int
164  *
165  */
166 #ifdef HAVE_CONFIG_H
167 # include <config.h>
168 #endif
169 
170 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 /*-----------------------------------------------------------------------------
180  Includes
181  -----------------------------------------------------------------------------*/
182 
183 #include <uves_reduce_scired.h>
184 #include <uves_parameters.h>
185 #include <uves_recipe.h>
186 #include <uves.h>
187 #include <uves_error.h>
188 #include <uves_msg.h>
189 
190 #include <cpl.h>
191 
192 /*-----------------------------------------------------------------------------
193  Functions prototypes
194  -----------------------------------------------------------------------------*/
195 static int
196 uves_scired_define_parameters(cpl_parameterlist *parameters);
197 
198 /*-----------------------------------------------------------------------------
199  Recipe standard code
200  -----------------------------------------------------------------------------*/
201 #define cpl_plugin_get_info uves_scired_get_info
202 UVES_RECIPE_DEFINE(
203  UVES_SCIRED_ID, UVES_SCIRED_DOM, uves_scired_define_parameters,
204  "Jonas M. Larsen", "cpl@eso.org",
205  uves_scired_desc_short,
206  uves_scired_desc);
207 
209 /*-----------------------------------------------------------------------------
210  Functions code
211  -----------------------------------------------------------------------------*/
212 
213 /*----------------------------------------------------------------------------*/
219 /*----------------------------------------------------------------------------*/
220 static int
221 uves_scired_define_parameters(cpl_parameterlist *parameters)
222 {
223  return uves_scired_define_parameters_body(parameters, make_str(UVES_SCIRED_ID));
224 }
225 
226 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 static void
235 UVES_CONCAT2X(UVES_SCIRED_ID,exe)(cpl_frameset *frames,
236  const cpl_parameterlist *parameters,
237  const char *starttime)
238 {
239  /* Do science reduction while pretending to be 'make_str(UVES_SCIRED_ID)' */
240  uves_reduce_scired(frames, parameters, make_str(UVES_SCIRED_ID), starttime);
241 
242  return;
243 }
244 
245