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 "sinfoni_tpl_dfs.h"
00042 #include "sinfoni_pro_types.h"
00043 #include "sinfoni_raw_types.h"
00044 #include "sinfoni_ref_types.h"
00045 #include "utilities.h"
00046
00047
00048
00054
00055
00058
00064
00065 int sinfoni_dfs_set_groups(cpl_frameset * set)
00066 {
00067 const char * _id = "sinfoni_dfs_set_groups";
00068 cpl_frame * cur_frame ;
00069 const char * tag ;
00070 int nframes ;
00071 int i ;
00072
00073 skip_if (cpl_error_get_code());
00074
00075
00076 if (set == NULL) return -1 ;
00077
00078
00079 nframes = cpl_frameset_get_size(set) ;
00080
00081
00082 for (i=0 ; i<nframes ; i++) {
00083 cur_frame = cpl_frameset_get_frame(set, i) ;
00084 tag = cpl_frame_get_tag(cur_frame) ;
00085 if (cpl_error_get_code()) break;
00086 if (tag == NULL) cpl_msg_warning(_id,
00087 "Frame %d has no tag", i);
00088
00089 else if (!strcmp(tag, RAW_LINEARITY_LAMP) ||
00090 !strcmp(tag, RAW_DARK) ||
00091 !strcmp(tag, RAW_FIBRE_NS) ||
00092 !strcmp(tag, RAW_FLAT_NS) ||
00093 !strcmp(tag, RAW_WAVE_NS) ||
00094 !strcmp(tag, RAW_FLAT_LAMP) ||
00095 !strcmp(tag, RAW_WAVE_LAMP) ||
00096 !strcmp(tag, RAW_PSF_CALIBRATOR) ||
00097 !strcmp(tag, RAW_SKY_PSF_CALIBRATOR) ||
00098 !strcmp(tag, RAW_STD) ||
00099 !strcmp(tag, RAW_SKY) ||
00100 !strcmp(tag, RAW_SKY_STD) ||
00101 !strcmp(tag, RAW_OBJECT_NODDING) ||
00102 !strcmp(tag, RAW_SKY_NODDING) ||
00103 !strcmp(tag, RAW_WAVE_LAMP_DITHER) ||
00104 !strcmp(tag, RAW_WAVE_NS_DITHER) ||
00105 !strcmp(tag, RAW_FLAT_LAMP_DITHER) ||
00106 !strcmp(tag, RAW_FLAT_NS_DITHER) ||
00107 !strcmp(tag, RAW_OBJECT_SKYSPIDER_DITHER) ||
00108 !strcmp(tag, RAW_OBJECT_NODDING_DITHER) ||
00109 !strcmp(tag, RAW_SKY_NODDING_DITHER) ||
00110 !strcmp(tag, RAW_OBJECT_SKYSPIDER))
00111 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ;
00112
00113 else if (!strcmp(tag, PRO_BP_MAP_HP) ||
00114 !strcmp(tag,PRO_BP_MAP_NL) ||
00115 !strcmp(tag,PRO_BP_MAP_NO) ||
00116 !strcmp(tag,PRO_BP_MAP_DI) ||
00117 !strcmp(tag,PRO_BP_MAP_NL) ||
00118 !strcmp(tag,PRO_BP_MAP_NO) ||
00119 !strcmp(tag,PRO_FIBRE_NS_STACKED_OFF) ||
00120 !strcmp(tag,PRO_FIBRE_NS_STACKED_ON) ||
00121 !strcmp(tag,PRO_FIBRE_NS_STACKED) ||
00122 !strcmp(tag,PRO_MASTER_BP_MAP) ||
00123 !strcmp(tag,PRO_MASTER_DARK) ||
00124 !strcmp(tag,PRO_DISTORTION) ||
00125 !strcmp(tag,PRO_SLITLETS_DISTANCE) ||
00126 !strcmp(tag,PRO_MASTER_FLAT_LAMP) ||
00127 !strcmp(tag,PRO_SLIT_POS) ||
00128 !strcmp(tag,PRO_SLIT_POS_GUESS) ||
00129 !strcmp(tag,PRO_FIRST_COL) ||
00130 !strcmp(tag,PRO_WAVE_MAP ) ||
00131 !strcmp(tag,REF_LINE_ARC ) ||
00132 !strcmp(tag,DRS_SETUP_WAVE ) ||
00133 !strcmp(tag,PRO_IMA ) ||
00134 !strcmp(tag,PRO_CUBE ) ||
00135 !strcmp(tag,REF_BP_MAP ) ||
00136 !strcmp(tag,PRO_SKY_DUMMY ) ||
00137 !strcmp(tag,PRO_SPECTRUM))
00138 cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ;
00139 else cpl_msg_warning(_id,
00140 "Frame %d has unknown tag: %s", i, tag);
00141 }
00142
00143 skip_if (i != nframes);
00144
00145 end_skip;
00146
00147 if (cpl_error_get_code())
00148 cpl_msg_error(_id, "Could not identify RAW and CALIB frames (in "
00149 "frame set of size %d)", nframes);
00150
00151
00152 return cpl_error_get_code();
00153 }
00154