source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Slit.ipf @ 954

Last change on this file since 954 was 954, checked in by srkline, 8 years ago

converted and renamed VSANS files. "VC_" prefix for VCALC related files (that's all of them right now), and moved and renamed parts of files so that the ipf names are more logical now with the contents. Deleted the "V_" prefix files. Added a lengthy routine to be able to write out a VSANS file in HDF format. This is NOT the final and approved data format, only a working version so that I can test things out...

File size: 5.2 KB
Line 
1#pragma rtGlobals=3             // Use modern global access method and strict wave access.
2
3
4//
5//
6// TODO - big question about averaging in this way...
7// can the T/B panels really be used at all for slit mode? - since there's a big "hole" in the scattering data
8// collected -- you're not getting the full column of data covering a wide range of Qy. L/R panels should be fine.
9//
10// - best answer so far is to skip the T/B panels, and simply not use them
11//
12
13//
14//
15Function V_fBinDetector_byRows(folderStr,type)
16        String folderStr,type
17       
18        SetDataFolder root:Packages:NIST:VSANS:VCALC   
19       
20        Variable pixSizeX,pixSizeY,delQx, delQy
21
22        WAVE inten = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":det_"+type)                // 2D detector data
23        WAVE/Z iErr = $("iErr_"+type)                   // 2D errors -- may not exist, especially for simulation
24        Wave qTotal = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qTot_"+type)                      // 2D q-values
25        Wave qx = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qx_"+type)
26        Wave qy = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qy_"+type)
27       
28        pixSizeX = VCALC_getPixSizeX(type)
29        pixSizeY = VCALC_getPixSizeY(type)
30       
31        delQx = abs(qx[0][0] - qx[1][0])
32        delQy = abs(qy[0][1] - qy[0][0])
33       
34        // delta Qx is set by the pixel X dimension of the detector, which is the limiting resolution
35
36        Variable nq,val
37        nq = DimSize(inten,0)           //nq == the number of columns (x dimension)
38       
39        SetDataFolder root:Packages:NIST:VSANS:VCALC   
40
41        Make/O/D/N=(nq)  $("iBin_qxqy_"+type)
42        Make/O/D/N=(nq)  $("qBin_qxqy_"+type)
43        Make/O/D/N=(nq)  $("nBin_qxqy_"+type)
44        Make/O/D/N=(nq)  $("iBin2_qxqy_"+type)
45        Make/O/D/N=(nq)  $("eBin_qxqy_"+type)
46        Make/O/D/N=(nq)  $("eBin2D_qxqy_"+type)
47       
48        Wave iBin_qxqy = $("iBin_qxqy_"+type)
49        Wave qBin_qxqy = $("qBin_qxqy_"+type)
50        Wave nBin_qxqy = $("nBin_qxqy_"+type)
51        Wave iBin2_qxqy = $("iBin2_qxqy_"+type)
52        Wave eBin_qxqy = $("eBin_qxqy_"+type)
53        Wave eBin2D_qxqy = $("eBin2D_qxqy_"+type)
54
55// sum the rows
56        MatrixOp/O iBin_qxqy = sumRows(inten)   //automatically generates the destination
57
58// if the detectors are "L", then the values are all negative...
59// if the detectors are T/B, then half is negative, and there's a very nearly zero point in the middle...       
60// and it may make no sense to use T/B anyways...
61        qBin_qxqy = abs(qx[p][0])
62
63       
64        //now get the scaling correct
65        // q-integration (rectangular), matrixOp simply summed, so I need to multiply by dy (pixelSizeY -> as Qy?)
66       
67        iBin_qxqy *= delQy
68       
69// TODO
70//      iBin_qxqy *= 4          //why the factor of 4??? -- this is what I needed to do with FFT->USANS. Do I need it here?
71
72
73/// TODO -- this is not correct, but just for getting the I(Q) display to look "pretty"
74        qBin_qxqy = (abs(qBin_qxqy[p][q]) < 1e-5) ? NaN : qBin_qxqy[p][q]                       // clean out the near-zero Q point in the T/B  and Back detectors
75
76
77        SetDataFolder root:
78       
79        return(0)
80End
81
82
83Proc CopyIQWaves()
84
85        SetDataFolder root:Packages:NIST:VSANS:VCALC   
86
87        duplicate/O iBin_qxqy_B iBin_qxqy_B_pin
88        duplicate/O qBin_qxqy_B qBin_qxqy_B_pin
89       
90        duplicate/O iBin_qxqy_MR iBin_qxqy_MR_pin
91        duplicate/O qBin_qxqy_MR qBin_qxqy_MR_pin
92        duplicate/O iBin_qxqy_MT iBin_qxqy_MT_pin
93        duplicate/O qBin_qxqy_MT qBin_qxqy_MT_pin
94        duplicate/O iBin_qxqy_ML iBin_qxqy_ML_pin
95        duplicate/O qBin_qxqy_ML qBin_qxqy_ML_pin
96        duplicate/O iBin_qxqy_MB iBin_qxqy_MB_pin
97        duplicate/O qBin_qxqy_MB qBin_qxqy_MB_pin
98
99        duplicate/O iBin_qxqy_FR iBin_qxqy_FR_pin
100        duplicate/O qBin_qxqy_FR qBin_qxqy_FR_pin
101        duplicate/O iBin_qxqy_FT iBin_qxqy_FT_pin
102        duplicate/O qBin_qxqy_FT qBin_qxqy_FT_pin
103        duplicate/O iBin_qxqy_FL iBin_qxqy_FL_pin
104        duplicate/O qBin_qxqy_FL qBin_qxqy_FL_pin
105        duplicate/O iBin_qxqy_FB iBin_qxqy_FB_pin
106        duplicate/O qBin_qxqy_FB qBin_qxqy_FB_pin
107
108        SetDataFolder root:
109End
110
111Window slit_vs_pin_graph() : Graph
112        PauseUpdate; Silent 1           // building window...
113        String fldrSav0= GetDataFolder(1)
114        SetDataFolder root:Packages:NIST:VSANS:VCALC:
115        Display /W=(1296,44,1976,696) iBin_qxqy_B vs qBin_qxqy_B
116        AppendToGraph iBin_qxqy_B_pin vs qBin_qxqy_B_pin
117        AppendToGraph iBin_qxqy_MR vs qBin_qxqy_MR
118        AppendToGraph iBin_qxqy_MR_pin vs qBin_qxqy_MR_pin
119        AppendToGraph iBin_qxqy_MT vs qBin_qxqy_MT
120        AppendToGraph iBin_qxqy_MT_pin vs qBin_qxqy_MT_pin
121        AppendToGraph iBin_qxqy_FR vs qBin_qxqy_FR
122        AppendToGraph iBin_qxqy_FR_pin vs qBin_qxqy_FR_pin
123        AppendToGraph iBin_qxqy_FT vs qBin_qxqy_FT
124        AppendToGraph iBin_qxqy_FT_pin vs qBin_qxqy_FT_pin
125        SetDataFolder fldrSav0
126        ModifyGraph mode=4
127        ModifyGraph marker=19
128        ModifyGraph lSize=2
129        ModifyGraph rgb(iBin_qxqy_B)=(0,0,0),rgb(iBin_qxqy_B_pin)=(65535,16385,16385),rgb(iBin_qxqy_MR)=(2,39321,1)
130        ModifyGraph rgb(iBin_qxqy_MR_pin)=(0,0,65535),rgb(iBin_qxqy_MT)=(39321,1,31457)
131        ModifyGraph rgb(iBin_qxqy_MT_pin)=(48059,48059,48059),rgb(iBin_qxqy_FR)=(65535,32768,32768)
132        ModifyGraph rgb(iBin_qxqy_FR_pin)=(0,65535,0),rgb(iBin_qxqy_FT)=(16385,65535,65535)
133        ModifyGraph rgb(iBin_qxqy_FT_pin)=(65535,32768,58981)
134        ModifyGraph msize=2
135        ModifyGraph grid=1
136        ModifyGraph log=1
137        ModifyGraph mirror=1
138        SetAxis bottom 1e-05,0.05287132
139        Legend/C/N=text0/J/X=64.73/Y=7.25 "\\Z12\\s(iBin_qxqy_B) iBin_qxqy_B\r\\s(iBin_qxqy_B_pin) iBin_qxqy_B_pin\r\\s(iBin_qxqy_MR) iBin_qxqy_MR"
140        AppendText "\\s(iBin_qxqy_MR_pin) iBin_qxqy_MR_pin\r\\s(iBin_qxqy_MT) iBin_qxqy_MT\r\\s(iBin_qxqy_MT_pin) iBin_qxqy_MT_pin\r\\s(iBin_qxqy_FR) iBin_qxqy_FR"
141        AppendText "\\s(iBin_qxqy_FR_pin) iBin_qxqy_FR_pin\r\\s(iBin_qxqy_FT) iBin_qxqy_FT\r\\s(iBin_qxqy_FT_pin) iBin_qxqy_FT_pin"
142EndMacro
Note: See TracBrowser for help on using the repository browser.