- Timestamp:
- Nov 16, 2017 10:57:32 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1071 r1073 27 27 // same old equation, just written in a more complex form. 28 28 // 29 // TODO29 // (DONE) 30 30 // x- verify the direction of the tubes and indexing 31 31 // x- decide on the appropriate functional form for the tubes … … 109 109 // 110 110 // 111 // TODO 112 // -- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 111 // (DONE) 112 // x- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 113 // 113 114 // x- verify the direction of the tubes and indexing 114 115 // x- be sure I'm working in the right data folder (it is passed in, and the full path is used) … … 151 152 152 153 // TODO 153 // -- GAP IS HARD-WIRED 154 // -- GAP IS HARD-WIRED as a single constant value (there really are 4 values) 154 155 Variable offset,gap 155 156 156 157 // kPanelTouchingGap is in mm 158 // the gap is added to the RIGHT and TOP panels ONLY 159 // TODO -- replace with V_getDet_panel_gap(fname,detStr) once it is added to the file 157 160 gap = kPanelTouchingGap 158 161 159 162 if(cmpstr(orientation,"vertical")==0) 160 163 // this is data dimensioned as (Ntubes,Npix) 161 data_realDistX[][] = tube_width*p162 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q163 164 164 165 // adjust the x postion based on the beam center being nominally (0,0) in units of cm, not pixels … … 180 181 if(kBCTR_CM) 181 182 if(cmpstr("L",detStr[1]) == 0) 182 data_realDistX[][] = offset - (dimX - p)*tube_width // TODO should this be dimX-1-p = 47-p?183 // data_realDistX[][] = -offset - (dimX - p)*tube_width// TODO should this be dimX-1-p = 47-p?183 // data_realDistX[][] = offset - (dimX - p)*tube_width // TODO should this be dimX-1-p = 47-p? 184 data_realDistX[][] = offset - (dimX - p)*tube_width - gap/2 // TODO should this be dimX-1-p = 47-p? 184 185 else 185 data_realDistX[][] += offset + gap + tube_width //add to the Right det, not recalculate 186 // right 187 // data_realDistX[][] = tube_width*(p+1) + offset + gap //add to the Right det, 188 data_realDistX[][] = tube_width*(p+1) + offset + gap/2 //add to the Right det 186 189 endif 190 else 191 data_realDistX[][] = tube_width*(p) 187 192 endif 193 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 188 194 189 195 190 196 elseif(cmpstr(orientation,"horizontal")==0) 191 197 // this is data (horizontal) dimensioned as (Npix,Ntubes) 192 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p193 198 data_realDistY[][] = tube_width*q 194 199 … … 208 213 if(kBCTR_CM) 209 214 if(cmpstr("T",detStr[1]) == 0) 210 data_realDistY[][] += offset + gap + tube_width 215 // data_realDistY[][] = tube_width*(q+1) + offset + gap 216 data_realDistY[][] = tube_width*(q+1) + offset + gap/2 211 217 else 212 data_realDistY[][] = offset - (dimY - q)*tube_width // TODO should this be dimY-1-q = 47-q? 218 // bottom 219 // data_realDistY[][] = offset - (dimY - q)*tube_width // TODO should this be dimY-1-q = 47-q? 220 data_realDistY[][] = offset - (dimY - q)*tube_width - gap/2 // TODO should this be dimY-1-q = 47-q? 213 221 endif 222 else 223 data_realDistY[][] = tube_width*(q) 214 224 endif 225 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 215 226 216 227 else … … 325 336 // 326 337 // 327 // TODO328 // -- VERIFY the calculations329 // -- verify where this needs to be done (if the beam center is changed)330 // -- then the q-calculation needs to be re-done331 // -- the position along the tube length is referenced to tube[0], for no particular reason338 // (DONE) 339 // x- VERIFY the calculations 340 // x- verify where this needs to be done (if the beam center is changed) 341 // x- then the q-calculation needs to be re-done 342 // x- the position along the tube length is referenced to tube[0], for no particular reason 332 343 // It may be better to take an average? but [0] is an ASSUMPTION 333 // -- distance along tube is simple interpolation, or do I use the coefficients to334 // calculate the actual value335 // 336 // -- distance in the lateral direction is based on tube width, which is a fixed parameter337 // 344 // x- distance along tube is simple interpolation 345 // 346 // x- distance in the lateral direction is based on tube width, which is a fixed parameter 347 // 348 // the value in pixels is written to the local data folder, NOT to disk (it is recalculated as needed) 338 349 // 339 350 Function V_ConvertBeamCtr_to_pix(folder,detStr,destPath) … … 364 375 365 376 variable edge,delta 377 Variable gap = kPanelTouchingGap // TODO: -- replace with V_getDet_panel_gap(fname,detStr) 366 378 367 379 // … … 377 389 // R panel 378 390 edge = data_realDistX[0][0] 379 delta = abs(xCtr*10 - edge + kPanelTouchingGap)391 delta = abs(xCtr*10 - edge + gap) 380 392 x_pix[0] = -delta/tube_width //since the left edge of the R panel is pixel 0 381 393 endif … … 394 406 if(cmpstr("T",detStr[1]) == 0) 395 407 edge = data_realDistY[0][0] //tube 0 396 delta = abs(yCtr*10 - edge + kPanelTouchingGap)408 delta = abs(yCtr*10 - edge + gap) 397 409 y_pix[0] = -delta/tube_width //since the bottom edge of the T panel is pixel 0 398 410 else … … 478 490 //// 479 491 480 // TODO 481 // get rid of this in the real data 492 482 493 // 483 494 // TESTING ONLY … … 496 507 497 508 498 // TODO499 // get rid of this in the real data500 509 // 501 510 // TESTING ONLY … … 549 558 550 559 // 551 // TODO:552 // -- MUST VERIFY the definition of SDD and how (if) setback is written to the data files553 // -- currently I'm assuming that the SDD is the "nominal" value which is correct for the560 // (DONE) 561 // x- MUST VERIFY the definition of SDD and how (if) setback is written to the data files 562 // x- currently I'm assuming that the SDD is the "nominal" value which is correct for the 554 563 // L/R panels, but is not correct for the T/B panels (must add in the setback) 555 564 // … … 609 618 //function to calculate the overall q-value, given all of the necesary trig inputs 610 619 // 611 // TODO:612 // -- verify the calculation (accuracy - in all input conditions)613 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated614 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding620 // (DONE) 621 // x- verify the calculation (accuracy - in all input conditions) 622 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 623 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 615 624 // to each pixel 616 625 // … … 642 651 643 652 //calculates just the q-value in the x-direction on the detector 644 // TODO:645 // -- verify the calculation (accuracy - in all input conditions)646 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated647 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding653 // (DONE) 654 // x- verify the calculation (accuracy - in all input conditions) 655 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 656 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 648 657 // to each pixel 649 658 // … … 676 685 677 686 //calculates just the q-value in the y-direction on the detector 678 // TODO:679 // -- verify the calculation (accuracy - in all input conditions)680 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated681 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding687 // (DONE) 688 // x- verify the calculation (accuracy - in all input conditions) 689 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 690 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 682 691 // to each pixel 683 692 // … … 710 719 711 720 //calculates just the q-value in the z-direction on the detector 712 // TODO:713 // -- verify the calculation (accuracy - in all input conditions)714 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated715 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding721 // (DONE) 722 // x- verify the calculation (accuracy - in all input conditions) 723 // x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 724 // x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 716 725 // to each pixel 717 726 // 718 727 // not actually used for any calculations, but here for completeness if anyone asks, or for 2D data export 719 728 // 720 // this properly accounts for qz 729 // this properly accounts for qz, because it is qz 721 730 // 722 731 Function V_CalcQZ(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) … … 745 754 746 755 // 747 // TODO -- VERIFY calculations 748 // -- This is the actual solid angle per pixel, not a ratio vs. some "unit SA" 756 // (DONE) 757 // x- VERIFY calculations 758 // x- This is the actual solid angle per pixel, not a ratio vs. some "unit SA" 749 759 // Do I just correct for the different area vs. the "nominal" central area? 750 // -- decide how to implement - eitherdirectly change the data values (as was done in the past)751 // or use this as a weighting for when the data is binned to I(q). In the second method, 2D data752 // would need this to be applied before exporting 753 // -- do I keep a wave note indicating that this correction has been applied to the data754 // so that it can be "un-applied"? 755 // -- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?)756 // ( probablyjust from geometry, since I need SDD and dx and dy values...)760 // x- decide how to implement - YES - directly change the data values (as was done in the past) 761 // or (NOT done this way...use this as a weighting for when the data is binned to I(q). In the second method, 2D data 762 // would need this to be applied before exporting) 763 // x- do I keep a wave note indicating that this correction has been applied to the data 764 // so that it can be "un-applied"? NO 765 // x- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?) 766 // (YES just from geometry, since I need SDD and dx and dy values...) 757 767 // 758 768 // … … 827 837 w /= solid_angle 828 838 829 830 // TODO: 839 // 831 840 // correctly apply the correction to the error wave (assume a perfect value?) 832 w_err /= solid_angle // is this correct??841 w_err /= solid_angle // 833 842 834 843 // TODO -- clean up after I'm satisfied computations are correct … … 844 853 // 845 854 // 846 // TODO : 847 // -- DoAlert 0,"This has not yet been updated for VSANS" 855 // NOV 2017 856 // Currently, this is not called from any VSANS routines. it is only referenced 857 // from V_Add_raw_to_work(), which would add two VSANS raw data files together. This has 858 // not yet been implemented. I am only keeping this function around to be sure that 859 // if/when V_Add_raw_to_work() is implemented, all of the functionality of V_DetCorr() is 860 // properly duplicated. 861 // 862 // 848 863 // 849 864 //performs solid angle and non-linear detector corrections to raw data as it is "added" to a work folder … … 977 992 978 993 979 994 // 995 // Large angle transmission correction 980 996 // 981 997 // DIVIDE the intensity by this correction to get the right answer 982 // TODO: 983 // -- DoAlert 0,"This has not yet been updated for VSANS" 984 // 985 // 986 998 // 999 // 987 1000 // Apply the large angle transmssion correction as the data is converted to WORK 988 1001 // so that whether the data is saved as 2D or 1D, the correction has properly been done. … … 1048 1061 endif 1049 1062 1050 // TODO1051 // -- properly calculate and apply the 2D error propagation1063 // (DONE) 1064 // x- properly calculate and apply the 2D error propagation 1052 1065 if(trans == 1) 1053 1066 lat_err[ii][jj] = 0 //no correction, no error … … 1077 1090 w_err = tmp_err 1078 1091 1079 // TODO:1080 // correctly apply the correction to the error wave (assume a perfect value?)1081 // w_err /= tmp //is this correct??1082 1092 1083 1093 // TODO -- clean up after I'm satisfied computations are correct … … 1127 1137 1128 1138 // 1129 // TODO:1130 1139 // 1131 1140 // kappa comes in as s_izero, so be sure to use 1/kappa_err … … 1256 1265 1257 1266 // 1258 // TODO: 1259 // -- DoAlert 0,"This has not yet been updated for VSANS" 1260 // 1261 //************************ 1262 //unused testing procedure, may not be up-to-date with other procedures 1263 //check before re-implementing 1267 // testing procedure, called from a menu selection 1264 1268 // 1265 1269 Proc V_DIV_a_Workfile(type)
Note: See TracChangeset
for help on using the changeset viewer.