UVES Pipeline Reference Manual  5.4.6
uves_physmod_plotmod.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.13 $
24  * $Name: not supported by cvs2svn $
25  * $Log: not supported by cvs2svn $
26  * Revision 1.11 2008/09/29 06:56:23 amodigli
27  * add #include <string.h>
28  *
29  * Revision 1.10 2007/10/15 11:10:55 amodigli
30  * fixed bug on reported chip ID in physmod plots
31  *
32  * Revision 1.9 2007/06/06 08:17:33 amodigli
33  * replace tab with 4 spaces
34  *
35  * Revision 1.8 2007/04/26 06:54:43 amodigli
36  * small changes on title
37  *
38  * Revision 1.7 2007/04/25 08:38:03 amodigli
39  * changed interface and plotting more info
40  *
41  * Revision 1.6 2007/01/15 08:43:15 jmlarsen
42  * Fixed missing plots
43  *
44  * Revision 1.5 2007/01/13 09:52:22 amodigli
45  * fixed some problems on flames QC log
46  *
47  * Revision 1.4 2006/11/06 15:19:41 jmlarsen
48  * Removed unused include directives
49  *
50  * Revision 1.3 2006/07/28 14:51:26 amodigli
51  * fixed some bugs on improper table selection
52  *
53  * Revision 1.2 2006/06/20 10:56:56 amodigli
54  * cleaned output, added units
55  *
56  * Revision 1.1 2006/02/03 07:46:30 jmlarsen
57  * Moved recipe implementations to ./uves directory
58  *
59  * Revision 1.5 2006/01/19 08:47:24 jmlarsen
60  * Inserted missing doxygen end tag
61  *
62  * Revision 1.4 2006/01/09 14:05:42 amodigli
63  * Fixed doxigen warnings
64  *
65  * Revision 1.3 2005/12/20 08:11:44 jmlarsen
66  * Added CVS entry
67  *
68  */
69 
70 /*----------------------------------------------------------------------------*/
74 /*----------------------------------------------------------------------------*/
76 #ifdef HAVE_CONFIG_H
77 # include <config.h>
78 #endif
79 
80 
81 /*-----------------------------------------------------------------------------
82  Includes
83  -----------------------------------------------------------------------------*/
84 #include <uves_physmod_plotmod.h>
85 
86 #include <uves_plot.h>
87 #include <uves_msg.h>
88 #include <uves_error.h>
89 #include <string.h>
90 /*-----------------------------------------------------------------------------
91  Defines
92  -----------------------------------------------------------------------------*/
93 /*-----------------------------------------------------------------------------
94  Functions prototypes
95  ----------------------------------------------------------------------------*/
96 /*-----------------------------------------------------------------------------
97  Static variables
98  -----------------------------------------------------------------------------*/
99 
100 /*-----------------------------------------------------------------------------
101  Functions code
102  -----------------------------------------------------------------------------*/
103 
104 /*----------------------------------------------------------------------------*/
116 /*----------------------------------------------------------------------------*/
117 
118 int
119 uves_physmod_plotmod(const cpl_table* tbl,
120  const uves_propertylist* head,
121  const char* rec_id,
122  const cpl_parameterlist* params,
123  enum uves_chip chip)
124 {
125 
126  char title[300];
127  double ech_ang_off=0;
128  double cd_ang_off=0;
129  double ccd_ang_off=0;
130  double wcent=0;
131  double temp_cam=0;
132  double slit_width=0;
133  double slit_length=0;
134  const char* origfile=NULL;
135  const char* tpl_start=NULL;
136  char chip_id[5];
137 
138  strcpy(chip_id,uves_chip_tostring_lower(chip));
139 
140  check( uves_get_parameter(params, NULL,rec_id,"ech_angle_off",
141  CPL_TYPE_DOUBLE, &ech_ang_off ) , "Could not read parameter");
142 
143  check( uves_get_parameter(params, NULL, rec_id, "cd_angle_off",
144  CPL_TYPE_DOUBLE, &cd_ang_off ) , "Could not read parameter");
145 
146  check( uves_get_parameter(params, NULL, rec_id, "ccd_rot_angle_off",
147  CPL_TYPE_DOUBLE, &ccd_ang_off ) , "Could not read parameter");
148 
149  check (wcent = uves_pfits_get_gratwlen(head, chip),
150  "Could not read central wavelength setting from input header");
151 
152  check (temp_cam = uves_pfits_get_tempcam(head,chip),
153  "Could not read camera's temperature from input header");
154 
155  check (slit_width = uves_pfits_get_slitwidth(head, chip),
156  "Could not read slit width input header");
157 
158  check (slit_length = uves_pfits_get_slitlength(head, chip),
159  "Could not read slit length input header");
160 
161  check(tpl_start=uves_pfits_get_tpl_start(head),"Error getting TPL START");
162 
163  check(origfile=uves_pfits_get_origfile(head),"Error getting ORIGFILE");
164 
165  sprintf(title,"%s %4.1f %s %2.1f %s %s %3.1f %s ",
166  "Central wavelength: ",wcent,
167  " nm, slit: ",slit_length,
168  " arcsec, CCD:",chip_id,temp_cam," C");
169 
170 
171  /* 1st plot */
172  check(uves_plot_table(tbl, "XMOD", "XDIF", "%s", title),
173  "Plotting failed");
174 
175  /* 2nd plot */
176  check(uves_plot_table(tbl, "XMOD", "YDIF", "%s", title),
177  "Plotting failed");
178 
179 
180  /* 3rd plot */
181  check(uves_plot_table(tbl, "YMOD", "XDIF", "%s", title),
182  "Plotting failed");
183 
184 
185  /* 4th plot */
186  check(uves_plot_table(tbl, "YMOD", "YDIF", "%s", title),
187  "Plotting failed");
188 
189 
190  /* 5th plot */
191  check(uves_plot_table(tbl, "XDIF", "YDIF", "%s", title),
192  "Plotting failed");
193 
194 
195  /* 6th plot */
196  check(uves_plot_table(tbl, "XMOD", "YMOD", "%s", title),
197  "Plotting failed");
198 
199  cleanup:
200  return 0;
201 }
const char * uves_pfits_get_tpl_start(const uves_propertylist *plist)
Find out the tpl start.
Definition: uves_pfits.c:1043
double uves_pfits_get_tempcam(const uves_propertylist *plist, enum uves_chip chip)
find out the pressure value
Definition: uves_pfits.c:1313
double uves_pfits_get_gratwlen(const uves_propertylist *plist, enum uves_chip chip)
find out the central wavelength
Definition: uves_pfits.c:1371
double uves_pfits_get_slitwidth(const uves_propertylist *plist, enum uves_chip chip)
find out the slit width
Definition: uves_pfits.c:1504
const char * uves_pfits_get_origfile(const uves_propertylist *plist)
find out the origfile
Definition: uves_pfits.c:334
const char * uves_chip_tostring_lower(enum uves_chip chip)
Convert to string.
Definition: uves_chip.c:139
int uves_physmod_plotmod(const cpl_table *tbl, const uves_propertylist *head, const char *rec_id, const cpl_parameterlist *params, enum uves_chip chip)
This procedure plots results from the uves_physmod recipe.
#define check(CMD,...)
Definition: uves_error.h:198
double uves_pfits_get_slitlength(const uves_propertylist *plist, enum uves_chip chip)
find out the slit length
Definition: uves_pfits.c:1484