38 #include "midi_utils.h"
39 #include "midi_pfits.h"
41 #include "midiControl.h"
42 #include "midiGlobal.h"
43 #include "midiAppendPropertylist.h"
49 static int midi_detron_create(cpl_plugin *) ;
50 static int midi_detron_exec(cpl_plugin *) ;
51 static int midi_detron_destroy(cpl_plugin *) ;
52 static int midi_detron(cpl_parameterlist *, cpl_frameset *) ;
58 static char midi_detron_description[] =
59 "The purpose of this technical recipe is to evaluate the read-out noise\n"
60 "of the detector.\n\n"
62 " DO category: Type: Explanation: Required:\n"
63 " DETRON Raw Raw data frame Y\n\n"
65 " DO category: Data type: Explanation:\n"
66 " REDUCED_DETRON FITS image detector read-out noise\n\n";
84 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe ) ;
85 cpl_plugin * plugin = &recipe->interface ;
87 cpl_plugin_init(plugin,
90 CPL_PLUGIN_TYPE_RECIPE,
92 "Evaluates the detectors Readout Noise",
93 midi_detron_description,
99 midi_detron_destroy) ;
101 cpl_pluginlist_append(list, plugin) ;
115 static int midi_detron_create(cpl_plugin * plugin)
117 cpl_recipe * recipe ;
121 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
122 recipe = (cpl_recipe *)plugin ;
126 recipe->parameters = cpl_parameterlist_new() ;
157 static int midi_detron_exec(cpl_plugin * plugin)
159 cpl_recipe * recipe ;
162 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
163 recipe = (cpl_recipe *)plugin ;
167 return midi_detron(recipe->parameters, recipe->frames) ;
177 static int midi_detron_destroy(cpl_plugin * plugin)
179 cpl_recipe * recipe ;
182 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
183 recipe = (cpl_recipe *)plugin ;
186 cpl_parameterlist_delete(recipe->parameters) ;
198 static int midi_detron(
199 cpl_parameterlist *parlist,
200 cpl_frameset *frameset)
204 cpl_frame *current_frame;
229 current_frame = cpl_frameset_get_first(frameset);
230 sofPtr = fopen (
"MIDI_sof.log",
"w");
231 while ( current_frame && sofPtr )
233 fprintf (sofPtr,
"%s \n", (
char *)cpl_frame_get_filename( current_frame ));
234 current_frame = cpl_frameset_get_next( frameset );
239 executeDataReduction (
"",
"",
"./", plotDuration,
"MIDI_sof.log", &error,parlist,frameset);
241 if (error)
return -1;
242 remove (
"MIDI_sof.log");
245 if (CPL_ERROR_NONE != appendPropertylist(
"MIDI_b1_ron.pro.fits", CPL_FRAME_TYPE_IMAGE,
"REDUCED_DETRON",frameset,parlist))
247 cpl_msg_error(cpl_func,
"Error in appendPropertylist");
252 if (cpl_error_get_code())