UVES Pipeline Reference Manual  5.4.0
uves_chip.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:02 $
23  * $Revision: 1.8 $
24  * $Name: not supported by cvs2svn $
25  * $Log: not supported by cvs2svn $
26  * Revision 1.6 2007/06/06 08:17:33 amodigli
27  * replace tab with 4 spaces
28  *
29  * Revision 1.5 2007/01/10 12:35:33 jmlarsen
30  * Added uves_chip_tochar
31  *
32  * Revision 1.4 2006/08/17 13:56:52 jmlarsen
33  * Reduced max line length
34  *
35  * Revision 1.3 2005/12/19 16:17:56 jmlarsen
36  * Replaced bool -> int
37  *
38  */
39 
40 #ifdef HAVE_CONFIG_H
41 # include <config.h>
42 #endif
43 
44 /*----------------------------------------------------------------------------*/
50 /*----------------------------------------------------------------------------*/
54 /*-----------------------------------------------------------------------------
55  Includes
56  -----------------------------------------------------------------------------*/
57 
58 #include <uves_chip.h>
59 #include <cpl.h>
60 
61 /*-----------------------------------------------------------------------------
62  Functions prototypes
63  -----------------------------------------------------------------------------*/
64 
65 /*-----------------------------------------------------------------------------
66  Implementation
67  -----------------------------------------------------------------------------*/
68 
69 
70 
71 /*----------------------------------------------------------------------------*/
90 /*----------------------------------------------------------------------------*/
91 enum uves_chip
93 {
94  return (blue) ? UVES_CHIP_BLUE : UVES_CHIP_REDL;
95 }
96 
97 /*----------------------------------------------------------------------------*/
105 /*----------------------------------------------------------------------------*/
106 
107 enum uves_chip
108 uves_chip_get_next(enum uves_chip chip)
109 {
110  return
111  (chip == UVES_CHIP_REDL) ? UVES_CHIP_REDU :
112  (chip == UVES_CHIP_BLUE) ? UVES_CHIP_INVALID :
113  (chip == UVES_CHIP_REDU) ? UVES_CHIP_INVALID :
114  UVES_CHIP_INVALID;
115 }
116 
117 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 int uves_chip_get_index(enum uves_chip chip)
125 {
126  /* 0 = REDL/BLUE, 1 = REDU */
127  return (chip == UVES_CHIP_REDU) ? 1 : 0;
128 }
129 
130 /*----------------------------------------------------------------------------*/
136 /*----------------------------------------------------------------------------*/
137 
138 const char *
139 uves_chip_tostring_lower(enum uves_chip chip)
140 {
141  return
142  (chip == UVES_CHIP_BLUE) ? "blue" :
143  (chip == UVES_CHIP_REDU) ? "redu" :
144  (chip == UVES_CHIP_REDL) ? "redl" : "?chip?";
145 }
146 
147 /*----------------------------------------------------------------------------*/
153 /*----------------------------------------------------------------------------*/
154 
155 const char *
156 uves_chip_tostring_upper(enum uves_chip chip)
157 {
158  return
159  (chip == UVES_CHIP_BLUE) ? "BLUE" :
160  (chip == UVES_CHIP_REDU) ? "REDU" :
161  (chip == UVES_CHIP_REDL) ? "REDL" : "?CHIP?";
162 }
163 
164 
165 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 const char *uves_chip_get_det(enum uves_chip chip)
173 {
174  return
175  (chip == UVES_CHIP_BLUE) ? "be" :
176  (chip == UVES_CHIP_REDU) ? "rm" :
177  (chip == UVES_CHIP_REDL) ? "re" : "??";
178 }
179 
180 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 char uves_chip_tochar(enum uves_chip chip)
188 {
189  return
190  (chip == UVES_CHIP_BLUE) ? 'b' :
191  (chip == UVES_CHIP_REDU) ? 'u' :
192  (chip == UVES_CHIP_REDL) ? 'l' : '?';
193 }
194