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 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033
00034 #include <cpl.h>
00035 #include "vircam_mods.h"
00036 #include "vircam_utils.h"
00037 #include "vircam_fits.h"
00038
00041
00081
00082
00083 extern int vircam_nditcor(vir_fits *infile, int ndit, int *status) {
00084 cpl_image *im;
00085 double dnd,exptime;
00086 cpl_propertylist *oplist;
00087 char comment[32];
00088
00089
00090
00091 if (*status != VIR_OK)
00092 return(*status);
00093
00094
00095
00096 if (cpl_propertylist_has(vircam_fits_get_ehu(infile),"ESO DRS NDITCOR"))
00097 return(*status);
00098
00099
00100
00101 im = vircam_fits_get_image(infile);
00102 dnd = (float)ndit;
00103
00104
00105
00106 cpl_image_divide_scalar(im,dnd);
00107
00108
00109
00110
00111
00112 oplist = vircam_fits_get_ehu(infile);
00113 if (oplist != NULL) {
00114 cpl_propertylist_update_bool(oplist,"ESO DRS NDITCOR",1);
00115 (void)sprintf(comment,"Corrected for ndit=%d",ndit);
00116 cpl_propertylist_set_comment(oplist,"ESO DRS NDITCOR",comment);
00117 exptime = cpl_propertylist_get_double(oplist,"EXPTIME");
00118 exptime /= dnd;
00119 cpl_propertylist_update_double(oplist,"EXPTIME",exptime);
00120 cpl_propertylist_set_comment(oplist,"EXPTIME",comment);
00121 }
00122 oplist = vircam_fits_get_phu(infile);
00123 if (oplist != NULL) {
00124 (void)sprintf(comment,"Corrected for ndit=%d",ndit);
00125 exptime = cpl_propertylist_get_double(oplist,"EXPTIME");
00126 exptime /= dnd;
00127 cpl_propertylist_update_double(oplist,"EXPTIME",exptime);
00128 cpl_propertylist_set_comment(oplist,"EXPTIME",comment);
00129 }
00130
00131
00132
00133 GOOD_STATUS
00134 }
00135
00136
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155