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 <stdarg.h>
00037 #include <stdio.h>
00038 #include <string.h>
00039 #include <math.h>
00040
00041 #include <cpl.h>
00042
00043 #include "irplib_tools.h"
00044 #include "irplib_utils.h"
00045 #include "visir_utils.h"
00046 #include "visir_pfits.h"
00047 #include "visir_dfs.h"
00048
00049
00050
00051
00052
00053 static const char * visir_dfs_find_tag_from_dpr(const char *, const char *,
00054 const char *);
00055
00056
00062
00063
00066
00072
00073 int visir_dfs_set_groups(cpl_frameset * set)
00074 {
00075 cpl_frame * frame = NULL;
00076 int i = 0;
00077
00078
00079 skip_if (0);
00080
00081
00082 for (frame = cpl_frameset_get_first(set); frame != NULL ;
00083 frame = cpl_frameset_get_next(set), i++) {
00084 const char * tag = cpl_frame_get_tag(frame);
00085
00086 skip_if (0);
00087
00088
00089 if (tag == NULL) cpl_msg_warning(cpl_func,
00090 "Frame %d has no tag", i);
00091 else if (!strcmp(tag, VISIR_IMG_ACHRO_RAW) ||
00092 !strcmp(tag, VISIR_IMG_COMBINE_CNJ) ||
00093 !strcmp(tag, VISIR_IMG_COMBINE_CJ) ||
00094 !strcmp(tag, VISIR_IMG_COMBINE_NJ) ||
00095 !strcmp(tag, VISIR_IMG_COMBINE_DJ) ||
00096 !strcmp(tag, VISIR_IMG_FF_RAW) ||
00097 !strcmp(tag, VISIR_IMG_TECH_FF_RAW) ||
00098 !strcmp(tag, VISIR_IMG_FOCFWHM_RAW) ||
00099 !strcmp(tag, VISIR_IMG_ILLU_RAW) ||
00100 !strcmp(tag, VISIR_IMG_PFOV_BIN) ||
00101 !strcmp(tag, VISIR_IMG_PFOV_TEL) ||
00102 !strcmp(tag, VISIR_IMG_PHOT_RAW) ||
00103 !strcmp(tag, VISIR_IMG_PSF_RAW) ||
00104 !strcmp(tag, VISIR_IMG_TRANS_RAW) ||
00105 !strcmp(tag, VISIR_IMG_DARK_RAW) ||
00106 !strcmp(tag, VISIR_SPC_OBS_ECH_RAW) ||
00107 !strcmp(tag, VISIR_SPC_OBS_RAW) ||
00108 !strcmp(tag, VISIR_SPC_OBS_HR_RAW) ||
00109 !strcmp(tag, VISIR_SPC_PHOT_RAW) ||
00110 !strcmp(tag, VISIR_SPC_PHOT_ECH_RAW) ||
00111 !strcmp(tag, VISIR_SPC_WCAL_ECH_RAW) ||
00112 !strcmp(tag, VISIR_SPC_WCAL_RAW) ||
00113 !strcmp(tag, VISIR_SPC_FF_RAW) ||
00114 !strcmp(tag, VISIR_SPC_TECH_FF_RAW) ||
00115 !strcmp(tag, VISIR_SPC_DARK_RAW) ||
00116 !strcmp(tag, VISIR_IMG_LINES_ASCII) ||
00117 !strcmp(tag, VISIR_SPC_LINES_ASCII) ||
00118 !strcmp(tag, VISIR_SPC_QEFF_ASCII) ||
00119 !strcmp(tag, VISIR_UTIL_INPUTS_RAW) ||
00120 !strcmp(tag, VISIR_UTIL_NODDED) ||
00121 !strcmp(tag, VISIR_UTIL_CONVERT_RAW) ||
00122 !strcmp(tag, VISIR_UTIL_CONVERT_TAB) ||
00123 !strcmp(tag, VISIR_UTIL_CONVERT_INV) ||
00124 !strcmp(tag, VISIR_UTIL_CONVERT_POS_AUX) ||
00125 !strcmp(tag, VISIR_UTIL_CONVERT_INV_AUX) ||
00126 !strcmp(tag, VISIR_UTIL_WEIGHT2ERROR) ||
00127 !strcmp(tag, VISIR_IMG_BURST) ||
00128 !strcmp(tag, VISIR_UTIL_DATA) ||
00129 !strcmp(tag, VISIR_UTIL_UNDISTORT_RAW) ||
00130 !strcmp(tag, VISIR_UTIL_REPACK_RAW))
00131 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00132
00133 else if (!strcmp(tag, VISIR_CALIB_FLAT) ||
00134 !strcmp(tag, VISIR_CALIB_BPM) ||
00135 !strcmp(tag, VISIR_CALIB_STATIC_MASK) ||
00136 !strcmp(tag, VISIR_CALIB_STDSTAR_IMG) ||
00137 !strcmp(tag, VISIR_CALIB_STDSTAR_SPC) ||
00138 !strcmp(tag, VISIR_CALIB_LINES_SPC) ||
00139 !strcmp(tag, VISIR_UTIL_WEIGHT2ERROR_PROCATG) ||
00140 !strcmp(tag, VISIR_IMG_CLIPPED_MAP_PROCATG) ||
00141 !strcmp(tag, VISIR_UTIL_WEIGHT2ERROR) ||
00142 !strcmp(tag, VISIR_UTIL_WEIGHT_MAP) ||
00143 !strcmp(tag, VISIR_UTIL_ERROR_MAP) ||
00144 !strcmp(tag, VISIR_UTIL_VARIANCE_MAP) ||
00145 !strcmp(tag, VISIR_SPC_CAT_ASCII) ||
00146 !strcmp(tag, VISIR_CALIB_QEFF_SPC))
00147 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
00148 else cpl_msg_warning(cpl_func,
00149 "Frame %d has unknown tag: %s", i, tag);
00150 }
00151
00152 skip_if (frame != NULL);
00153
00154 end_skip;
00155
00156 if (cpl_error_get_code())
00157 cpl_msg_error(cpl_func, "Could not identify RAW and CALIB frames "
00158 "(after processing %d frames)", i);
00159
00160 return cpl_error_get_code();
00161 }
00162
00163
00169
00170 cpl_error_code visir_dfs_check_framelist_tag(const irplib_framelist * self)
00171 {
00172
00173 if (cpl_error_get_code()) return cpl_error_get_code();
00174
00175 cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
00176
00177 return irplib_dfs_check_framelist_tag(self, visir_dfs_find_tag_from_dpr);
00178
00179 }
00180
00183
00192
00193 static const char * visir_dfs_find_tag_from_dpr(const char * catg,
00194 const char * type,
00195 const char * tech)
00196 {
00197 const char * docatg = NULL;
00198
00199
00200 if (cpl_error_get_code()) return NULL;
00201
00202 cpl_ensure(catg != NULL, CPL_ERROR_NULL_INPUT, NULL);
00203 cpl_ensure(type != NULL, CPL_ERROR_NULL_INPUT, NULL);
00204 cpl_ensure(tech != NULL, CPL_ERROR_NULL_INPUT, NULL);
00205
00206 #include "visir_dfs_dpr.h"
00207
00208 return docatg;
00209
00210 }
00211
00212