36 #include "muse_processing.h" 37 #include "muse_instrument.h" 39 #include "muse_datacube.h" 42 #include "muse_pfits.h" 44 #include "muse_utils.h" 50 #define DEBUG_EXPOSURES_SORT 0 79 muse_processing_get_rawtags(cpl_recipe *aRecipe)
82 cpl_array *rawtags = cpl_array_new(0, CPL_TYPE_STRING);
86 cpl_msg_error(__func__,
"No recipeconfig found!");
92 cpl_size iframe, nframes = cpl_frameset_get_size(aRecipe->frames);
93 for (iframe = 0; iframe < nframes; iframe++) {
94 cpl_frame *frame = cpl_frameset_get_position(aRecipe->frames, iframe);
95 const char *tag = cpl_frame_get_tag(frame);
97 cpl_size itag, ntags = cpl_array_get_size(rawtags);
98 for (itag = 0; itag < ntags; itag++) {
99 if (!strcmp(cpl_array_get_string(rawtags, itag), tag)) {
104 cpl_errorstate state = cpl_errorstate_get();
105 char **tags = cpl_recipeconfig_get_inputs(recipeconfig, tag);
107 cpl_errorstate_set(state);
111 cpl_array_set_size(rawtags, ntags + 1);
112 cpl_array_set_string(rawtags, ntags, tag);
115 for (i = 0; tags[i]; i++) {
120 if (!cpl_array_get_size(rawtags)) {
121 cpl_msg_error(__func__,
"No valid raw tag(s) found!");
138 processing->
name = aName;
139 processing->
recipe = aRecipe;
140 processing->
inframes = cpl_frameset_duplicate(aRecipe->frames);
142 processing->
outframes = cpl_frameset_new();
143 #pragma omp critical(cpl_parameters) 145 processing->
intags = muse_processing_get_rawtags(aRecipe);
163 cpl_array_delete(aProcessing->
intags);
164 cpl_frameset_delete(aProcessing->
inframes);
166 cpl_frameset_delete(aProcessing->
outframes);
167 cpl_parameterlist_delete(aProcessing->
parameters);
169 for (i = 0; aProcessing->
counter[i].
tag != NULL; i++) {
170 cpl_free((
char *)aProcessing->
counter[i].
tag);
172 cpl_free(aProcessing->
counter);
173 cpl_free(aProcessing);
195 cpl_frame *aFrame, cpl_frame_group aGroup,
199 cpl_msg_error(__func__,
"NULL processing struct!");
203 if (aGroup == CPL_FRAME_GROUP_CALIB) {
204 cpl_msg_debug(__func__,
"using %s %s frame %s",
"calibration",
205 cpl_frame_get_tag(aFrame), cpl_frame_get_filename(aFrame));
206 }
else if (aGroup == CPL_FRAME_GROUP_RAW) {
207 cpl_msg_debug(__func__,
"using %s %s frame %s",
"raw",
208 cpl_frame_get_tag(aFrame), cpl_frame_get_filename(aFrame));
213 cpl_boolean doreturn = CPL_FALSE;
214 #pragma omp critical(muse_processing_used_frames) 216 const char *fn = cpl_frame_get_filename(aFrame),
217 *tag = cpl_frame_get_tag(aFrame);
218 cpl_size iframe, nframes = cpl_frameset_get_size(aProcessing->
usedframes);
220 (iframe < nframes) && fn && tag;
222 cpl_frame *frame = cpl_frameset_get_position(aProcessing->
usedframes, iframe);
223 const char *fn2 = cpl_frame_get_filename(frame),
224 *tag2 = cpl_frame_get_tag(frame);
225 if (fn2 && !strncmp(fn, fn2, strlen(fn) + 1) &&
226 tag2 && !strncmp(tag, tag2, strlen(tag) + 1)) {
228 cpl_frame_delete(aFrame);
240 cpl_frame_set_group(aFrame, aGroup);
243 #pragma omp critical(muse_processing_used_frames) 246 cpl_frameset_insert(aProcessing->
usedframes, cpl_frame_duplicate(aFrame));
248 cpl_frameset_insert(aProcessing->
usedframes, aFrame);
269 const char *aTag,
int aIFU)
272 cpl_msg_error(__func__,
"NULL processing struct!");
276 for (i = 0; aProcessing->
counter[i].
tag != NULL; i++) {
277 if (strcmp(aProcessing->
counter[i].
tag, aTag) == 0 &&
284 aProcessing->
counter[i].
tag = cpl_strdup(aTag);
307 cpl_propertylist *aHeader, cpl_frame *aFrame,
308 int aIndex,
const char *aDateObs,
309 cpl_boolean aSequence)
312 cpl_msg_error(__func__,
"NULL processing struct!");
316 cpl_frameset_is_empty(aProcessing->
inframes)) {
317 cpl_msg_warning(__func__,
"No raw input files, no DFS product header added");
322 cpl_propertylist *hkeep = cpl_propertylist_new();
323 cpl_propertylist_copy_property_regexp(hkeep, aHeader,
324 MUSE_HEADERS_KEEP_REGEXP, 0);
327 cpl_propertylist_erase_regexp(aHeader,
"^ESO PRO|^COMMENT", 0);
329 cpl_propertylist_erase_regexp(aHeader, MUSE_HDR_TMP_REGEXP, 0);
333 aIndex, aDateObs, aSequence);
335 #if CPL_VERSION_CODE < CPL_VERSION(7, 0, 0) 337 if (cpl_propertylist_has(aHeader,
"EQUINOX") &&
338 cpl_propertylist_get_type(aHeader,
"EQUINOX") < CPL_TYPE_FLOAT) {
339 cpl_property *equinox = cpl_propertylist_get_property(aHeader,
"EQUINOX");
340 double equvalue = cpl_property_get_long_long(equinox);
341 const char *equcomment = cpl_property_get_comment(equinox);
342 cpl_property_set_name(equinox,
"EQUIBRK");
343 cpl_propertylist_insert_after_double(aHeader,
"EQUIBRK",
"EQUINOX",
345 cpl_propertylist_set_comment(aHeader,
"EQUINOX", equcomment);
346 cpl_propertylist_erase(aHeader,
"EQUIBRK");
350 char *pkgstring = cpl_sprintf(
"%s/%s", PACKAGE, PACKAGE_VERSION);
352 #pragma omp critical(muse_processing_dfs_setup_header) 353 if (cpl_dfs_setup_product_header(aHeader, aFrame, fset,
355 pkgstring, MUSE_PRO_DID, NULL)
357 cpl_msg_error(__func__,
"Could not add DFS product header: %s",
358 cpl_error_get_message());
361 cpl_frameset_delete(fset);
364 int i, n = cpl_propertylist_get_size(hkeep);
365 for (i = 0; i < n; i++) {
366 const cpl_property *p = cpl_propertylist_get_const(hkeep, i);
367 cpl_propertylist_erase(aHeader, cpl_property_get_name(p));
368 cpl_propertylist_append_property(aHeader, p);
370 cpl_propertylist_delete(hkeep);
373 cpl_propertylist_update_string(aHeader,
"ESO PRO TECH",
"IFU");
375 if (strstr(aProcessing->
name,
"muse_sci") ||
376 !strcmp(aProcessing->
name,
"muse_exp_combine")) {
377 cpl_propertylist_update_bool(aHeader,
"ESO PRO SCIENCE", 1);
407 cpl_propertylist *aHeader,
const char *aTag,
408 cpl_frame_type aType)
410 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
412 const char *prefix = cpl_propertylist_has(aHeader,
"MUSE PRIVATE FILE PREFIX")
413 ? cpl_propertylist_get_string(aHeader,
414 "MUSE PRIVATE FILE PREFIX")
417 cpl_frame *frame = cpl_frame_new();
419 cpl_errorstate prestate = cpl_errorstate_get();
426 framecounter = muse_processing_get_framecounter(aProcessing, prefix, aIFU);
428 const char *dateobs = NULL;
435 char filename[FILENAME_MAX];
437 if (framecounter == 0) {
438 snprintf(filename, FILENAME_MAX,
"%s-%02d.fits", prefix, aIFU);
440 snprintf(filename, FILENAME_MAX,
"%s_%04d-%02d.fits", prefix,
444 if (framecounter == 0) {
445 snprintf(filename, FILENAME_MAX,
"%s.fits", prefix);
447 snprintf(filename, FILENAME_MAX,
"%s_%04d.fits", prefix, framecounter);
450 cpl_frame_set_filename(frame, filename);
451 cpl_frame_set_tag(frame, aTag);
452 cpl_frame_set_type(frame, aType);
453 cpl_frame_set_group(frame, CPL_FRAME_GROUP_PRODUCT);
454 cpl_frame_set_level(frame,
457 if (!cpl_errorstate_is_equal(prestate)) {
458 cpl_msg_error(__func__,
"Error while initialising the product frame: %s",
459 cpl_error_get_message());
460 cpl_frame_delete(frame);
463 cpl_propertylist_erase_regexp(aHeader,
"MUSE PRIVATE.*", 0);
466 muse_processing_setup_header(aProcessing, aHeader, frame, idx, dateobs,
492 cpl_ensure_code(aProcessing && aImage && aTag, CPL_ERROR_NULL_INPUT);
496 CPL_FRAME_TYPE_IMAGE);
497 cpl_msg_info(__func__,
"Saving image as %s", cpl_frame_get_filename(frame));
499 if (r == CPL_ERROR_NONE) {
500 #pragma omp critical(muse_processing_output_frames) 501 cpl_frameset_insert(aProcessing->
outframes, frame);
503 cpl_frame_delete(frame);
533 cpl_ensure_code(aProcessing && aCube && aTag, CPL_ERROR_NULL_INPUT);
543 aTag, CPL_FRAME_TYPE_IMAGE);
549 cpl_errorstate status = cpl_errorstate_get();
550 muse_idp_properties *properties =
551 muse_idp_properties_collect(aProcessing, (
muse_datacube *)aCube, aTag);
553 muse_idp_properties_update(((
muse_datacube *)aCube)->header, properties);
555 muse_idp_properties_delete(properties);
556 if (!cpl_errorstate_is_equal(status)) {
557 cpl_frame_delete(frame);
558 return cpl_error_get_code();
562 cpl_msg_info(__func__,
"Saving %s cube as \"%s\"",
564 cpl_frame_get_filename(frame));
565 cpl_error_code rc = CPL_ERROR_NONE;
568 cpl_frame_get_filename(frame));
571 cpl_frame_get_filename(frame));
574 cpl_frame_get_filename(frame));
576 if (rc == CPL_ERROR_NONE) {
577 #pragma omp critical(muse_processing_output_frames) 578 cpl_frameset_insert(aProcessing->
outframes, frame);
580 cpl_frame_delete(frame);
609 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
617 cpl_table *ctable = table->
table;
647 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
654 cpl_msg_debug(__func__,
"No table found for tag %s and IFU %hhu", aTag,
658 cpl_msg_debug(__func__,
"No table found for tag %s", aTag);
664 cpl_errorstate state = cpl_errorstate_get();
666 if (!cpl_errorstate_is_equal(state)) {
667 cpl_error_set(__func__, cpl_error_get_code());
703 void *aTable, cpl_propertylist *aHeader,
706 cpl_ensure_code(aProcessing && aTable && aTag, CPL_ERROR_NULL_INPUT);
710 cpl_propertylist *header;
712 cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
720 aTag, CPL_FRAME_TYPE_TABLE);
721 cpl_msg_info(__func__,
"Saving %stable as \"%s\"",
723 cpl_frame_get_filename(frame));
724 cpl_error_code rc = CPL_ERROR_NONE;
726 cpl_size nrow = cpl_table_get_nrow((cpl_table *)aTable);
727 rc = cpl_table_save((cpl_table *)aTable, aHeader, NULL,
728 cpl_frame_get_filename(frame), CPL_IO_CREATE);
730 cpl_msg_warning(__func__,
"Table saved as \"%s\" has no rows!", aTag);
736 cpl_frame_get_filename(frame));
738 if (rc == CPL_ERROR_NONE) {
739 #pragma omp critical(muse_processing_output_frames) 740 cpl_frameset_insert(aProcessing->
outframes, frame);
742 cpl_msg_error(__func__,
"Saving %stable failed: %s",
744 cpl_error_get_message());
745 cpl_frame_delete(frame);
770 cpl_image *aImage, cpl_propertylist *aHeader,
773 cpl_ensure_code(aProcessing && aImage && aHeader && aTag, CPL_ERROR_NULL_INPUT);
777 CPL_FRAME_TYPE_IMAGE);
778 cpl_msg_info(__func__,
"Saving image as %s", cpl_frame_get_filename(frame));
779 int r = cpl_image_save(aImage, cpl_frame_get_filename(frame),
780 CPL_TYPE_UNSPECIFIED, aHeader, CPL_IO_CREATE);
781 if (r == CPL_ERROR_NONE) {
782 #pragma omp critical(muse_processing_output_frames) 783 cpl_frameset_insert(aProcessing->
outframes, frame);
785 cpl_msg_error(__func__,
"Saving image failed: %s", cpl_error_get_message());
786 cpl_frame_delete(frame);
807 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
811 cpl_msg_debug(__func__,
"No propertylist found for tag %s", aTag);
815 const char *filename = cpl_frame_get_filename(frame);
816 cpl_propertylist *pl = cpl_propertylist_load(filename, 0);
818 cpl_msg_info(__func__,
"loading %s from file %s failed: %s", aTag,
819 filename, cpl_error_get_message());
820 cpl_frame_delete(frame);
823 cpl_msg_info(__func__,
"loaded %s from file \"%s\"", aTag, filename);
850 cpl_propertylist *aHeader,
const char *aTag)
852 cpl_ensure_code(aProcessing && aHeader && aTag, CPL_ERROR_NULL_INPUT);
856 CPL_FRAME_TYPE_IMAGE);
857 cpl_msg_info(__func__,
"Saving header as %s", cpl_frame_get_filename(frame));
858 cpl_error_code rc = cpl_propertylist_save(aHeader,
859 cpl_frame_get_filename(frame),
861 if (rc == CPL_ERROR_NONE) {
862 #pragma omp critical(muse_processing_output_frames) 863 cpl_frameset_insert(aProcessing->
outframes, frame);
865 cpl_msg_error(__func__,
"Saving header failed: %s", cpl_error_get_message());
866 cpl_frame_delete(frame);
891 if (frames == NULL || cpl_frameset_get_size(frames) <= 0) {
892 cpl_frameset_delete(frames);
895 cpl_frame *frame = cpl_frameset_get_position(frames, 0);
898 cpl_msg_warning(__func__,
"loading mask \"%s\" failed!",
899 cpl_frame_get_filename(frame));
900 cpl_frameset_delete(frames);
903 cpl_msg_info(__func__,
"using mask \"%s\" (%"CPL_SIZE_FORMAT
" pixels)",
904 cpl_frame_get_filename(frame), cpl_mask_count(mask->
mask));
906 cpl_frameset_delete(frames);
931 cpl_ensure_code(aProcessing && aMask && aTag, CPL_ERROR_NULL_INPUT);
935 CPL_FRAME_TYPE_IMAGE);
936 cpl_msg_info(__func__,
"Saving mask as %s", cpl_frame_get_filename(frame));
938 if (r == CPL_ERROR_NONE) {
939 #pragma omp critical(muse_processing_output_frames) 940 cpl_frameset_insert(aProcessing->
outframes, frame);
942 cpl_frame_delete(frame);
965 cpl_ensure(aProcessing && aTag, CPL_ERROR_NULL_INPUT, CPL_FALSE);
967 cpl_boolean hastag = CPL_FALSE;
969 cpl_size itag, ntags = cpl_array_get_size(aProcessing->
intags);
970 for (itag = 0; itag < ntags; itag++) {
971 const char *tag = cpl_array_get_string(aProcessing->
intags, itag);
972 if (tag && !strncmp(tag, aTag, aNChars)) {
1002 cpl_msg_error(__func__,
"NULL processing struct");
1003 return CPL_ERROR_NULL_INPUT;
1005 cpl_recipeconfig *recipeconfig
1007 if (!recipeconfig) {
1008 cpl_msg_error(__func__,
"No recipeconfig found!");
1009 return CPL_ERROR_ILLEGAL_INPUT;
1012 cpl_boolean output = CPL_TRUE;
1013 cpl_size itag, ntags = cpl_array_get_size(aProcessing->
intags);
1014 unsigned int errors = 0;
1015 for (itag = 0; itag < ntags; itag++) {
1016 const char *intag = cpl_array_get_string(aProcessing->
intags, itag);
1018 intag, aIFU, CPL_FALSE);
1019 int nframes = cpl_frameset_count_tags(frames, intag),
1020 nmin = cpl_recipeconfig_get_min_count(recipeconfig, intag, intag),
1021 nmax = cpl_recipeconfig_get_max_count(recipeconfig, intag, intag);
1022 cpl_frameset_delete(frames);
1023 if (nmin >= 0 && nframes < nmin) {
1024 cpl_msg_error(__func__,
"Required %d, found %d input frames with tag " 1025 "\"%s\" with IFU %hhu", nmin, nframes, intag, aIFU);
1028 if (nmax >= 0 && nframes > nmax) {
1029 cpl_msg_error(__func__,
"At most %d allowed, found %d input frames with " 1030 "tag \"%s\" with IFU %hhu", nmax, nframes, intag, aIFU);
1033 char **tags = cpl_recipeconfig_get_inputs(recipeconfig, intag);
1035 cpl_msg_error(__func__,
"Input frames with tag \"%s\" cannot be used with" 1036 " this recipe", intag);
1042 for (i = 0; tags[i]; i++) {
1045 nframes = cpl_frameset_count_tags(frames, tags[i]);
1046 cpl_frameset_delete(frames);
1048 nmin = cpl_recipeconfig_get_min_count(recipeconfig, intag, tags[i]);
1049 nmax = cpl_recipeconfig_get_max_count(recipeconfig, intag, tags[i]);
1050 if (nmin >= 0 && nframes < nmin) {
1052 cpl_msg_error(__func__,
"Required %d, found %d frames with tag \"%s\" " 1053 "with IFU %hhu", nmin, nframes, tags[i], aIFU);
1057 if (nframes == 0 && nmin <= 0) {
1059 cpl_msg_debug(__func__,
"Optional frame with tag \"%s\" not given",
1063 if (nmax >= 0 && nframes > nmax) {
1065 cpl_msg_error(__func__,
"At most %d allowed, found %d frames with tag " 1066 "\"%s\" with IFU %hhu", nmax, nframes, tags[i], aIFU);
1077 cpl_msg_error(__func__,
"Found %u error(s)", errors);
1078 return CPL_ERROR_DATA_NOT_FOUND;
1080 return CPL_ERROR_NONE;
1115 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
1116 cpl_size nframes = cpl_frameset_get_size(aProcessing->
inframes);
1117 cpl_ensure(nframes, CPL_ERROR_DATA_NOT_FOUND, NULL);
1121 cpl_table *exptable = cpl_table_new(0);
1123 cpl_table_new_column(exptable,
"DATE-OBS", CPL_TYPE_STRING);
1126 for (i = 0; i <= kMuseNumIFUs; i++) {
1127 snprintf(colname, 3,
"%02d", i);
1128 cpl_table_new_column(exptable, colname, CPL_TYPE_STRING);
1133 for (iframe = 0; iframe < nframes; iframe++) {
1134 cpl_frame *frame = cpl_frameset_get_position(aProcessing->
inframes,
1136 const char *tag = cpl_frame_get_tag(frame);
1138 const char *filename = cpl_frame_get_filename(frame);
1141 cpl_propertylist *header = cpl_propertylist_load(filename, 0);
1143 cpl_msg_warning(__func__,
"\"%s\" could not be loaded, it will be " 1144 "ignored!", filename);
1149 cpl_msg_warning(__func__,
"\"%s\" does not contain the DATE-OBS " 1150 "keyword, it will be ignored!", filename);
1151 cpl_propertylist_delete(header);
1156 cpl_msg_debug(__func__,
"\"%s\" seems to contain merged data (no " 1157 "EXTNAME=CHANnn)", filename);
1159 #if DEBUG_EXPOSURES_SORT 1160 cpl_msg_debug(__func__,
"\"%s\": IFU %2d, DATE-OBS=\"%s\"", filename, ifu, date);
1165 for (i = 0; i < cpl_table_get_nrow(exptable); i++) {
1166 #if DEBUG_EXPOSURES_SORT 1167 cpl_msg_debug(__func__,
"i=%d, DATE-OBS=\"%s\"", i,
1168 cpl_table_get_string(exptable,
"DATE-OBS", i));
1170 if (!strcmp(date, cpl_table_get_string(exptable,
"DATE-OBS", i))) {
1177 cpl_table_set_size(exptable, cpl_table_get_nrow(exptable)+1);
1178 irow = cpl_table_get_nrow(exptable) - 1;
1179 cpl_table_set_string(exptable,
"DATE-OBS", irow, date);
1184 snprintf(colname, 3,
"%02d", ifu);
1185 if (cpl_table_is_valid(exptable, colname, irow)) {
1186 cpl_msg_warning(__func__,
"we already have IFU %d of exposure %d (\"%s\")!" 1187 " Ignoring \"%s\"", ifu, irow+1,
1188 cpl_table_get_string(exptable, colname, irow),
1190 cpl_propertylist_delete(header);
1193 cpl_table_set_string(exptable, colname, irow, filename);
1199 cpl_propertylist_delete(header);
1201 #if DEBUG_EXPOSURES_SORT 1203 cpl_msg_debug(__func__,
"wrong tag \"%s\" for \"%s\"", tag,
1204 cpl_frame_get_filename(frame));
1209 if (cpl_table_get_nrow(exptable) <= 0) {
1211 cpl_table_delete(exptable);
1212 cpl_error_set(__func__, CPL_ERROR_DATA_NOT_FOUND);
1216 for (i = 0; i < cpl_table_get_nrow(exptable); i++) {
1218 if (cpl_table_is_valid(exptable,
"00", i)) {
1222 for (j = 1; j <= kMuseNumIFUs; j++) {
1223 snprintf(colname, 3,
"%02d", j);
1224 if (cpl_table_is_valid(exptable, colname, i)) {
1228 cpl_msg_debug(__func__,
"Data from exposure %2d is contained in %2d " 1229 "IFU%s/%d merged file%s", i+1, nvalid, nvalid == 1 ?
"" :
"s",
1230 nmerged, nmerged == 1 ?
"" :
"s");
1235 cpl_propertylist *sorting = cpl_propertylist_new();
1236 cpl_propertylist_append_bool(sorting,
"DATE-OBS",
1238 cpl_table_sort(exptable, sorting);
1239 cpl_propertylist_delete(sorting);
int muse_processing_save_cimage(muse_processing *aProcessing, int aIFU, cpl_image *aImage, cpl_propertylist *aHeader, const char *aTag)
Save a computed FITS image to disk.
Structure definition of a MUSE datacube.
int muse_processing_get_frame_mode(const cpl_recipe *, const char *)
Get the mode for a product frame with a certain tag.
void muse_processing_delete(muse_processing *aProcessing)
Free the muse_processing structure.
int muse_processing_save_mask(muse_processing *aProcessing, int aIFU, muse_mask *aMask, const char *aTag)
Save a computed MUSE mask to disk.
cpl_error_code muse_euro3dcube_save(muse_euro3dcube *aEuro3D, const char *aFilename)
Save a Euro3D cube object to a file.
unsigned char muse_utils_get_ifu(const cpl_propertylist *aHeaders)
Find out the IFU/channel from which this header originated.
muse_processing_framecounter * counter
const char * muse_pfits_get_dateobs(const cpl_propertylist *aHeaders)
find out the date of observations
cpl_error_code muse_table_save(muse_table *aTable, const char *aFilename)
Save the data and the FITS headers of a MUSE table to a file.
Data cube/stacked image list containing the LSF for one IFU.
Structure definition of MUSE three extension FITS file.
cpl_error_code muse_lsf_cube_save(muse_lsf_cube *aLsfCube, const char *aFileName)
Save the LSF cube to disk.
cpl_propertylist * header
the FITS header
cpl_boolean muse_processing_check_intags(muse_processing *aProcessing, const char *aTag, int aNChars)
Check that a tag is part of the input tags of a processing structure.
cpl_error_code muse_datacube_save(muse_datacube *aCube, const char *aFilename)
Save the three cube extensions and the FITS headers of a MUSE datacube to a file. ...
cpl_frameset * usedframes
muse_processing * muse_processing_new(const char *aName, cpl_recipe *aRecipe)
Create a new processing structure.
cpl_error_code muse_processing_prepare_header(const cpl_recipe *, const char *, cpl_propertylist *)
Prepare and check a FITS header for a certain frame tag.
cpl_error_code muse_processing_save_header(muse_processing *aProcessing, int aIFU, cpl_propertylist *aHeader, const char *aTag)
Save a FITS header to disk.
Structure definition of MUSE pixel table.
cpl_frame * muse_processing_new_frame(muse_processing *aProcessing, int aIFU, cpl_propertylist *aHeader, const char *aTag, cpl_frame_type aType)
Create a new frame for a result file.
muse_mask * muse_mask_load(const char *aFilename)
Load a mask file and its FITS header.
cpl_error_code muse_mask_save(muse_mask *aMask, const char *aFilename)
Save the data and the FITS headers of a MUSE mask to a file.
cpl_error_code muse_processing_save_cube(muse_processing *aProcessing, int aIFU, void *aCube, const char *aTag, muse_cube_type aType)
Save a MUSE datacube to disk.
cpl_frame_level muse_processing_get_frame_level(const cpl_recipe *, const char *)
Get the level for a product frame with a certain tag.
cpl_frameset * muse_frameset_sort_raw_other(const cpl_frameset *aFrames, int aIndex, const char *aDateObs, cpl_boolean aSequence)
Create a new frameset containing all relevant raw frames first then all other frames.
cpl_table * table
The table.
muse_table * muse_processing_load_table(muse_processing *aProcessing, const char *aTag, unsigned char aIFU)
Load a MUSE table according to its tag and IFU/channel number.
cpl_recipeconfig * muse_processing_get_recipeconfig(cpl_recipe *)
Get the recipe (frame) configuration.
Structure definition of a Euro3D datacube.
void muse_processing_append_used(muse_processing *aProcessing, cpl_frame *aFrame, cpl_frame_group aGroup, int aDuplicate)
Add a frame to the set of used frames.
Structure to store a table together with a property list.
muse_mask * muse_processing_load_mask(muse_processing *aProcessing, const char *aTag)
Load a mask file and its FITS header.
void muse_table_delete(muse_table *aTable)
Deallocate memory associated to a muse_table object.
cpl_error_code muse_pixtable_save(muse_pixtable *aPixtable, const char *aFilename)
Save a MUSE pixel table to a file on disk.
int muse_processing_save_image(muse_processing *aProcessing, int aIFU, muse_image *aImage, const char *aTag)
Save a computed MUSE image to disk.
cpl_table * muse_processing_load_ctable(muse_processing *aProcessing, const char *aTag, unsigned char aIFU)
Load a CPL table according to its tag and IFU/channel number.
cpl_parameterlist * muse_cplparameterlist_duplicate(const cpl_parameterlist *aPList)
Duplicate a CPL parameter list.
cpl_error_code muse_image_save(muse_image *aImage, const char *aFilename)
Save the three image extensions and the FITS headers of a MUSE image to a file.
Handling of "mask" files.
cpl_error_code muse_processing_save_table(muse_processing *aProcessing, int aIFU, void *aTable, cpl_propertylist *aHeader, const char *aTag, muse_table_type aType)
Save a computed table to disk.
cpl_error_code muse_processing_check_input(muse_processing *aProcessing, unsigned char aIFU)
Check the input files for completeness.
cpl_propertylist * header
the FITS header
cpl_frameset * muse_frameset_find(const cpl_frameset *aFrames, const char *aTag, unsigned char aIFU, cpl_boolean aInvert)
return frameset containing data from an IFU/channel with a certain tag
cpl_table * muse_processing_sort_exposures(muse_processing *aProcessing)
Sort input frames (containing lists of pixel table filenames) into different exposures.
cpl_mask * mask
The mask data.
cpl_propertylist * muse_processing_load_header(muse_processing *aProcessing, const char *aTag)
load a header according to its tag
cpl_frame * muse_frameset_find_master(const cpl_frameset *aFrames, const char *aTag, unsigned char aIFU)
find the master frame according to its CCD number and tag
cpl_parameterlist * parameters
muse_table * muse_table_load(const char *aFilename, unsigned char aIFU)
Load a table file and its primary FITS header.