- Timestamp:
- Jun 20, 2017 3:17:19 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_EventModeProcessing.ipf
r1046 r1047 2 2 #pragma IgorVersion=6.22 3 3 4 // vers 7.13e 4 // 5 // Event mode prcessing for VSANS 6 // 7 // First pass, getting the basics to work 8 // 9 // -- need TOF processing for wavelength calibration 10 // -- document this so it can be done quickly and easily. 11 // 12 13 14 5 15 6 16 // TODO: … … 39 49 40 50 41 // TODO -- these dimensions are hard-wired and will be wrong half of the time 42 // 43 Static Constant XBINS=48 44 Static Constant YBINS=128 51 // TODO 52 // x- these dimensions are hard-wired (OK) 53 // 54 Constant XBINS=48 55 Constant NTUBES=192 56 Constant YBINS=128 45 57 46 58 Static Constant MODE_STREAM = 0 … … 60 72 61 73 // TODO: 62 // -- need an index table with the tube <-> panel correspondence 74 // x- need an index table with the tube <-> panel correspondence 75 // NO, per Phil, the tube numbering is sequential: 76 // 77 // Based on the numbering 0-191: 78 // group 1 = R (0,47) MatrixOp out = ReverseRows(in) 79 // group 2 = T (48,95) output = slices_T[q][p][r] 80 // group 3 = B (96,143) output = slices_B[XBINS-q-1][YBINS-p-1][r] (reverses rows and columns) 81 // group 4 = L (144,191) MatrixOp out = ReverseCols(in) 82 // 83 // There is a separate function that does the proper flipping to get the panels into the correct orientation 63 84 // 64 85 Function V_Init_Event() … … 169 190 PopupMenu popup0,mode=1,popvalue="Equal",value= #"\"Equal;Fibonacci;Custom;\"" 170 191 Button button1,pos={389,103},size={120,20},fSize=12,proc=V_ProcessEventLog_Button,title="Bin Event Data" 192 193 194 Button button21,pos={580,70},size={120,20},proc=V_SplitToPanels_Button,title="Split to Panels" 195 Button button22,pos={580,90},size={120,20},proc=V_GraphPanels_Button,title="Show Panels" 171 196 172 197 Button button10,pos={488,305},size={100,20},proc=V_SplitFileButtonProc,title="Split Big File",disable=2 … … 216 241 217 242 218 243 Function V_SplitToPanels_Button(ba) : ButtonControl 244 STRUCT WMButtonAction &ba 245 246 switch( ba.eventCode ) 247 case 2: // mouse up 248 // click code here 249 V_SplitBinnedToPanels() 250 // 251 break 252 case -1: // control being killed 253 break 254 endswitch 255 256 return 0 257 End 258 259 Function V_GraphPanels_Button(ba) : ButtonControl 260 STRUCT WMButtonAction &ba 261 262 switch( ba.eventCode ) 263 case 2: // mouse up 264 // click code here 265 Execute "VSANS_EventPanels()" 266 // 267 break 268 case -1: // control being killed 269 break 270 endswitch 271 272 return 0 273 End 219 274 220 275 // mode selector … … 427 482 String ctrlName 428 483 429 Make/O/D/N=(XBINS,YBINS) root:Packages:NIST:VSANS:Event:binnedData 484 // Make/O/D/N=(XBINS,YBINS) root:Packages:NIST:VSANS:Event:binnedData 485 Make/O/D/N=(NTUBES,YBINS) root:Packages:NIST:VSANS:Event:binnedData 430 486 431 487 Wave binnedData = root:Packages:NIST:VSANS:Event:binnedData … … 440 496 SetDataFolder root:Packages:NIST:VSANS:Event //don't count on the folder remaining here 441 497 442 Make/D/O/N=(XBINS,YBINS,nslices) slicedData 498 // Make/D/O/N=(XBINS,YBINS,nslices) slicedData 499 Make/D/O/N=(NTUBES,YBINS,nslices) slicedData 443 500 444 501 Wave slicedData = slicedData 445 502 Wave rescaledTime = rescaledTime 446 503 Wave timePt = timePt 447 Make/O/D/N=(XBINS,YBINS) tmpData 504 // Make/O/D/N=(XBINS,YBINS) tmpData 505 Make/O/D/N=(NTUBES,YBINS) tmpData 448 506 Make/O/D/N=(nslices+1) binEndTime,binCount 449 507 Make/O/D/N=(nslices) timeWidth … … 490 548 SetDataFolder root:Packages:NIST:VSANS:Event: 491 549 550 s_tic() 492 551 if(WaveExists($"root:Packages:NIST:VSANS:Event:OscSortIndex") == 0 ) 493 552 Duplicate/O rescaledTime OscSortIndex … … 499 558 Endif 500 559 560 printf "sort time = " 561 s_toc() 562 501 563 Wave index = root:Packages:NIST:VSANS:Event:SavedIndex //this is the histogram index 502 564 565 s_tic() 503 566 for(ii=0;ii<nslices;ii+=1) 504 567 if(ii==0) … … 534 597 binCount[ii] = sum(tmpData,-inf,inf) 535 598 endfor 599 printf "histogram time = " 600 s_toc() 536 601 537 602 Duplicate/O slicedData,root:Packages:NIST:VSANS:Event:dispsliceData,root:Packages:NIST:VSANS:Event:logSlicedData … … 556 621 557 622 558 Make/O/D/N=(XBINS,YBINS) root:Packages:NIST:VSANS:Event:binnedData 623 // Make/O/D/N=(XBINS,YBINS) root:Packages:NIST:VSANS:Event:binnedData 624 Make/O/D/N=(NTUBES,YBINS) root:Packages:NIST:VSANS:Event:binnedData 559 625 560 626 Wave binnedData = root:Packages:NIST:VSANS:Event:binnedData … … 570 636 SetDataFolder root:Packages:NIST:VSANS:Event //don't count on the folder remaining here 571 637 572 Make/D/O/N=(XBINS,YBINS,nslices) slicedData 638 // Make/D/O/N=(XBINS,YBINS,nslices) slicedData 639 Make/D/O/N=(NTUBES,YBINS,nslices) slicedData 573 640 574 641 Wave slicedData = slicedData 575 642 Wave rescaledTime = rescaledTime 576 Make/O/D/N=(XBINS,YBINS) tmpData 643 // Make/O/D/N=(XBINS,YBINS) tmpData 644 Make/O/D/N=(NTUBES,YBINS) tmpData 577 645 Make/O/D/N=(nslices+1) binEndTime,binCount//,binStartTime 578 646 Make/O/D/N=(nslices) timeWidth … … 865 933 SetDataFolder root:Packages:NIST:VSANS:Event: //GBLoadWave in V_LoadEvents sets back to root: 866 934 867 868 935 // Now, I have tube, location, and timePt (no units yet) 869 936 // assign to the proper panels 870 937 871 s_tic() 872 V_SortAndSplitEvents() 873 874 Printf "File sort and split time (s) = " 875 s_toc() 876 877 // TODO -- currently, nothing is assigned, and nothing is assigned properly - just a 878 // fake assignment to get the TOF to use all of the data 879 // 938 // TODO: 939 // x- (YES - this is MUCH faster) what if I do the JointHistogram first, then break out the blocks of the 940 // 3D sliced data into the individual panels. Then the sort operation could be skipped, 941 // since it would implicitly be done during the histogram operation 942 // x- go back and redimension as needed to get the 128 x 192 histogram to work 943 // x- MatrixOp or a wave assignemt should be able to break up the 3D 944 // 945 946 KillWaves/Z timePt,xLoc,yLoc 947 Duplicate/O eventTime timePt 948 949 // TODO: 950 // x- for processing, initially treat all of the tubes along x, and 128 pixels along y 951 // panels can be transposed later as needed to get the orientation correct 952 953 Duplicate/O tube xLoc 954 Duplicate/O location yLoc 955 956 Redimension/D xLoc,yLoc,timePt 957 958 //s_tic() 959 // V_SortAndSplitEvents() 960 // 961 //Printf "File sort and split time (s) = " 962 //s_toc() 963 880 964 881 965 // … … 886 970 // 887 971 888 V_SwitchTubeGroup(1)972 // V_SwitchTubeGroup(1) 889 973 890 974 // … … 1050 1134 // for the bit shifts, see the decimal-binary conversion 1051 1135 // http://www.binaryconvert.com/convert_unsigned_int.html 1052 // and for 64-bit values: 1136 // 1137 // for 64-bit values: 1053 1138 // http://calc.penjee.com 1054 1139 // … … 1163 1248 Make/O/L/U/N=(num) eventTime //64 bit unsigned 1164 1249 Make/O/U/B/N=(num) tube,location //8 bit unsigned 1165 1166 for(ii=0;ii<num;ii+=1) 1167 val = V_Events[ii] 1168 1169 // b1 = (val >> 56 ) & 0xFF // = 255, last two bytes, after shifting 1170 // b2 = (val >> 48 ) & 0xFF 1171 // btime = val & 0xFFFFFFFFFFFF // = really big number, last 6 bytes 1172 1173 b1 = val & 0xFF 1174 b2 = (val >> 8) & 0xFF 1175 btime = (val >> 16) 1176 1177 1178 tube[ii] = b1 1179 location[ii] = b2 1180 eventTime[ii] = btime 1181 1182 endfor 1250 1251 // MultiThread is about 10x faster than the for loop 1252 MultiThread tube = (V_Events[p]) & 0xFF 1253 MultiThread location = (V_Events[p] >> 8 ) & 0xFF 1254 MultiThread eventTime = (V_Events[p] >> 16) 1255 1256 // for(ii=0;ii<num;ii+=1) 1257 // val = V_Events[ii] 1258 // 1259 //// b1 = (val >> 56 ) & 0xFF // = 255, last two bytes, after shifting 1260 //// b2 = (val >> 48 ) & 0xFF 1261 //// btime = val & 0xFFFFFFFFFFFF // = really big number, last 6 bytes 1262 // 1263 // b1 = val & 0xFF 1264 // b2 = (val >> 8) & 0xFF 1265 // btime = (val >> 16) 1266 // 1267 // 1268 // tube[ii] = b1 1269 // location[ii] = b2 1270 // eventTime[ii] = btime 1271 // 1272 // endfor 1183 1273 1184 1274 Printf "File decode time (s) = " … … 1602 1692 1603 1693 1694 // this is not used - it now conflicts with the name of a built-in function in Igor 7 1695 // 1604 1696 Function xJointHistogram(w0,w1,hist,index) 1605 1697 wave w0,w1,hist,index … … 1686 1778 1687 1779 ////////////// Post-processing of the event mode data 1780 // 1781 // 1782 // TODO: 1783 // -- this is ALL geared towards ordela event mode data and the 6.7s errors, and bad signal 1784 // I don't know if I'll need any of this for the VSANS event data. 1785 // 1786 // 1688 1787 Proc V_ShowEventCorrectionPanel() 1689 1788 DoWindow/F V_EventCorrectionPanel
Note: See TracChangeset
for help on using the changeset viewer.