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 cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00121
00122 else if (!strcmp(tag, VISIR_CALIB_FLAT) ||
00123 !strcmp(tag, VISIR_CALIB_BPM) ||
00124 !strcmp(tag, VISIR_CALIB_STDSTAR_IMG) ||
00125 !strcmp(tag, VISIR_CALIB_STDSTAR_SPC) ||
00126 !strcmp(tag, VISIR_CALIB_LINES_SPC) ||
00127 !strcmp(tag, VISIR_SPC_CAT_ASCII) ||
00128 !strcmp(tag, VISIR_CALIB_QEFF_SPC))
00129 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
00130 else cpl_msg_warning(cpl_func,
00131 "Frame %d has unknown tag: %s", i, tag);
00132 }
00133
00134 skip_if (frame != NULL);
00135
00136 end_skip;
00137
00138 if (cpl_error_get_code())
00139 cpl_msg_error(cpl_func, "Could not identify RAW and CALIB frames "
00140 "(after processing %d frames)", i);
00141
00142 return cpl_error_get_code();
00143 }
00144
00145
00151
00152 cpl_error_code visir_dfs_check_framelist_tag(const irplib_framelist * self)
00153 {
00154
00155 if (cpl_error_get_code()) return cpl_error_get_code();
00156
00157 cpl_ensure_code(self != NULL, CPL_ERROR_NULL_INPUT);
00158
00159 return irplib_dfs_check_framelist_tag(self, visir_dfs_find_tag_from_dpr);
00160
00161 }
00162
00165
00174
00175 static const char * visir_dfs_find_tag_from_dpr(const char * catg,
00176 const char * type,
00177 const char * tech)
00178 {
00179 const char * docatg = NULL;
00180
00181
00182 if (cpl_error_get_code()) return NULL;
00183
00184 cpl_ensure(catg != NULL, CPL_ERROR_NULL_INPUT, NULL);
00185 cpl_ensure(type != NULL, CPL_ERROR_NULL_INPUT, NULL);
00186 cpl_ensure(tech != NULL, CPL_ERROR_NULL_INPUT, NULL);
00187
00188 #include "visir_dfs_dpr.h"
00189
00190 return docatg;
00191
00192 }
00193
00194