SINFONI Pipeline Reference Manual  2.6.0
sinfo_step_objnod.c
1 /* $Id: sinfo_step_objnod.c,v 1.9 2007-06-06 07:09:56 amodigli Exp $
2  *
3  * This file is part of the CPL (Common Pipeline Library)
4  * Copyright (C) 2002 European Southern Observatory
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 /*
21  * $Author: amodigli $
22  * $Date: 2007-06-06 07:09:56 $
23  * $Revision: 1.9 $
24  * $Name: not supported by cvs2svn $
25  */
26 
27 /****************************************************************
28  * Object Data reduction *
29  ****************************************************************/
30 #include <strings.h>
31 #include <string.h>
32 #include <stdio.h>
33 
34 #ifdef HAVE_CONFIG_H
35 #include <config.h>
36 #endif
37 #include <cpl.h>
38 #include <irplib_utils.h>
39 
40 #include <sinfo_pro_types.h>
41 #include <sinfo_general_config.h>
42 #include <sinfo_objnod_config.h>
43 #include <sinfo_skycor_config.h>
44 
45 #include <sinfo_new_objnod.h>
46 #include <sinfo_globals.h>
47 #include <sinfo_tpl_utils.h>
48 
49 static int sinfo_step_objnod(cpl_parameterlist *, cpl_frameset *);
50 /*---------------------------------------------------------------------------*/
54 /*---------------------------------------------------------------------------*/
55 
56 
57 
58 int
59 sinfo_step_objnod_create(cpl_plugin *plugin)
60 {
61 
62  /*
63  * We have to provide the option we accept to the application.
64  * We need to setup our parameter list and hook it into the recipe
65  * interface.
66  */
67  cpl_recipe *recipe = (cpl_recipe *)plugin;
68  recipe->parameters = cpl_parameterlist_new();
69  if(recipe->parameters == NULL) {
70  return 1;
71  }
72  irplib_reset();
73  cpl_error_reset();
74 
75  /*
76  * Fill the parameter list.
77  */
78 
79  /* General parameters */
80  sinfo_general_config_add(recipe->parameters);
81  sinfo_objnod_config_add(recipe->parameters);
82  sinfo_skycor_config_add(recipe->parameters);
83 
84  return 0;
85 
86 }
87 
88 int
89 sinfo_step_objnod_exec(cpl_plugin *plugin)
90 {
91 
92  cpl_recipe *recipe = (cpl_recipe *) plugin;
93  if(recipe->parameters == NULL) {
94  return 1;
95  }
96  if(recipe->frames == NULL) {
97  return 1;
98  }
99  return sinfo_step_objnod(recipe->parameters, recipe->frames);
100 
101 }
102 
103 int
104 sinfo_step_objnod_destroy(cpl_plugin *plugin)
105 {
106  cpl_recipe *recipe = (cpl_recipe *) plugin;
107  /*
108  * We just destroy what was created during the plugin initializzation phase
109  * i.e. the parameter list. The frame set is managed by the application which
110  * called us, so that we must not touch it.
111  */
112 
113  cpl_parameterlist_delete(recipe->parameters);
114 
115  return 0;
116 
117 }
118 
119 int
120 cpl_plugin_get_info(cpl_pluginlist *list)
121 {
122 
123  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
124  cpl_plugin *plugin = &recipe->interface;
125 
126 
127  cpl_plugin_init(plugin,
128  CPL_PLUGIN_API,
129  SINFONI_BINARY_VERSION,
130  CPL_PLUGIN_TYPE_RECIPE,
131  "sinfo_step_objnod",
132  "Object data reduction",
133  "TBD",
134  "A. Modigliani",
135  "amodigli@eso.org",
136  "No license",
137  sinfo_step_objnod_create,
138  sinfo_step_objnod_exec,
139  sinfo_step_objnod_destroy);
140 
141  cpl_pluginlist_append(list, plugin);
142 
143  return 0;
144 
145 }
146 
147 
148 
149 /*
150  * The actual recipe actually start here.
151  */
152 
153 static int
154 sinfo_step_objnod(cpl_parameterlist *config, cpl_frameset *set)
155 {
156  int ind =0;
157 
158  sinfo_msg("------------------------------") ;
159  sinfo_msg("NODDING SCIENCE FRAMES");
160  sinfo_msg("------------------------------") ;
161  if ( -1 == (ind = sinfo_new_objnod(cpl_func,config,set,PRO_COADD_OBJ))) {
162  sinfo_msg("no: %d\n", ind) ;
163  return -1 ;
164  } else {
165  sinfo_msg("success");
166  }
167  return 0 ;
168 
169 }
170 
void irplib_reset(void)
Reset IRPLIB state.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.