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_dsptrn_create(cpl_plugin *) ;
50 static int midi_dsptrn_exec(cpl_plugin *) ;
51 static int midi_dsptrn_destroy(cpl_plugin *) ;
52 static int midi_dsptrn(cpl_parameterlist *, cpl_frameset *) ;
58 static char midi_dsptrn_description[] =
59 "The purpose of this technical template is to measure the transmission\n"
60 "characteristics of the dispersive elements (Prism and Grism) in order\n"
61 "to monitor the evolution of their coatings.\n\n"
63 " DO category: Type: Explanation: Required:\n"
64 " DSPTRN Raw Raw data frame Y\n\n"
66 " DO category: Data type: Explanation:\n"
67 " REDUCED_DSPTRN FITS image transmission coefficient\n\n";
85 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe ) ;
86 cpl_plugin * plugin = &recipe->interface ;
88 cpl_plugin_init(plugin,
91 CPL_PLUGIN_TYPE_RECIPE,
93 "Evaluates the dispersive characteristics of the Grism/Prism",
94 midi_dsptrn_description,
100 midi_dsptrn_destroy) ;
102 cpl_pluginlist_append(list, plugin) ;
116 static int midi_dsptrn_create(cpl_plugin * plugin)
118 cpl_recipe * recipe ;
122 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
123 recipe = (cpl_recipe *)plugin ;
127 recipe->parameters = cpl_parameterlist_new() ;
158 static int midi_dsptrn_exec(cpl_plugin * plugin)
161 cpl_recipe * recipe ;
164 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
165 recipe = (cpl_recipe *)plugin ;
169 return midi_dsptrn(recipe->parameters, recipe->frames) ;
180 static int midi_dsptrn_destroy(cpl_plugin * plugin)
182 cpl_recipe * recipe ;
185 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
186 recipe = (cpl_recipe *)plugin ;
189 cpl_parameterlist_delete(recipe->parameters) ;
201 static int midi_dsptrn(
202 cpl_parameterlist *parlist,
203 cpl_frameset *frameset)
207 cpl_frame *current_frame;
234 current_frame = cpl_frameset_get_first(frameset);
235 sofPtr = fopen (
"MIDI_sof.log",
"w");
236 while ( current_frame && sofPtr )
238 fprintf (sofPtr,
"%s \n", (
char *)cpl_frame_get_filename( current_frame ));
239 current_frame = cpl_frameset_get_next( frameset );
244 executeDataReduction (
"",
"",
"./", plotDuration,
"MIDI_sof.log", &error,parlist,frameset);
247 if (error)
return -1;
248 remove (
"MIDI_sof.log");
251 if (CPL_ERROR_NONE != appendPropertylist(
"MIDI_b1_trn.pro.fits", CPL_FRAME_TYPE_IMAGE,
"REDUCED_DSPTRN",frameset,parlist))
253 cpl_msg_error(cpl_func,
"Error in appendPropertylist");
311 if (cpl_error_get_code())