IIINSTRUMENT Pipeline Reference Manual 0.1.15
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/*----------------------------------------------------------------------------*/
54cpl_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 cpl_size i;
64 for (i = 0; i < nframes; i++) {
65
66 cpl_frame *cur_frame = cpl_frameset_get_position(set, i);
67 const char *tag = cpl_frame_get_tag(cur_frame);
68
69 if (tag == NULL) {
70
71 /* tag not defined */
72 cpl_msg_warning(cpl_func, "Frame %d of %d has no tag",
73 1 + (int)i, (int)nframes);
74 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_NONE);
75
76 } else if (!strcmp(tag, RRRECIPE_RAW ) ||
77 !strcmp(tag, RRRECIPE_OUT_PROCATG ) ){
78
79 /* RAW frames */
80 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW);
81
82 } else if (!strcmp(tag, RRRECIPE_CALIB_RAW ) ||
83 !strcmp(tag, RRRECIPE_OUT_CALIB_PROCATG ) ||
84 !strcmp(tag, IIINSTRUMENT_CALIB_FLAT ) ||
85 !strcmp(tag, LINE_INTMON_TABLE ) ){
86
87 /* CALIB frames */
88 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB);
89
90 } else {
91
92 /* unknown tag frame */
93 cpl_msg_warning(cpl_func, "Frame:%lld with tag:<%s>, unknown!", i, tag);
94 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_NONE);
95 }
96 }
97
98 return cpl_error_get_code();
99}
100
cpl_error_code iiinstrument_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.