- 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_VSANS_Event_Testing.ipf
r1046 r1047 238 238 // -- can this be multithreaded (eliminating the loop)? 239 239 // 240 // MultiThread tube = (w >> 56 ) & 0xFF 241 // MultiThread location = (w >> 48 ) & 0xFF 242 // MultiThread eventTime = val & 0xFFFFFFFFFFFF 243 // 240 // MultiThread tube = (w[p]) & 0xFF 241 // MultiThread location = (w[p] >> 8 ) & 0xFF 242 // MultiThread eventTime = (w[p] >> 16) 243 // 244 // !!!!- yes - for a 35 MB file: 245 // for loop = 4.3 s 246 // MultiThread = 0.35 s 247 // 248 // !!! can I use the bit operations in MatrixOp? 1D waves are valid 249 // to use with MatrixOp. Would it be better than multiThread? 244 250 // 245 251 // … … 262 268 Make/O/L/U/N=(num) eventTime 263 269 Make/O/U/B/N=(num) tube,location //8 bit unsigned 264 265 for(ii=0;ii<num;ii+=1) 266 val = w[ii] 267 268 // b1 = (val >> 56 ) & 0xFF // = 255, last two bytes, after shifting 269 // b2 = (val >> 48 ) & 0xFF 270 // btime = val & 0xFFFFFFFFFFFF // = really big number, last 6 bytes 271 272 b1 = val & 0xFF 273 b2 = (val >> 8) & 0xFF 274 btime = (val >> 16) 275 276 tube[ii] = b1 277 location[ii] = b2 278 eventTime[ii] = btime 279 280 endfor 270 271 MultiThread tube = (w[p]) & 0xFF 272 MultiThread location = (w[p] >> 8 ) & 0xFF 273 MultiThread eventTime = (w[p] >> 16) 274 275 // for(ii=0;ii<num;ii+=1) 276 // val = w[ii] 277 // 278 //// b1 = (val >> 56 ) & 0xFF // = 255, last two bytes, after shifting 279 //// b2 = (val >> 48 ) & 0xFF 280 //// btime = val & 0xFFFFFFFFFFFF // = really big number, last 6 bytes 281 // 282 // b1 = val & 0xFF 283 // b2 = (val >> 8) & 0xFF 284 // btime = (val >> 16) 285 // 286 // tube[ii] = b1 287 // location[ii] = b2 288 // eventTime[ii] = btime 289 // 290 // endfor 281 291 282 292 s_toc() … … 549 559 550 560 561 562 563 564 565 566 551 567 // TODO: 552 568 // … … 564 580 Wave location = location 565 581 Wave tube = tube 566 582 583 Variable t1=ticks 584 Print "sort started" 567 585 Sort tube,tube,eventTime,location 586 print "sort done ",(ticks-t1)/60 568 587 569 588 Variable b1,e1,b2,e2,b3,e3,b4,e4 … … 625 644 // switch the "active" panel to the selected group (1-4) (5 concatenates them all together) 626 645 // 646 647 // 627 648 // copy the set of tubes over to the "active" set that is to be histogrammed 628 649 // and redimension them to be sure that they are double precision … … 638 659 Wave eventTime = $("eventTime"+num2Str(tubeGroup)) 639 660 640 Wave xloc,yLoc,timePt661 Wave/Z xloc,yLoc,timePt 641 662 642 663 KillWaves/Z timePt,xLoc,yLoc 643 Duplicate/O tube xLoc644 Duplicate/O location yLoc645 664 Duplicate/O eventTime timePt 665 666 // TODO: 667 // -- for processing, initially treat all of the tubes along x, and 128 pixels along y 668 // panels can be transposed later as needed to get the orientation correct 669 670 671 // if(tubeGroup == 1 || tubeGroup == 4) 672 // L/R panels, they have tubes along x 673 Duplicate/O tube xLoc 674 Duplicate/O location yLoc 675 // else 676 // // T/B panels, tubes are along y 677 // Duplicate/O tube yLoc 678 // Duplicate/O location xLoc 679 // endif 646 680 647 681 Redimension/D xLoc,yLoc,timePt … … 704 738 705 739 SetDataFolder root: 706 740 return(0) 707 741 end 742 743 744 745 // Based on the numbering 0-191: 746 // group 1 = R (0,47) MatrixOp out = ReverseRows(in) 747 // group 2 = T (48,95) output = slices_T[q][p][r] 748 // group 3 = B (96,143) output = slices_B[XBINS-q-1][YBINS-p-1][r] (reverses rows and columns) 749 // group 4 = L (144,191) MatrixOp out = ReverseCols(in) 750 // 751 // the transformation flips the panel to the view as if the detector was viewed from the sample position 752 // (this is the standard view for SANS and VSANS) 753 // 754 // Takes the data that was binned, and separates it into the 4 detector panels 755 // Waves are 3D waves x-y-time 756 // 757 // MatrixOp may not be necessary for the R/L transformations, but indexing or MatrixOp are both really fast. 758 // 759 // 760 Function V_SplitBinnedToPanels() 761 762 SetDataFolder root:Packages:NIST:VSANS:Event: 763 Wave slicedData = slicedData //this is 3D 764 765 Variable nSlices = DimSize(slicedData,2) 766 767 Make/O/D/N=(XBINS,YBINS,nSlices) slices_R, slices_L, slices_T, slices_B, output 768 769 slices_R = slicedData[p][q][r] 770 slices_T = slicedData[p+48][q][r] 771 slices_B = slicedData[p+96][q][r] 772 slices_L = slicedData[p+144][q][r] 773 774 MatrixOp/O output = ReverseRows(slices_R) 775 slices_R = output 776 777 MatrixOp/O output = ReverseCols(slices_L) 778 slices_L = output 779 780 781 Redimension/N=(YBINS,XBINS,nSlices) output 782 output = slices_T[q][p][r] 783 KillWaves/Z slices_T 784 Duplicate/O output slices_T 785 786 output = slices_B[XBINS-q-1][YBINS-p-1][r] 787 KillWaves/Z slices_B 788 Duplicate/O output slices_B 789 790 KillWaves/Z output 791 SetDataFolder root: 792 793 return(0) 794 End 795 796 797 // simple panel to display the 4 detector panels after the data has been binned and sliced 798 // 799 // TODO: 800 // -- label panels, axes 801 // -- add a way to display different slices (this can still be done on the main panel, all at once) 802 // -- any other manipulations? 803 // 804 805 Proc VSANS_EventPanels() 806 PauseUpdate; Silent 1 // building window... 807 NewPanel /W=(720,45,1530,570)/N=VSANS_EventPanels/K=1 808 DoWindow/C VSANS_EventPanels 809 ModifyPanel fixedSize=1,noEdit =1 810 811 // Display/W=(745,45,945,425)/HOST=# 812 Display/W=(10,45,210,425)/HOST=# 813 AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_L // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 814 ModifyImage slices_L ctab= {*,*,ColdWarm,0} 815 ModifyImage slices_L ctabAutoscale=3 816 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 817 ModifyGraph mirror=2 818 ModifyGraph nticks=4 819 ModifyGraph minor=1 820 ModifyGraph fSize=9 821 ModifyGraph standoff=0 822 ModifyGraph tkLblRot(left)=90 823 ModifyGraph btLen=3 824 ModifyGraph tlOffset=-2 825 RenameWindow #,Event_slice_L 826 SetActiveSubwindow ## 827 828 // Display/W=(1300,45,1500,425)/HOST=# 829 Display/W=(565,45,765,425)/HOST=# 830 AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_R // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 831 ModifyImage slices_R ctab= {*,*,ColdWarm,0} 832 ModifyImage slices_R ctabAutoscale=3 833 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 834 ModifyGraph mirror=2 835 ModifyGraph nticks=4 836 ModifyGraph minor=1 837 ModifyGraph fSize=9 838 ModifyGraph standoff=0 839 ModifyGraph tkLblRot(left)=90 840 ModifyGraph btLen=3 841 ModifyGraph tlOffset=-2 842 RenameWindow #,Event_slice_R 843 SetActiveSubwindow ## 844 845 // Display/W=(945,45,1300,235)/HOST=# 846 Display/W=(210,45,565,235)/HOST=# 847 AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_T // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 848 ModifyImage slices_T ctab= {*,*,ColdWarm,0} 849 ModifyImage slices_T ctabAutoscale=3 850 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 851 ModifyGraph mirror=2 852 ModifyGraph nticks=4 853 ModifyGraph minor=1 854 ModifyGraph fSize=9 855 ModifyGraph standoff=0 856 ModifyGraph tkLblRot(left)=90 857 ModifyGraph btLen=3 858 ModifyGraph tlOffset=-2 859 RenameWindow #,Event_slice_T 860 SetActiveSubwindow ## 861 862 // Display/W=(945,235,1300,425)/HOST=# 863 Display/W=(210,235,565,425)/HOST=# 864 AppendImage/T/G=1 :Packages:NIST:VSANS:Event:slices_B // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly 865 ModifyImage slices_B ctab= {*,*,ColdWarm,0} 866 ModifyImage slices_B ctabAutoscale=3 867 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 868 ModifyGraph mirror=2 869 ModifyGraph nticks=4 870 ModifyGraph minor=1 871 ModifyGraph fSize=9 872 ModifyGraph standoff=0 873 ModifyGraph tkLblRot(left)=90 874 ModifyGraph btLen=3 875 ModifyGraph tlOffset=-2 876 RenameWindow #,Event_slice_B 877 SetActiveSubwindow ## 878 // 879 880 881 End 882 883
Note: See TracChangeset
for help on using the changeset viewer.