SINFONI Pipeline Reference Manual  2.6.0
sinfo_tpl_utils.c
1 /* $Id: sinfo_tpl_utils.c,v 1.4 2013-07-15 08:13:35 amodigli Exp $
2  *
3  * This file is part of the SINFONI Pipeline
4  * Copyright (C) 2002,2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: amodigli $
23  * $Date: 2013-07-15 08:13:35 $
24  * $Revision: 1.4 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 #include <string.h>
36 #include <cpl.h>
37 
38 #include "sinfo_tpl_utils.h"
39 #include "sinfo_globals.h"
40 
42 /*----------------------------------------------------------------------------*/
46 /*----------------------------------------------------------------------------*/
47 
48 
49 /*----------------------------------------------------------------------------*/
57 /*----------------------------------------------------------------------------*/
58 const char * sinfo_get_license(void)
59 {
60  const char * sinfoni_license =
61  "This file is part of the SINFONI Instrument Pipeline\n"
62  "Copyright (C) 2002,2003 European Southern Observatory\n"
63  "\n"
64  "This program is free software; you can redistribute it and/or modify\n"
65  "it under the terms of the GNU General Public License as published by\n"
66  "the Free Software Foundation; either version 2 of the License, or\n"
67  "(at your option) any later version.\n"
68  "\n"
69  "This program is distributed in the hope that it will be useful,\n"
70  "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
71  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
72  "GNU General Public License for more details.\n"
73  "\n"
74  "You should have received a copy of the GNU General Public License\n"
75  "along with this program; if not, write to the Free Software\n"
76  "Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"
77  "MA 02111-1307 USA" ;
78 
79  return sinfoni_license ;
80 }
81 
82 
83 /*---------------------------------------------------------------------------*/
92 /*---------------------------------------------------------------------------*/
93 cpl_frameset * sinfo_extract_frameset(
94  const cpl_frameset * in,
95  const char * tag)
96 {
97  cpl_frameset * out ;
98  cpl_frame * loc_frame ;
99  int nbframes, nbext ;
100  int i ;
101 
102  /* Test entries */
103  if (in == NULL) return NULL ;
104  if (tag == NULL) return NULL ;
105 
106  /* Initialise */
107  nbframes = cpl_frameset_get_size(in) ;
108 
109  /* Count the frames with the tag */
110  if ((nbext = cpl_frameset_count_tags(in, tag)) == 0) return NULL ;
111 
112  /* Create the output frameset */
113  out = cpl_frameset_new() ;
114 
115  /* Loop on the requested frames and store them in out */
116  nbext = 0 ;
117  for (i=0 ; i<nbframes ; i++) {
118  const cpl_frame* cur_frame = cpl_frameset_get_frame_const(in, i) ;
119  if (!strcmp(cpl_frame_get_tag(cur_frame), tag)) {
120  loc_frame = cpl_frame_duplicate(cur_frame) ;
121  cpl_frameset_insert(out, loc_frame) ;
122  nbext ++ ;
123  }
124  }
125  return out ;
126 }
127 /*----------------------------------------------------------------------------*/
134 /*----------------------------------------------------------------------------*/
135 const char * sinfo_extract_filename(
136  const cpl_frameset * in,
137  const char * tag)
138 {
139  const cpl_frame * cur_frame ;
140 
141  /* Get the frame */
142  if ((cur_frame = cpl_frameset_find_const(in, tag)) == NULL) return NULL ;
143  return cpl_frame_get_filename(cur_frame) ;
144 }
145 
146 /*-------------------------------------------------------------------------*/
152 /*--------------------------------------------------------------------------*/
153 const char * sinfo_std_band_name(sinfo_band band)
154 {
155  switch (band) {
156  case SINFO_BAND_J: return "J" ;
157  case SINFO_BAND_JS: return "Js" ;
158  case SINFO_BAND_JBLOCK: return "J+Block" ;
159  case SINFO_BAND_H: return "H" ;
160  case SINFO_BAND_K: return "K" ;
161  case SINFO_BAND_KS: return "Ks" ;
162  case SINFO_BAND_L: return "L" ;
163  case SINFO_BAND_M: return "M" ;
164  case SINFO_BAND_LP: return "Lp" ;
165  case SINFO_BAND_MP: return "Mp" ;
166  case SINFO_BAND_Z: return "Z" ;
167  case SINFO_BAND_SZ: return "SZ" ;
168  case SINFO_BAND_SH: return "SH" ;
169  case SINFO_BAND_SK: return "SK" ;
170  case SINFO_BAND_SL: return "SL" ;
171  default: return "Unknown" ;
172  }
173 }
174