34#include "cr2res_utils.h"
35#include "cr2res_pfits.h"
36#include "cr2res_dfs.h"
38#include "cr2res_trace.h"
39#include "cr2res_extract.h"
40#include "cr2res_bpm.h"
46#define RECIPE_STRING "cr2res_util_extract"
52int cpl_plugin_get_info(cpl_pluginlist * list);
58static cpl_frameset * cr2res_util_extract_find_RAW(
const cpl_frameset * in) ;
59static int cr2res_util_extract_create(cpl_plugin *);
60static int cr2res_util_extract_exec(cpl_plugin *);
61static int cr2res_util_extract_destroy(cpl_plugin *);
62static int cr2res_util_extract(cpl_frameset *,
const cpl_parameterlist *);
68static char cr2res_util_extract_description[] =
"\
69Spectrum Extraction \n\
70 This utility performs the optimal extraction along precomputed traces \n\
73 raw.fits " CR2RES_FLAT_RAW
" [1 to n] \n\
74 or " CR2RES_UTIL_CALIB_PROCATG
" \n\
75 or " CR2RES_WAVE_UNE_RAW
" \n\
76 or " CR2RES_WAVE_FPET_RAW
" \n\
77 or " CR2RES_CAL_NODDING_OTHER_RAW
" \n\
78 or " CR2RES_CAL_NODDING_JITTER_RAW
" \n\
79 or " CR2RES_OBS_NODDING_OTHER_RAW
" \n\
80 or " CR2RES_OBS_NODDING_JITTER_RAW
" \n\
81 or " CR2RES_OBS_ASTROMETRY_OTHER_RAW
" \n\
82 or " CR2RES_OBS_ASTROMETRY_JITTER_RAW
" \n\
83 or " CR2RES_OBS_STARING_OTHER_RAW
" \n\
84 or " CR2RES_OBS_STARING_JITTER_RAW
" \n\
85 or " CR2RES_OBS_STARING_WAVE_SKY_RAW
" \n\
86 or " CR2RES_OBS_POLARIMETRY_OTHER_RAW
" \n\
87 or " CR2RES_OBS_2D_OBJECT_RAW
" \n\
88 or " CR2RES_OBS_2D_SKY_RAW
" \n\
89 trace.fits " CR2RES_CAL_FLAT_TW_PROCATG
" [1] \n\
90 or " CR2RES_CAL_FLAT_TW_MERGED_PROCATG
" \n\
91 or " CR2RES_UTIL_TRACE_TW_PROCATG
" \n\
92 or " CR2RES_UTIL_WAVE_TW_PROCATG
" \n\
93 or " CR2RES_CAL_WAVE_TW_PROCATG
" \n\
94 or " CR2RES_UTIL_SLIT_CURV_TW_PROCATG
" \n\
95 slitfunc.fits " CR2RES_CAL_FLAT_SLIT_FUNC_PROCATG
" [0 to 1] \n\
96 or " CR2RES_UTIL_SLIT_FUNC_PROCATG
" \n\
97 or " CR2RES_OBS_NODDING_SLITFUNCA_PROCATG
" \n\
98 or " CR2RES_OBS_NODDING_SLITFUNCB_PROCATG
" \n\
99 or " CR2RES_OBS_STARING_SLITFUNC_PROCATG
" \n\
100 bpm.fits " CR2RES_CAL_DARK_BPM_PROCATG
" [0 to 1] \n\
101 or " CR2RES_CAL_FLAT_BPM_PROCATG
" \n\
102 or " CR2RES_CAL_DETLIN_BPM_PROCATG
" \n\
103 or " CR2RES_UTIL_BPM_MERGE_PROCATG
" \n\
104 or " CR2RES_UTIL_BPM_SPLIT_PROCATG
" \n\
107 <input_name>_extr1D.fits " CR2RES_UTIL_EXTRACT_1D_PROCATG
" \n\
108 <input_name>_extrSlitFu.fits " CR2RES_UTIL_SLIT_FUNC_PROCATG
" \n\
109 <input_name>_extrModel.fits " CR2RES_UTIL_SLIT_MODEL_PROCATG
" \n\
112 loop on raw frames f: \n\
113 loop on detectors d: \n\
114 Load the trace wave \n\
115 Recompute a new trace wave with the specified slit fraction \n\
116 (--slit_frac) if needed \n\
117 Load the image to extract \n\
118 Load the BPM and set them in the image \n\
119 Load the input slit_func if available \n\
120 Run the extraction cr2res_extract_traces(--method,--height, \n\
121 --swath_width,--oversample,--smooth_slit,--smooth_spec)\n\
122 -> creates SLIT_MODEL(f,d), SLIT_FUNC(f,d), EXTRACT_1D(f,d) \n\
123 Save SLIT_MODEL(f), SLIT_FUNC(f), EXTRACT_1D(f) \n\
125 Library functions used \n\
126 cr2res_io_load_TRACE_WAVE() \n\
127 cr2res_trace_new_slit_fraction() \n\
128 cr2res_io_load_image() \n\
129 cr2res_io_load_BPM() \n\
130 cr2res_extract_traces() \n\
131 cr2res_io_save_SLIT_MODEL() \n\
132 cr2res_io_save_SLIT_FUNC() \n\
133 cr2res_io_save_EXTRACT_1D() \n\
151int cpl_plugin_get_info(cpl_pluginlist * list)
153 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe );
154 cpl_plugin * plugin = &recipe->interface;
156 if (cpl_plugin_init(plugin,
158 CR2RES_BINARY_VERSION,
159 CPL_PLUGIN_TYPE_RECIPE,
161 "Optimal Extraction utility",
162 cr2res_util_extract_description,
163 CR2RES_PIPELINE_AUTHORS,
166 cr2res_util_extract_create,
167 cr2res_util_extract_exec,
168 cr2res_util_extract_destroy)) {
169 cpl_msg_error(cpl_func,
"Plugin initialization failed");
170 (void)cpl_error_set_where(cpl_func);
174 if (cpl_pluginlist_append(list, plugin)) {
175 cpl_msg_error(cpl_func,
"Error adding plugin to list");
176 (void)cpl_error_set_where(cpl_func);
192static int cr2res_util_extract_create(cpl_plugin * plugin)
198 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
199 recipe = (cpl_recipe *)plugin;
204 recipe->parameters = cpl_parameterlist_new();
207 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.oversample",
208 CPL_TYPE_INT,
"factor by which to oversample the extraction",
209 "cr2res.cr2res_util_extract", 5);
210 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"oversample");
211 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
212 cpl_parameterlist_append(recipe->parameters, p);
214 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.swath_width",
215 CPL_TYPE_INT,
"The swath width",
"cr2res.cr2res_util_extract", 800);
216 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"swath_width");
217 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
218 cpl_parameterlist_append(recipe->parameters, p);
220 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.height",
221 CPL_TYPE_INT,
"Extraction height",
222 "cr2res.cr2res_util_extract", -1);
223 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"height");
224 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
225 cpl_parameterlist_append(recipe->parameters, p);
227 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.smooth_slit",
229 "Smoothing along the slit at extraction",
230 "cr2res.cr2res_util_extract", 2.0);
231 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"smooth_slit");
232 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
233 cpl_parameterlist_append(recipe->parameters, p);
235 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.smooth_spec",
237 "Smoothing spectrum at extraction",
238 "cr2res.cr2res_util_extract", 0.0);
239 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"smooth_spec");
240 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
241 cpl_parameterlist_append(recipe->parameters, p);
243 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.method",
244 CPL_TYPE_STRING,
"Extraction method (SUM / MEDIAN / TILTSUM / "
246 "cr2res.cr2res_util_extract",
"OPT_CURV");
247 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"method");
248 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
249 cpl_parameterlist_append(recipe->parameters, p);
251 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.slit_frac",
252 CPL_TYPE_STRING,
"Wished slit fraction",
253 "cr2res.cr2res_util_extract",
"-1.0, -1.0");
254 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"slit_frac");
255 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
256 cpl_parameterlist_append(recipe->parameters, p);
258 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.detector",
259 CPL_TYPE_INT,
"Only reduce the specified detector",
260 "cr2res.cr2res_util_extract", 0);
261 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"detector");
262 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
263 cpl_parameterlist_append(recipe->parameters, p);
265 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.order",
266 CPL_TYPE_INT,
"Only reduce the specified order",
267 "cr2res.cr2res_util_extract", -1);
268 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"order");
269 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
270 cpl_parameterlist_append(recipe->parameters, p);
272 p = cpl_parameter_new_value(
"cr2res.cr2res_util_extract.trace_nb",
273 CPL_TYPE_INT,
"Only reduce the specified trace number",
274 "cr2res.cr2res_util_extract", -1);
275 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"trace_nb");
276 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
277 cpl_parameterlist_append(recipe->parameters, p);
289static int cr2res_util_extract_exec(cpl_plugin * plugin)
294 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
295 recipe = (cpl_recipe *)plugin;
298 return cr2res_util_extract(recipe->frames, recipe->parameters);
308static int cr2res_util_extract_destroy(cpl_plugin * plugin)
313 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
314 recipe = (cpl_recipe *)plugin;
317 cpl_parameterlist_delete(recipe->parameters);
329static int cr2res_util_extract(
330 cpl_frameset * frameset,
331 const cpl_parameterlist * parlist)
333 const cpl_parameter * param;
334 int oversample, swath_width, extr_height,
335 reduce_det, reduce_order, reduce_trace ;
336 double smooth_slit, smooth_spec, slit_low, slit_up,
338 cpl_array * slit_frac ;
339 cpl_frameset * rawframes ;
340 cpl_frameset * cur_fset ;
341 const cpl_frame * trace_frame ;
342 const cpl_frame * bpm_frame ;
343 const cpl_frame * slit_func_frame ;
346 hdrl_image * model_master[CR2RES_NB_DETECTORS] ;
347 cpl_table * slit_func_tab[CR2RES_NB_DETECTORS] ;
348 cpl_table * extract_tab[CR2RES_NB_DETECTORS] ;
349 cpl_propertylist * ext_plist[CR2RES_NB_DETECTORS] ;
350 cpl_table * trace_table ;
351 cpl_table * trace_table_new ;
352 hdrl_image * science_hdrl;
353 cpl_table * slit_func_in ;
354 int det_nr, ext_nr, i ;
355 cr2res_extr_method extr_method;
358 setlocale(LC_NUMERIC,
"C");
361 param = cpl_parameterlist_find_const(parlist,
362 "cr2res.cr2res_util_extract.oversample");
363 oversample = cpl_parameter_get_int(param);
364 param = cpl_parameterlist_find_const(parlist,
365 "cr2res.cr2res_util_extract.swath_width");
366 swath_width = cpl_parameter_get_int(param);
367 param = cpl_parameterlist_find_const(parlist,
368 "cr2res.cr2res_util_extract.smooth_slit");
369 smooth_slit = cpl_parameter_get_double(param);
370 param = cpl_parameterlist_find_const(parlist,
371 "cr2res.cr2res_util_extract.smooth_spec");
372 smooth_spec = cpl_parameter_get_double(param);
373 param = cpl_parameterlist_find_const(parlist,
374 "cr2res.cr2res_util_extract.detector");
375 reduce_det = cpl_parameter_get_int(param);
376 param = cpl_parameterlist_find_const(parlist,
377 "cr2res.cr2res_util_extract.order");
378 reduce_order = cpl_parameter_get_int(param);
379 param = cpl_parameterlist_find_const(parlist,
380 "cr2res.cr2res_util_extract.trace_nb");
381 reduce_trace = cpl_parameter_get_int(param);
382 param = cpl_parameterlist_find_const(parlist,
383 "cr2res.cr2res_util_extract.height");
384 extr_height = cpl_parameter_get_int(param);
385 param = cpl_parameterlist_find_const(parlist,
386 "cr2res.cr2res_util_extract.method");
387 sval = cpl_parameter_get_string(param);
388 if (!strcmp(sval,
"")) extr_method = CR2RES_EXTR_OPT_CURV;
389 else if (!strcmp(sval,
"OPT_CURV")) extr_method = CR2RES_EXTR_OPT_CURV;
390 else if (!strcmp(sval,
"SUM")) extr_method = CR2RES_EXTR_SUM;
391 else if (!strcmp(sval,
"MEDIAN")) extr_method = CR2RES_EXTR_MEDIAN;
392 else if (!strcmp(sval,
"TILTSUM")) extr_method = CR2RES_EXTR_TILTSUM;
394 cpl_msg_error(__func__,
"Invalid Extraction Method specified");
395 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
398 param = cpl_parameterlist_find_const(parlist,
399 "cr2res.cr2res_util_extract.slit_frac");
400 sval = cpl_parameter_get_string(param) ;
401 if (sscanf(sval,
"%lg,%lg", &slit_low, &slit_up) != 2) {
402 cpl_msg_error(__func__,
"Invalid Slit Fraction specified");
403 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
408 int extract_niter = 30;
409 double extract_kappa = 10;
412 if (slit_low >= 0.0 && slit_up >= 0.0 && slit_low <= 1.0 && slit_up <= 1.0
413 && slit_up > slit_low) {
414 slit_frac = cpl_array_new(3, CPL_TYPE_DOUBLE) ;
415 cpl_array_set(slit_frac, 0, slit_low) ;
416 cpl_array_set(slit_frac, 1, (slit_low+slit_up)/2.0) ;
417 cpl_array_set(slit_frac, 2, slit_up) ;
424 cpl_msg_error(__func__,
"Cannot identify RAW and CALIB frames") ;
425 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
426 if (slit_frac != NULL) cpl_array_delete(slit_frac) ;
436 rawframes = cr2res_util_extract_find_RAW(frameset) ;
437 if (rawframes==NULL || cpl_frameset_get_size(rawframes) <= 0) {
438 cpl_msg_error(__func__,
"Cannot find any RAW file") ;
439 cpl_error_set(__func__, CPL_ERROR_DATA_NOT_FOUND) ;
440 if (rawframes!= NULL) cpl_frameset_delete(rawframes) ;
444 if (trace_frame == NULL) {
445 cpl_msg_error(__func__,
"The utility needs a trace wave frame");
446 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
447 if (slit_frac != NULL) cpl_array_delete(slit_frac) ;
452 for (i = 0; i < cpl_frameset_get_size(rawframes); i++) {
453 const cpl_frame *cur_frame;
454 const char *cur_fname;
455 cpl_propertylist *prim_plist;
457 cur_frame = cpl_frameset_get_position(rawframes, i) ;
458 cur_fname = cpl_frame_get_filename(cur_frame) ;
459 cpl_msg_info(__func__,
"Reduce Frame %s", cur_fname) ;
460 cpl_msg_indent_more() ;
463 prim_plist = cpl_propertylist_load(cur_fname, 0);
466 for (det_nr=1 ; det_nr<=CR2RES_NB_DETECTORS ; det_nr++) {
469 model_master[det_nr-1] = NULL ;
470 slit_func_tab[det_nr-1] = NULL ;
471 extract_tab[det_nr-1] = NULL ;
472 ext_plist[det_nr-1] = NULL ;
476 if (ext_nr < 0) continue ;
477 ext_plist[det_nr-1] = cpl_propertylist_load(cur_fname, ext_nr) ;
480 if (reduce_det != 0 && det_nr != reduce_det) continue ;
482 cpl_msg_info(__func__,
"Process detector number %d", det_nr) ;
483 cpl_msg_indent_more() ;
486 cpl_msg_info(__func__,
"Load the trace table") ;
488 cpl_frame_get_filename(trace_frame),
490 cpl_msg_error(__func__,
491 "Failed to get trace table - skip detector");
493 cpl_msg_indent_less() ;
498 if (slit_frac != NULL) {
500 trace_table, slit_frac)) == NULL) {
501 cpl_msg_warning(__func__,
502 "Failed to compute the traces for user specified slit fraction") ;
505 cpl_table_delete(trace_table) ;
506 trace_table = trace_table_new ;
507 trace_table_new = NULL ;
512 cpl_msg_info(__func__,
"Load the Image") ;
514 cpl_table_delete(trace_table) ;
515 cpl_msg_error(__func__,
516 "Failed to load the image - skip detector");
518 cpl_msg_indent_less() ;
522 if (bpm_frame != NULL) {
523 cpl_msg_info(__func__,
"Load and assign the BPM") ;
526 cpl_frame_get_filename(bpm_frame), det_nr, 1)){
527 cpl_table_delete(trace_table) ;
529 cpl_msg_error(__func__,
530 "Failed to load BPM - skip detector");
532 cpl_msg_indent_less() ;
538 if (slit_func_frame != NULL) {
540 cpl_frame_get_filename(slit_func_frame),
543 slit_func_in = NULL ;
547 if (det_nr == 1) gain = CR2RES_GAIN_CHIP1 ;
548 else if (det_nr == 2) gain = CR2RES_GAIN_CHIP2 ;
549 else if (det_nr == 3) gain = CR2RES_GAIN_CHIP3 ;
551 cpl_msg_error(__func__,
"Failed to get the Gain value, det %d",
558 cpl_msg_info(__func__,
"Spectra Extraction") ;
560 slit_func_in, NULL, 0, reduce_order, reduce_trace,
561 extr_method, extr_height, swath_width, oversample,
562 smooth_slit, smooth_spec,
563 extract_niter, extract_kappa, error_factor, 0, 0, 0,
564 &(extract_tab[det_nr-1]), &(slit_func_tab[det_nr-1]),
565 &(model_master[det_nr-1]))==-1) {
566 cpl_table_delete(trace_table) ;
568 if (slit_func_in != NULL) cpl_table_delete(slit_func_in) ;
569 cpl_msg_error(__func__,
"Failed to extract - skip detector");
571 cpl_msg_indent_less() ;
574 if (slit_func_in != NULL) cpl_table_delete(slit_func_in) ;
576 cpl_table_delete(trace_table) ;
577 cpl_msg_indent_less() ;
579 cpl_array_delete(slit_frac) ;
580 cpl_propertylist_delete(prim_plist);
584 cur_fset = cpl_frameset_new() ;
585 cpl_frameset_insert(cur_fset, cpl_frame_duplicate(cur_frame)) ;
588 out_file = cpl_sprintf(
"%s_extrModel.fits",
591 model_master, NULL, ext_plist, CR2RES_UTIL_SLIT_MODEL_PROCATG,
594 out_file = cpl_sprintf(
"%s_extrSlitFu.fits",
597 slit_func_tab, NULL, ext_plist, CR2RES_UTIL_SLIT_FUNC_PROCATG,
600 out_file = cpl_sprintf(
"%s_extr1D.fits",
603 extract_tab, NULL, ext_plist, CR2RES_UTIL_EXTRACT_1D_PROCATG,
606 cpl_frameset_delete(cur_fset) ;
609 for (det_nr=1 ; det_nr<=CR2RES_NB_DETECTORS ; det_nr++) {
610 if (ext_plist[det_nr-1] != NULL)
611 cpl_propertylist_delete(ext_plist[det_nr-1]) ;
612 if (slit_func_tab[det_nr-1] != NULL)
613 cpl_table_delete(slit_func_tab[det_nr-1]) ;
614 if (extract_tab[det_nr-1] != NULL)
615 cpl_table_delete(extract_tab[det_nr-1]) ;
616 if (model_master[det_nr-1] != NULL)
619 cpl_msg_indent_less() ;
621 cpl_frameset_delete(rawframes) ;
622 return (
int)cpl_error_get_code();
648static cpl_frameset * cr2res_util_extract_find_RAW(
const cpl_frameset * in)
655 if (in == NULL)
return NULL ;
659 tags = cpl_malloc(ntags *
sizeof(
char *)) ;
660 tags[0] = cpl_sprintf(CR2RES_FLAT_RAW) ;
661 tags[1] = cpl_sprintf(CR2RES_UTIL_CALIB_PROCATG) ;
662 tags[2] = cpl_sprintf(CR2RES_WAVE_UNE_RAW) ;
663 tags[3] = cpl_sprintf(CR2RES_WAVE_FPET_RAW) ;
664 tags[4] = cpl_sprintf(CR2RES_CAL_NODDING_OTHER_RAW) ;
665 tags[5] = cpl_sprintf(CR2RES_CAL_NODDING_JITTER_RAW) ;
666 tags[6] = cpl_sprintf(CR2RES_OBS_NODDING_OTHER_RAW) ;
667 tags[7] = cpl_sprintf(CR2RES_OBS_NODDING_JITTER_RAW) ;
668 tags[8] = cpl_sprintf(CR2RES_OBS_ASTROMETRY_OTHER_RAW) ;
669 tags[9] = cpl_sprintf(CR2RES_OBS_ASTROMETRY_JITTER_RAW) ;
670 tags[10] = cpl_sprintf(CR2RES_OBS_STARING_OTHER_RAW) ;
671 tags[11] = cpl_sprintf(CR2RES_OBS_STARING_JITTER_RAW) ;
672 tags[12] = cpl_sprintf(CR2RES_OBS_STARING_WAVE_SKY_RAW) ;
673 tags[13] = cpl_sprintf(CR2RES_OBS_POLARIMETRY_OTHER_RAW) ;
674 tags[14] = cpl_sprintf(CR2RES_OBS_2D_OBJECT_RAW) ;
675 tags[15] = cpl_sprintf(CR2RES_OBS_2D_SKY_RAW) ;
680 for (i=0 ; i<ntags ; i++) cpl_free(tags[i]) ;
int cr2res_bpm_set_and_correct_image(cpl_image *in, const char *bpm, int chip, int correct)
Set the BPM and optionally apply the correction to an image.
cpl_error_code cr2res_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
const cpl_frame * cr2res_io_find_BPM(const cpl_frameset *in)
Get the first CR2RES_BPM_DRSTYPE frame from a frameset.
int cr2res_io_save_SLIT_MODEL(const char *filename, cpl_frameset *allframes, cpl_frameset *inframes, const cpl_parameterlist *parlist, hdrl_image **data, const cpl_propertylist *qc_list, cpl_propertylist **ext_plist, const char *procatg, const char *recipe)
Save a SLIT_MODEL.
const cpl_frame * cr2res_io_find_SLIT_FUNC(const cpl_frameset *in)
Get the first CR2RES_SLIT_FUNC_DRSTYPE frame from a frameset.
const cpl_frame * cr2res_io_find_TRACE_WAVE(const cpl_frameset *in)
Get the first CR2RES_TW_DRSTYPE frame from a frameset.
int cr2res_io_save_EXTRACT_1D(const char *filename, cpl_frameset *allframes, cpl_frameset *inframes, const cpl_parameterlist *parlist, cpl_table **tables, const cpl_propertylist *qc_list, cpl_propertylist **ext_plist, const char *procatg, const char *recipe)
Save a 1D extracted spectrum.
int cr2res_io_get_ext_idx(const char *filename, int detector, int data)
Get the wished extension number for a detector.
cpl_table * cr2res_io_load_SLIT_FUNC(const char *filename, int detector)
Load a table from a SLIT_FUNC.
hdrl_image * cr2res_io_load_image(const char *in, int detector)
Load an hdrl image from a image file.
int cr2res_io_save_SLIT_FUNC(const char *filename, cpl_frameset *allframes, cpl_frameset *inframes, const cpl_parameterlist *parlist, cpl_table **slit_func, const cpl_propertylist *qc_list, cpl_propertylist **ext_plist, const char *procatg, const char *recipe)
Save a SLIT_FUNC.
cpl_table * cr2res_io_load_TRACE_WAVE(const char *filename, int detector)
Load a table from a TRACE_WAVE.
int cr2res_pfits_get_ndit(const cpl_propertylist *plist)
find out the NDIT value
cpl_table * cr2res_trace_new_slit_fraction(const cpl_table *traces, const cpl_array *new_slit_fraction)
Recompute the traces at a newly specified slit fraction.
char * cr2res_get_root_name(const char *filename)
Find out the root part of a basename (name without extension).
cpl_frameset * cr2res_extract_frameset_several_tags(const cpl_frameset *in, const char **tags, int ntags)
Extract the frames whose tag is within a list from a frameset.
char * cr2res_get_base_name(const char *filename)
Find out the base name of a file (i.e. without prefix path)
const char * cr2res_get_license(void)
Get the pipeline copyright and license.
cpl_image * hdrl_image_get_image(hdrl_image *himg)
get data as cpl image
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image