midi_dfs.c

00001 /* $Id: midi_dfs.c,v 1.11 2009/12/21 12:35:16 agabasch Exp $
00002  *
00003  * This file is part of the MIDI 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: agabasch $
00023  * $Date: 2009/12/21 12:35:16 $
00024  * $Revision: 1.11 $
00025  * $Name: midi-2_8_2 $
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 "midi_dfs.h"
00042 
00043 /*----------------------------------------------------------------------------*/
00049 /*----------------------------------------------------------------------------*/
00050 
00053 /*----------------------------------------------------------------------------*/
00059 /*----------------------------------------------------------------------------*/
00060 cpl_error_code midi_dfs_set_groups(cpl_frameset * set)
00061 {
00062    cpl_errorstate prestate = cpl_errorstate_get();
00063    cpl_frame * frame = NULL;
00064    int         i = 0;
00065    
00066    
00067    /* Loop on frames */
00068    for (frame = cpl_frameset_get_first(set); frame != NULL;
00069         frame = cpl_frameset_get_next(set), i++) {
00070       
00071       const char * tag = cpl_frame_get_tag(frame);
00072       
00073       if (tag == NULL) {
00074          cpl_msg_warning(cpl_func, "Frame %d has no tag", i);
00075       } else if (!strcmp(tag, MIDI_HIGH_SENS_CALIB    ) ||
00076                  !strcmp(tag, MIDI_HIGH_SENS_SCIENCE  ) ||
00077                  !strcmp(tag, MIDI_SCI_PHOT_CALIB     ) ||
00078                  !strcmp(tag, MIDI_SCI_PHOT_SCIENCE   ) ||
00079                  !strcmp(tag, MIDI_KAPPA_SP_CALIB     ) ||
00080                  !strcmp(tag, MIDI_KAPPA_SP_SCIENCE   ) ||
00081                  !strcmp(tag, MIDI_ACQ                ) ||
00082                  !strcmp(tag, MIDI_DETLIN             ) ||
00083                  !strcmp(tag, MIDI_DETRON             ) ||
00084                  !strcmp(tag, MIDI_DSPTRN             ) ||
00085                  !strcmp(tag, MIDI_REFPIX             ) ||
00086                  !strcmp(tag, MIDI_WAVECAL            ) ||
00087                  !strcmp(tag, MIDI_PHOTOM_SP_CALIB    ) ||
00088                  !strcmp(tag, MIDI_PHOTOM_SP_SCIENCE  ) ||
00089                  !strcmp(tag, MIDI_PHOTOM_HS_CALIB    ) ||
00090                  !strcmp(tag, MIDI_PHOTOM_HS_SCIENCE  ) ||
00091                  !strcmp(tag, MIDI_OTHER_DETLIN       ) ||
00092                  !strcmp(tag, MIDI_OTHER_DETRON       ) ||
00093                  !strcmp(tag, MIDI_OTHER_DSPTRN       ) ||
00094                  !strcmp(tag, MIDI_OTHER_GENERIC      ) ||
00095                  !strcmp(tag, MIDI_OTHER_REFPIX       ) ||
00096                  !strcmp(tag, MIDI_OTHER_WAVECAL      ) ||
00097                  !strcmp(tag, MIDI_OTHER_ACQ          ) ||
00098                  !strcmp(tag, MIDI_DOME_AOPEN         ) ||
00099                  !strcmp(tag, MIDI_DOME_BOPEN         ) ||
00100                  !strcmp(tag, MIDI_INTERNAL_OPD       ) ||
00101                  !strcmp(tag, MIDI_CAL_SEARCH         ) ||
00102                  !strcmp(tag, MIDI_OTHER_FRINGE       )) 
00103       {
00104          /* RAW frames */
00105          cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00106       } else if (!strcmp(tag, MIDI_CALIB_FLAT)          ||
00107                  !strcmp(tag, MIDI_KAPPA_SP_MASK_PRISM) ||
00108                  !strcmp(tag, MIDI_KAPPA_SP_MASK_GRISM) ||
00109                  !strcmp(tag, MIDI_KAPPA_HS_MASK_PRISM) ||
00110                  !strcmp(tag, MIDI_KAPPA_HS_MASK_GRISM) ||
00111                  !strcmp(tag, MIDI_KAPPAMATRIX_PRISM)   ||
00112                  !strcmp(tag, MIDI_KAPPAMATRIX_GRISM)   ||
00113                  !strcmp(tag, MIDI_TRF_GRISM)           ||
00114                  !strcmp(tag, MIDI_TRF_PRISM)           ||
00115                  !strcmp(tag, MIDI_CALIB_DATABASE))
00116       {
00117          /* CALIB frames */
00118          cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
00119       }
00120       
00121       
00122 
00123 
00124 
00125 
00126 
00127    }
00128    
00129     if (!cpl_errorstate_is_equal(prestate)) {
00130         return cpl_error_set_message(cpl_func, cpl_error_get_code(),
00131                                      "Could not identify RAW and CALIB "
00132                                      "frames");
00133     }
00134 
00135     return CPL_ERROR_NONE;
00136 }
00137 

Generated on 5 Mar 2013 for MIDI Pipeline Reference Manual by  doxygen 1.6.1