35 #include "muse_illum_z.h" 58 static const char *muse_illum_help =
59 "The recipe copies the data of an illumination flat-field unmodified to the output file. However it alters the header data such that the result is a DFS compliant product file, which can be used in the on-line pipeline environment to correct the illumination of twilight and/or science observations. This recipe has no use in any environment other than the on-line pipeline environment!";
61 static const char *muse_illum_help_esorex =
62 "\n\nInput frames for raw frame tag \"ILLUMFLAT\":\n" 63 "\n Frame tag Type Req #Fr Description" 64 "\n -------------------- ---- --- --- ------------" 65 "\n ILLUMFLAT raw Y 1 Illumination flat-field frame" 66 "\n\nProduct frames for raw frame tag \"ILLUMFLAT\":\n" 67 "\n Frame tag Level Description" 68 "\n -------------------- -------- ------------" 69 "\n ILLUM final \"Processed\" illumination flat-field";
80 static cpl_recipeconfig *
81 muse_illum_new_recipeconfig(
void)
83 cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
85 cpl_recipeconfig_set_tag(recipeconfig,
"ILLUMFLAT", 1, 1);
86 cpl_recipeconfig_set_output(recipeconfig,
"ILLUMFLAT",
"ILLUM");
102 static cpl_error_code
103 muse_illum_prepare_header(
const char *aFrametag, cpl_propertylist *aHeader)
105 cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
106 cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
107 if (!strcmp(aFrametag,
"ILLUM")) {
109 cpl_msg_warning(__func__,
"Frame tag %s is not defined", aFrametag);
110 return CPL_ERROR_ILLEGAL_INPUT;
112 return CPL_ERROR_NONE;
125 static cpl_frame_level
126 muse_illum_get_frame_level(
const char *aFrametag)
129 return CPL_FRAME_LEVEL_NONE;
131 if (!strcmp(aFrametag,
"ILLUM")) {
132 return CPL_FRAME_LEVEL_FINAL;
134 return CPL_FRAME_LEVEL_NONE;
148 muse_illum_get_frame_mode(
const char *aFrametag)
153 if (!strcmp(aFrametag,
"ILLUM")) {
171 muse_illum_create(cpl_plugin *aPlugin)
175 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
176 recipe = (cpl_recipe *)aPlugin;
184 muse_illum_new_recipeconfig(),
185 muse_illum_prepare_header,
186 muse_illum_get_frame_level,
187 muse_illum_get_frame_mode);
192 cpl_msg_set_time_on();
196 recipe->parameters = cpl_parameterlist_new();
218 cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
219 cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
234 muse_illum_exec(cpl_plugin *aPlugin)
236 if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
240 cpl_recipe *recipe = (cpl_recipe *)aPlugin;
241 cpl_msg_set_threadid_on();
243 cpl_frameset *usedframes = cpl_frameset_new(),
244 *outframes = cpl_frameset_new();
246 muse_illum_params_fill(¶ms, recipe->parameters);
248 cpl_errorstate prestate = cpl_errorstate_get();
252 int rc = muse_illum_compute(proc, ¶ms);
253 cpl_frameset_join(usedframes, proc->
usedframes);
254 cpl_frameset_join(outframes, proc->
outframes);
257 if (!cpl_errorstate_is_equal(prestate)) {
261 cpl_msg_set_level(CPL_MSG_INFO);
272 cpl_frameset_join(recipe->frames, usedframes);
273 cpl_frameset_join(recipe->frames, outframes);
274 cpl_frameset_delete(usedframes);
275 cpl_frameset_delete(outframes);
288 muse_illum_destroy(cpl_plugin *aPlugin)
292 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
293 recipe = (cpl_recipe *)aPlugin;
299 cpl_parameterlist_delete(recipe->parameters);
316 cpl_plugin_get_info(cpl_pluginlist *aList)
318 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
319 cpl_plugin *plugin = &recipe->interface;
323 helptext = cpl_sprintf(
"%s%s", muse_illum_help,
324 muse_illum_help_esorex);
326 helptext = cpl_sprintf(
"%s", muse_illum_help);
330 cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
331 CPL_PLUGIN_TYPE_RECIPE,
333 "Dummy recipe to convert a raw illumination flat field into a DFS product",
341 cpl_pluginlist_append(aList, plugin);
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
Structure to hold the parameters of the muse_illum recipe.
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
cpl_frameset * usedframes
muse_processing * muse_processing_new(const char *aName, cpl_recipe *aRecipe)
Create a new processing structure.
const char * muse_get_license(void)
Get the pipeline copyright and license.
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
void muse_processinginfo_delete(cpl_recipe *)
Clear all information from the processing info and from the recipe config.
cpl_error_code muse_cplframeset_erase_duplicate(cpl_frameset *aFrames)
Erase all duplicate frames from a frameset.
cpl_error_code muse_cplframeset_erase_all(cpl_frameset *aFrames)
Erase all frames in a frameset.
void muse_processinginfo_register(cpl_recipe *, cpl_recipeconfig *, muse_processing_prepare_header_func *, muse_processing_get_frame_level_func *, muse_processing_get_frame_mode_func *)
Register extended functionalities for MUSE recipes.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.