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 #ifdef HAVE_CONFIG_H
00028 #include <config.h>
00029 #endif
00030 #include <xsh_efficiency_response.h>
00031 #include <xsh_error.h>
00032
00033 HIGH_ABS_REGION NirTellComputeResidRegions[] = {
00034 {1105.0, 1266.0},
00035 {1300.0, 1343.0},
00036 {1468.0, 1780.0},
00037 {1940.0, 1994.0},
00038 {2030.0, 2046.0},
00039 {2080.0, 2100.0},
00040 {0., 0.}
00041 } ;
00042
00043
00044 HIGH_ABS_REGION VisTellComputeResidRegions[] = {
00045 {0., 0.}
00046 } ;
00047
00048
00049 HIGH_ABS_REGION UvbTellComputeResidRegions[] = {
00050 {0., 0.}
00051 } ;
00052
00053 HIGH_ABS_REGION NirTellFitRegions[] = {
00054 {1039.0, 1041.0},
00055 {1059.0, 1061.0},
00056 {1190.0, 1192.0},
00057 {1228.0, 1230.0},
00058 {1243.0, 1245.0},
00059 {1552.0, 1554.0},
00060 {1589.0, 1591.0},
00061 {1619.0, 1621.0},
00062 {1658.0, 1660.0},
00063 {1691.0, 1693.0},
00064 {1702.0, 1704.0},
00065 {1709.0, 1711.0},
00066 {1717.0, 1719.0},
00067 {1990.0, 1992.0},
00068 {2036.0, 2038.0},
00069 {2102.0, 2103.0},
00070 {2112.0, 2114.0},
00071 {2125.0, 2127.0},
00072 {2132.0, 2134.0},
00073 {2137.0, 2139.0},
00074 {2141.0, 2143.0},
00075 {2144.0, 2146.0},
00076 {2156.0, 2158.0},
00077 {2163.0, 2165.0},
00078 {2186.0, 2188.0},
00079 {2209.0, 2211.0},
00080 {2239.0, 2241.0},
00081 {2259.0, 2261.0},
00082 {2279.0, 2281.0},
00083 {2306.0, 2308.0},
00084 {2324.0, 2326.0},
00085 {2342.0, 2344.0},
00086 {2379.0, 2381.0},
00087 {2429.0, 2431.0},
00088 {2475.0, 2477.0},
00089 {0., 0.}
00090 } ;
00091
00092 HIGH_ABS_REGION VisTellFitRegions[] = {
00093 {0., 0.}
00094 } ;
00095
00096
00097 HIGH_ABS_REGION UvbTellFitRegions[] = {
00098 {0., 0.}
00099 } ;
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 HIGH_ABS_REGION NirHighAbsRegions[] = {
00134 {1084.0, 1169.0},
00135 {1300.0, 1503.0},
00136 {1735.0, 1980.0},
00137 {1995.0, 2035.0},
00138 {2048.0, 2082.0},
00139 {0., 0.}
00140 } ;
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 HIGH_ABS_REGION VisHighAbsRegions[] = {
00181 {500.0, 540.0},
00182 {585.0, 604.0},
00183 {632.0, 644.0},
00184 {684.5, 695.0},
00185 {695.5, 714.0},
00186 {756.0, 773.0},
00187 {810.0, 835.0},
00188 {893.0, 923.0},
00189 {927.0, 966.0},
00190 {966.0, 980.0},
00191 {0., 0.}
00192 } ;
00193
00194
00195 HIGH_ABS_REGION UvbHighAbsRegions[] = {
00196 {295.0, 301.0},
00197 {393.0, 401.0},
00198 {406.0, 414.0},
00199 {428.5, 440.0},
00200 {479.0, 493.0},
00201 {556.0, 574.0},
00202 {0., 0.}
00203 } ;
00204
00205
00206
00207 HIGH_ABS_REGION *
00208 xsh_fill_high_abs_regions(
00209 xsh_instrument* instrument,
00210 cpl_frame* high_abs_frame)
00211 {
00212 HIGH_ABS_REGION * phigh=NULL;
00213 int nrow=0;
00214 double* pwmin=0;
00215 double* pwmax=0;
00216 int i=0;
00217 cpl_table* high_abs_tab=NULL;
00218 XSH_ARM the_arm;
00219
00220 if(high_abs_frame !=NULL) {
00221 high_abs_tab=cpl_table_load(cpl_frame_get_filename(high_abs_frame),1,0);
00222 }
00223 the_arm=xsh_instrument_get_arm(instrument);
00224
00225
00226
00227 if(high_abs_tab!=NULL) {
00228 nrow=cpl_table_get_nrow(high_abs_tab);
00229 check(pwmin=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MIN"));
00230 check(pwmax=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MAX"));
00231
00232 phigh = (HIGH_ABS_REGION *) cpl_calloc(nrow + 1, sizeof(HIGH_ABS_REGION));
00233 for(i=0;i<nrow;i++) {
00234 phigh[i].lambda_min=pwmin[i];
00235 phigh[i].lambda_max=pwmax[i];
00236 }
00237 phigh[nrow].lambda_min=0;
00238 phigh[nrow].lambda_max=0;
00239
00240 } else {
00241
00242
00243
00244
00245 if ( the_arm == XSH_ARM_UVB ) {
00246
00247 phigh = UvbHighAbsRegions ;
00248 }
00249 else if ( the_arm == XSH_ARM_VIS ) {
00250
00251 phigh = VisHighAbsRegions ;
00252 }
00253 else if ( the_arm == XSH_ARM_NIR ) {
00254
00255 phigh = NirHighAbsRegions ;
00256 }
00257
00258 }
00259 cleanup:
00260 xsh_free_table(&high_abs_tab);
00261 return phigh;
00262 }
00263
00264
00265
00266 HIGH_ABS_REGION *
00267 xsh_fill_tell_fit_regions(
00268 xsh_instrument* instrument,
00269 cpl_frame* high_abs_frame)
00270 {
00271 HIGH_ABS_REGION * phigh=NULL;
00272 int nrow=0;
00273 double* pwmin=0;
00274 double* pwmax=0;
00275 int i=0;
00276 cpl_table* high_abs_tab=NULL;
00277 XSH_ARM the_arm;
00278
00279 if(high_abs_frame !=NULL) {
00280 high_abs_tab=cpl_table_load(cpl_frame_get_filename(high_abs_frame),1,0);
00281 }
00282 the_arm=xsh_instrument_get_arm(instrument);
00283
00284
00285
00286 if(high_abs_tab!=NULL) {
00287 nrow=cpl_table_get_nrow(high_abs_tab);
00288 check(pwmin=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MIN"));
00289 check(pwmax=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MAX"));
00290
00291 phigh = (HIGH_ABS_REGION *) cpl_calloc(nrow + 1, sizeof(HIGH_ABS_REGION));
00292 for(i=0;i<nrow;i++) {
00293 phigh[i].lambda_min=pwmin[i];
00294 phigh[i].lambda_max=pwmax[i];
00295 }
00296 phigh[nrow].lambda_min=0;
00297 phigh[nrow].lambda_max=0;
00298
00299 } else {
00300
00301
00302
00303
00304 if ( the_arm == XSH_ARM_UVB ) {
00305
00306 phigh = UvbTellFitRegions ;
00307 }
00308 else if ( the_arm == XSH_ARM_VIS ) {
00309
00310 phigh = VisTellFitRegions ;
00311 }
00312 else if ( the_arm == XSH_ARM_NIR ) {
00313
00314 phigh = NirTellFitRegions ;
00315 }
00316
00317 }
00318 cleanup:
00319 xsh_free_table(&high_abs_tab);
00320 return phigh;
00321 }
00322
00323
00324
00325 HIGH_ABS_REGION *
00326 xsh_fill_tell_compute_resid_regions(
00327 xsh_instrument* instrument,
00328 cpl_frame* high_abs_frame)
00329 {
00330 HIGH_ABS_REGION * phigh=NULL;
00331 int nrow=0;
00332 double* pwmin=0;
00333 double* pwmax=0;
00334 int i=0;
00335 cpl_table* high_abs_tab=NULL;
00336 XSH_ARM the_arm;
00337
00338 if(high_abs_frame !=NULL) {
00339 high_abs_tab=cpl_table_load(cpl_frame_get_filename(high_abs_frame),1,0);
00340 }
00341 the_arm=xsh_instrument_get_arm(instrument);
00342
00343
00344
00345 if(high_abs_tab!=NULL) {
00346 nrow=cpl_table_get_nrow(high_abs_tab);
00347 check(pwmin=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MIN"));
00348 check(pwmax=cpl_table_get_data_double(high_abs_tab,"LAMBDA_MAX"));
00349
00350 phigh = (HIGH_ABS_REGION *) cpl_calloc(nrow + 1, sizeof(HIGH_ABS_REGION));
00351 for(i=0;i<nrow;i++) {
00352 phigh[i].lambda_min=pwmin[i];
00353 phigh[i].lambda_max=pwmax[i];
00354 }
00355 phigh[nrow].lambda_min=0;
00356 phigh[nrow].lambda_max=0;
00357
00358 } else {
00359
00360
00361
00362
00363 if ( the_arm == XSH_ARM_UVB ) {
00364
00365 phigh = UvbTellComputeResidRegions ;
00366 }
00367 else if ( the_arm == XSH_ARM_VIS ) {
00368
00369 phigh = VisTellComputeResidRegions ;
00370 }
00371 else if ( the_arm == XSH_ARM_NIR ) {
00372
00373 phigh = NirTellComputeResidRegions ;
00374 }
00375
00376 }
00377 cleanup:
00378 xsh_free_table(&high_abs_tab);
00379 return phigh;
00380 }