ERIS Pipeline Reference Manual 1.9.2
eris_dfs.c
1/* $Id: eris_dfs.c,v 1.9 2013-03-26 17:00:44 jtaylor Exp $
2 *
3 * This file is part of the ERIS Pipeline
4 * Copyright (C) 2002,2003 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-03-26 17:00:44 $
24 * $Revision: 1.9 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32/*-----------------------------------------------------------------------------
33 Includes
34 -----------------------------------------------------------------------------*/
35
36#include "eris_dfs.h"
37
38#include <string.h>
39#include "eris_utils.h"
40/*----------------------------------------------------------------------------*/
46/*----------------------------------------------------------------------------*/
47
50/*----------------------------------------------------------------------------*/
56/*----------------------------------------------------------------------------*/
57cpl_error_code eris_dfs_set_groups(cpl_frameset * self)
58{
59 cpl_errorstate prestate = cpl_errorstate_get();
60 const cpl_size n = cpl_frameset_get_size(self);
61
62
63 /* Loop on frames */
64 for (cpl_size i = 0; i < n; i++) {
65 cpl_frame* frame = cpl_frameset_get_position(self, i);
66 const char * tag = cpl_frame_get_tag(frame);
67
68 if (tag == NULL) {
69 cpl_msg_warning(cpl_func, "Frame %d of %d has no tag",
70 1 + (int)i, (int)n);
71 } else if (!strcmp(tag, ERIS_RECIPE_RAW)
72 || !strcmp(tag,"OBJECT_CUBE" )) {
73 /* RAW frames */
74 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
75 } else if (!strcmp(tag, ERIS_CALIB_FLAT)) {
76 /* CALIB frames */
77 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
78 } else if (!strcmp(tag, ERIS_RECIPE_CALIB_RAW)) {
79 /* CALIB frames */
80 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
81 }
82 }
83
84 if (!cpl_errorstate_is_equal(prestate)) {
85 return cpl_error_set_message(cpl_func, cpl_error_get_code(),
86 "Could not identify RAW and CALIB "
87 "frames");
88 }
89 eris_check_error_code("eris_dfs_set_groups");
90 return CPL_ERROR_NONE;
91}
92
cpl_error_code eris_dfs_set_groups(cpl_frameset *self)
Set the group as RAW or CALIB in a frameset.
Definition: eris_dfs.c:57
cpl_error_code eris_check_error_code(const char *func_id)
handle CPL errors
Definition: eris_utils.c:56