35 #include "muse_quick_image_z.h"
57 static const char *muse_quick_image_help =
58 "This recipe is designed for quick operation on the instrument workstation, so it does not e.g. take into account spectral curvature on the CCD. This will create some artifacts on the output image, but these will not affect the use of this quick-look image. Selection of the wavelength range is done using the mask image (see Sect. 5.2 of the DRL Design document for a description of the format).";
60 static const char *muse_quick_image_help_esorex =
62 "\n Frame tag Type Req #Fr Description"
63 "\n -------------------- ---- --- --- ------------"
64 "\n any raw Y Raw exposure"
65 "\n BIAS raw . 1 Raw data taken with zero exposure time and closed shutter"
66 "\n FLAT raw . 1 Raw exposure of a continuum lamp exposure illuminating the whole field of view"
67 "\n MASK_IMAGE calib Y 1 Image masks for quick image reconstruction"
68 "\n\nProduct frames for raw frame tag \"\":\n"
69 "\n Frame tag Level Description"
70 "\n -------------------- -------- ------------"
71 "\n QUICK_IMAGE final Final quick-look image";
82 static cpl_recipeconfig *
83 muse_quick_image_new_recipeconfig(
void)
85 cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
89 cpl_recipeconfig_set_tag(recipeconfig, tag, 1, -1);
91 cpl_recipeconfig_set_tag(recipeconfig, tag, -1, 1);
93 cpl_recipeconfig_set_tag(recipeconfig, tag, -1, 1);
94 cpl_recipeconfig_set_input(recipeconfig, tag,
"MASK_IMAGE", 1, 1);
95 cpl_recipeconfig_set_output(recipeconfig, tag,
"QUICK_IMAGE");
111 static cpl_error_code
112 muse_quick_image_prepare_header(
const char *aFrametag, cpl_propertylist *aHeader)
114 cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
115 cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
116 if (!strcmp(aFrametag,
"QUICK_IMAGE")) {
118 cpl_msg_warning(__func__,
"Frame tag %s is not defined", aFrametag);
119 return CPL_ERROR_ILLEGAL_INPUT;
121 return CPL_ERROR_NONE;
134 static cpl_frame_level
135 muse_quick_image_get_frame_level(
const char *aFrametag)
138 return CPL_FRAME_LEVEL_NONE;
140 if (!strcmp(aFrametag,
"QUICK_IMAGE")) {
141 return CPL_FRAME_LEVEL_FINAL;
143 return CPL_FRAME_LEVEL_NONE;
157 muse_quick_image_get_frame_mode(
const char *aFrametag)
162 if (!strcmp(aFrametag,
"QUICK_IMAGE")) {
180 muse_quick_image_create(cpl_plugin *aPlugin)
184 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
185 recipe = (cpl_recipe *)aPlugin;
193 muse_quick_image_new_recipeconfig(),
194 muse_quick_image_prepare_header,
195 muse_quick_image_get_frame_level,
196 muse_quick_image_get_frame_mode);
201 cpl_msg_set_time_on();
205 recipe->parameters = cpl_parameterlist_new();
210 p = cpl_parameter_new_range(
"muse.muse_quick_image.nifu",
212 "IFU to handle. If set to 0, all IFUs are processed serially. If set to -1, all IFUs are processed in parallel.",
213 "muse.muse_quick_image",
217 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG,
"nifu");
218 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"nifu");
220 cpl_parameterlist_append(recipe->parameters, p);
240 cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
241 cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
244 p = cpl_parameterlist_find(aParameters,
"muse.muse_quick_image.nifu");
245 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
246 aParams->
nifu = cpl_parameter_get_int(p);
260 muse_quick_image_exec(cpl_plugin *aPlugin)
262 if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
265 cpl_recipe *recipe = (cpl_recipe *)aPlugin;
266 cpl_msg_set_threadid_on();
268 cpl_frameset *usedframes = cpl_frameset_new(),
269 *outframes = cpl_frameset_new();
271 muse_quick_image_params_fill(¶ms, recipe->parameters);
273 cpl_errorstate prestate = cpl_errorstate_get();
277 int rc = muse_quick_image_compute(proc, ¶ms);
278 cpl_frameset_join(usedframes, proc->
usedFrames);
282 if (!cpl_errorstate_is_equal(prestate)) {
286 cpl_msg_set_level(CPL_MSG_INFO);
296 cpl_frameset_join(recipe->frames, usedframes);
297 cpl_frameset_join(recipe->frames, outframes);
298 cpl_frameset_delete(usedframes);
299 cpl_frameset_delete(outframes);
312 muse_quick_image_destroy(cpl_plugin *aPlugin)
316 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
317 recipe = (cpl_recipe *)aPlugin;
323 cpl_parameterlist_delete(recipe->parameters);
340 cpl_plugin_get_info(cpl_pluginlist *aList)
342 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
343 cpl_plugin *plugin = &recipe->interface;
347 helptext = cpl_sprintf(
"%s%s", muse_quick_image_help,
348 muse_quick_image_help_esorex);
350 helptext = cpl_sprintf(
"%s", muse_quick_image_help);
354 cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
355 CPL_PLUGIN_TYPE_RECIPE,
357 "Carry out quick image reconstruction: create an image of the field of view in the fastest possible way for a visual check of the telescope pointing.",
359 "Peter Weilbacher (based on Arlette Pecontal's makeima)",
362 muse_quick_image_create,
363 muse_quick_image_exec,
364 muse_quick_image_destroy);
365 cpl_pluginlist_append(aList, plugin);
Structure to hold the parameters of the muse_quick_image recipe.
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
const char * muse_get_license(void)
Get the pipeline copyright and license.
muse_processing * muse_processing_new(const char *aRecipeName, cpl_recipe *aRecipe)
Create a new processing structure.
cpl_frameset * outputFrames
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.
cpl_frameset * usedFrames
int nifu
IFU to handle. If set to 0, all IFUs are processed serially. If set to -1, all IFUs are processed in ...