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 | // |
---|
11 | |
---|
12 | // |
---|
13 | // |
---|
14 | Function V_fBinDetector_byRows(folderStr,type) |
---|
15 | String folderStr,type |
---|
16 | |
---|
17 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
18 | |
---|
19 | Variable pixSizeX,pixSizeY,delQx, delQy |
---|
20 | |
---|
21 | WAVE inten = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":det_"+type) // 2D detector data |
---|
22 | WAVE/Z iErr = $("iErr_"+type) // 2D errors -- may not exist, especially for simulation |
---|
23 | Wave qTotal = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qTot_"+type) // 2D q-values |
---|
24 | Wave qx = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qx_"+type) |
---|
25 | Wave qy = $("root:Packages:NIST:VSANS:VCALC:"+folderStr+":qy_"+type) |
---|
26 | |
---|
27 | pixSizeX = VCALC_getPixSizeX(type) |
---|
28 | pixSizeY = VCALC_getPixSizeY(type) |
---|
29 | |
---|
30 | delQx = abs(qx[0][0] - qx[1][0]) |
---|
31 | delQy = abs(qy[0][1] - qy[0][0]) |
---|
32 | |
---|
33 | // delta Qx is set by the pixel X dimension of the detector, which is the limiting resolution |
---|
34 | |
---|
35 | Variable nq,val |
---|
36 | nq = DimSize(inten,0) //nq == the number of columns (x dimension) |
---|
37 | |
---|
38 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
39 | |
---|
40 | // Make/O/D/N=(nq) $("iBin_slit_"+type) |
---|
41 | // Make/O/D/N=(nq) $("qBin_slit_"+type) |
---|
42 | // Make/O/D/N=(nq) $("nBin_slit_"+type) |
---|
43 | // Make/O/D/N=(nq) $("iBin2_slit_"+type) |
---|
44 | // Make/O/D/N=(nq) $("eBin_slit_"+type) |
---|
45 | // Make/O/D/N=(nq) $("eBin2D_slit_"+type) |
---|
46 | // |
---|
47 | // Wave iBin_qxqy = $("iBin_slit_"+type) |
---|
48 | // Wave qBin_qxqy = $("qBin_slit_"+type) |
---|
49 | // Wave nBin_qxqy = $("nBin_slit_"+type) |
---|
50 | // Wave iBin2_qxqy = $("iBin2_slit_"+type) |
---|
51 | // Wave eBin_qxqy = $("eBin_slit_"+type) |
---|
52 | // Wave eBin2D_qxqy = $("eBin2D_slit_"+type) |
---|
53 | |
---|
54 | Make/O/D/N=(nq) $("iBin_qxqy_"+type) |
---|
55 | Make/O/D/N=(nq) $("qBin_qxqy_"+type) |
---|
56 | Make/O/D/N=(nq) $("nBin_qxqy_"+type) |
---|
57 | Make/O/D/N=(nq) $("iBin2_qxqy_"+type) |
---|
58 | Make/O/D/N=(nq) $("eBin_qxqy_"+type) |
---|
59 | Make/O/D/N=(nq) $("eBin2D_qxqy_"+type) |
---|
60 | |
---|
61 | Wave iBin_qxqy = $("iBin_qxqy_"+type) |
---|
62 | Wave qBin_qxqy = $("qBin_qxqy_"+type) |
---|
63 | Wave nBin_qxqy = $("nBin_qxqy_"+type) |
---|
64 | Wave iBin2_qxqy = $("iBin2_qxqy_"+type) |
---|
65 | Wave eBin_qxqy = $("eBin_qxqy_"+type) |
---|
66 | Wave eBin2D_qxqy = $("eBin2D_qxqy_"+type) |
---|
67 | |
---|
68 | // sum the rows |
---|
69 | MatrixOp/O iBin_qxqy=sumRows(inten) //automatically generates the destination |
---|
70 | |
---|
71 | // if the detectors are "L", then the values are all negative... |
---|
72 | // if the detectors are T/B, then half is negative, and there's a very nearly zero point in the middle... |
---|
73 | // and it may make no sense to use T/B anyways... |
---|
74 | qBin_qxqy = abs(qx[p][0]) |
---|
75 | |
---|
76 | |
---|
77 | //now get the scaling correct |
---|
78 | // q-integration (rectangular), matrixOp simply summed, so I need to multiply by dy (pixelSizeY -> as Qy?) |
---|
79 | |
---|
80 | iBin_qxqy *= delQy |
---|
81 | |
---|
82 | // TODO |
---|
83 | // iBin_qxqy *= 4 //why the factor of 4??? -- this is what I needed to do with FFT->USANS. Do I need it here? |
---|
84 | |
---|
85 | |
---|
86 | /// TODO -- this is not correct, but just for getting the I(Q) display to look "pretty" |
---|
87 | 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 |
---|
88 | |
---|
89 | |
---|
90 | SetDataFolder root: |
---|
91 | |
---|
92 | return(0) |
---|
93 | End |
---|
94 | |
---|
95 | |
---|
96 | Proc CopyIQWaves() |
---|
97 | |
---|
98 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
99 | |
---|
100 | duplicate/O iBin_qxqy_B iBin_qxqy_B_pin |
---|
101 | duplicate/O qBin_qxqy_B qBin_qxqy_B_pin |
---|
102 | |
---|
103 | duplicate/O iBin_qxqy_MR iBin_qxqy_MR_pin |
---|
104 | duplicate/O qBin_qxqy_MR qBin_qxqy_MR_pin |
---|
105 | duplicate/O iBin_qxqy_MT iBin_qxqy_MT_pin |
---|
106 | duplicate/O qBin_qxqy_MT qBin_qxqy_MT_pin |
---|
107 | duplicate/O iBin_qxqy_ML iBin_qxqy_ML_pin |
---|
108 | duplicate/O qBin_qxqy_ML qBin_qxqy_ML_pin |
---|
109 | duplicate/O iBin_qxqy_MB iBin_qxqy_MB_pin |
---|
110 | duplicate/O qBin_qxqy_MB qBin_qxqy_MB_pin |
---|
111 | |
---|
112 | duplicate/O iBin_qxqy_FR iBin_qxqy_FR_pin |
---|
113 | duplicate/O qBin_qxqy_FR qBin_qxqy_FR_pin |
---|
114 | duplicate/O iBin_qxqy_FT iBin_qxqy_FT_pin |
---|
115 | duplicate/O qBin_qxqy_FT qBin_qxqy_FT_pin |
---|
116 | duplicate/O iBin_qxqy_FL iBin_qxqy_FL_pin |
---|
117 | duplicate/O qBin_qxqy_FL qBin_qxqy_FL_pin |
---|
118 | duplicate/O iBin_qxqy_FB iBin_qxqy_FB_pin |
---|
119 | duplicate/O qBin_qxqy_FB qBin_qxqy_FB_pin |
---|
120 | |
---|
121 | SetDataFolder root: |
---|
122 | End |
---|
123 | |
---|
124 | Window slit_vs_pin_graph() : Graph |
---|
125 | PauseUpdate; Silent 1 // building window... |
---|
126 | String fldrSav0= GetDataFolder(1) |
---|
127 | SetDataFolder root:Packages:NIST:VSANS:VCALC: |
---|
128 | Display /W=(1296,44,1976,696) iBin_qxqy_B vs qBin_qxqy_B |
---|
129 | AppendToGraph iBin_qxqy_B_pin vs qBin_qxqy_B_pin |
---|
130 | AppendToGraph iBin_qxqy_MR vs qBin_qxqy_MR |
---|
131 | AppendToGraph iBin_qxqy_MR_pin vs qBin_qxqy_MR_pin |
---|
132 | AppendToGraph iBin_qxqy_MT vs qBin_qxqy_MT |
---|
133 | AppendToGraph iBin_qxqy_MT_pin vs qBin_qxqy_MT_pin |
---|
134 | AppendToGraph iBin_qxqy_FR vs qBin_qxqy_FR |
---|
135 | AppendToGraph iBin_qxqy_FR_pin vs qBin_qxqy_FR_pin |
---|
136 | AppendToGraph iBin_qxqy_FT vs qBin_qxqy_FT |
---|
137 | AppendToGraph iBin_qxqy_FT_pin vs qBin_qxqy_FT_pin |
---|
138 | SetDataFolder fldrSav0 |
---|
139 | ModifyGraph mode=4 |
---|
140 | ModifyGraph marker=19 |
---|
141 | ModifyGraph lSize=2 |
---|
142 | ModifyGraph rgb(iBin_qxqy_B)=(0,0,0),rgb(iBin_qxqy_B_pin)=(65535,16385,16385),rgb(iBin_qxqy_MR)=(2,39321,1) |
---|
143 | ModifyGraph rgb(iBin_qxqy_MR_pin)=(0,0,65535),rgb(iBin_qxqy_MT)=(39321,1,31457) |
---|
144 | ModifyGraph rgb(iBin_qxqy_MT_pin)=(48059,48059,48059),rgb(iBin_qxqy_FR)=(65535,32768,32768) |
---|
145 | ModifyGraph rgb(iBin_qxqy_FR_pin)=(0,65535,0),rgb(iBin_qxqy_FT)=(16385,65535,65535) |
---|
146 | ModifyGraph rgb(iBin_qxqy_FT_pin)=(65535,32768,58981) |
---|
147 | ModifyGraph msize=2 |
---|
148 | ModifyGraph grid=1 |
---|
149 | ModifyGraph log=1 |
---|
150 | ModifyGraph mirror=1 |
---|
151 | SetAxis bottom 1e-05,0.05287132 |
---|
152 | 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" |
---|
153 | 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" |
---|
154 | 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" |
---|
155 | EndMacro |
---|