sinfo_tpl_utils.c

00001 /* $Id: sinfo_tpl_utils.c,v 1.2 2007/08/20 10:03:49 amodigli Exp $
00002  *
00003  * This file is part of the SINFONI Pipeline
00004  * Copyright (C) 2002,2003 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: amodigli $
00023  * $Date: 2007/08/20 10:03:49 $
00024  * $Revision: 1.2 $
00025  * $Name: sinfo-2_2_5 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                                                 Includes
00034  -----------------------------------------------------------------------------*/
00035 #include <string.h>
00036 #include <cpl.h>
00037 
00038 #include "sinfo_tpl_utils.h"
00039 
00040 /*----------------------------------------------------------------------------*/
00044 /*----------------------------------------------------------------------------*/
00045 
00048 /*----------------------------------------------------------------------------*/
00056 /*----------------------------------------------------------------------------*/
00057 const char * sinfo_get_license(void)
00058 {
00059     const char *   sinfoni_license =
00060         "This file is part of the SINFONI Instrument Pipeline\n"
00061         "Copyright (C) 2002,2003 European Southern Observatory\n"
00062         "\n"
00063         "This program is free software; you can redistribute it and/or modify\n"
00064         "it under the terms of the GNU General Public License as published by\n"
00065         "the Free Software Foundation; either version 2 of the License, or\n"
00066         "(at your option) any later version.\n"
00067         "\n"
00068         "This program is distributed in the hope that it will be useful,\n"
00069         "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
00070         "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
00071         "GNU General Public License for more details.\n"
00072         "\n"
00073         "You should have received a copy of the GNU General Public License\n"
00074         "along with this program; if not, write to the Free Software\n"
00075         "Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"
00076         "MA  02111-1307  USA" ;
00077 
00078     return sinfoni_license ;
00079 }
00080 
00081 
00082 /*---------------------------------------------------------------------------*/
00091 /*---------------------------------------------------------------------------*/
00092 cpl_frameset * sinfo_extract_frameset(
00093         const cpl_frameset  *   in,
00094         const char          *   tag)
00095 {
00096     cpl_frameset    *   out ;
00097     const cpl_frame *   cur_frame ;
00098     cpl_frame       *   loc_frame ;
00099     int                 nbframes, nbext ;
00100     int                 i ;
00101 
00102     /* Test entries */
00103     if (in == NULL) return NULL ;
00104     if (tag == NULL) return NULL ;
00105 
00106     /* Initialise */
00107     nbframes = cpl_frameset_get_size(in) ;
00108 
00109     /* Count the frames with the tag */
00110     if ((nbext = cpl_frameset_count_tags(in, tag)) == 0) return NULL ;
00111 
00112     /* Create the output frameset */
00113     out = cpl_frameset_new() ;
00114 
00115     /* Loop on the requested frames and store them in out */
00116     nbext = 0 ;
00117     for (i=0 ; i<nbframes ; i++) {
00118         cur_frame = cpl_frameset_get_frame_const(in, i) ;
00119         if (!strcmp(cpl_frame_get_tag(cur_frame), tag)) {
00120             loc_frame = cpl_frame_duplicate(cur_frame) ;
00121             cpl_frameset_insert(out, loc_frame) ;
00122             nbext ++ ;
00123         }
00124     }
00125     return out ;
00126 }
00127 /*----------------------------------------------------------------------------*/
00134 /*----------------------------------------------------------------------------*/
00135 const char * sinfo_extract_filename(
00136         const cpl_frameset  *   in,
00137         const char          *   tag)
00138 {
00139     const cpl_frame *   cur_frame ;
00140 
00141     /* Get the frame  */
00142     if ((cur_frame = cpl_frameset_find_const(in, tag)) == NULL) return NULL ;
00143     return cpl_frame_get_filename(cur_frame) ;
00144 }
00145 
00146 /*-------------------------------------------------------------------------*/
00152 /*--------------------------------------------------------------------------*/
00153 const char * sinfo_std_band_name(sinfo_band band)
00154 {
00155     switch (band) {
00156         case SINFO_BAND_J:        return "J" ;
00157         case SINFO_BAND_JS:       return "Js" ;
00158         case SINFO_BAND_JBLOCK:   return "J+Block" ;
00159         case SINFO_BAND_H:        return "H" ;
00160         case SINFO_BAND_K:        return "K" ;
00161         case SINFO_BAND_KS:       return "Ks" ;
00162         case SINFO_BAND_L:        return "L" ;
00163         case SINFO_BAND_M:        return "M" ;
00164         case SINFO_BAND_LP:       return "Lp" ;
00165         case SINFO_BAND_MP:       return "Mp" ;
00166         case SINFO_BAND_Z:        return "Z" ;
00167         case SINFO_BAND_SZ:       return "SZ" ;
00168         case SINFO_BAND_SH:       return "SH" ;
00169         case SINFO_BAND_SK:       return "SK" ;
00170         case SINFO_BAND_SL:       return "SL" ;
00171         default:            return "Unknown" ;
00172     } 
00173 }
00174 

Generated on 8 Mar 2011 for SINFONI Pipeline Reference Manual by  doxygen 1.6.1