IIINSTRUMENT Pipeline Reference Manual  0.1.12
iiinstrument_dfs.c
1 /*
2  * This file is part of the IIINSTRUMENT Pipeline
3  * Copyright (C) 2002-2017 European Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 
24 /*----------------------------------------------------------------------------*/
28 /*----------------------------------------------------------------------------*/
29 
30 #include "iiinstrument_dfs.h"
31 
32 #include <string.h>
33 
34 /*----------------------------------------------------------------------------*/
40 /*----------------------------------------------------------------------------*/
41 
44 /*----------------------------------------------------------------------------*/
53 /*----------------------------------------------------------------------------*/
54 cpl_error_code iiinstrument_dfs_set_groups(cpl_frameset * set)
55 {
56  /* Check entries */
57  cpl_ensure_code(set, CPL_ERROR_NULL_INPUT);
58 
59  /* Initialize */
60  cpl_size nframes = cpl_frameset_get_size(set);
61 
62  /* Loop on frames */
63  for (cpl_size i = 0; i < nframes; i++) {
64 
65  cpl_frame *cur_frame = cpl_frameset_get_position(set, i);
66  const char *tag = cpl_frame_get_tag(cur_frame);
67 
68  if (tag == NULL) {
69 
70  /* tag not defined */
71  cpl_msg_warning(cpl_func, "Frame %d of %d has no tag",
72  1 + (int)i, (int)nframes);
73  cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_NONE);
74 
75  } else if (!strcmp(tag, RRRECIPE_RAW ) ||
76  !strcmp(tag, RRRECIPE_OUT_PROCATG ) ){
77 
78  /* RAW frames */
79  cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW);
80 
81  } else if (!strcmp(tag, RRRECIPE_CALIB_RAW ) ||
82  !strcmp(tag, RRRECIPE_OUT_CALIB_PROCATG ) ||
83  !strcmp(tag, IIINSTRUMENT_CALIB_FLAT ) ){
84 
85  /* CALIB frames */
86  cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB);
87 
88  } else {
89 
90  /* unknown tag frame */
91  cpl_msg_warning(cpl_func, "Frame:%lld with tag:%s, unknown!", i, tag);
92  cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_NONE);
93  }
94  }
95 
96  return cpl_error_get_code();
97 }
98 
cpl_error_code iiinstrument_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.