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
00029
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include <config.h>
00033 #endif
00034
00035 #include <string.h>
00036 #include <cpl.h>
00037
00038 #include "vircam_dfs.h"
00039 #include "vircam_utils.h"
00040
00041 #define PACKSZ 1024
00042
00057
00079
00080
00081 extern int vircam_dfs_set_groups(cpl_frameset *set) {
00082 cpl_frame *cur_frame;
00083 const char *tag;
00084 const char *fctid = "vircam_dfs_set_groups";
00085 int nframes,i;
00086
00087
00088
00089 if (set == NULL)
00090 return(VIR_FATAL);
00091
00092
00093
00094 nframes = cpl_frameset_get_size(set);
00095
00096
00097
00098 for (i = 0; i < nframes; i++) {
00099 cur_frame = cpl_frameset_get_frame(set,i);
00100 tag = cpl_frame_get_tag(cur_frame);
00101
00102
00103
00104 if (!strcmp(tag,VIRCAM_CROSSTALK_RAW) ||
00105 !strcmp(tag,VIRCAM_DARK_RAW) ||
00106 !strcmp(tag,VIRCAM_DARKCUR_RAW) ||
00107 !strcmp(tag,VIRCAM_NOISE_FLAT_RAW) ||
00108 !strcmp(tag,VIRCAM_NOISE_DARK_RAW) ||
00109 !strcmp(tag,VIRCAM_DOME_RAW) ||
00110 !strcmp(tag,VIRCAM_SCI_OBJECT_RAW) ||
00111 !strcmp(tag,VIRCAM_SCI_OBJECT_EXT_RAW) ||
00112 !strcmp(tag,VIRCAM_TEST_SCIENCE_RAW) ||
00113 !strcmp(tag,VIRCAM_LIN_DOME_RAW) ||
00114 !strcmp(tag,VIRCAM_LIN_DOME_CHECK) ||
00115 !strcmp(tag,VIRCAM_LIN_DARK_RAW) ||
00116 !strcmp(tag,VIRCAM_LIN_DARK_CHECK) ||
00117 !strcmp(tag,VIRCAM_ILLUM_RAW) ||
00118 !strcmp(tag,VIRCAM_PERSIST_OBJ_RAW) ||
00119 !strcmp(tag,VIRCAM_PERSIST_DARK_RAW) ||
00120 !strcmp(tag,VIRCAM_RESET_RAW) ||
00121 !strcmp(tag,VIRCAM_STD_OBJECT_RAW) ||
00122 !strcmp(tag,VIRCAM_TWI_RAW))
00123 cpl_frame_set_group(cur_frame,CPL_FRAME_GROUP_RAW);
00124
00125
00126
00127 else if (!strcmp(tag,VIRCAM_CAL_RESET) ||
00128 !strcmp(tag,VIRCAM_CAL_DARK) ||
00129 !strcmp(tag,VIRCAM_CAL_DOME_FLAT) ||
00130 !strcmp(tag,VIRCAM_CAL_TWILIGHT_FLAT) ||
00131 !strcmp(tag,VIRCAM_CAL_CONF) ||
00132 !strcmp(tag,VIRCAM_CAL_BPM) ||
00133 !strcmp(tag,VIRCAM_CAL_FRINGE) ||
00134 !strcmp(tag,VIRCAM_CAL_CHANTAB) ||
00135 !strcmp(tag,VIRCAM_CAL_READGAINFILE) ||
00136 !strcmp(tag,VIRCAM_CAL_CHANTAB_INIT) ||
00137 !strcmp(tag,VIRCAM_CAL_PHOTTAB) ||
00138 !strcmp(tag,VIRCAM_CAL_STDTAB) ||
00139 !strcmp(tag,VIRCAM_CAL_OBJCAT) ||
00140 !strcmp(tag,VIRCAM_CAL_MSTDTAB) ||
00141 !strcmp(tag,VIRCAM_CAL_2MASS) ||
00142 !strcmp(tag,VIRCAM_CAL_REFCAT) ||
00143 !strcmp(tag,VIRCAM_REF_RESET) ||
00144 !strcmp(tag,VIRCAM_REF_DARK) ||
00145 !strcmp(tag,VIRCAM_REF_DOME_FLAT) ||
00146 !strcmp(tag,VIRCAM_REF_TWILIGHT_FLAT))
00147 cpl_frame_set_group(cur_frame,CPL_FRAME_GROUP_CALIB);
00148 else
00149 cpl_msg_info(fctid,"No such tag as %s in frame %s",tag,
00150 cpl_frame_get_filename(cur_frame));
00151 }
00152 return(VIR_OK);
00153 }
00154
00155
00180
00181
00182 extern void vircam_dfs_set_product_primary_header(cpl_propertylist *plist,
00183 cpl_frame *frame,
00184 cpl_frameset *frameset,
00185 cpl_parameterlist *parlist,
00186 char *recipeid,
00187 const char *dict) {
00188 const char *fctid="vircam_dfs_set_product_primary_header";
00189 char package[PACKSZ],*catg;
00190
00191
00192
00193 (void)snprintf(package,PACKSZ,"%s/%s",PACKAGE,PACKAGE_VERSION);
00194
00195
00196
00197 if (cpl_dfs_setup_product_header(plist,frame,frameset,parlist,recipeid,
00198 package,dict) != CPL_ERROR_NONE) {
00199 cpl_msg_warning(fctid,
00200 "Problem with the product primary DFS compliance");
00201 cpl_error_reset();
00202 }
00203
00204
00205
00206 catg = cpl_strdup(cpl_propertylist_get_string(plist,"ESO PRO CATG"));
00207
00208
00209
00210 cpl_propertylist_erase_regexp(plist,"ESO PRO",0);
00211
00212
00213
00214 cpl_propertylist_update_string(plist,"ESO PRO CATG",catg);
00215 cpl_propertylist_set_comment(plist,"ESO PRO CATG",
00216 "Category of pipeline product frame");
00217 cpl_free(catg);
00218 }
00219
00220
00245
00246
00247 extern void vircam_dfs_set_product_exten_header(cpl_propertylist *plist,
00248 cpl_frame *frame,
00249 cpl_frameset *frameset,
00250 cpl_parameterlist *parlist,
00251 char *recipeid,
00252 const char *dict) {
00253 const char *fctid="vircam_dfs_set_product_exten_header";
00254 char package[PACKSZ];
00255
00256
00257
00258 (void)snprintf(package,PACKSZ,"%s/%s",PACKAGE,PACKAGE_VERSION);
00259
00260
00261
00262 if (cpl_dfs_setup_product_header(plist,frame,frameset,parlist,recipeid,
00263 package,dict) != CPL_ERROR_NONE) {
00264 cpl_msg_warning(fctid,"Problem with the product extn DFS compliance");
00265 cpl_error_reset();
00266 }
00267
00268
00269
00270 cpl_propertylist_erase(plist,"INSTRUME");
00271 cpl_propertylist_erase(plist,"PIPEFILE");
00272 cpl_propertylist_erase_regexp(plist,"ESO INS",0);
00273 cpl_propertylist_erase_regexp(plist,"ESO OBS",0);
00274 cpl_propertylist_erase_regexp(plist,"ESO TEL",0);
00275
00276 }
00277
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384