sinfo_tpl_dfs.c

00001 /* $Id: sinfo_tpl_dfs.c,v 1.3 2006/11/06 08:11:37 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: 2006/11/06 08:11:37 $
00024  * $Revision: 1.3 $
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 "sinfo_tpl_dfs.h"
00042 #include "sinfo_pro_types.h"
00043 #include "sinfo_raw_types.h"
00044 #include "sinfo_ref_types.h"
00045 #include "sinfo_msg.h"
00046 #include "sinfo_utilities.h" 
00047 
00048 
00049 /*----------------------------------------------------------------------------*/
00055 /*----------------------------------------------------------------------------*/
00056 
00059 /*----------------------------------------------------------------------------*/
00065 /*----------------------------------------------------------------------------*/
00066 int sinfo_dfs_set_groups(cpl_frameset * set)
00067 {
00068     cpl_frame   *   cur_frame=NULL ;
00069     const char  *   tag=NULL ;
00070     int             nframes=0 ;
00071     int             i=0 ;
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) sinfo_msg_warning( "Frame %d has no tag", i);
00087         /* RAW frames */
00088         else if (!strcmp(tag, RAW_LINEARITY_LAMP) ||
00089              !strcmp(tag, RAW_DARK) ||
00090                  !strcmp(tag, RAW_FIBRE_NS) ||
00091                  !strcmp(tag, RAW_FIBRE_PSF) ||
00092                  !strcmp(tag, RAW_FIBRE_DARK) ||
00093                  !strcmp(tag, RAW_FLAT_NS) ||
00094                  !strcmp(tag, RAW_WAVE_NS) ||
00095                  !strcmp(tag, RAW_FLAT_LAMP) ||
00096                  !strcmp(tag, RAW_WAVE_LAMP) ||
00097                  !strcmp(tag, RAW_PSF_CALIBRATOR) ||
00098              !strcmp(tag, RAW_SKY_PSF_CALIBRATOR) ||
00099              !strcmp(tag, RAW_STD) ||
00100              !strcmp(tag, RAW_SKY) ||
00101                  !strcmp(tag, RAW_SKY_STD) ||
00102              !strcmp(tag, RAW_OBJECT_NODDING) ||
00103              !strcmp(tag, RAW_SKY_NODDING) ||
00104                  !strcmp(tag, RAW_WAVE_LAMP_DITHER) ||
00105                  !strcmp(tag, RAW_WAVE_NS_DITHER) ||
00106                  !strcmp(tag, RAW_FLAT_LAMP_DITHER) ||
00107                  !strcmp(tag, RAW_FLAT_NS_DITHER) ||
00108                  !strcmp(tag, RAW_OBJECT_SKYSPIDER_DITHER) ||
00109                  !strcmp(tag, RAW_OBJECT_NODDING_DITHER) ||
00110                  !strcmp(tag, RAW_SKY_NODDING_DITHER) ||
00111                  !strcmp(tag, RAW_OBJECT_JITTER) ||
00112                  !strcmp(tag, RAW_SKY_JITTER) ||
00113                  !strcmp(tag, RAW_PUPIL_LAMP) ||
00114                  !strcmp(tag, RAW_IMAGE_PRE_OBJECT) ||
00115                  !strcmp(tag, RAW_IMAGE_PRE_SKY) ||
00116                  !strcmp(tag, RAW_OBJECT_SKYSPIDER))
00117             cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ;
00118         /* CALIB frames */
00119         else if (!strcmp(tag, PRO_BP_MAP_HP)  ||
00120          !strcmp(tag,PRO_BP_MAP_NL) ||
00121          !strcmp(tag,PRO_BP_MAP_NO) ||
00122          !strcmp(tag,PRO_BP_MAP_DI) ||
00123          !strcmp(tag,PRO_BP_MAP_NL) ||
00124          !strcmp(tag,PRO_BP_MAP_NO) ||
00125          !strcmp(tag,PRO_BP_MAP) ||
00126          !strcmp(tag,PRO_ILL_COR) ||
00127          !strcmp(tag,PRO_MASTER_BP_MAP) ||
00128          !strcmp(tag,PRO_MASTER_DARK) ||
00129                  !strcmp(tag,PRO_DISTORTION) ||
00130          !strcmp(tag,PRO_SLITLETS_DISTANCE) ||
00131          !strcmp(tag,PRO_MASTER_FLAT_LAMP) ||
00132          !strcmp(tag,PRO_SLIT_POS) ||
00133          !strcmp(tag,PRO_SLIT_POS_GUESS) ||
00134          !strcmp(tag,PRO_FIRST_COL) ||
00135          !strcmp(tag,PRO_WAVE_MAP ) ||
00136          !strcmp(tag,REF_LINE_ARC ) ||
00137          !strcmp(tag,DRS_SETUP_WAVE ) ||
00138          !strcmp(tag,PRO_IMA ) ||
00139          !strcmp(tag,PRO_CUBE ) ||
00140          !strcmp(tag,REF_BP_MAP ) ||
00141          !strcmp(tag,PRO_SKY_DUMMY ) ||
00142          !strcmp(tag,PRO_SPECTRUM))
00143             cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
00144         else if (!strcmp(tag, PRO_OBS_OBJ)  ||
00145          !strcmp(tag,PRO_MED_OBS_OBJ) ||
00146          !strcmp(tag,PRO_OBS_STD) ||
00147          !strcmp(tag,PRO_MED_OBS_STD) ||
00148          !strcmp(tag,PRO_OBS_PSF) ||
00149          !strcmp(tag,PRO_MED_OBS_PSF) ||
00150          !strcmp(tag,PRO_COADD_OBJ) ||
00151          !strcmp(tag,PRO_COADD_STD) ||
00152          !strcmp(tag,PRO_COADD_PSF) ||
00153          !strcmp(tag,PRO_COADD_PUPIL) ||
00154          !strcmp(tag,PRO_MED_COADD_OBJ) ||
00155          !strcmp(tag,PRO_MED_COADD_STD) ||
00156          !strcmp(tag,PRO_MED_COADD_PSF) ||
00157          !strcmp(tag,PRO_MED_COADD_PUPIL) ||
00158          !strcmp(tag,PRO_MASK_COADD_OBJ) ||
00159          !strcmp(tag,PRO_MASK_COADD_STD) ||
00160          !strcmp(tag,PRO_MASK_COADD_PSF) ||
00161          !strcmp(tag,PRO_MASK_COADD_PUPIL) ||
00162          !strcmp(tag,PRO_PSF_CALIBRATOR_STACKED) ||
00163          !strcmp(tag,PRO_SKY_PSF_CALIBRATOR_STACKED) ||
00164          !strcmp(tag,PRO_AO_PERFORMANCE) ||
00165          !strcmp(tag,PRO_ENC_ENERGY) ||
00166          !strcmp(tag,PRO_PSF) ||
00167          !strcmp(tag,PRO_STD_STAR_SPECTRA) ||
00168          !strcmp(tag,PRO_STD_STAR_SPECTRUM) ||
00169          !strcmp(tag,PRO_MFLAT_CUBE) ||
00170          !strcmp(tag,PRO_MFLAT_AVG) ||
00171          !strcmp(tag,PRO_MFLAT_MED) ||
00172          !strcmp(tag,PRO_STACK_MFLAT_DIST) ||
00173          !strcmp(tag,PRO_WAVE_LAMP_STACKED ) ||
00174          !strcmp(tag,PRO_FIBRE_NS_STACKED_OFF) ||
00175          !strcmp(tag,PRO_FIBRE_NS_STACKED_ON) ||
00176          !strcmp(tag,PRO_FIBRE_NS_STACKED) ||
00177          !strcmp(tag,PRO_SLITLETS_POS_PREDIST) ||
00178          !strcmp(tag,PRO_OBS_SKY) ||
00179          !strcmp(tag,PRO_SKY_MED) ||
00180          !strcmp(tag,PRO_FIBRE_NS_STACKED_DIST))
00181             cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_PRODUCT) ;
00182         else sinfo_msg_warning( "Frame %d has unknown tag: %s", i, tag);
00183     }
00184 
00185     skip_if (i != nframes);
00186 
00187  end_skip;
00188 
00189     if (cpl_error_get_code())
00190         sinfo_msg_error( "Could not identify RAW and CALIB frames (in "
00191                       "frame set of size %d)", nframes);
00192 
00193 
00194     return cpl_error_get_code();
00195 }
00196 

Generated on Wed Jan 17 08:33:44 2007 for SINFONI Pipeline Reference Manual by  doxygen 1.4.4