SINFONI Pipeline Reference Manual  2.6.0
sinfo_step_psf.c
1 /* $Id: sinfo_step_psf.c,v 1.7 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.7 $
24  * $Name: not supported by cvs2svn $
25  */
26 
27 /****************************************************************
28  * _Step_Psf Frames Data Reduction *
29  ****************************************************************/
30 
31 #include <strings.h>
32 #include <string.h>
33 #include <stdio.h>
34 
35 #ifdef HAVE_CONFIG_H
36 #include <config.h> /* allows the program compilation */
37 #endif
38 #include <cpl.h>
39 #include <sinfo_pro_types.h>
40 #include <sinfo_psf_config.h>
41 #include <sinfo_new_psf.h>
42 #include <sinfo_tpl_utils.h>
43 #include <sinfo_msg.h>
44 #include <irplib_utils.h>
45 
46 /*-----------------------------------------------------------------------------
47  Functions prototypes
48  ----------------------------------------------------------------------------*/
49 
50 static int sinfo_step_psf(cpl_parameterlist *, cpl_frameset *);
51 static int sinfo_step_psf_create(cpl_plugin* plugin );
52 static int sinfo_step_psf_exec(cpl_plugin* plugin);
53 static int sinfo_step_psf_destroy(cpl_plugin* plugin);
54 
55 /*-----------------------------------------------------------------------------
56  Static variables
57  ----------------------------------------------------------------------------*/
58 static char sinfo_step_psf_description[] ="to debug\n";
59 
60 /*-----------------------------------------------------------------------------
61  Functions code
62  ----------------------------------------------------------------------------*/
63 
64 /*---------------------------------------------------------------------------*/
68 /*---------------------------------------------------------------------------*/
69 
70 /*---------------------------------------------------------------------------*/
79 /*---------------------------------------------------------------------------*/
80 
81 
82 int
83 cpl_plugin_get_info(cpl_pluginlist *list)
84 {
85 
86  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
87  cpl_plugin *plugin = &recipe->interface;
88 
89 
90  cpl_plugin_init(plugin,
91  CPL_PLUGIN_API,
92  SINFONI_BINARY_VERSION,
93  CPL_PLUGIN_TYPE_RECIPE,
94  "sinfo_step_psf",
95  "PSF determination",
96  sinfo_step_psf_description,
97  "A. Modigliani",
98  "amodigli@eso.org",
99  "No license",
100  sinfo_step_psf_create,
101  sinfo_step_psf_exec,
102  sinfo_step_psf_destroy);
103 
104  cpl_pluginlist_append(list, plugin);
105 
106  return 0;
107 
108 }
109 /*---------------------------------------------------------------------------*/
117 /*---------------------------------------------------------------------------*/
118 int
119 sinfo_step_psf_create(cpl_plugin *plugin)
120 {
121  cpl_recipe * recipe ;
122 
123  /* Check that the plugin is part of a valid recipe */
124  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
125  recipe = (cpl_recipe *)plugin ;
126  else return -1 ;
127 
128  /* Create the parameters list in the cpl_recipe object */
129  recipe->parameters = cpl_parameterlist_new() ;
130 
131  /*
132  * Fill the parameter list.
133  */
134  irplib_reset();
135  sinfo_psf_config_add(recipe->parameters);
136 
137  return 0;
138 
139 }
140 
141 
142 /*---------------------------------------------------------------------------*/
148 /*---------------------------------------------------------------------------*/
149 int
150 sinfo_step_psf_exec(cpl_plugin *plugin)
151 {
152 
153  cpl_recipe * recipe ;
154 
155  /* Get the recipe out of the plugin */
156  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
157  recipe = (cpl_recipe *)plugin ;
158  else return -1 ;
159 
160  return sinfo_step_psf(recipe->parameters, recipe->frames);
161 
162 }
163 /*---------------------------------------------------------------------------*/
169 /*---------------------------------------------------------------------------*/
170 
171 int
172 sinfo_step_psf_destroy(cpl_plugin *plugin)
173 {
174  cpl_recipe * recipe ;
175 
176  /* Get the recipe out of the plugin */
177  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
178  recipe = (cpl_recipe *)plugin ;
179  else return -1 ;
180 
181  cpl_parameterlist_delete(recipe->parameters);
182 
183  return 0;
184 
185 }
186 /*---------------------------------------------------------------------------*/
193 /*---------------------------------------------------------------------------*/
194 
195 /*
196  * The actual recipe actually start here.
197  */
198 
199 static int
200 sinfo_step_psf(cpl_parameterlist *config, cpl_frameset *set)
201 {
202 
203  int ind =0;
204 
205 
206  sinfo_msg("running") ;
207  if ( -1 == (ind = sinfo_new_psf(cpl_func,config,set) ) )
208  {
209  sinfo_msg("no: %d\n", ind) ;
210  return -1 ;
211  }
212  sinfo_msg ("success\n") ;
213 
214  return 0 ;
215 }
void irplib_reset(void)
Reset IRPLIB state.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.