vircam_dfs.c

00001 /* $Id: vircam_dfs.c,v 1.32 2007/11/20 09:37:56 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
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: jim $
00023  * $Date: 2007/11/20 09:37:56 $
00024  * $Revision: 1.32 $
00025  * $Name:  $
00026  */
00027 
00028 
00029 /* Includes */
00030 
00031 #ifdef HAVE_CONFIG_H
00032 #include <config.h>
00033 #endif
00034 
00035 #include <string.h>
00036 #include <cpl.h>
00037 
00038 #include "vircam_dfs.h"
00039 #include "vircam_utils.h"
00040 
00041 #define PACKSZ 1024
00042 
00057 /*---------------------------------------------------------------------------*/
00079 /*---------------------------------------------------------------------------*/
00080 
00081 extern int vircam_dfs_set_groups(cpl_frameset *set) {
00082     cpl_frame *cur_frame;
00083     const char *tag;
00084     const char *fctid = "vircam_dfs_set_groups";
00085     int nframes,i;
00086 
00087     /* Check entries */
00088 
00089     if (set == NULL) 
00090         return(VIR_FATAL); 
00091     
00092     /* Initialize */
00093 
00094     nframes = cpl_frameset_get_size(set);
00095 
00096     /* Loop on frames */
00097 
00098     for (i = 0; i < nframes; i++) {
00099         cur_frame = cpl_frameset_get_frame(set,i);
00100         tag = cpl_frame_get_tag(cur_frame);
00101        
00102         /* RAW frames */
00103 
00104         if (!strcmp(tag,VIRCAM_CROSSTALK_RAW) ||
00105             !strcmp(tag,VIRCAM_DARK_RAW)  ||
00106             !strcmp(tag,VIRCAM_DARKCUR_RAW)  ||
00107             !strcmp(tag,VIRCAM_NOISE_FLAT_RAW) ||
00108             !strcmp(tag,VIRCAM_NOISE_DARK_RAW) ||
00109             !strcmp(tag,VIRCAM_DOME_RAW) ||
00110             !strcmp(tag,VIRCAM_SCI_OBJECT_RAW) || 
00111             !strcmp(tag,VIRCAM_SCI_OBJECT_EXT_RAW) || 
00112             !strcmp(tag,VIRCAM_TEST_SCIENCE_RAW) || 
00113             !strcmp(tag,VIRCAM_LIN_DOME_RAW) ||
00114             !strcmp(tag,VIRCAM_LIN_DOME_CHECK) ||
00115             !strcmp(tag,VIRCAM_LIN_DARK_RAW) ||
00116             !strcmp(tag,VIRCAM_LIN_DARK_CHECK) ||
00117             !strcmp(tag,VIRCAM_ILLUM_RAW) ||
00118             !strcmp(tag,VIRCAM_PERSIST_OBJ_RAW) ||
00119             !strcmp(tag,VIRCAM_PERSIST_DARK_RAW) ||
00120             !strcmp(tag,VIRCAM_RESET_RAW) ||
00121             !strcmp(tag,VIRCAM_STD_OBJECT_RAW) ||
00122             !strcmp(tag,VIRCAM_TWI_RAW))
00123             cpl_frame_set_group(cur_frame,CPL_FRAME_GROUP_RAW);
00124 
00125         /* CALIB frames */
00126 
00127         else if (!strcmp(tag,VIRCAM_CAL_RESET) ||
00128                  !strcmp(tag,VIRCAM_CAL_DARK) ||
00129                  !strcmp(tag,VIRCAM_CAL_DOME_FLAT) ||
00130                  !strcmp(tag,VIRCAM_CAL_TWILIGHT_FLAT) ||
00131                  !strcmp(tag,VIRCAM_CAL_CONF) ||
00132                  !strcmp(tag,VIRCAM_CAL_BPM) ||
00133                  !strcmp(tag,VIRCAM_CAL_FRINGE) ||
00134                  !strcmp(tag,VIRCAM_CAL_CHANTAB) ||
00135                  !strcmp(tag,VIRCAM_CAL_READGAINFILE) ||
00136                  !strcmp(tag,VIRCAM_CAL_CHANTAB_INIT) ||
00137                  !strcmp(tag,VIRCAM_CAL_PHOTTAB) ||
00138                  !strcmp(tag,VIRCAM_CAL_STDTAB) ||
00139                  !strcmp(tag,VIRCAM_CAL_OBJCAT) ||
00140                  !strcmp(tag,VIRCAM_CAL_MSTDTAB) ||
00141                  !strcmp(tag,VIRCAM_CAL_2MASS) ||
00142                  !strcmp(tag,VIRCAM_CAL_REFCAT) ||
00143                  !strcmp(tag,VIRCAM_REF_RESET) ||
00144                  !strcmp(tag,VIRCAM_REF_DARK) ||
00145                  !strcmp(tag,VIRCAM_REF_DOME_FLAT) ||
00146                  !strcmp(tag,VIRCAM_REF_TWILIGHT_FLAT))
00147             cpl_frame_set_group(cur_frame,CPL_FRAME_GROUP_CALIB);
00148         else 
00149             cpl_msg_info(fctid,"No such tag as %s in frame %s",tag,
00150                          cpl_frame_get_filename(cur_frame));
00151     }
00152     return(VIR_OK);
00153 }
00154 
00155 /*---------------------------------------------------------------------------*/
00180 /*---------------------------------------------------------------------------*/
00181 
00182 extern void vircam_dfs_set_product_primary_header(cpl_propertylist *plist,
00183                                                   cpl_frame *frame,
00184                                                   cpl_frameset *frameset,
00185                                                   cpl_parameterlist *parlist,
00186                                                   char *recipeid, 
00187                                                   const char *dict) {
00188     const char *fctid="vircam_dfs_set_product_primary_header";
00189     char package[PACKSZ],*catg;
00190 
00191     /* Get the package name and version */
00192 
00193     (void)snprintf(package,PACKSZ,"%s/%s",PACKAGE,PACKAGE_VERSION);
00194 
00195     /* Add the data-flow keywords */
00196 
00197     if (cpl_dfs_setup_product_header(plist,frame,frameset,parlist,recipeid,
00198                                      package,dict) != CPL_ERROR_NONE) {
00199         cpl_msg_warning(fctid,
00200                         "Problem with the product primary DFS compliance");
00201         cpl_error_reset();
00202     }
00203 
00204     /* Get a copy of the PRO CATG */
00205 
00206     catg = cpl_strdup(cpl_propertylist_get_string(plist,"ESO PRO CATG"));
00207 
00208     /* Remove the stuff that isn't supposed to be here */
00209 
00210     cpl_propertylist_erase_regexp(plist,"ESO PRO",0);
00211 
00212     /* Now add the PRO CATG back in */
00213 
00214     cpl_propertylist_update_string(plist,"ESO PRO CATG",catg);
00215     cpl_propertylist_set_comment(plist,"ESO PRO CATG",
00216                                  "Category of pipeline product frame");
00217     cpl_free(catg);
00218 }
00219 
00220 /*---------------------------------------------------------------------------*/
00245 /*---------------------------------------------------------------------------*/
00246 
00247 extern void vircam_dfs_set_product_exten_header(cpl_propertylist *plist,
00248                                                 cpl_frame *frame,
00249                                                 cpl_frameset *frameset,
00250                                                 cpl_parameterlist *parlist,
00251                                                 char *recipeid, 
00252                                                 const char *dict) {
00253     const char *fctid="vircam_dfs_set_product_exten_header";
00254     char package[PACKSZ];
00255 
00256     /* Get the package name and version */
00257 
00258     (void)snprintf(package,PACKSZ,"%s/%s",PACKAGE,PACKAGE_VERSION);
00259 
00260     /* Add the data-flow keywords */
00261 
00262     if (cpl_dfs_setup_product_header(plist,frame,frameset,parlist,recipeid,
00263                                      package,dict) != CPL_ERROR_NONE) {
00264         cpl_msg_warning(fctid,"Problem with the product extn DFS compliance");
00265         cpl_error_reset();
00266     }
00267 
00268     /* Remove the stuff that isn't supposed to be here */
00269 
00270     cpl_propertylist_erase(plist,"INSTRUME");
00271     cpl_propertylist_erase(plist,"PIPEFILE");
00272     cpl_propertylist_erase_regexp(plist,"ESO INS",0);
00273     cpl_propertylist_erase_regexp(plist,"ESO OBS",0);
00274     cpl_propertylist_erase_regexp(plist,"ESO TEL",0);
00275 
00276 }
00277 
00280 /*
00281 
00282 $Log: vircam_dfs.c,v $
00283 Revision 1.32  2007/11/20 09:37:56  jim
00284 Added VIRCAM_LIN_DOME_CHECK and VIRCAM_LIN_DARK_CHECK
00285 
00286 Revision 1.31  2007/10/19 06:55:06  jim
00287 Modifications made to use new method for directing the recipes to the
00288 standard catalogues using the sof
00289 
00290 Revision 1.30  2007/08/23 09:00:59  jim
00291 Removed annoying error messages in the product header routines which used
00292 to tell you if it couldn't find stuff to erase.
00293 
00294 Revision 1.29  2007/04/23 12:50:22  jim
00295 Added VIRCAM_TEST_SCIENCE_RAW
00296 
00297 Revision 1.28  2007/04/04 10:34:42  jim
00298 Complete rewrite of the dfs tags
00299 
00300 Revision 1.27  2007/03/23 10:53:22  jim
00301 Fixed little documentation errors
00302 
00303 Revision 1.26  2007/03/01 12:42:41  jim
00304 Modified slightly after code checking
00305 
00306 Revision 1.25  2007/02/15 11:53:45  jim
00307 Added type CHANNEL_TABLE_INIT
00308 
00309 Revision 1.24  2007/02/05 13:54:00  jim
00310 Added REFERENCE tags
00311 
00312 Revision 1.23  2007/01/17 23:53:43  jim
00313 Modified to remove INS, OBS and TEL structures from extension headers
00314 
00315 Revision 1.22  2006/12/06 12:58:57  jim
00316 Added MASTER_FRINGE
00317 
00318 Revision 1.21  2006/11/28 20:57:05  jim
00319 Added ILLUM types
00320 
00321 Revision 1.20  2006/10/05 09:22:59  jim
00322 Small modifications to a couple of cpl calls to bring them into line with
00323 cpl v3.0
00324 
00325 Revision 1.19  2006/07/04 09:19:04  jim
00326 replaced all sprintf statements with snprintf
00327 
00328 Revision 1.18  2006/06/14 14:13:58  jim
00329 fixed minor doc problem
00330 
00331 Revision 1.17  2006/06/13 21:26:02  jim
00332 Added VIRCAM_CALIB_READNOISE_FILE
00333 
00334 Revision 1.16  2006/05/24 13:33:56  jim
00335 Added VIRCAM_PHOTTAB
00336 
00337 Revision 1.15  2006/05/18 12:32:23  jim
00338 Added channel table and object catalogue to calib list
00339 
00340 Revision 1.14  2006/04/27 09:46:27  jim
00341 Modified to conform to new dictionary
00342 
00343 Revision 1.13  2006/04/26 09:39:35  jim
00344 Fixes the pipeline id to the header
00345 
00346 Revision 1.12  2006/04/25 13:47:59  jim
00347 Modified calls to vircam_dfs_set_product_*_header routines
00348 
00349 Revision 1.11  2006/04/20 11:19:22  jim
00350 *** empty log message ***
00351 
00352 Revision 1.10  2006/03/22 13:14:24  jim
00353 Sorted data categories
00354 
00355 Revision 1.9  2006/02/27 13:53:32  jim
00356 Added new categories to vircam_dfs_set_groups
00357 
00358 Revision 1.8  2006/02/18 11:45:01  jim
00359 Added vircam_dfs_set_product_primary_header and
00360 vircam_dfs_set_product_exten_header
00361 
00362 Revision 1.7  2006/01/23 10:30:49  jim
00363 Mainly documentation mods
00364 
00365 Revision 1.6  2005/12/14 22:17:33  jim
00366 Updated docs
00367 
00368 Revision 1.5  2005/11/29 14:56:36  jim
00369 Added a few new categories
00370 
00371 Revision 1.4  2005/11/25 09:56:14  jim
00372 Tidied up some more documentation
00373 
00374 Revision 1.3  2005/11/03 13:28:48  jim
00375 All sorts of changes to tighten up error handling
00376 
00377 Revision 1.2  2005/09/20 15:07:46  jim
00378 Fixed a few bugs and added a few things
00379 
00380 Revision 1.1.1.1  2005/08/05 08:29:09  jim
00381 Initial import
00382 
00383 
00384 */

Generated on Wed Apr 10 04:01:55 2013 for VIRCAM Pipeline by  doxygen 1.5.1