midi_dfs.c
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036 #include <string.h>
00037 #include <math.h>
00038
00039 #include <cpl.h>
00040
00041 #include "midi_dfs.h"
00042
00043
00049
00050
00053
00059
00060 cpl_error_code midi_dfs_set_groups(cpl_frameset * set)
00061 {
00062 cpl_errorstate prestate = cpl_errorstate_get();
00063 cpl_frame * frame = NULL;
00064 int i = 0;
00065
00066
00067
00068 for (frame = cpl_frameset_get_first(set); frame != NULL;
00069 frame = cpl_frameset_get_next(set), i++) {
00070
00071 const char * tag = cpl_frame_get_tag(frame);
00072
00073 if (tag == NULL) {
00074 cpl_msg_warning(cpl_func, "Frame %d has no tag", i);
00075 } else if (!strcmp(tag, MIDI_HIGH_SENS_CALIB ) ||
00076 !strcmp(tag, MIDI_HIGH_SENS_SCIENCE ) ||
00077 !strcmp(tag, MIDI_SCI_PHOT_CALIB ) ||
00078 !strcmp(tag, MIDI_SCI_PHOT_SCIENCE ) ||
00079 !strcmp(tag, MIDI_KAPPA_SP_CALIB ) ||
00080 !strcmp(tag, MIDI_KAPPA_SP_SCIENCE ) ||
00081 !strcmp(tag, MIDI_ACQ ) ||
00082 !strcmp(tag, MIDI_DETLIN ) ||
00083 !strcmp(tag, MIDI_DETRON ) ||
00084 !strcmp(tag, MIDI_DSPTRN ) ||
00085 !strcmp(tag, MIDI_REFPIX ) ||
00086 !strcmp(tag, MIDI_WAVECAL ) ||
00087 !strcmp(tag, MIDI_PHOTOM_SP_CALIB ) ||
00088 !strcmp(tag, MIDI_PHOTOM_SP_SCIENCE ) ||
00089 !strcmp(tag, MIDI_PHOTOM_HS_CALIB ) ||
00090 !strcmp(tag, MIDI_PHOTOM_HS_SCIENCE ) ||
00091 !strcmp(tag, MIDI_OTHER_DETLIN ) ||
00092 !strcmp(tag, MIDI_OTHER_DETRON ) ||
00093 !strcmp(tag, MIDI_OTHER_DSPTRN ) ||
00094 !strcmp(tag, MIDI_OTHER_GENERIC ) ||
00095 !strcmp(tag, MIDI_OTHER_REFPIX ) ||
00096 !strcmp(tag, MIDI_OTHER_WAVECAL ) ||
00097 !strcmp(tag, MIDI_OTHER_ACQ ) ||
00098 !strcmp(tag, MIDI_DOME_AOPEN ) ||
00099 !strcmp(tag, MIDI_DOME_BOPEN ) ||
00100 !strcmp(tag, MIDI_INTERNAL_OPD ) ||
00101 !strcmp(tag, MIDI_CAL_SEARCH ) ||
00102 !strcmp(tag, MIDI_OTHER_FRINGE ))
00103 {
00104
00105 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00106 } else if (!strcmp(tag, MIDI_CALIB_FLAT) ||
00107 !strcmp(tag, MIDI_KAPPA_SP_MASK_PRISM) ||
00108 !strcmp(tag, MIDI_KAPPA_SP_MASK_GRISM) ||
00109 !strcmp(tag, MIDI_KAPPA_HS_MASK_PRISM) ||
00110 !strcmp(tag, MIDI_KAPPA_HS_MASK_GRISM) ||
00111 !strcmp(tag, MIDI_KAPPAMATRIX_PRISM) ||
00112 !strcmp(tag, MIDI_KAPPAMATRIX_GRISM) ||
00113 !strcmp(tag, MIDI_TRF_GRISM) ||
00114 !strcmp(tag, MIDI_TRF_PRISM) ||
00115 !strcmp(tag, MIDI_CALIB_DATABASE))
00116 {
00117
00118 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
00119 }
00120
00121
00122
00123
00124
00125
00126
00127 }
00128
00129 if (!cpl_errorstate_is_equal(prestate)) {
00130 return cpl_error_set_message(cpl_func, cpl_error_get_code(),
00131 "Could not identify RAW and CALIB "
00132 "frames");
00133 }
00134
00135 return CPL_ERROR_NONE;
00136 }
00137