File: uves_physmod_plotmod.c

package info (click to toggle)
cpl-plugin-uves 6.1.3+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 23,128 kB
  • sloc: ansic: 171,056; sh: 4,359; python: 3,002; makefile: 1,322
file content (202 lines) | stat: -rw-r--r-- 7,167 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*                                                                              *
 *   This file is part of the ESO UVES Pipeline                                 *
 *   Copyright (C) 2004,2005 European Southern Observatory                      *
 *                                                                              *
 *   This library is free software; you can redistribute it and/or modify       *
 *   it under the terms of the GNU General Public License as published by       *
 *   the Free Software Foundation; either version 2 of the License, or          *
 *   (at your option) any later version.                                        *
 *                                                                              *
 *   This program is distributed in the hope that it will be useful,            *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 *   GNU General Public License for more details.                               *
 *                                                                              *
 *   You should have received a copy of the GNU General Public License          *
 *   along with this program; if not, write to the Free Software                *
 *   Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA       *
 *                                                                              */

/*
 * $Author: amodigli $
 * $Date: 2010-09-24 09:32:07 $
 * $Revision: 1.13 $
 * $Name: not supported by cvs2svn $
 * $Log: not supported by cvs2svn $
 * Revision 1.11  2008/09/29 06:56:23  amodigli
 * add #include <string.h>
 *
 * Revision 1.10  2007/10/15 11:10:55  amodigli
 * fixed bug on reported chip ID in physmod plots
 *
 * Revision 1.9  2007/06/06 08:17:33  amodigli
 * replace tab with 4 spaces
 *
 * Revision 1.8  2007/04/26 06:54:43  amodigli
 * small changes on title
 *
 * Revision 1.7  2007/04/25 08:38:03  amodigli
 * changed interface and plotting more info
 *
 * Revision 1.6  2007/01/15 08:43:15  jmlarsen
 * Fixed missing plots
 *
 * Revision 1.5  2007/01/13 09:52:22  amodigli
 * fixed some problems on flames QC log
 *
 * Revision 1.4  2006/11/06 15:19:41  jmlarsen
 * Removed unused include directives
 *
 * Revision 1.3  2006/07/28 14:51:26  amodigli
 * fixed some bugs on improper table selection
 *
 * Revision 1.2  2006/06/20 10:56:56  amodigli
 * cleaned output, added units
 *
 * Revision 1.1  2006/02/03 07:46:30  jmlarsen
 * Moved recipe implementations to ./uves directory
 *
 * Revision 1.5  2006/01/19 08:47:24  jmlarsen
 * Inserted missing doxygen end tag
 *
 * Revision 1.4  2006/01/09 14:05:42  amodigli
 * Fixed doxigen warnings
 *
 * Revision 1.3  2005/12/20 08:11:44  jmlarsen
 * Added CVS  entry
 *
 */

/*----------------------------------------------------------------------------*/
/**
 * @addtogroup uves_physmod
 */
/*----------------------------------------------------------------------------*/
/**@{*/
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif


/*-----------------------------------------------------------------------------
                                Includes
 -----------------------------------------------------------------------------*/
#include <uves_physmod_plotmod.h>

#include <uves_plot.h>
#include <uves_msg.h>
#include <uves_error.h>
#include <string.h>
/*-----------------------------------------------------------------------------
                                Defines
 -----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
                            Functions prototypes
 ----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
                            Static variables
 -----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
                            Functions code
 -----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/**
  @brief    This procedure plots results from the uves_physmod recipe
  @param    tbl    The input line table. 
  @param    tbl    The input raw data header. 
  @param    params The input recipe parameters. 

  @return   0 if everything is ok, -1 otherwise


 This procedure plots results from the uves_physmod recipe
 */
/*----------------------------------------------------------------------------*/

int 
uves_physmod_plotmod(const cpl_table* tbl,
                     const uves_propertylist* head,
                     const char* rec_id,
                     const cpl_parameterlist* params,
                     enum uves_chip chip)
{

  char title[300];
  double ech_ang_off=0;
  double cd_ang_off=0;
  double ccd_ang_off=0;
  double wcent=0;
  double temp_cam=0;
  double slit_width=0;
  double slit_length=0;
  const char* origfile=NULL;
  const char* tpl_start=NULL;
  char chip_id[5];

  strcpy(chip_id,uves_chip_tostring_lower(chip));

  check( uves_get_parameter(params, NULL,rec_id,"ech_angle_off", 
         CPL_TYPE_DOUBLE, &ech_ang_off )  , "Could not read parameter");

  check( uves_get_parameter(params, NULL, rec_id, "cd_angle_off", 
         CPL_TYPE_DOUBLE, &cd_ang_off )  , "Could not read parameter");

  check( uves_get_parameter(params, NULL, rec_id, "ccd_rot_angle_off", 
         CPL_TYPE_DOUBLE, &ccd_ang_off )  , "Could not read parameter");

  check (wcent = uves_pfits_get_gratwlen(head, chip), 
     "Could not read central wavelength setting from input header");

  check (temp_cam = uves_pfits_get_tempcam(head,chip), 
     "Could not read camera's temperature from input header");

  check (slit_width = uves_pfits_get_slitwidth(head, chip), 
     "Could not read slit width input header");
  
  check (slit_length = uves_pfits_get_slitlength(head, chip), 
     "Could not read slit length input header");

  check(tpl_start=uves_pfits_get_tpl_start(head),"Error getting TPL START");

  check(origfile=uves_pfits_get_origfile(head),"Error getting ORIGFILE");

  sprintf(title,"%s %4.1f %s %2.1f %s %s %3.1f %s ",
      "Central wavelength: ",wcent,
          " nm, slit: ",slit_length,
          " arcsec, CCD:",chip_id,temp_cam," C");


  /* 1st plot */
  check(uves_plot_table(tbl, "XMOD", "XDIF", "%s", title),
    "Plotting failed");
  
  /* 2nd plot */
  check(uves_plot_table(tbl, "XMOD", "YDIF", "%s", title),
    "Plotting failed");
  
  
  /* 3rd plot */
  check(uves_plot_table(tbl, "YMOD", "XDIF", "%s", title),
    "Plotting failed");
  
  
  /* 4th plot */
  check(uves_plot_table(tbl, "YMOD", "YDIF", "%s", title),
        "Plotting failed");
  
  
  /* 5th plot */
  check(uves_plot_table(tbl, "XDIF", "YDIF", "%s", title),
        "Plotting failed");
  
  
  /* 6th plot */
  check(uves_plot_table(tbl, "XMOD", "YMOD", "%s", title),
        "Plotting failed");
  
 cleanup:
  return 0;
}
/**@}*/