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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00108
00111 #ifdef HAVE_CONFIG_H
00112 # include <config.h>
00113 #endif
00114
00115
00116
00117 #include <uves_physmod_create_table.h>
00118
00119 #include <uves_physmod_utils.h>
00120 #include <uves_utils_wrappers.h>
00121 #include <uves_pfits.h>
00122 #include <uves_msg.h>
00123 #include <uves_error.h>
00124
00125
00126
00127
00128
00129
00130
00131
00132 static int
00133 flames_get_trans(const int plt_no,
00134 enum uves_chip chip,
00135 const double wlen,
00136 double * TX,
00137 double * TY);
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00170
00171
00172
00173
00174
00175 int
00176 uves_physmod_create_table(const uves_propertylist *raw_header,
00177 enum uves_chip chip,
00178 const char *recipe_id,
00179 const cpl_parameterlist* parameters,
00180 cpl_table* line_refer,
00181 const double physmod_shift_x,
00182 const double physmod_shift_y,
00183 cpl_table** mod_tbl,
00184 cpl_table** fsr_tbl)
00185
00186 {
00187
00188
00189 int MBOX_X=0;
00190 int MBOX_Y=0;
00191 double TRANS_X=0;
00192 double TRANS_Y=0;
00193
00194 double ECH_ANG_OFF=0;
00195 double CD_ANG_OFF=0;
00196 double CCD_ANG_OFF=0;
00197
00198
00199
00200 int CMP_REG_SW=0;
00201
00202 double binx=0;
00203 double biny=0;
00204
00205 double pressure=0;
00206 double temp_cam=0;
00207 double slit_width=0;
00208 double slit_length=0;
00209 double humidity=0;
00210
00211
00212 double wcent=0;
00213 double xtrans=0;
00214 double ytrans=0;
00215 double echoff=0;
00216 double CDoff=0;
00217 double ccdrotoff=0;
00218 double ccd_rot[2];
00219 double offset_x[6];
00220 double offset_y[6];
00221
00222 const char* cd_id;
00223 int CDID=0;
00224 int status=0;
00225
00226
00227 int aRowNumber=0;
00228 int xpix=0;
00229 int ypix=0;
00230 int i=0;
00231 int mm=0;
00232 double xmod=0;
00233 double ymod=0;
00234 double blaze=0;
00235 double binsize=0;
00236 double pixscale=0;
00237 double pixscalCD=0;
00238 double linelenpx=0;
00239 double linewidth=0;
00240 double linewidpx=0;
00241 double resol=0;
00242 double xreg=0;
00243 double yreg=0;
00244 double fsr_min=0;
00245 double fsr_max=0;
00246 double xfsr_min=0;
00247 double xfsr_max=0;
00248 double yfsr_min=0;
00249 double yfsr_max=0;
00250 int m_min=0;
00251 int m_max=0;
00252 double lmin=0;
00253 double lmax=0;
00254 double dxpix=0;
00255 double dypix=0;
00256 double dblwav=0;
00257 int imod=0;
00258 double dl=0;
00259 int mmin=0;
00260 int mmax=0;
00261 int ncol=0;
00262 int order=0;
00263 double xr=0;
00264 double yr=0;
00265 double lcent=0;
00266
00267 double mbox_x=0;
00268 double mbox_y=0;
00269
00270
00271 double uves_beta_ech=0;
00272 double uves_beta_cd=0 ;
00273 double uves_physmod_rcd=0;
00274 double uves_physmod_rech=0;
00275 double uves_physmod_x_off=0;
00276 double uves_physmod_y_off=0;
00277 double x=0;
00278 double y=0;
00279 double fc=0;
00280 double l=0;
00281 int m=0;
00282 int plate_no=0;
00283
00284
00285
00286
00287 enum uves_arm_ident {UVES_ARM_UNDEF,UVES_ARM_BLUE,UVES_ARM_RED};
00288 enum uves_arm_ident uves_arm_ident = UVES_ARM_UNDEF;
00289 int upper;
00290
00291 const char* ccd_id="";
00292 const char* dpr_tech="";
00293
00294
00295
00296
00297 {
00298 check( uves_get_parameter(parameters, NULL, recipe_id,
00299 "mbox_x", CPL_TYPE_INT, &MBOX_X ) ,
00300 "Could not read parameter");
00301
00302 check( uves_get_parameter(parameters, NULL, recipe_id,
00303 "mbox_y", CPL_TYPE_INT, &MBOX_Y ) ,
00304 "Could not read parameter");
00305
00306 check( uves_get_parameter(parameters, NULL, recipe_id,
00307 "trans_x", CPL_TYPE_DOUBLE, &TRANS_X ) ,
00308 "Could not read parameter");
00309
00310 check( uves_get_parameter(parameters, NULL, recipe_id,
00311 "trans_y", CPL_TYPE_DOUBLE, &TRANS_Y ) ,
00312 "Could not read parameter");
00313 xtrans=TRANS_X;
00314 ytrans=TRANS_Y;
00315
00316
00317
00318
00319
00320
00321 if ((xtrans == 0.) && (ytrans == 0.)) {
00322
00323
00324
00325
00326 if (chip == UVES_CHIP_REDU) {
00327 ytrans = 6.7;
00328 }
00329 }
00330
00331 uves_msg_debug("xtrans=%f ytrans=%f",xtrans,ytrans);
00332 check( uves_get_parameter(parameters, NULL, recipe_id,
00333 "ech_angle_off", CPL_TYPE_DOUBLE, &ECH_ANG_OFF ) ,
00334 "Could not read parameter");
00335
00336 check( uves_get_parameter(parameters, NULL, recipe_id,
00337 "cd_angle_off", CPL_TYPE_DOUBLE, &CD_ANG_OFF ) ,
00338 "Could not read parameter");
00339
00340 check( uves_get_parameter(parameters, NULL, recipe_id,
00341 "ccd_rot_angle_off", CPL_TYPE_DOUBLE, &CCD_ANG_OFF ) ,
00342 "Could not read parameter");
00343
00344 check( uves_get_parameter(parameters, NULL, recipe_id,
00345 "compute_regression_sw", CPL_TYPE_BOOL, &CMP_REG_SW ) ,
00346 "Could not read parameter");
00347
00348
00349
00350
00351 }
00352
00353
00354
00355
00356 check (ccd_id = uves_pfits_get_chipid(raw_header,chip),
00357 "Could not read CCD ID from input header");
00358 check (dpr_tech = uves_pfits_get_dpr_tech(raw_header),
00359 "Could not read DPR TECH from input header");
00360 uves_msg("DPR TECH=%s<",dpr_tech);
00361 if(strstr(dpr_tech,"MOS")!=NULL) {
00362 check_nomsg( plate_no = uves_flames_pfits_get_plateid(raw_header) );
00363 uves_msg("PLATE NO=%d",plate_no);
00364 }
00365
00366 if(strcmp(ccd_id,"CCD-44b") == 0) {
00367 uves_msg("New Spectral Format");
00368 offset_x[0]=1355.0;
00369 offset_x[1]=1350.0;
00370 offset_x[2]=1852.0;
00371 offset_x[3]=1835.0;
00372 offset_x[4]=1852.0;
00373 offset_x[5]=1834.0;
00374
00375 offset_y[0]=1030.0;
00376 offset_y[1]=1023.0;
00377 offset_y[2]=2098.0;
00378 offset_y[3]=2104.0;
00379 offset_y[4]=-52.0;
00380 offset_y[5]=-49.0;
00381 ccd_rot[0]=0.3;
00382 ccd_rot[1]=-0.10;
00383
00384 } else {
00385 uves_msg("Old Spectral Format");
00386
00387 offset_x[0]=1391.0;
00388 offset_x[1]=1385.0;
00389 offset_x[2]=1852.0;
00390 offset_x[3]=1835.0;
00391 offset_x[4]=1852.0;
00392 offset_x[5]=1834.0;
00393
00394 offset_y[0]=1030.0;
00395 offset_y[1]=1025.0;
00396 offset_y[2]=2098.0;
00397 offset_y[3]=2104.0;
00398 offset_y[4]=-52.0;
00399 offset_y[5]=-49.0;
00400
00401 ccd_rot[0]=0.3;
00402 ccd_rot[1]=-0.55;
00403 }
00404
00405
00406 check (biny = uves_pfits_get_binx(raw_header),
00407 "Could not read x binning factor from input header");
00408
00409 check (binx = uves_pfits_get_biny(raw_header),
00410 "Could not read x binning factor from input header");
00411
00412 check (pressure = uves_pfits_get_pressure(raw_header),
00413 "Could not read pressure from input header");
00414
00415
00416
00417
00418
00419 humidity=3.;
00420
00421
00422
00423 check (slit_width = uves_pfits_get_slitwidth(raw_header, chip),
00424 "Could not read slit width input header");
00425
00426 check (slit_length = uves_pfits_get_slitlength(raw_header, chip),
00427 "Could not read slit length input header");
00428
00429 check (wcent = uves_pfits_get_gratwlen(raw_header, chip),
00430 "Could not read central wavelength setting from input header");
00431
00432 check (cd_id = uves_pfits_get_gratid(raw_header, chip),
00433 "Could not read central CD ID setting from input header");
00434
00435 check (temp_cam = uves_pfits_get_tempcam(raw_header,chip),
00436 "Could not read camera's temperature from input header");
00437
00438 if (chip == UVES_CHIP_BLUE)
00439 {
00440 uves_arm_id='b';
00441 uves_arm_ident=UVES_ARM_BLUE;
00442
00443 }
00444 else
00445 {
00446 uves_arm_id='r';
00447 uves_arm_ident=UVES_ARM_RED;
00448 }
00449 upper = (chip == UVES_CHIP_REDU);
00450
00451
00452
00453
00454 if(strstr(cd_id,"CD#1") != NULL) {
00455 CDID=1;
00456 } else if(strstr(cd_id,"CD#2") != NULL) {
00457 CDID=2;
00458 } else if(strstr(cd_id,"CD#3") != NULL) {
00459 CDID=3;
00460 } else if(strstr(cd_id,"CD#4") != NULL) {
00461 CDID=4;
00462 } else {
00463 CDID=0;
00464 }
00465
00466 mbox_x=MBOX_X/binx;
00467 mbox_y=MBOX_Y/biny;
00468 uves_msg("UVES configuration:");
00469 uves_msg("Optical path: %s (%s)",
00470 UVES_ARM(chip),UVES_ARMID(chip));
00471
00472 uves_msg("Detector: %s Binning: %1.1f, %1.1f pix/bin",
00473 UVES_DETECTOR(chip),binx,biny);
00474 uves_msg("Cross disperser ID, number: %s %d",cd_id,CDID);
00475 uves_msg("Central wavelength: %4.1f nm",wcent);
00476 uves_msg("Slit width: %3.1f (arcsecs)",slit_width);
00477 uves_msg("Slit length: %3.1f (arcsecs)",slit_length);
00478 uves_msg("Temperature: %3.1f C",temp_cam);
00479 uves_msg("Air pressure: %4.1f mmHg/cm^2",pressure);
00480 uves_msg("Humidity: %2.1f %%",humidity);
00481
00482 uves_msg_debug("chip =%s", uves_chip_tostring_upper(chip));
00483
00484
00485
00486 ncol=cpl_table_get_ncol(line_refer);
00487
00488 aRowNumber = cpl_table_get_nrow(line_refer);
00489
00490 uves_msg_debug("Opened table %s ncol=%d nrow=%d","line_ref_table" ,ncol,aRowNumber);
00491
00492 uves_air_config(pressure/1.33322, temp_cam, humidity);
00493 uves_msg("Air Index = %g",uves_air_index(wcent));
00494 if(strstr(dpr_tech,"MOS")!=NULL) {
00495 uves_msg("uves chip=%d REDL%d REDU%d",chip,UVES_CHIP_REDL,UVES_CHIP_REDU);
00496 flames_get_trans(plate_no,chip,wcent,&TRANS_X,&TRANS_Y);
00497 xtrans=TRANS_X+physmod_shift_x;
00498 ytrans=TRANS_Y+physmod_shift_y;
00499 }
00500 uves_msg("Shift in x = %6.3f pix, shift in y = %6.3f pix",TRANS_X,TRANS_Y);
00501 uves_msg("Offset angle of echelle, CD, CCD rotation (deg): "
00502 "%4.3f, %4.3f, %4.3f",ECH_ANG_OFF,CD_ANG_OFF,CCD_ANG_OFF);
00503
00504 uves_set_ccd_rot(ccd_rot,ccdrotoff, ccdrotoff);
00505 uves_physmod_set_incidence(echoff, echoff, CDoff, CDoff);
00506 uves_msg_debug("ccdbin=%f,%f",binx,biny);
00507 uves_msg_debug("offset x=%f %f %f %f %f %f",
00508 offset_x[0],offset_x[1],offset_x[2],offset_x[3],offset_x[4],offset_x[5]);
00509
00510 uves_msg_debug("offset y=%f %f %f %f %f %f",
00511 offset_y[0],offset_y[1],offset_y[2],offset_y[3],offset_y[4],offset_y[5]);
00512
00513 uves_msg("Central wavelength: %4.2f nm",wcent);
00514 uves_msg_debug("chip =%s", uves_chip_tostring_upper(chip));
00515
00516 uves_msg_debug("uves_arm_ident=%d",uves_arm_ident);
00517
00518
00519
00520
00521 uves_cfg_indx = uves_config_cpl_new(uves_arm_ident,upper,CDID,wcent,binx,biny);
00522 uves_msg_debug("uves_cfg_indx=%d",uves_cfg_indx);
00523
00524 uves_physmod_set_offset(offset_x[uves_cfg_indx-1],offset_y[uves_cfg_indx-1],
00525 uves_physmod_x_off,uves_physmod_y_off);
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537 *mod_tbl= cpl_table_new(3*aRowNumber);
00538
00539 uves_msg_debug("table created: %s ncol=%d, nrow=%d","mod_tbl",10,3*aRowNumber);
00540 cpl_table_new_column(*mod_tbl,"WAVE",CPL_TYPE_DOUBLE);
00541 cpl_table_new_column(*mod_tbl,"ORDER",CPL_TYPE_INT);
00542 cpl_table_new_column(*mod_tbl,"XMOD",CPL_TYPE_DOUBLE);
00543 cpl_table_new_column(*mod_tbl,"YMOD",CPL_TYPE_DOUBLE);
00544 cpl_table_new_column(*mod_tbl,"BIN_SIZE",CPL_TYPE_DOUBLE);
00545 cpl_table_new_column(*mod_tbl,"LINEWIDPX",CPL_TYPE_DOUBLE);
00546 cpl_table_new_column(*mod_tbl,"LINEWIDTH",CPL_TYPE_DOUBLE);
00547 cpl_table_new_column(*mod_tbl,"RESOL",CPL_TYPE_DOUBLE);
00548 cpl_table_new_column(*mod_tbl,"LINELENPX",CPL_TYPE_DOUBLE);
00549 cpl_table_new_column(*mod_tbl,"BLAZE",CPL_TYPE_DOUBLE);
00550
00551 uves_ccd_size(&xpix,&ypix);
00552 uves_msg_debug("CCDsize: %d %d",xpix,ypix);
00553
00554
00555 for (i=0; i<aRowNumber; i++) {
00556
00557
00558
00559
00560
00561
00562
00563 dblwav=cpl_table_get_double(line_refer, "Wave",i,&status);
00564 uves_msg_debug(" i: %d Line: %f",i,dblwav);
00565
00566 dblwav /= 10.0;
00567 order = uves_physmod_find_order(dblwav);
00568 uves_msg_debug("order=%d",order);
00569
00570 order++;
00571
00572
00573
00574
00575 for (mm=0; mm<3; mm++){
00576
00577
00578
00579 uves_physmod_lambda_order2beta(dblwav, order, &uves_beta_ech, &uves_beta_cd, &fc);
00580
00581 uves_msg_debug("uves_beta_ech %f, uves_beta_cd %f, fc %f",
00582 uves_beta_ech, uves_beta_cd, fc);
00583
00584 uves_beta2xy(uves_beta_cd, uves_beta_ech, fc, &xmod, &ymod);
00585 uves_msg_debug("xmod=%f ymod=%f",xmod,ymod);
00586
00587 uves_physmod_photo_beta(dblwav, uves_beta_ech, uves_beta_cd,
00588 &uves_physmod_rech, &uves_physmod_rcd, &blaze);
00589
00590 uves_msg_debug("uves_physmod_rech %f, uves_physmod_rcd %f, blaze %f",
00591 uves_physmod_rech, uves_physmod_rcd, blaze);
00592
00593
00594
00595 uves_msg_debug("Before translation: xmod %f, ymod %f",xmod, ymod);
00596
00597 xmod += xtrans;
00598 ymod += ytrans;
00599 uves_msg_debug("xtrans=%f ytrans=%f xmod=%f ymod=%f",
00600 xtrans, ytrans, xmod, ymod);
00601
00602 uves_msg_debug("After translation: xmod %f, ymod %f",xmod, ymod);
00603 uves_msg_debug("xpix=%d ypix=%d",xpix,ypix);
00604
00605 uves_msg_debug("binx=%f biny=%f",binx,biny);
00606
00607 if (xmod > 0 && xmod < xpix && ymod > 0 && ymod < ypix) {
00608
00609
00610 uves_physmod_pixscl(dblwav, order, uves_physmod_rech, uves_physmod_rcd,
00611 binx, biny, fc, slit_width, slit_length,
00612 &binsize, &pixscale, &pixscalCD, &linewidpx,
00613 &linelenpx, &linewidth, &resol);
00614
00615 uves_msg_debug("binsize %f, pixscale %f, pixscalCD %f",
00616 binsize,pixscale,pixscalCD);
00617 uves_msg_debug("linewidpx %f, linelenpx %f, linewidth %f, resol %f",
00618 linewidpx,linelenpx,linewidth,resol);
00619
00620
00621 if (CMP_REG_SW) {
00622 uves_physmod_xy_regres(xmod,ymod,&xreg,&yreg);
00623 } else {
00624 xreg = xmod;
00625 yreg = ymod;
00626 }
00627
00628
00629 uves_msg_debug("Fill tab: i=%d wave=%f order=%d xmod=%f ymod=%f",
00630 i,dblwav,order,xmod,ymod);
00631
00632 uves_msg_debug("Fill tab: bin_sixe=%f xreg=%f yreg=%f ",
00633 binsize,xreg,yreg);
00634
00635 uves_msg_debug("Fill tab: linewidpx=%f linewidth=%f resol=%f linelenpx=%f blaze=%f",
00636 linewidpx,linewidth,resol,linelenpx,blaze);
00637
00638
00639 cpl_table_set_double(*mod_tbl, "WAVE" ,imod, dblwav);
00640 cpl_table_set_int (*mod_tbl, "ORDER" ,imod, order);
00641 cpl_table_set_double(*mod_tbl, "XMOD" ,imod, xreg);
00642 cpl_table_set_double(*mod_tbl, "YMOD" ,imod, yreg);
00643 cpl_table_set_double(*mod_tbl, "BIN_SIZE" ,imod, binsize);
00644 cpl_table_set_double(*mod_tbl, "LINEWIDPX",imod, linewidpx);
00645 cpl_table_set_double(*mod_tbl, "LINEWIDTH",imod, linewidth);
00646 cpl_table_set_double(*mod_tbl, "RESOL" ,imod, resol);
00647 cpl_table_set_double(*mod_tbl, "LINELENPX",imod, linelenpx);
00648 cpl_table_set_double(*mod_tbl, "BLAZE" ,imod, blaze);
00649 ++imod;
00650
00651 }
00652 order--;
00653 }
00654 }
00655
00656 cpl_table_duplicate_column(*mod_tbl,"IDENT",*mod_tbl,"WAVE");
00657 cpl_table_multiply_scalar(*mod_tbl,"IDENT",10.);
00658 cpl_table_duplicate_column(*mod_tbl,"XSTART",*mod_tbl,"XMOD");
00659 cpl_table_add_scalar(*mod_tbl,"XSTART",-mbox_x/2.);
00660 cpl_table_duplicate_column(*mod_tbl,"YSTART",*mod_tbl,"YMOD");
00661 cpl_table_add_scalar(*mod_tbl,"YSTART",-mbox_y/2.);
00662 cpl_table_duplicate_column(*mod_tbl,"XEND",*mod_tbl,"XMOD");
00663 cpl_table_add_scalar(*mod_tbl,"XEND",mbox_x/2.);
00664 cpl_table_duplicate_column(*mod_tbl,"YEND",*mod_tbl,"YMOD");
00665 cpl_table_add_scalar(*mod_tbl,"YEND",mbox_y/2.);
00666
00667
00668
00669
00670
00671
00672 uves_msg("Predicted number of lines: %d",imod);
00673
00674
00675
00676 uves_msg("Determine the Free Spectral Range");
00677
00678 dxpix = (double) xpix;
00679 dypix = (double) ypix;
00680
00681 m_min = -1;
00682 m_max = -1;
00683
00684
00685
00686
00687 uves_physmod_lambda_order_model(&lmax,&m_min,1.0,dypix);
00688 uves_physmod_lambda_order_model(&lmin,&m_max,dxpix,1.0);
00689
00690 uves_physmod_lambda_order_model(&lmax,&m_min,dxpix,dypix);
00691 uves_physmod_lambda_order_model(&lmin,&m_max,1.0,1.0);
00692
00693
00694 uves_msg_debug("m_min= %d,m_max= %d",m_min,m_max);
00695
00696
00697
00698
00699 *fsr_tbl=cpl_table_new(m_max-m_min+1);
00700
00701 uves_msg_debug("FSR tbl created: %s. No of columns: %d, No of rows: %d","free_spectral_range",
00702 20,m_max-m_min+1);
00703 cpl_table_new_column(*fsr_tbl,"ORDER",CPL_TYPE_INT);
00704 cpl_table_new_column(*fsr_tbl,"WVCENTCOL",CPL_TYPE_DOUBLE);
00705 cpl_table_new_column(*fsr_tbl,"YCENTCOL",CPL_TYPE_DOUBLE);
00706 cpl_table_new_column(*fsr_tbl,"START",CPL_TYPE_DOUBLE);
00707 cpl_table_new_column(*fsr_tbl,"END",CPL_TYPE_DOUBLE);
00708 cpl_table_new_column(*fsr_tbl,"WAVECENT",CPL_TYPE_DOUBLE);
00709 cpl_table_new_column(*fsr_tbl,"YCENT",CPL_TYPE_DOUBLE);
00710 cpl_table_new_column(*fsr_tbl,"FSRMIN",CPL_TYPE_DOUBLE);
00711 cpl_table_new_column(*fsr_tbl,"FSRMAX",CPL_TYPE_DOUBLE);
00712 cpl_table_new_column(*fsr_tbl,"XFSR_MIN",CPL_TYPE_DOUBLE);
00713 cpl_table_new_column(*fsr_tbl,"XFSR_MAX",CPL_TYPE_DOUBLE);
00714 cpl_table_new_column(*fsr_tbl,"YFSR_MIN",CPL_TYPE_DOUBLE);
00715 cpl_table_new_column(*fsr_tbl,"YFSR_MAX",CPL_TYPE_DOUBLE);
00716 cpl_table_new_column(*fsr_tbl,"PIXSCALE",CPL_TYPE_DOUBLE);
00717 cpl_table_new_column(*fsr_tbl,"PIXSCALCD",CPL_TYPE_DOUBLE);
00718 cpl_table_new_column(*fsr_tbl,"BIN_SIZE",CPL_TYPE_DOUBLE);
00719 cpl_table_new_column(*fsr_tbl,"LINEWIDPX",CPL_TYPE_DOUBLE);
00720 cpl_table_new_column(*fsr_tbl,"LINEWIDTH",CPL_TYPE_DOUBLE);
00721 cpl_table_new_column(*fsr_tbl,"RESOL",CPL_TYPE_DOUBLE);
00722 cpl_table_new_column(*fsr_tbl,"LINELENPX",CPL_TYPE_DOUBLE);
00723
00724
00725 imod = 0;
00726 uves_msg_debug("m, waveCentcol, Start, End, yCent, FSRmin, FSRmax, bin (mA)");
00727
00728 for (m=m_max; m>=m_min; m--) {
00729 uves_msg_debug("%d ",m);
00730 uves_physmod_find_FSR(m,&l, &fsr_min, &fsr_max);
00731
00732 uves_physmod_xy_model(l,m,&x,&y);
00733
00734
00735 x += xtrans;
00736 y += ytrans;
00737
00738 uves_physmod_xy_model(fsr_min,m,&xfsr_min,&yfsr_min);
00739
00740
00741 xfsr_min += xtrans;
00742 yfsr_min += ytrans;
00743
00744 uves_physmod_xy_model(fsr_max,m,&xfsr_max,&yfsr_max);
00745
00746
00747 xfsr_max += xtrans;
00748 yfsr_max += ytrans;
00749
00750
00751 uves_physmod_lambda_order2beta(l,m, &uves_beta_ech, &uves_beta_cd, &fc);
00752 uves_physmod_photo_beta(l, uves_beta_ech, uves_beta_cd,
00753 &uves_physmod_rech, &uves_physmod_rcd, &blaze);
00754
00755
00756
00757
00758 uves_physmod_pixscl(l, m, uves_physmod_rech, uves_physmod_rcd,
00759 binx, biny, fc, slit_width, slit_length,
00760 &dl, &pixscale, &pixscalCD,
00761 &linewidpx, &linelenpx, &linewidth, &resol);
00762
00763 mmin = m;
00764 mmax = m;
00765
00766
00767
00768
00769 uves_physmod_lambda_order_model(&lcent,&m,dxpix/2,y);
00770 uves_physmod_xy_model(lcent,m,&xr,&yr);
00771
00772 uves_physmod_lambda_order_model(&lmax,&mmax,dxpix,y);
00773 uves_physmod_lambda_order_model(&lmin,&mmin,1.0,y);
00774
00775
00776
00777 uves_msg_debug("m=%d, waveCent (nm)=%f, Start=%f, End=%f",m,l,lmin,lmax);
00778 uves_msg_debug("yCent=%f,FSRmin=%f,FSRmax=%f,bin (mA)=%f",y,fsr_min,fsr_max,dl);
00779
00780
00781 uves_msg_debug("%d %f %f %f %f %f %f %f",m,lcent,lmin,lmax,yr,fsr_min,fsr_max,dl);
00782
00783
00784 uves_msg_debug("pixel-scale = %f, anamorphic corrections = %f, %f",
00785 pixscale, uves_physmod_rech, uves_physmod_rcd);
00786
00787
00788 cpl_table_set_int(*fsr_tbl, "ORDER",imod,m);
00789 cpl_table_set_double(*fsr_tbl, "WVCENTCOL",imod,lcent);
00790 cpl_table_set_double(*fsr_tbl, "YCENTCOL",imod,yr);
00791 cpl_table_set_double(*fsr_tbl, "START",imod,lmin);
00792 cpl_table_set_double(*fsr_tbl, "END",imod,lmax);
00793 cpl_table_set_double(*fsr_tbl, "WAVECENT",imod,l);
00794 cpl_table_set_double(*fsr_tbl, "YCENT",imod,y);
00795 cpl_table_set_double(*fsr_tbl, "FSRMIN",imod,fsr_min);
00796 cpl_table_set_double(*fsr_tbl, "FSRMAX",imod,fsr_max);
00797 cpl_table_set_double(*fsr_tbl, "XFSR_MIN",imod,xfsr_min);
00798 cpl_table_set_double(*fsr_tbl, "XFSR_MAX",imod,xfsr_max);
00799 cpl_table_set_double(*fsr_tbl, "YFSR_MIN",imod,yfsr_min);
00800 cpl_table_set_double(*fsr_tbl, "YFSR_MAX",imod,yfsr_max);
00801 cpl_table_set_double(*fsr_tbl, "PIXSCALE",imod,pixscale);
00802 cpl_table_set_double(*fsr_tbl, "PIXSCALCD",imod,pixscalCD);
00803 cpl_table_set_double(*fsr_tbl, "BIN_SIZE",imod,dl);
00804 cpl_table_set_double(*fsr_tbl, "LINEWIDPX",imod,linewidpx);
00805 cpl_table_set_double(*fsr_tbl, "LINEWIDTH",imod,linewidth);
00806 cpl_table_set_double(*fsr_tbl, "RESOL",imod,resol);
00807 cpl_table_set_double(*fsr_tbl, "LINELENPX",imod,linelenpx);
00808 ++imod;
00809
00810
00811 }
00812
00813
00814 cpl_table_erase_invalid_rows(*mod_tbl);
00815
00816
00817 uves_msg_debug("End determination fsr range");
00818
00819
00820 cleanup:
00821
00822 return 0;
00823 }
00824
00825
00826 static int
00827 flames_get_trans(const int plt_no,
00828 enum uves_chip chip,
00829 const double wlen,
00830 double * TX,
00831 double * TY)
00832 {
00833
00834
00835 if(plt_no==1) {
00836 if( chip==UVES_CHIP_REDL) {
00837 if(wlen==520) {
00838 *TX = -15.330;
00839 *TY = -40.461;
00840 } else if (wlen == 580) {
00841 *TX = -17.972;
00842 *TY = -39.200;
00843 } else if (wlen == 860) {
00844 *TX= -12.212;
00845 *TY= -49.370;
00846 }
00847 } else {
00848 if(wlen==520) {
00849 *TX = -14.237;
00850 *TY = -40.337;
00851 } else if (wlen == 580) {
00852 *TX= -14.738;
00853 *TY= -38.831;
00854 } else if (wlen == 860) {
00855
00856 *TX = -08.253;
00857 *TY = -45.385;
00858 }
00859 }
00860 } else if (plt_no==2) {
00861 if( chip==UVES_CHIP_REDL) {
00862 if(wlen==520) {
00863 *TX = +10.136;
00864 *TY = -41.420;
00865 } else if (wlen == 580) {
00866 *TX = +09.000;
00867 *TY = -38.289;
00868 } else if (wlen == 860) {
00869 *TX = +16.386;
00870 *TY = -47.519;
00871 }
00872 } else {
00873 if(wlen==520) {
00874 *TX = +12.244;
00875 *TY = -41.970;
00876 } else if (wlen == 580) {
00877 *TX = +12.023;
00878 *TY = -38.165;
00879 } else if (wlen == 860) {
00880 *TX = +18.241;
00881 *TY = -43.889;
00882 }
00883 }
00884
00885 } else {
00886 uves_msg_warning("plt_no=%d chip=%d Wlen %g is not standard setting setting defaults",plt_no,chip,wlen);
00887 *TX = 0;
00888 *TY = 0;
00889 }
00890 return 0;
00891
00892 }
00893