sinfoni_tpl_dfs.c

00001 /* $Id: sinfoni_tpl_dfs.c,v 1.8 2005/09/09 16:22:29 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: 2005/09/09 16:22:29 $
00024  * $Revision: 1.8 $
00025  * $Name:  $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                 Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <string.h>
00037 #include <math.h>
00038 
00039 #include <cpl.h>
00040 
00041 #include "sinfoni_tpl_dfs.h"
00042 #include "sinfoni_pro_types.h"
00043 #include "sinfoni_raw_types.h"
00044 #include "sinfoni_ref_types.h"
00045 #include "utilities.h"
00046 
00047 
00048 /*----------------------------------------------------------------------------*/
00054 /*----------------------------------------------------------------------------*/
00055 
00058 /*----------------------------------------------------------------------------*/
00064 /*----------------------------------------------------------------------------*/
00065 int sinfoni_dfs_set_groups(cpl_frameset * set)
00066 {
00067   const char * _id = "sinfoni_dfs_set_groups";
00068     cpl_frame   *   cur_frame ;
00069     const char  *   tag ;
00070     int             nframes ;
00071     int             i ;
00072 
00073     skip_if (cpl_error_get_code());
00074 
00075     /* Check entries */
00076     if (set == NULL) return -1 ; 
00077     
00078     /* Initialize */
00079     nframes = cpl_frameset_get_size(set) ;
00080 
00081     /* Loop on frames */
00082     for (i=0 ; i<nframes ; i++) {
00083         cur_frame = cpl_frameset_get_frame(set, i) ;
00084         tag = cpl_frame_get_tag(cur_frame) ;
00085         if (cpl_error_get_code()) break;
00086         if (tag == NULL) cpl_msg_warning(_id,
00087                                          "Frame %d has no tag", i);
00088         /* RAW frames */
00089         else if (!strcmp(tag, RAW_LINEARITY_LAMP) ||
00090              !strcmp(tag, RAW_DARK) ||
00091                  !strcmp(tag, RAW_FIBRE_NS) ||
00092                  !strcmp(tag, RAW_FLAT_NS) ||
00093                  !strcmp(tag, RAW_WAVE_NS) ||
00094                  !strcmp(tag, RAW_FLAT_LAMP) ||
00095                  !strcmp(tag, RAW_WAVE_LAMP) ||
00096                  !strcmp(tag, RAW_PSF_CALIBRATOR) ||
00097              !strcmp(tag, RAW_SKY_PSF_CALIBRATOR) ||
00098              !strcmp(tag, RAW_STD) ||
00099              !strcmp(tag, RAW_SKY) ||
00100                  !strcmp(tag, RAW_SKY_STD) ||
00101              !strcmp(tag, RAW_OBJECT_NODDING) ||
00102              !strcmp(tag, RAW_SKY_NODDING) ||
00103                  !strcmp(tag, RAW_WAVE_LAMP_DITHER) ||
00104                  !strcmp(tag, RAW_WAVE_NS_DITHER) ||
00105                  !strcmp(tag, RAW_FLAT_LAMP_DITHER) ||
00106                  !strcmp(tag, RAW_FLAT_NS_DITHER) ||
00107                  !strcmp(tag, RAW_OBJECT_SKYSPIDER_DITHER) ||
00108                  !strcmp(tag, RAW_OBJECT_NODDING_DITHER) ||
00109                  !strcmp(tag, RAW_SKY_NODDING_DITHER) ||
00110                  !strcmp(tag, RAW_OBJECT_SKYSPIDER))
00111             cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ;
00112         /* CALIB frames */
00113         else if (!strcmp(tag, PRO_BP_MAP_HP)  ||
00114          !strcmp(tag,PRO_BP_MAP_NL) ||
00115          !strcmp(tag,PRO_BP_MAP_NO) ||
00116          !strcmp(tag,PRO_BP_MAP_DI) ||
00117          !strcmp(tag,PRO_BP_MAP_NL) ||
00118          !strcmp(tag,PRO_BP_MAP_NO) ||
00119          !strcmp(tag,PRO_FIBRE_NS_STACKED_OFF) ||
00120          !strcmp(tag,PRO_FIBRE_NS_STACKED_ON) ||
00121          !strcmp(tag,PRO_FIBRE_NS_STACKED) ||
00122          !strcmp(tag,PRO_MASTER_BP_MAP) ||
00123          !strcmp(tag,PRO_MASTER_DARK) ||
00124                  !strcmp(tag,PRO_DISTORTION) ||
00125          !strcmp(tag,PRO_SLITLETS_DISTANCE) ||
00126          !strcmp(tag,PRO_MASTER_FLAT_LAMP) ||
00127          !strcmp(tag,PRO_SLIT_POS) ||
00128          !strcmp(tag,PRO_SLIT_POS_GUESS) ||
00129          !strcmp(tag,PRO_FIRST_COL) ||
00130          !strcmp(tag,PRO_WAVE_MAP ) ||
00131          !strcmp(tag,REF_LINE_ARC ) ||
00132          !strcmp(tag,DRS_SETUP_WAVE ) ||
00133          !strcmp(tag,PRO_IMA ) ||
00134          !strcmp(tag,PRO_CUBE ) ||
00135          !strcmp(tag,REF_BP_MAP ) ||
00136          !strcmp(tag,PRO_SKY_DUMMY ) ||
00137          !strcmp(tag,PRO_SPECTRUM))
00138             cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
00139         else cpl_msg_warning(_id,
00140                              "Frame %d has unknown tag: %s", i, tag);
00141     }
00142 
00143     skip_if (i != nframes);
00144 
00145  end_skip;
00146 
00147     if (cpl_error_get_code())
00148         cpl_msg_error(_id, "Could not identify RAW and CALIB frames (in "
00149                       "frame set of size %d)", nframes);
00150 
00151 
00152     return cpl_error_get_code();
00153 }
00154 

Generated on Wed Oct 26 13:08:55 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001