MUSE Pipeline Reference Manual  2.5.2
muse_exp_align_z.c
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set sw=2 sts=2 et cin: */
3 /*
4  * This file is part of the MUSE Instrument Pipeline
5  * Copyright (C) 2005-2015 European Southern Observatory
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 /* This file was automatically generated */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 /*----------------------------------------------------------------------------*
29  * Includes *
30  *----------------------------------------------------------------------------*/
31 #include <string.h> /* strcmp(), strstr() */
32 #include <strings.h> /* strcasecmp() */
33 #include <cpl.h>
34 
35 #include "muse_exp_align_z.h" /* in turn includes muse.h */
36 
37 /*----------------------------------------------------------------------------*/
48 /*----------------------------------------------------------------------------*/
51 /*----------------------------------------------------------------------------*
52  * Static variables *
53  *----------------------------------------------------------------------------*/
54 static const char *muse_exp_align_help =
55  "Compute the coordinate offset for each input field-of-view image with respect to a reference. The created list of coordinate offsets can then be used in muse_exp_combine as the field coordinate offsets to properly align the exposures during their combination.";
56 
57 static const char *muse_exp_align_help_esorex =
58  "\n\nInput frames for raw frame tag \"IMAGE_FOV\":\n"
59  "\n Frame tag Type Req #Fr Description"
60  "\n -------------------- ---- --- --- ------------"
61  "\n IMAGE_FOV raw Y >=2 Input field-of-view images"
62  "\n\nProduct frames for raw frame tag \"IMAGE_FOV\":\n"
63  "\n Frame tag Level Description"
64  "\n -------------------- -------- ------------"
65  "\n SOURCE_LIST final List of parameters of the detected point sources."
66  "\n OFFSET_LIST final List of computed coordinate offsets.";
67 
68 /*----------------------------------------------------------------------------*/
76 /*----------------------------------------------------------------------------*/
77 static cpl_recipeconfig *
78 muse_exp_align_new_recipeconfig(void)
79 {
80  cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
81 
82  cpl_recipeconfig_set_tag(recipeconfig, "IMAGE_FOV", 2, -1);
83  cpl_recipeconfig_set_output(recipeconfig, "IMAGE_FOV", "SOURCE_LIST");
84  cpl_recipeconfig_set_output(recipeconfig, "IMAGE_FOV", "OFFSET_LIST");
85 
86  return recipeconfig;
87 } /* muse_exp_align_new_recipeconfig() */
88 
89 /*----------------------------------------------------------------------------*/
99 /*----------------------------------------------------------------------------*/
100 static cpl_error_code
101 muse_exp_align_prepare_header(const char *aFrametag, cpl_propertylist *aHeader)
102 {
103  cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
104  cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
105  if (!strcmp(aFrametag, "SOURCE_LIST")) {
106  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN NDET",
107  CPL_TYPE_INT,
108  "Number of detected sources.");
109  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN BKG MEDIAN",
110  CPL_TYPE_FLOAT,
111  "Median value of background pixels.");
112  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN BKG MAD",
113  CPL_TYPE_FLOAT,
114  "Median absolute deviation of the background pixels.");
115  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN THRESHOLD",
116  CPL_TYPE_FLOAT,
117  "Detection threshold used for detecting sources.");
118  } else if (!strcmp(aFrametag, "OFFSET_LIST")) {
119  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN NDET[0-9]+",
120  CPL_TYPE_INT,
121  "Number of detected sources for input image i");
122  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN NMATCH[0-9]+",
123  CPL_TYPE_INT,
124  "Median number of matches of input image i with other images");
125  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN NMATCH MIN",
126  CPL_TYPE_INT,
127  "Minimum of the median number of matches for all input images");
128  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN NOMATCH",
129  CPL_TYPE_INT,
130  "Number of input images that do not have any matches with other images");
131  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET RA MIN",
132  CPL_TYPE_FLOAT,
133  "[arcsec] RA minimum offset.");
134  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET RA MAX",
135  CPL_TYPE_FLOAT,
136  "[arcsec] RA maximum offset.");
137  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET RA MEAN",
138  CPL_TYPE_FLOAT,
139  "[arcsec] RA mean offset.");
140  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET RA STDEV",
141  CPL_TYPE_FLOAT,
142  "[arcsec] Standard deviation of RA offsets.");
143  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET DEC MIN",
144  CPL_TYPE_FLOAT,
145  "[arcsec] DEC minimum offset.");
146  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET DEC MAX",
147  CPL_TYPE_FLOAT,
148  "[arcsec] DEC maximum offset.");
149  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET DEC MEAN",
150  CPL_TYPE_FLOAT,
151  "[arcsec] DEC mean offset.");
152  muse_processing_prepare_property(aHeader, "ESO QC EXPALIGN OFFSET DEC STDEV",
153  CPL_TYPE_FLOAT,
154  "[arcsec] Standard deviation of DEC offsets.");
155  } else {
156  cpl_msg_warning(__func__, "Frame tag %s is not defined", aFrametag);
157  return CPL_ERROR_ILLEGAL_INPUT;
158  }
159  return CPL_ERROR_NONE;
160 } /* muse_exp_align_prepare_header() */
161 
162 /*----------------------------------------------------------------------------*/
171 /*----------------------------------------------------------------------------*/
172 static cpl_frame_level
173 muse_exp_align_get_frame_level(const char *aFrametag)
174 {
175  if (!aFrametag) {
176  return CPL_FRAME_LEVEL_NONE;
177  }
178  if (!strcmp(aFrametag, "SOURCE_LIST")) {
179  return CPL_FRAME_LEVEL_FINAL;
180  }
181  if (!strcmp(aFrametag, "OFFSET_LIST")) {
182  return CPL_FRAME_LEVEL_FINAL;
183  }
184  return CPL_FRAME_LEVEL_NONE;
185 } /* muse_exp_align_get_frame_level() */
186 
187 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 static muse_frame_mode
198 muse_exp_align_get_frame_mode(const char *aFrametag)
199 {
200  if (!aFrametag) {
201  return MUSE_FRAME_MODE_ALL;
202  }
203  if (!strcmp(aFrametag, "SOURCE_LIST")) {
205  }
206  if (!strcmp(aFrametag, "OFFSET_LIST")) {
207  return MUSE_FRAME_MODE_MASTER;
208  }
209  return MUSE_FRAME_MODE_ALL;
210 } /* muse_exp_align_get_frame_mode() */
211 
212 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 static int
224 muse_exp_align_create(cpl_plugin *aPlugin)
225 {
226  /* Check that the plugin is part of a valid recipe */
227  cpl_recipe *recipe;
228  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
229  recipe = (cpl_recipe *)aPlugin;
230  } else {
231  return -1;
232  }
233 
234  /* register the extended processing information (new FITS header creation, *
235  * getting of the frame level for a certain tag) */
237  muse_exp_align_new_recipeconfig(),
238  muse_exp_align_prepare_header,
239  muse_exp_align_get_frame_level,
240  muse_exp_align_get_frame_mode);
241 
242  /* XXX initialize timing in messages *
243  * since at least esorex is too stupid to turn it on, we have to do it */
245  cpl_msg_set_time_on();
246  }
247 
248  /* Create the parameter list in the cpl_recipe object */
249  recipe->parameters = cpl_parameterlist_new();
250  /* Fill the parameters list */
251  cpl_parameter *p;
252 
253  /* --rsearch:
254  Search radius (in arcsec) for each iteration of the offset computation.
255  */
256  p = cpl_parameter_new_value("muse.muse_exp_align.rsearch",
257  CPL_TYPE_STRING,
258  "Search radius (in arcsec) for each iteration of the offset computation.",
259  "muse.muse_exp_align",
260  (const char *)"30.,4.,2.,0.8");
261  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "rsearch");
262  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rsearch");
263 
264  cpl_parameterlist_append(recipe->parameters, p);
265 
266  /* --nbins:
267  Number of bins to use for 2D histogram on the first iteration of the
268  offset computation.
269  */
270  p = cpl_parameter_new_value("muse.muse_exp_align.nbins",
271  CPL_TYPE_INT,
272  "Number of bins to use for 2D histogram on the first iteration of the offset computation.",
273  "muse.muse_exp_align",
274  (int)60);
275  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "nbins");
276  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "nbins");
277 
278  cpl_parameterlist_append(recipe->parameters, p);
279 
280  /* --weight: Use weighting. */
281  p = cpl_parameter_new_value("muse.muse_exp_align.weight",
282  CPL_TYPE_BOOL,
283  "Use weighting.",
284  "muse.muse_exp_align",
285  (int)TRUE);
286  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "weight");
287  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "weight");
288 
289  cpl_parameterlist_append(recipe->parameters, p);
290 
291  /* --fwhm: FWHM in pixels of the convolution filter. */
292  p = cpl_parameter_new_value("muse.muse_exp_align.fwhm",
293  CPL_TYPE_DOUBLE,
294  "FWHM in pixels of the convolution filter.",
295  "muse.muse_exp_align",
296  (double)5.);
297  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "fwhm");
298  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "fwhm");
299 
300  cpl_parameterlist_append(recipe->parameters, p);
301 
302  /* --threshold:
303  Initial intensity threshold for detecting point sources. If the value
304  is negative or zero the threshold is taken as sigma above median
305  background MAD. If it is larger than zero the threshold is taken as
306  absolute background level.
307  */
308  p = cpl_parameter_new_value("muse.muse_exp_align.threshold",
309  CPL_TYPE_DOUBLE,
310  "Initial intensity threshold for detecting point sources. If the value is negative or zero the threshold is taken as sigma above median background MAD. If it is larger than zero the threshold is taken as absolute background level.",
311  "muse.muse_exp_align",
312  (double)15.);
313  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "threshold");
314  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "threshold");
315 
316  cpl_parameterlist_append(recipe->parameters, p);
317 
318  /* --bkgignore:
319  Fraction of the image to be ignored.
320  */
321  p = cpl_parameter_new_value("muse.muse_exp_align.bkgignore",
322  CPL_TYPE_DOUBLE,
323  "Fraction of the image to be ignored.",
324  "muse.muse_exp_align",
325  (double)0.05);
326  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "bkgignore");
327  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bkgignore");
328 
329  cpl_parameterlist_append(recipe->parameters, p);
330 
331  /* --bkgfraction:
332  Fraction of the image (without the ignored part) to be considered as
333  background.
334  */
335  p = cpl_parameter_new_value("muse.muse_exp_align.bkgfraction",
336  CPL_TYPE_DOUBLE,
337  "Fraction of the image (without the ignored part) to be considered as background.",
338  "muse.muse_exp_align",
339  (double)0.10);
340  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "bkgfraction");
341  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "bkgfraction");
342 
343  cpl_parameterlist_append(recipe->parameters, p);
344 
345  /* --step: Increment/decrement of the threshold value in subsequent iterations. */
346  p = cpl_parameter_new_value("muse.muse_exp_align.step",
347  CPL_TYPE_DOUBLE,
348  "Increment/decrement of the threshold value in subsequent iterations.",
349  "muse.muse_exp_align",
350  (double)0.5);
351  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "step");
352  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "step");
353 
354  cpl_parameterlist_append(recipe->parameters, p);
355 
356  /* --iterations: Maximum number of iterations used for detecting sources. */
357  p = cpl_parameter_new_value("muse.muse_exp_align.iterations",
358  CPL_TYPE_INT,
359  "Maximum number of iterations used for detecting sources.",
360  "muse.muse_exp_align",
361  (int)100000);
362  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "iterations");
363  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "iterations");
364 
365  cpl_parameterlist_append(recipe->parameters, p);
366 
367  /* --srcmin: Minimum number of sources which must be found. */
368  p = cpl_parameter_new_value("muse.muse_exp_align.srcmin",
369  CPL_TYPE_INT,
370  "Minimum number of sources which must be found.",
371  "muse.muse_exp_align",
372  (int)5);
373  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "srcmin");
374  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "srcmin");
375 
376  cpl_parameterlist_append(recipe->parameters, p);
377 
378  /* --srcmax: Maximum number of sources which may be found. */
379  p = cpl_parameter_new_value("muse.muse_exp_align.srcmax",
380  CPL_TYPE_INT,
381  "Maximum number of sources which may be found.",
382  "muse.muse_exp_align",
383  (int)80);
384  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "srcmax");
385  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "srcmax");
386 
387  cpl_parameterlist_append(recipe->parameters, p);
388 
389  /* --roundmin: Lower limit of the allowed point-source roundness. */
390  p = cpl_parameter_new_value("muse.muse_exp_align.roundmin",
391  CPL_TYPE_DOUBLE,
392  "Lower limit of the allowed point-source roundness.",
393  "muse.muse_exp_align",
394  (double)-1.);
395  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "roundmin");
396  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "roundmin");
397 
398  cpl_parameterlist_append(recipe->parameters, p);
399 
400  /* --roundmax: Upper limit of the allowed point-source roundness. */
401  p = cpl_parameter_new_value("muse.muse_exp_align.roundmax",
402  CPL_TYPE_DOUBLE,
403  "Upper limit of the allowed point-source roundness.",
404  "muse.muse_exp_align",
405  (double)1.);
406  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "roundmax");
407  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "roundmax");
408 
409  cpl_parameterlist_append(recipe->parameters, p);
410 
411  /* --sharpmin: Lower limit of the allowed point-source sharpness. */
412  p = cpl_parameter_new_value("muse.muse_exp_align.sharpmin",
413  CPL_TYPE_DOUBLE,
414  "Lower limit of the allowed point-source sharpness.",
415  "muse.muse_exp_align",
416  (double)0.2);
417  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "sharpmin");
418  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sharpmin");
419 
420  cpl_parameterlist_append(recipe->parameters, p);
421 
422  /* --sharpmax: Upper limit of the allowed point-source sharpness. */
423  p = cpl_parameter_new_value("muse.muse_exp_align.sharpmax",
424  CPL_TYPE_DOUBLE,
425  "Upper limit of the allowed point-source sharpness.",
426  "muse.muse_exp_align",
427  (double)1.);
428  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "sharpmax");
429  cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sharpmax");
430 
431  cpl_parameterlist_append(recipe->parameters, p);
432 
433  return 0;
434 } /* muse_exp_align_create() */
435 
436 /*----------------------------------------------------------------------------*/
447 /*----------------------------------------------------------------------------*/
448 static int
449 muse_exp_align_params_fill(muse_exp_align_params_t *aParams, cpl_parameterlist *aParameters)
450 {
451  cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
452  cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
453  cpl_parameter *p;
454 
455  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.rsearch");
456  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
457  aParams->rsearch = cpl_parameter_get_string(p);
458 
459  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.nbins");
460  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
461  aParams->nbins = cpl_parameter_get_int(p);
462 
463  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.weight");
464  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
465  aParams->weight = cpl_parameter_get_bool(p);
466 
467  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.fwhm");
468  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
469  aParams->fwhm = cpl_parameter_get_double(p);
470 
471  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.threshold");
472  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
473  aParams->threshold = cpl_parameter_get_double(p);
474 
475  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.bkgignore");
476  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
477  aParams->bkgignore = cpl_parameter_get_double(p);
478 
479  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.bkgfraction");
480  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
481  aParams->bkgfraction = cpl_parameter_get_double(p);
482 
483  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.step");
484  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
485  aParams->step = cpl_parameter_get_double(p);
486 
487  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.iterations");
488  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
489  aParams->iterations = cpl_parameter_get_int(p);
490 
491  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.srcmin");
492  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
493  aParams->srcmin = cpl_parameter_get_int(p);
494 
495  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.srcmax");
496  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
497  aParams->srcmax = cpl_parameter_get_int(p);
498 
499  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.roundmin");
500  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
501  aParams->roundmin = cpl_parameter_get_double(p);
502 
503  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.roundmax");
504  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
505  aParams->roundmax = cpl_parameter_get_double(p);
506 
507  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.sharpmin");
508  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
509  aParams->sharpmin = cpl_parameter_get_double(p);
510 
511  p = cpl_parameterlist_find(aParameters, "muse.muse_exp_align.sharpmax");
512  cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
513  aParams->sharpmax = cpl_parameter_get_double(p);
514 
515  return 0;
516 } /* muse_exp_align_params_fill() */
517 
518 /*----------------------------------------------------------------------------*/
525 /*----------------------------------------------------------------------------*/
526 static int
527 muse_exp_align_exec(cpl_plugin *aPlugin)
528 {
529  if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
530  return -1;
531  }
533  cpl_recipe *recipe = (cpl_recipe *)aPlugin;
534  cpl_msg_set_threadid_on();
535 
536  cpl_frameset *usedframes = cpl_frameset_new(),
537  *outframes = cpl_frameset_new();
539  muse_exp_align_params_fill(&params, recipe->parameters);
540 
541  cpl_errorstate prestate = cpl_errorstate_get();
542 
543  muse_processing *proc = muse_processing_new("muse_exp_align",
544  recipe);
545  int rc = muse_exp_align_compute(proc, &params);
546  cpl_frameset_join(usedframes, proc->usedframes);
547  cpl_frameset_join(outframes, proc->outframes);
549 
550  if (!cpl_errorstate_is_equal(prestate)) {
551  /* dump all errors from this recipe in chronological order */
552  cpl_errorstate_dump(prestate, CPL_FALSE, muse_cplerrorstate_dump_some);
553  /* reset message level to not get the same errors displayed again by esorex */
554  cpl_msg_set_level(CPL_MSG_INFO);
555  }
556  /* clean up duplicates in framesets of used and output frames */
559 
560  /* to get esorex to see our classification (frame groups etc.), *
561  * replace the original frameset with the list of used frames *
562  * before appending product output frames */
563  /* keep the same pointer, so just erase all frames, not delete the frameset */
564  muse_cplframeset_erase_all(recipe->frames);
565  cpl_frameset_join(recipe->frames, usedframes);
566  cpl_frameset_join(recipe->frames, outframes);
567  cpl_frameset_delete(usedframes);
568  cpl_frameset_delete(outframes);
569  return rc;
570 } /* muse_exp_align_exec() */
571 
572 /*----------------------------------------------------------------------------*/
579 /*----------------------------------------------------------------------------*/
580 static int
581 muse_exp_align_destroy(cpl_plugin *aPlugin)
582 {
583  /* Get the recipe from the plugin */
584  cpl_recipe *recipe;
585  if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
586  recipe = (cpl_recipe *)aPlugin;
587  } else {
588  return -1;
589  }
590 
591  /* Clean up */
592  cpl_parameterlist_delete(recipe->parameters);
594  return 0;
595 } /* muse_exp_align_destroy() */
596 
597 /*----------------------------------------------------------------------------*/
607 /*----------------------------------------------------------------------------*/
608 int
609 cpl_plugin_get_info(cpl_pluginlist *aList)
610 {
611  cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
612  cpl_plugin *plugin = &recipe->interface;
613 
614  char *helptext;
616  helptext = cpl_sprintf("%s%s", muse_exp_align_help,
617  muse_exp_align_help_esorex);
618  } else {
619  helptext = cpl_sprintf("%s", muse_exp_align_help);
620  }
621 
622  /* Initialize the CPL plugin stuff for this module */
623  cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
624  CPL_PLUGIN_TYPE_RECIPE,
625  "muse_exp_align",
626  "Create a coordinate offset table to be used to align exposures during exposure combination.",
627  helptext,
628  "Ralf Palsa",
629  "usd-help@eso.org",
631  muse_exp_align_create,
632  muse_exp_align_exec,
633  muse_exp_align_destroy);
634  cpl_pluginlist_append(aList, plugin);
635  cpl_free(helptext);
636 
637  return 0;
638 } /* cpl_plugin_get_info() */
639 
int srcmin
Minimum number of sources which must be found.
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
int weight
Use weighting.
double fwhm
FWHM in pixels of the convolution filter.
muse_cplframework_type muse_cplframework(void)
Return the CPL framework the recipe is run under.
double roundmax
Upper limit of the allowed point-source roundness.
double step
Increment/decrement of the threshold value in subsequent iterations.
cpl_frameset * usedframes
muse_processing * muse_processing_new(const char *aName, cpl_recipe *aRecipe)
Create a new processing structure.
double bkgfraction
Fraction of the image (without the ignored part) to be considered as background.
double sharpmax
Upper limit of the allowed point-source sharpness.
const char * muse_get_license(void)
Get the pipeline copyright and license.
Definition: muse_utils.c:83
Structure to hold the parameters of the muse_exp_align recipe.
int srcmax
Maximum number of sources which may be found.
muse_frame_mode
double threshold
Initial intensity threshold for detecting point sources. If the value is negative or zero the thresho...
cpl_frameset * outframes
int iterations
Maximum number of iterations used for detecting sources.
int nbins
Number of bins to use for 2D histogram on the first iteration of the offset computation.
double bkgignore
Fraction of the image to be ignored.
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.
const char * rsearch
Search radius (in arcsec) for each iteration of the offset computation.
cpl_error_code muse_cplframeset_erase_all(cpl_frameset *aFrames)
Erase all frames in a frameset.
double roundmin
Lower limit of the allowed point-source roundness.
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.
double sharpmin
Lower limit of the allowed point-source sharpness.
cpl_error_code muse_processing_prepare_property(cpl_propertylist *, const char *, cpl_type, const char *)
Prepare and check the specified property.