1 | #pragma rtGlobals=3 // Use modern global access method and strict wave access. |
---|
2 | |
---|
3 | |
---|
4 | ////////////////// |
---|
5 | // |
---|
6 | // Procedures for: |
---|
7 | // |
---|
8 | // Gathering information to calculate QxQyQz |
---|
9 | // Filling the panels with Qtot, QxQyQz |
---|
10 | // Filling the "data" with a model function |
---|
11 | // Averaging the panels (independently) into I(Q) |
---|
12 | // Plotting the 9 detector panels in 2D |
---|
13 | // Plotting the 1D I(q) data depending on the panel combinations |
---|
14 | // |
---|
15 | // |
---|
16 | // There are some things in the current circular averaging that don't make any sense |
---|
17 | // and don't seem to really do anything at all, so i have decided to trim them out. |
---|
18 | // 1) subdividing pixels near the beam stop into 9 sub-pixels |
---|
19 | // 2) non-linear correction (only applies to Ordela) |
---|
20 | // |
---|
21 | // |
---|
22 | // Do I separate out the circular, sector, rectangular, annular averaging into |
---|
23 | // separate routines? |
---|
24 | // |
---|
25 | // |
---|
26 | // |
---|
27 | /////////////////// |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | Proc PlotFrontPanels() |
---|
33 | fPlotFrontPanels() |
---|
34 | End |
---|
35 | |
---|
36 | // |
---|
37 | // Plot the front panels in 2D and 1D |
---|
38 | // calcualate Q |
---|
39 | // fill w/model data |
---|
40 | // "shadow" the T/B detectors |
---|
41 | // bin the data to I(q) |
---|
42 | // draw I(q) graph |
---|
43 | // draw 2D panel graph |
---|
44 | // |
---|
45 | // *** Call this function when front panels are adjusted, or wavelength, etc. changed |
---|
46 | // |
---|
47 | Function fPlotFrontPanels() |
---|
48 | |
---|
49 | // space is allocated for all of the detectors and Q's on initialization |
---|
50 | // calculate Qtot, qxqyqz arrays from geometry |
---|
51 | VC_CalculateQFrontPanels() |
---|
52 | |
---|
53 | // fill the panels with fake sphere scattering data |
---|
54 | // TODO: am I in the right data folder?? |
---|
55 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
56 | |
---|
57 | String folderStr = "VCALC" |
---|
58 | String detStr = "" |
---|
59 | |
---|
60 | String folderPath = "root:Packages:NIST:VSANS:"+folderStr |
---|
61 | String instPath = ":entry:instrument:detector_" |
---|
62 | |
---|
63 | detStr = "FL" |
---|
64 | WAVE det_FL = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
65 | WAVE qTot_FL = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
66 | |
---|
67 | detStr = "FR" |
---|
68 | WAVE det_FR = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
69 | WAVE qTot_FR = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
70 | // WAVE qTot_FR = $("root:Packages:NIST:VSANS:RAW:entry:instrument:detector_FR:qTot_FR") |
---|
71 | |
---|
72 | detStr = "FT" |
---|
73 | WAVE det_FT = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
74 | WAVE qTot_FT = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
75 | |
---|
76 | detStr = "FB" |
---|
77 | WAVE det_FB = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
78 | WAVE qTot_FB = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | FillPanel_wModelData(det_FL,qTot_FL,"FL") |
---|
83 | FillPanel_wModelData(det_FR,qTot_FR,"FR") |
---|
84 | FillPanel_wModelData(det_FT,qTot_FT,"FT") |
---|
85 | FillPanel_wModelData(det_FB,qTot_FB,"FB") |
---|
86 | |
---|
87 | SetDataFolder root: |
---|
88 | |
---|
89 | // set any "shadowed" area of the T/B detectors to NaN to get a realistic |
---|
90 | // view of how much of the detectors are actually collecting data |
---|
91 | // -- I can get the separation L/R from the panel - only this "open" width is visible. |
---|
92 | //TODO - make this a proper shadow - TB extent of the LR panels matters too, not just the LR separation |
---|
93 | VC_SetShadow_TopBottom("VCALC","FT") // TODO: -- be sure the data folder is properly set (within the function...) |
---|
94 | VC_SetShadow_TopBottom("VCALC","FB") |
---|
95 | |
---|
96 | // do the q-binning for each of the panels to get I(Q) |
---|
97 | BinAllFrontPanels() |
---|
98 | |
---|
99 | |
---|
100 | // plot the results |
---|
101 | String type = "VCALC" |
---|
102 | String str,winStr="VCALC#Panels_IQ",workTypeStr,popStr |
---|
103 | workTypeStr = "root:Packages:NIST:VSANS:"+type |
---|
104 | |
---|
105 | ControlInfo/W=VCALC popup_b |
---|
106 | popStr = S_Value // |
---|
107 | |
---|
108 | sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr |
---|
109 | |
---|
110 | Execute ("V_Front_IQ_Graph"+str) |
---|
111 | |
---|
112 | // Execute "Front_IQ_Graph()" |
---|
113 | |
---|
114 | FrontPanels_AsQ() |
---|
115 | |
---|
116 | return(0) |
---|
117 | End |
---|
118 | |
---|
119 | |
---|
120 | // works for Left, works for Right... works for T/B too. |
---|
121 | // |
---|
122 | // - TODO: be sure that the Q's are calculated correctly even when the beam is off of the |
---|
123 | // detector, and on different sides of the detector (or T/B) - since it will be in a different |
---|
124 | // relative postion to 0,0 on the detector. If the postions are symmetric, then the Q's should be identical. |
---|
125 | // --- test this... |
---|
126 | // TODO -- be sure I'm in the right data folder. nothing is set correctly right now |
---|
127 | // |
---|
128 | // TODO: make all detector parameters global, not hard-wired |
---|
129 | // |
---|
130 | // |
---|
131 | // --- Panels are all allocated in the initialization. Here, only the q-values are calculated |
---|
132 | // when anything changes |
---|
133 | // |
---|
134 | // TODO |
---|
135 | // NOTE -- this is VCALC ONLY. data is not referenced for hdf here, and data is rescaled based on VCALC assumptions |
---|
136 | // |
---|
137 | Function VC_CalculateQFrontPanels() |
---|
138 | |
---|
139 | Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,nPix_X,nPix_Y |
---|
140 | Variable F_L_sep,F_R_sep,F_T_sep,F_B_sep,F_sdd_setback |
---|
141 | |
---|
142 | String folderPath = "root:Packages:NIST:VSANS:VCALC" |
---|
143 | String instPath = ":entry:instrument:detector_" |
---|
144 | String detStr="" |
---|
145 | |
---|
146 | // get the values from the panel + constants |
---|
147 | F_L_sep = VCALC_getPanelTranslation("FL") |
---|
148 | F_R_sep = VCALC_getPanelTranslation("FR") |
---|
149 | F_T_sep = VCALC_getPanelTranslation("FT") |
---|
150 | F_B_sep = VCALC_getPanelTranslation("FB") |
---|
151 | |
---|
152 | SDD = VCALC_getSDD("FL") //nominal SDD [cm] - need offset for TB |
---|
153 | lam = VCALC_getWavelength() |
---|
154 | |
---|
155 | //separations are in cm -- |
---|
156 | // F_LR_sep /= 10 |
---|
157 | // F_TB_sep /= 10 |
---|
158 | // TODO - I'm treating the separation as the TOTAL width - so the difference |
---|
159 | // from the "center" to the edge is 1/2 of the separation |
---|
160 | |
---|
161 | // TODO (make the N along the tube length a variable, since this can be reset @ acquisition) |
---|
162 | |
---|
163 | F_sdd_setback = VCALC_getTopBottomSDDSetback("FT") //T/B are 41 cm farther back //TODO: make all detector parameters global, not hard-wired |
---|
164 | |
---|
165 | // detector data to bin |
---|
166 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
167 | Wave det_FL = $(folderPath+instPath+"FL"+":det_FL") |
---|
168 | Wave det_FR = $(folderPath+instPath+"FR"+":det_FR") // these are (48,128) (nominal, may change) |
---|
169 | |
---|
170 | Wave det_FT = $(folderPath+instPath+"FT"+":det_FT") |
---|
171 | Wave det_FB = $(folderPath+instPath+"FB"+":det_FB") // these are (128,48) |
---|
172 | |
---|
173 | //FRONT/LEFT |
---|
174 | detStr = "FL" |
---|
175 | Wave qTot_FL = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
176 | Wave qx_FL = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
177 | Wave qy_FL = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
178 | Wave qz_FL = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
179 | |
---|
180 | qTot_FL = 0 |
---|
181 | qx_FL = 0 |
---|
182 | qy_FL = 0 |
---|
183 | qz_FL = 0 |
---|
184 | |
---|
185 | // TODO - these are to be set from globals, not hard-wired. N and pixelSixze will be known (or pre-measured) |
---|
186 | // pixel sizes are in cm |
---|
187 | pixSizeX = VCALC_getPixSizeX("FL") |
---|
188 | pixSizeY = VCALC_getPixSizeY("FL") |
---|
189 | // pixSizeX = 0.8 // 0.8 cm/pixel along width |
---|
190 | // pixSizeY = 0.4 // approx 0.4 cm/pixel along length |
---|
191 | nPix_X = VCALC_get_nPix_X("FL") |
---|
192 | nPix_Y = VCALC_get_nPix_Y("FL") |
---|
193 | |
---|
194 | if(kBCTR_CM) |
---|
195 | xCtr = 0 |
---|
196 | yCtr = 0 //values in cm |
---|
197 | else |
---|
198 | xCtr = nPix_X-(F_L_sep/pixSizeX) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? |
---|
199 | yCtr = nPix_Y/2 |
---|
200 | endif |
---|
201 | //put these beam center values into the local folder |
---|
202 | V_putDet_beam_center_x("VCALC","FL",xCtr) |
---|
203 | V_putDet_beam_center_y("VCALC","FL",yCtr) |
---|
204 | |
---|
205 | // VC_Detector_2Q(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) |
---|
206 | VC_Detector_2Q_NonLin(det_FL,qTot_FL,qx_FL,qy_FL,qz_FL,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"FL") |
---|
207 | Print "xy for FL = ",xCtr,yCtr |
---|
208 | |
---|
209 | //set the wave scaling for the detector image so that it can be plotted in q-space |
---|
210 | // TODO: this is only approximate - since the left "edge" is not the same from top to bottom, so I crudely |
---|
211 | // take the middle value. At very small angles, OK, at 1m, this is a crummy approximation. |
---|
212 | // since qTot is magnitude only, I need to put in the (-ve) |
---|
213 | SetScale/I x WaveMin(qx_FL),WaveMax(qx_FL),"", det_FL //this sets the left and right ends of the data scaling |
---|
214 | SetScale/I y WaveMin(qy_FL),WaveMax(qy_FL),"", det_FL |
---|
215 | ////////////////// |
---|
216 | |
---|
217 | //FRONT/RIGHT |
---|
218 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
219 | detStr = "FR" |
---|
220 | Wave qTot_FR = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
221 | Wave qx_FR = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
222 | Wave qy_FR = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
223 | Wave qz_FR = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
224 | |
---|
225 | qTot_FR = 0 |
---|
226 | qx_FR = 0 |
---|
227 | qy_FR = 0 |
---|
228 | qz_FR = 0 |
---|
229 | |
---|
230 | // TODO - these are to be set from globals, not hard-wired |
---|
231 | // pixel sizes are in cm |
---|
232 | pixSizeX = VCALC_getPixSizeX("FR") |
---|
233 | pixSizeY = VCALC_getPixSizeY("FR") |
---|
234 | nPix_X = VCALC_get_nPix_X("FR") |
---|
235 | nPix_Y = VCALC_get_nPix_Y("FR") |
---|
236 | |
---|
237 | if(kBCTR_CM) |
---|
238 | xCtr = 0 |
---|
239 | yCtr = 0 //values in cm |
---|
240 | else |
---|
241 | xCtr = -(F_R_sep/pixSizeX)-1 |
---|
242 | yCtr = nPix_Y/2 |
---|
243 | endif |
---|
244 | |
---|
245 | //put these beam center values into the local folder |
---|
246 | V_putDet_beam_center_x("VCALC","FR",xCtr) |
---|
247 | V_putDet_beam_center_y("VCALC","FR",yCtr) |
---|
248 | // VC_Detector_2Q(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) |
---|
249 | VC_Detector_2Q_NonLin(det_FR,qTot_FR,qx_FR,qy_FR,qz_FR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"FR") |
---|
250 | |
---|
251 | // Print "xy for FR = ",xCtr,yCtr |
---|
252 | SetScale/I x WaveMin(qx_FR),WaveMax(qx_FR),"", det_FR //this sets the left and right ends of the data scaling |
---|
253 | SetScale/I y WaveMin(qy_FR),WaveMax(qy_FR),"", det_FR |
---|
254 | ///////////////// |
---|
255 | |
---|
256 | //FRONT/TOP |
---|
257 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
258 | detStr = "FT" |
---|
259 | Wave qTot_FT = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
260 | Wave qx_FT = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
261 | Wave qy_FT = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
262 | Wave qz_FT = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
263 | |
---|
264 | qTot_FT = 0 |
---|
265 | qx_FT = 0 |
---|
266 | qy_FT = 0 |
---|
267 | qz_FT = 0 |
---|
268 | |
---|
269 | // TODO - these are to be set from globals, not hard-wired |
---|
270 | // pixel sizes are in cm |
---|
271 | pixSizeX = VCALC_getPixSizeX("FT") |
---|
272 | pixSizeY = VCALC_getPixSizeY("FT") |
---|
273 | nPix_X = VCALC_get_nPix_X("FT") |
---|
274 | nPix_Y = VCALC_get_nPix_Y("FT") |
---|
275 | |
---|
276 | if(kBCTR_CM) |
---|
277 | xCtr = 0 |
---|
278 | yCtr = 0 //values in cm |
---|
279 | else |
---|
280 | xCtr = nPix_X/2 |
---|
281 | yCtr = -(F_T_sep/2/pixSizeY)-1 |
---|
282 | endif |
---|
283 | |
---|
284 | //put these beam center values into the local folder |
---|
285 | V_putDet_beam_center_x("VCALC","FT",xCtr) |
---|
286 | V_putDet_beam_center_y("VCALC","FT",yCtr) |
---|
287 | |
---|
288 | // global sdd_offset is in (mm), convert to meters here for the Q-calculation |
---|
289 | // VC_Detector_2Q(det_FT,qTot_FT,qx_FT,qy_FT,qz_FT,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) |
---|
290 | VC_Detector_2Q_NonLin(det_FT,qTot_FT,qx_FT,qy_FT,qz_FT,xCtr,yCtr,sdd+F_sdd_setback,lam,pixSizeX,pixSizeY,"FT") |
---|
291 | |
---|
292 | // Print "xy for FT = ",xCtr,yCtr |
---|
293 | SetScale/I x WaveMin(qx_FT),WaveMax(qx_FT),"", det_FT //this sets the left and right ends of the data scaling |
---|
294 | SetScale/I y WaveMin(qy_FT),WaveMax(qy_FT),"", det_FT |
---|
295 | ////////////////// |
---|
296 | |
---|
297 | //FRONT/BOTTOM |
---|
298 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
299 | detStr = "FB" |
---|
300 | Wave qTot_FB = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
301 | Wave qx_FB = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
302 | Wave qy_FB = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
303 | Wave qz_FB = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
304 | |
---|
305 | qTot_FB = 0 |
---|
306 | qx_FB = 0 |
---|
307 | qy_FB = 0 |
---|
308 | qz_FB = 0 |
---|
309 | |
---|
310 | // TODO - these are to be set from globals, not hard-wired |
---|
311 | // pixel sizes are in cm |
---|
312 | pixSizeX = VCALC_getPixSizeX("FB") |
---|
313 | pixSizeY = VCALC_getPixSizeY("FB") |
---|
314 | nPix_X = VCALC_get_nPix_X("FB") |
---|
315 | nPix_Y = VCALC_get_nPix_Y("FB") |
---|
316 | |
---|
317 | if(kBCTR_CM) |
---|
318 | xCtr = 0 |
---|
319 | yCtr = 0 //values in cm |
---|
320 | else |
---|
321 | xCtr = nPix_X/2 |
---|
322 | yCtr = nPix_Y+(F_B_sep/2/pixSizeY) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? |
---|
323 | endif |
---|
324 | |
---|
325 | //put these beam center values into the local folder |
---|
326 | V_putDet_beam_center_x("VCALC","FB",xCtr) |
---|
327 | V_putDet_beam_center_y("VCALC","FB",yCtr) |
---|
328 | |
---|
329 | // global sdd_offset is in (mm), convert to meters here for the Q-calculation |
---|
330 | // VC_Detector_2Q(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_offset/1000,lam,pixSizeX,pixSizeY) |
---|
331 | VC_Detector_2Q_NonLin(det_FB,qTot_FB,qx_FB,qy_FB,qz_FB,xCtr,yCtr,sdd+F_sdd_setback,lam,pixSizeX,pixSizeY,"FB") |
---|
332 | |
---|
333 | // Print "xy for FB = ",xCtr,yCtr |
---|
334 | SetScale/I x WaveMin(qx_FB),WaveMax(qx_FB),"", det_FB //this sets the left and right ends of the data scaling |
---|
335 | SetScale/I y WaveMin(qy_FB),WaveMax(qy_FB),"", det_FB |
---|
336 | ///////////////// |
---|
337 | |
---|
338 | SetDataFolder root: |
---|
339 | |
---|
340 | return(0) |
---|
341 | End |
---|
342 | |
---|
343 | |
---|
344 | // TODO - this doesn't quite mask things out as they should be (too much is masked L/R of center) |
---|
345 | // and the outer edges of the detector are masked even if the TB panels extend past the TB of the LR panels. |
---|
346 | // ? skip the masking? but then I bin the detector data directly to get I(q), skipping the masked NaN values... |
---|
347 | // |
---|
348 | Function VC_SetShadow_TopBottom(folderStr,type) |
---|
349 | String folderStr,type |
---|
350 | |
---|
351 | Variable L_sep,R_sep,nPix_L,nPix_R,xCtr,ii,jj,numCol,pixSizeX,pixSizeY,nPix_X,nPix_Y |
---|
352 | |
---|
353 | /// !! type passed in will be FT, FB, MT, MB, so I can't ask for the panel separation -- or I'll get the TB separation... |
---|
354 | // translation in [cm] |
---|
355 | if(cmpstr("F",type[0]) == 0) // FT or FB passed in |
---|
356 | L_sep = VCALC_getPanelTranslation("FL") |
---|
357 | R_sep = VCALC_getPanelTranslation("FR") |
---|
358 | else |
---|
359 | L_sep = VCALC_getPanelTranslation("ML") |
---|
360 | R_sep = VCALC_getPanelTranslation("MR") |
---|
361 | endif |
---|
362 | |
---|
363 | |
---|
364 | //detector data |
---|
365 | Wave det = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+type+":det_"+type) |
---|
366 | |
---|
367 | // TODO - these are to be set from globals, not hard-wired |
---|
368 | // pixel sizes are in cm for T/B detector |
---|
369 | // TODO - the "FT" check is hard wired for FRONT -- get rid of this... |
---|
370 | |
---|
371 | pixSizeX = VCALC_getPixSizeX(type) |
---|
372 | pixSizeY = VCALC_getPixSizeY(type) |
---|
373 | |
---|
374 | nPix_X = VCALC_get_nPix_X(type) |
---|
375 | nPix_Y = VCALC_get_nPix_Y(type) |
---|
376 | |
---|
377 | //TODO -- get this from a global |
---|
378 | xCtr = nPix_X/2 |
---|
379 | nPix_L = trunc(abs(L_sep)/pixSizeX) // approx # of pixels Left of center that are not obscured by L/R panels |
---|
380 | nPix_R = trunc(abs(R_sep)/pixSizeX) // approx # of pixels Right of center that are not obscured by L/R panels |
---|
381 | |
---|
382 | numCol = DimSize(det,0) // x dim (columns) |
---|
383 | for(ii=0;ii<(xCtr-nPix_L-4);ii+=1) |
---|
384 | det[ii][] = NaN |
---|
385 | endfor |
---|
386 | for(ii=(xCtr+nPix_R+6);ii<numCol;ii+=1) |
---|
387 | det[ii][] = NaN |
---|
388 | endfor |
---|
389 | |
---|
390 | return(0) |
---|
391 | end |
---|
392 | |
---|
393 | |
---|
394 | // After the panels have been calculated and rescaled in terms of Q, and filled with simulated data |
---|
395 | // they can be appended to the subwindow. If they are already there, the axes and coloring |
---|
396 | // are rescaled as needed |
---|
397 | // |
---|
398 | Function FrontPanels_AsQ() |
---|
399 | |
---|
400 | String frontStr = "root:Packages:NIST:VSANS:VCALC:entry:instrument:" |
---|
401 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Front |
---|
402 | SetDataFolder $(frontStr+"detector_FB") |
---|
403 | Wave det_FB = det_FB |
---|
404 | SetDataFolder $(frontStr+"detector_FT") |
---|
405 | Wave det_FT = det_FT |
---|
406 | SetDataFolder $(frontStr+"detector_FL") |
---|
407 | Wave det_FL = det_FL |
---|
408 | SetDataFolder $(frontStr+"detector_FR") |
---|
409 | Wave det_FR = det_FR |
---|
410 | |
---|
411 | CheckDisplayed /W=VCALC#Panels_Q det_FB |
---|
412 | if(V_flag == 0) |
---|
413 | AppendImage/W=VCALC#Panels_Q det_FB |
---|
414 | ModifyImage/W=VCALC#Panels_Q det_FB ctab= {*,*,ColdWarm,0} |
---|
415 | AppendImage/W=VCALC#Panels_Q det_FT |
---|
416 | ModifyImage/W=VCALC#Panels_Q det_FT ctab= {*,*,ColdWarm,0} |
---|
417 | AppendImage/W=VCALC#Panels_Q det_FL |
---|
418 | ModifyImage/W=VCALC#Panels_Q det_FL ctab= {*,*,ColdWarm,0} |
---|
419 | AppendImage/W=VCALC#Panels_Q det_FR |
---|
420 | ModifyImage/W=VCALC#Panels_Q det_FR ctab= {*,*,ColdWarm,0} |
---|
421 | endif |
---|
422 | |
---|
423 | Variable dval |
---|
424 | ControlInfo/W=VCALC setVar_b |
---|
425 | dval = V_Value |
---|
426 | |
---|
427 | SetAxis/W=VCALC#Panels_Q left -dval,dval |
---|
428 | SetAxis/W=VCALC#Panels_Q bottom -dval,dval |
---|
429 | |
---|
430 | ControlInfo/W=VCALC check_0a |
---|
431 | // V_Value == 1 if checked |
---|
432 | ModifyImage/W=VCALC#Panels_Q det_FB log=V_Value |
---|
433 | ModifyImage/W=VCALC#Panels_Q det_FT log=V_Value |
---|
434 | ModifyImage/W=VCALC#Panels_Q det_FL log=V_Value |
---|
435 | ModifyImage/W=VCALC#Panels_Q det_FR log=V_Value |
---|
436 | |
---|
437 | |
---|
438 | SetDataFolder root: |
---|
439 | |
---|
440 | EndMacro |
---|
441 | |
---|
442 | |
---|
443 | |
---|
444 | |
---|
445 | |
---|
446 | |
---|
447 | // |
---|
448 | // these routines bin the 2D q data to 1D I(q). Currently the Qtot is magnitude only, no sign (since |
---|
449 | // it's being binned to I(Q), having a sign makes no sense. If you want the sign, work from qxqyqz |
---|
450 | // |
---|
451 | // first - the DeltaQ step is set as the smaller detector resolution (along tube) |
---|
452 | // which is different for LR / TB geometry. This is not set in stone. |
---|
453 | // |
---|
454 | // second - each detector is binned separately |
---|
455 | // |
---|
456 | // -- like the routines in CircSectAve, start with 500 points, and trim after binning is done. |
---|
457 | // you'l end up with < 200 points. |
---|
458 | // |
---|
459 | // the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed |
---|
460 | // |
---|
461 | // TODO -- this is a (partial) duplicated routine... I need to |
---|
462 | // **** COPY the logic from V_QBinAllPanels_Circular every time I add a new bin type |
---|
463 | // |
---|
464 | // -- see also BinAllMiddlePanels() |
---|
465 | // -- BinAllBackPanels() |
---|
466 | // |
---|
467 | Function BinAllFrontPanels() |
---|
468 | |
---|
469 | SetDeltaQ("VCALC","FL") |
---|
470 | SetDeltaQ("VCALC","FR") |
---|
471 | SetDeltaQ("VCALC","FT") |
---|
472 | SetDeltaQ("VCALC","FB") |
---|
473 | |
---|
474 | Variable binType |
---|
475 | ControlInfo/W=VCALC popup_b |
---|
476 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
477 | |
---|
478 | String folderStr = "VCALC" |
---|
479 | |
---|
480 | switch(binType) |
---|
481 | case 1: |
---|
482 | VC_fDoBinning_QxQy2D(folderStr,"FL") |
---|
483 | VC_fDoBinning_QxQy2D(folderStr,"FR") |
---|
484 | VC_fDoBinning_QxQy2D(folderStr,"FT") |
---|
485 | VC_fDoBinning_QxQy2D(folderStr,"FB") |
---|
486 | // VC_fDoBinning_QxQy2D(folderStr,"ML") |
---|
487 | // VC_fDoBinning_QxQy2D(folderStr,"MR") |
---|
488 | // VC_fDoBinning_QxQy2D(folderStr,"MT") |
---|
489 | // VC_fDoBinning_QxQy2D(folderStr,"MB") |
---|
490 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
491 | |
---|
492 | break |
---|
493 | case 2: |
---|
494 | VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
495 | VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
496 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
497 | // VC_fDoBinning_QxQy2D(folderStr,"MTB") |
---|
498 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
499 | |
---|
500 | break |
---|
501 | case 3: |
---|
502 | // VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
503 | VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
504 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
505 | |
---|
506 | break |
---|
507 | case 4: /// this is for a tall, narrow slit mode |
---|
508 | VC_fBinDetector_byRows(folderStr,"FL") |
---|
509 | VC_fBinDetector_byRows(folderStr,"FR") |
---|
510 | // VC_fBinDetector_byRows(folderStr,"ML") |
---|
511 | // VC_fBinDetector_byRows(folderStr,"MR") |
---|
512 | // VC_fBinDetector_byRows(folderStr,"B") |
---|
513 | |
---|
514 | break |
---|
515 | case 5: |
---|
516 | VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
517 | VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
518 | // VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
519 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
520 | |
---|
521 | break |
---|
522 | case 6: |
---|
523 | VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
524 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
525 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
526 | |
---|
527 | break |
---|
528 | case 7: |
---|
529 | VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
530 | VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
531 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
532 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
533 | |
---|
534 | break |
---|
535 | |
---|
536 | default: |
---|
537 | Abort "Binning mode not found in BinAllFrontPanels "// when no case matches |
---|
538 | endswitch |
---|
539 | |
---|
540 | |
---|
541 | // if(binType == 1) |
---|
542 | // VC_BinQxQy_to_1D("VCALC","FL") |
---|
543 | // VC_BinQxQy_to_1D("VCALC","FR") |
---|
544 | // VC_BinQxQy_to_1D("VCALC","FT") |
---|
545 | // VC_BinQxQy_to_1D("VCALC","FB") |
---|
546 | // endif |
---|
547 | // |
---|
548 | // if(binType == 2) |
---|
549 | // VC_BinQxQy_to_1D("VCALC","FLR") |
---|
550 | // VC_BinQxQy_to_1D("VCALC","FTB") |
---|
551 | // endif |
---|
552 | // |
---|
553 | // if(binType == 3) |
---|
554 | // VC_BinQxQy_to_1D("VCALC","FLRTB") |
---|
555 | // endif |
---|
556 | // |
---|
557 | //// TODO -- this is only a temporary fix for slit mode |
---|
558 | // if(binType == 4) |
---|
559 | // /// this is for a tall, narrow slit mode |
---|
560 | // VC_fBinDetector_byRows("VCALC","FL") |
---|
561 | // VC_fBinDetector_byRows("VCALC","FR") |
---|
562 | // VC_fBinDetector_byRows("VCALC","FT") |
---|
563 | // VC_fBinDetector_byRows("VCALC","FB") |
---|
564 | // endif |
---|
565 | |
---|
566 | End |
---|
567 | |
---|
568 | |
---|
569 | |
---|
570 | |
---|
571 | |
---|
572 | |
---|
573 | |
---|
574 | Proc PlotMiddlePanels() |
---|
575 | fPlotMiddlePanels() |
---|
576 | End |
---|
577 | |
---|
578 | // to plot I(q) for the 4 Middle panels |
---|
579 | // |
---|
580 | // *** Call this function when Middle panels are adjusted, or wavelength, etc. changed |
---|
581 | // |
---|
582 | Function fPlotMiddlePanels() |
---|
583 | |
---|
584 | // space is allocated for all of the detectors and Q's on initialization |
---|
585 | // calculate Qtot, qxqyqz arrays from geometry |
---|
586 | VC_CalculateQMiddlePanels() |
---|
587 | |
---|
588 | // fill the panels with fake sphere scattering data |
---|
589 | // TODO: am I in the right data folder?? |
---|
590 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
591 | |
---|
592 | String folderStr = "VCALC" |
---|
593 | String detStr = "" |
---|
594 | |
---|
595 | String folderPath = "root:Packages:NIST:VSANS:"+folderStr |
---|
596 | String instPath = ":entry:instrument:detector_" |
---|
597 | |
---|
598 | detStr = "ML" |
---|
599 | WAVE det_ML = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
600 | WAVE qTot_ML = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
601 | |
---|
602 | detStr = "MR" |
---|
603 | WAVE det_MR = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
604 | WAVE qTot_MR = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
605 | |
---|
606 | detStr = "MT" |
---|
607 | WAVE det_MT = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
608 | WAVE qTot_MT = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
609 | |
---|
610 | detStr = "MB" |
---|
611 | WAVE det_MB = $(folderPath+instPath+detStr+":det_"+detStr) |
---|
612 | WAVE qTot_MB = $(folderPath+instPath+detStr+":qTot_"+detStr) |
---|
613 | |
---|
614 | FillPanel_wModelData(det_ML,qTot_ML,"ML") |
---|
615 | FillPanel_wModelData(det_MR,qTot_MR,"MR") |
---|
616 | FillPanel_wModelData(det_MT,qTot_MT,"MT") |
---|
617 | FillPanel_wModelData(det_MB,qTot_MB,"MB") |
---|
618 | |
---|
619 | SetDataFolder root: |
---|
620 | |
---|
621 | // set any "shadowed" area of the T/B detectors to NaN to get a realitic |
---|
622 | // view of how much of the detectors are actually collecting data |
---|
623 | // -- I can get the separation L/R from the panel - only this "open" width is visible. |
---|
624 | VC_SetShadow_TopBottom("VCALC","MT") // TODO: -- be sure the data folder is properly set (within the function...) |
---|
625 | VC_SetShadow_TopBottom("VCALC","MB") |
---|
626 | |
---|
627 | // do the q-binning for each of the panels to get I(Q) |
---|
628 | BinAllMiddlePanels() |
---|
629 | |
---|
630 | // plot the results |
---|
631 | String type = "VCALC" |
---|
632 | String str,winStr="VCALC#Panels_IQ",workTypeStr,popStr |
---|
633 | workTypeStr = "root:Packages:NIST:VSANS:"+type |
---|
634 | |
---|
635 | ControlInfo/W=VCALC popup_b |
---|
636 | popStr = S_Value // |
---|
637 | |
---|
638 | sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr |
---|
639 | |
---|
640 | Execute ("V_Middle_IQ_Graph"+str) |
---|
641 | |
---|
642 | |
---|
643 | // plot the results |
---|
644 | // Execute "Middle_IQ_Graph()" |
---|
645 | |
---|
646 | |
---|
647 | MiddlePanels_AsQ() |
---|
648 | |
---|
649 | return(0) |
---|
650 | End |
---|
651 | |
---|
652 | // works for Left, works for Right... works for T/B too. |
---|
653 | // |
---|
654 | // - TODO: be sure that the Q's are calculated correctly even when the beam is off of the |
---|
655 | // detector, and on different sides of the detector (or T/B) - since it will be in a different |
---|
656 | // relative postion to 0,0 on the detector. If the postions are symmetric, then the Q's should be identical. |
---|
657 | // --- test this... |
---|
658 | // TODO -- be sure I'm in the right data folder. nothing is set correctly right now |
---|
659 | // |
---|
660 | // TODO: make all detector parameters global, not hard-wired |
---|
661 | // |
---|
662 | // |
---|
663 | // --- Panels are all allocated in the initialization. Here, only the q-values are calculated |
---|
664 | // when anything changes |
---|
665 | // |
---|
666 | Function VC_CalculateQMiddlePanels() |
---|
667 | |
---|
668 | Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,nPix_X,nPix_Y |
---|
669 | Variable M_L_sep,M_R_sep,M_T_sep,M_B_sep, M_sdd_setback |
---|
670 | |
---|
671 | |
---|
672 | String folderPath = "root:Packages:NIST:VSANS:VCALC" |
---|
673 | String instPath = ":entry:instrument:detector_" |
---|
674 | String detStr="" |
---|
675 | |
---|
676 | M_L_sep = VCALC_getPanelTranslation("ML") |
---|
677 | M_R_sep = VCALC_getPanelTranslation("MR") |
---|
678 | M_T_sep = VCALC_getPanelTranslation("MT") |
---|
679 | M_B_sep = VCALC_getPanelTranslation("MB") |
---|
680 | |
---|
681 | SDD = VCALC_getSDD("ML") //nominal SDD [cm] - need offset for TB |
---|
682 | lam = VCALC_getWavelength() |
---|
683 | |
---|
684 | //separations are in cm -- need to watch the units, convert to cm |
---|
685 | // M_LR_sep /= 10 |
---|
686 | // M_TB_sep /= 10 |
---|
687 | // TODO - I'm treating the separation as the TOTAL width - so the difference |
---|
688 | // from the "center" to the edge is 1/2 of the separation |
---|
689 | |
---|
690 | // TODO (make the N along the tube length a variable, since this can be reset @ acquisition) |
---|
691 | M_sdd_setback = VCALC_getTopBottomSDDSetback("MT") //T/B are 41 cm farther back //TODO: make all detector parameters global, not hard-wired |
---|
692 | |
---|
693 | |
---|
694 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
695 | Wave det_ML = $(folderPath+instPath+"ML"+":det_ML") |
---|
696 | Wave det_MR = $(folderPath+instPath+"MR"+":det_MR") // these are (48,128) (nominal, may change) |
---|
697 | |
---|
698 | Wave det_MT = $(folderPath+instPath+"MT"+":det_MT") |
---|
699 | Wave det_MB = $(folderPath+instPath+"MB"+":det_MB") // these are (128,48) |
---|
700 | |
---|
701 | //Middle/LEFT |
---|
702 | detStr = "ML" |
---|
703 | Wave qTot_ML = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
704 | Wave qx_ML = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
705 | Wave qy_ML = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
706 | Wave qz_ML = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
707 | |
---|
708 | qTot_ML = 0 |
---|
709 | qx_ML = 0 |
---|
710 | qy_ML = 0 |
---|
711 | qz_ML = 0 |
---|
712 | |
---|
713 | // TODO - these are to be set from globals, not hard-wired. N and pixelSixze will be known (or pre-measured) |
---|
714 | // pixel sizes are in cm |
---|
715 | pixSizeX = VCALC_getPixSizeX("ML") |
---|
716 | pixSizeY = VCALC_getPixSizeY("ML") |
---|
717 | nPix_X = VCALC_get_nPix_X("ML") |
---|
718 | nPix_Y = VCALC_get_nPix_Y("ML") |
---|
719 | |
---|
720 | if(kBCTR_CM) |
---|
721 | xCtr = 0 |
---|
722 | yCtr = 0 //values in cm |
---|
723 | else |
---|
724 | xCtr = nPix_X+(M_L_sep/pixSizeX) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? |
---|
725 | yCtr = nPix_Y/2 |
---|
726 | endif |
---|
727 | |
---|
728 | //put these beam center values into the local folder |
---|
729 | V_putDet_beam_center_x("VCALC","ML",xCtr) |
---|
730 | V_putDet_beam_center_y("VCALC","ML",yCtr) |
---|
731 | |
---|
732 | // VC_Detector_2Q(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) |
---|
733 | VC_Detector_2Q_NonLin(det_ML,qTot_ML,qx_ML,qy_ML,qz_ML,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"ML") |
---|
734 | |
---|
735 | // Print "xy for ML = ",xCtr,yCtr |
---|
736 | |
---|
737 | //set the wave scaling for the detector image so that it can be plotted in q-space |
---|
738 | // TODO: this is only approximate - since the left "edge" is not the same from top to bottom, so I crudely |
---|
739 | // take the middle value. At very small angles, OK, at 1m, this is a crummy approximation. |
---|
740 | // since qTot is magnitude only, I need to put in the (-ve) |
---|
741 | SetScale/I x WaveMin(qx_ML),WaveMax(qx_ML),"", det_ML //this sets the left and right ends of the data scaling |
---|
742 | SetScale/I y WaveMin(qy_ML),WaveMax(qy_ML),"", det_ML |
---|
743 | |
---|
744 | ////////////////// |
---|
745 | |
---|
746 | //Middle/RIGHT |
---|
747 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
748 | detStr = "MR" |
---|
749 | Wave qTot_MR = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
750 | Wave qx_MR = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
751 | Wave qy_MR = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
752 | Wave qz_MR = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
753 | |
---|
754 | qTot_MR = 0 |
---|
755 | qx_MR = 0 |
---|
756 | qy_MR = 0 |
---|
757 | qz_MR = 0 |
---|
758 | |
---|
759 | // TODO - these are to be set from globals, not hard-wired |
---|
760 | // pixel sizes are in cm |
---|
761 | pixSizeX = VCALC_getPixSizeX("MR") |
---|
762 | pixSizeY = VCALC_getPixSizeY("MR") |
---|
763 | |
---|
764 | nPix_X = VCALC_get_nPix_X("MR") |
---|
765 | nPix_Y = VCALC_get_nPix_Y("MR") |
---|
766 | |
---|
767 | if(kBCTR_CM) |
---|
768 | xCtr = 0 |
---|
769 | yCtr = 0 //values in cm |
---|
770 | else |
---|
771 | xCtr = -(M_R_sep/pixSizeX)-1 |
---|
772 | yCtr = nPix_Y/2 |
---|
773 | endif |
---|
774 | |
---|
775 | |
---|
776 | //put these beam center values into the local folder |
---|
777 | V_putDet_beam_center_x("VCALC","MR",xCtr) |
---|
778 | V_putDet_beam_center_y("VCALC","MR",yCtr) |
---|
779 | |
---|
780 | // VC_Detector_2Q(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) |
---|
781 | VC_Detector_2Q_NonLin(det_MR,qTot_MR,qx_MR,qy_MR,qz_MR,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"MR") |
---|
782 | |
---|
783 | // Print "xy for MR = ",xCtr,yCtr |
---|
784 | SetScale/I x WaveMin(qx_MR),WaveMax(qx_MR),"", det_MR //this sets the left and right ends of the data scaling |
---|
785 | SetScale/I y WaveMin(qy_MR),WaveMax(qy_MR),"", det_MR |
---|
786 | ///////////////// |
---|
787 | |
---|
788 | //Middle/TOP |
---|
789 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
790 | detStr = "MT" |
---|
791 | Wave qTot_MT = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
792 | Wave qx_MT = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
793 | Wave qy_MT = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
794 | Wave qz_MT = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
795 | |
---|
796 | qTot_MT = 0 |
---|
797 | qx_MT = 0 |
---|
798 | qy_MT = 0 |
---|
799 | qz_MT = 0 |
---|
800 | |
---|
801 | // TODO - these are to be set from globals, not hard-wired |
---|
802 | // pixel sizes are in cm |
---|
803 | pixSizeX = VCALC_getPixSizeX("MT") |
---|
804 | pixSizeY = VCALC_getPixSizeY("MT") |
---|
805 | nPix_X = VCALC_get_nPix_X("MT") |
---|
806 | nPix_Y = VCALC_get_nPix_Y("MT") |
---|
807 | |
---|
808 | if(kBCTR_CM) |
---|
809 | xCtr = 0 |
---|
810 | yCtr = 0 //values in cm |
---|
811 | else |
---|
812 | xCtr = nPix_X/2 |
---|
813 | yCtr = -(M_T_sep/pixSizeY)-1 |
---|
814 | endif |
---|
815 | |
---|
816 | |
---|
817 | //put these beam center values into the local folder |
---|
818 | V_putDet_beam_center_x("VCALC","MT",xCtr) |
---|
819 | V_putDet_beam_center_y("VCALC","MT",yCtr) |
---|
820 | |
---|
821 | // global sdd_offset is in (mm), convert to meters here for the Q-calculation |
---|
822 | // VC_Detector_2Q(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) |
---|
823 | VC_Detector_2Q_NonLin(det_MT,qTot_MT,qx_MT,qy_MT,qz_MT,xCtr,yCtr,sdd+M_sdd_setback,lam,pixSizeX,pixSizeY,"MT") |
---|
824 | |
---|
825 | // Print "xy for MT = ",xCtr,yCtr |
---|
826 | SetScale/I x WaveMin(qx_MT),WaveMax(qx_MT),"", det_MT //this sets the left and right ends of the data scaling |
---|
827 | SetScale/I y WaveMin(qy_MT),WaveMax(qy_MT),"", det_MT |
---|
828 | ////////////////// |
---|
829 | |
---|
830 | //Middle/BOTTOM |
---|
831 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
832 | detStr = "MB" |
---|
833 | Wave qTot_MB = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
834 | Wave qx_MB = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
835 | Wave qy_MB = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
836 | Wave qz_MB = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
837 | |
---|
838 | qTot_MB = 0 |
---|
839 | qx_MB = 0 |
---|
840 | qy_MB = 0 |
---|
841 | qz_MB = 0 |
---|
842 | |
---|
843 | // TODO - these are to be set from globals, not hard-wired |
---|
844 | // pixel sizes are in cm |
---|
845 | pixSizeX = VCALC_getPixSizeX("MB") |
---|
846 | pixSizeY = VCALC_getPixSizeY("MB") |
---|
847 | nPix_X = VCALC_get_nPix_X("MB") |
---|
848 | nPix_Y = VCALC_get_nPix_Y("MB") |
---|
849 | |
---|
850 | if(kBCTR_CM) |
---|
851 | xCtr = 0 |
---|
852 | yCtr = 0 //values in cm |
---|
853 | else |
---|
854 | xCtr = nPix_X/2 |
---|
855 | yCtr = nPix_Y+(M_B_sep/pixSizeY) // TODO -- check -- starting from 47 rather than 48 (but I'm in pixel units for centers)?? |
---|
856 | endif |
---|
857 | |
---|
858 | //put these beam center values into the local folder |
---|
859 | V_putDet_beam_center_x("VCALC","MB",xCtr) |
---|
860 | V_putDet_beam_center_y("VCALC","MB",yCtr) |
---|
861 | |
---|
862 | // global sdd_offset is in (mm), convert to meters here for the Q-calculation |
---|
863 | // VC_Detector_2Q(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_offset/1000,lam,pixSizeX,pixSizeY) |
---|
864 | VC_Detector_2Q_NonLin(det_MB,qTot_MB,qx_MB,qy_MB,qz_MB,xCtr,yCtr,sdd+M_sdd_setback,lam,pixSizeX,pixSizeY,"MB") |
---|
865 | |
---|
866 | // Print "xy for MB = ",xCtr,yCtr |
---|
867 | SetScale/I x WaveMin(qx_MB),WaveMax(qx_MB),"", det_MB //this sets the left and right ends of the data scaling |
---|
868 | SetScale/I y WaveMin(qy_MB),WaveMax(qy_MB),"", det_MB |
---|
869 | ///////////////// |
---|
870 | |
---|
871 | SetDataFolder root: |
---|
872 | |
---|
873 | return(0) |
---|
874 | End |
---|
875 | |
---|
876 | |
---|
877 | Function MiddlePanels_AsQ() |
---|
878 | // DoWindow/F MiddlePanels_AsQ |
---|
879 | // if(V_flag == 0) |
---|
880 | // PauseUpdate; Silent 1 // building window... |
---|
881 | // Display /W=(1477,44,1978,517) |
---|
882 | |
---|
883 | String midStr = "root:Packages:NIST:VSANS:VCALC:entry:instrument:" |
---|
884 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Middle |
---|
885 | SetDataFolder $(midStr+"detector_MB") |
---|
886 | Wave det_MB = det_MB |
---|
887 | SetDataFolder $(midStr+"detector_MT") |
---|
888 | Wave det_MT = det_MT |
---|
889 | SetDataFolder $(midStr+"detector_ML") |
---|
890 | Wave det_ML = det_ML |
---|
891 | SetDataFolder $(midStr+"detector_MR") |
---|
892 | Wave det_MR = det_MR |
---|
893 | |
---|
894 | CheckDisplayed /W=VCALC#Panels_Q det_MB |
---|
895 | |
---|
896 | if(V_flag == 0) |
---|
897 | AppendImage/W=VCALC#Panels_Q det_MB |
---|
898 | ModifyImage/W=VCALC#Panels_Q det_MB ctab= {*,*,ColdWarm,0} |
---|
899 | AppendImage/W=VCALC#Panels_Q det_MT |
---|
900 | ModifyImage/W=VCALC#Panels_Q det_MT ctab= {*,*,ColdWarm,0} |
---|
901 | AppendImage/W=VCALC#Panels_Q det_ML |
---|
902 | ModifyImage/W=VCALC#Panels_Q det_ML ctab= {*,*,ColdWarm,0} |
---|
903 | AppendImage/W=VCALC#Panels_Q det_MR |
---|
904 | ModifyImage/W=VCALC#Panels_Q det_MR ctab= {*,*,ColdWarm,0} |
---|
905 | endif |
---|
906 | |
---|
907 | Variable dval |
---|
908 | ControlInfo/W=VCALC setVar_b |
---|
909 | dval = V_Value |
---|
910 | |
---|
911 | SetAxis/W=VCALC#Panels_Q left -dval,dval |
---|
912 | SetAxis/W=VCALC#Panels_Q bottom -dval,dval |
---|
913 | |
---|
914 | ControlInfo/W=VCALC check_0a |
---|
915 | // V_Value == 1 if checked |
---|
916 | ModifyImage/W=VCALC#Panels_Q det_MB log=V_Value |
---|
917 | ModifyImage/W=VCALC#Panels_Q det_MT log=V_Value |
---|
918 | ModifyImage/W=VCALC#Panels_Q det_ML log=V_Value |
---|
919 | ModifyImage/W=VCALC#Panels_Q det_MR log=V_Value |
---|
920 | |
---|
921 | |
---|
922 | SetDataFolder root: |
---|
923 | |
---|
924 | // ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797) |
---|
925 | // ModifyGraph grid=2 |
---|
926 | // ModifyGraph mirror=2 |
---|
927 | // SetAxis left -0.2,0.2 |
---|
928 | // SetAxis bottom -0.2,0.2 |
---|
929 | // endif |
---|
930 | EndMacro |
---|
931 | |
---|
932 | // |
---|
933 | // these routines bin the 2D q data to 1D I(q). Currently the Qtot is magnitude only, no sign (since |
---|
934 | // it's being binned to I(Q), having a sign makes no sense. If you want the sign, work from qxqyqz |
---|
935 | // |
---|
936 | // first - the DeltaQ step is set as the smaller detector resolution (along tube) |
---|
937 | // which is different for LR / TB geometry. This is not set in stone. |
---|
938 | // |
---|
939 | // second - each detector is binned separately |
---|
940 | // |
---|
941 | // -- like the routines in CircSectAve, start with 500 points, and trim after binning is done. |
---|
942 | // you'l end up with < 200 points. |
---|
943 | // |
---|
944 | // the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed |
---|
945 | // |
---|
946 | Function BinAllMiddlePanels() |
---|
947 | |
---|
948 | SetDeltaQ("VCALC","ML") |
---|
949 | SetDeltaQ("VCALC","MR") |
---|
950 | SetDeltaQ("VCALC","MT") |
---|
951 | SetDeltaQ("VCALC","MB") |
---|
952 | |
---|
953 | Variable binType |
---|
954 | ControlInfo/W=VCALC popup_b |
---|
955 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
956 | |
---|
957 | String folderStr = "VCALC" |
---|
958 | |
---|
959 | switch(binType) |
---|
960 | case 1: |
---|
961 | // VC_fDoBinning_QxQy2D(folderStr,"FL") |
---|
962 | // VC_fDoBinning_QxQy2D(folderStr,"FR") |
---|
963 | // VC_fDoBinning_QxQy2D(folderStr,"FT") |
---|
964 | // VC_fDoBinning_QxQy2D(folderStr,"FB") |
---|
965 | VC_fDoBinning_QxQy2D(folderStr,"ML") |
---|
966 | VC_fDoBinning_QxQy2D(folderStr,"MR") |
---|
967 | VC_fDoBinning_QxQy2D(folderStr,"MT") |
---|
968 | VC_fDoBinning_QxQy2D(folderStr,"MB") |
---|
969 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
970 | |
---|
971 | break |
---|
972 | case 2: |
---|
973 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
974 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
975 | VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
976 | VC_fDoBinning_QxQy2D(folderStr,"MTB") |
---|
977 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
978 | |
---|
979 | break |
---|
980 | case 3: |
---|
981 | VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
982 | // VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
983 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
984 | |
---|
985 | break |
---|
986 | case 4: /// this is for a tall, narrow slit mode |
---|
987 | // VC_fBinDetector_byRows(folderStr,"FL") |
---|
988 | // VC_fBinDetector_byRows(folderStr,"FR") |
---|
989 | VC_fBinDetector_byRows(folderStr,"ML") |
---|
990 | VC_fBinDetector_byRows(folderStr,"MR") |
---|
991 | // VC_fBinDetector_byRows(folderStr,"B") |
---|
992 | |
---|
993 | break |
---|
994 | case 5: |
---|
995 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
996 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
997 | VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
998 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
999 | |
---|
1000 | break |
---|
1001 | case 6: |
---|
1002 | // VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
1003 | VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
1004 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1005 | |
---|
1006 | break |
---|
1007 | case 7: |
---|
1008 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
1009 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
1010 | VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
1011 | // VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1012 | |
---|
1013 | break |
---|
1014 | |
---|
1015 | default: |
---|
1016 | Abort "Binning mode not found in BinAllFrontPanels "// when no case matches |
---|
1017 | endswitch |
---|
1018 | |
---|
1019 | |
---|
1020 | |
---|
1021 | // if(binType == 1) |
---|
1022 | // VC_BinQxQy_to_1D("VCALC","ML") |
---|
1023 | // VC_BinQxQy_to_1D("VCALC","MR") |
---|
1024 | // VC_BinQxQy_to_1D("VCALC","MT") |
---|
1025 | // VC_BinQxQy_to_1D("VCALC","MB") |
---|
1026 | // endif |
---|
1027 | // |
---|
1028 | // if(binType == 2) |
---|
1029 | // VC_BinQxQy_to_1D("VCALC","MLR") |
---|
1030 | // VC_BinQxQy_to_1D("VCALC","MTB") |
---|
1031 | // endif |
---|
1032 | // |
---|
1033 | // if(binType == 3) |
---|
1034 | // VC_BinQxQy_to_1D("VCALC","MLRTB") |
---|
1035 | // endif |
---|
1036 | // |
---|
1037 | // // TODO -- this is only a temporary fix for slit mode |
---|
1038 | // if(binType == 4) |
---|
1039 | // /// this is for a tall, narrow slit mode |
---|
1040 | // VC_fBinDetector_byRows("VCALC","ML") |
---|
1041 | // VC_fBinDetector_byRows("VCALC","MR") |
---|
1042 | // VC_fBinDetector_byRows("VCALC","MT") |
---|
1043 | // VC_fBinDetector_byRows("VCALC","MB") |
---|
1044 | // endif |
---|
1045 | End |
---|
1046 | |
---|
1047 | ////////////to plot the (4) 2D panels and to plot the I(Q) data on the same plot |
---|
1048 | Window Middle_IQ_Graph() : Graph |
---|
1049 | |
---|
1050 | Variable binType |
---|
1051 | |
---|
1052 | ControlInfo/W=VCALC popup_b |
---|
1053 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
1054 | |
---|
1055 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1056 | |
---|
1057 | if(binType==1) |
---|
1058 | ClearIQIfDisplayed("VCALC","MLRTB","") |
---|
1059 | ClearIQIfDisplayed("VCALC","MLR","") |
---|
1060 | ClearIQIfDisplayed("VCALC","MTB","") |
---|
1061 | |
---|
1062 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1063 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_ML |
---|
1064 | |
---|
1065 | if(V_flag==0) |
---|
1066 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_ML vs qBin_qxqy_ML |
---|
1067 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MR vs qBin_qxqy_MR |
---|
1068 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MT vs qBin_qxqy_MT |
---|
1069 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MB vs qBin_qxqy_MB |
---|
1070 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1071 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1072 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535) |
---|
1073 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1074 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8} |
---|
1075 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1076 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1077 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1078 | endif |
---|
1079 | endif |
---|
1080 | |
---|
1081 | if(binType==2) |
---|
1082 | ClearIQIfDisplayed("VCALC","MLRTB","") |
---|
1083 | ClearIQIfDisplayed("VCALC","MT","") |
---|
1084 | ClearIQIfDisplayed("VCALC","ML","") |
---|
1085 | ClearIQIfDisplayed("VCALC","MR","") |
---|
1086 | ClearIQIfDisplayed("VCALC","MB","") |
---|
1087 | |
---|
1088 | |
---|
1089 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1090 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_MLR |
---|
1091 | |
---|
1092 | if(V_flag==0) |
---|
1093 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_MLR vs qBin_qxqy_MLR |
---|
1094 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MTB vs qBin_qxqy_MTB |
---|
1095 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1096 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1097 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_MLR)=(65535,0,0),rgb(iBin_qxqy_MTB)=(1,16019,65535) |
---|
1098 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1099 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_MLR)={0,2} |
---|
1100 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1101 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1102 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1103 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1104 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1105 | endif |
---|
1106 | |
---|
1107 | endif |
---|
1108 | |
---|
1109 | if(binType==3) |
---|
1110 | ClearIQIfDisplayed("VCALC","MLR","") |
---|
1111 | ClearIQIfDisplayed("VCALC","MTB","") |
---|
1112 | ClearIQIfDisplayed("VCALC","MT","") |
---|
1113 | ClearIQIfDisplayed("VCALC","ML","") |
---|
1114 | ClearIQIfDisplayed("VCALC","MR","") |
---|
1115 | ClearIQIfDisplayed("VCALC","MB","") |
---|
1116 | |
---|
1117 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1118 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_MLRTB |
---|
1119 | |
---|
1120 | if(V_flag==0) |
---|
1121 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB |
---|
1122 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1123 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1124 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_MLRTB)=(65535,0,0) |
---|
1125 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1126 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1127 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1128 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1129 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1130 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1131 | endif |
---|
1132 | |
---|
1133 | endif |
---|
1134 | |
---|
1135 | if(binType==4) // slit aperture binning - MT, ML, MR, MB are averaged |
---|
1136 | ClearIQIfDisplayed("VCALC","MLRTB","") |
---|
1137 | ClearIQIfDisplayed("VCALC","MLR","") |
---|
1138 | ClearIQIfDisplayed("VCALC","MTB","") |
---|
1139 | |
---|
1140 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1141 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_ML |
---|
1142 | |
---|
1143 | if(V_flag==0) |
---|
1144 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_ML vs qBin_qxqy_ML |
---|
1145 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MR vs qBin_qxqy_MR |
---|
1146 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MT vs qBin_qxqy_MT |
---|
1147 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_MB vs qBin_qxqy_MB |
---|
1148 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1149 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1150 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535) |
---|
1151 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1152 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8} |
---|
1153 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1154 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1155 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1156 | endif |
---|
1157 | |
---|
1158 | endif |
---|
1159 | SetDataFolder root: |
---|
1160 | EndMacro |
---|
1161 | |
---|
1162 | |
---|
1163 | ////////// and for the BACK detector |
---|
1164 | Proc PlotBackPanels() |
---|
1165 | fPlotBackPanels() |
---|
1166 | End |
---|
1167 | |
---|
1168 | // to plot I(q) for the Back panel |
---|
1169 | // |
---|
1170 | // *** Call this function when Back panel is adjusted, or wavelength, etc. changed |
---|
1171 | // |
---|
1172 | Function fPlotBackPanels() |
---|
1173 | |
---|
1174 | // space is allocated for all of the detectors and Q's on initialization |
---|
1175 | // calculate Qtot, qxqyqz arrays from geometry |
---|
1176 | VC_CalculateQBackPanels() |
---|
1177 | |
---|
1178 | // fill the panels with fake sphere scattering data |
---|
1179 | // TODO: am I in the right data folder?? |
---|
1180 | SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B |
---|
1181 | |
---|
1182 | WAVE det_B = det_B |
---|
1183 | WAVE qTot_B = qTot_B |
---|
1184 | |
---|
1185 | FillPanel_wModelData(det_B,qTot_B,"B") |
---|
1186 | |
---|
1187 | SetDataFolder root: |
---|
1188 | |
---|
1189 | // set any "shadowed" area of the T/B detectors to NaN to get a realitic |
---|
1190 | // view of how much of the detectors are actually collecting data |
---|
1191 | // -- I can get the separation L/R from the panel - only this "open" width is visible. |
---|
1192 | // VC_SetShadow_TopBottom("","MT") // TODO: -- be sure the data folder is properly set (within the function...) |
---|
1193 | // VC_SetShadow_TopBottom("","MB") |
---|
1194 | |
---|
1195 | // do the q-binning for each of the panels to get I(Q) |
---|
1196 | BinAllBackPanels() |
---|
1197 | |
---|
1198 | // plot the results |
---|
1199 | String type = "VCALC" |
---|
1200 | String str,winStr="VCALC#Panels_IQ",workTypeStr,popStr |
---|
1201 | workTypeStr = "root:Packages:NIST:VSANS:"+type |
---|
1202 | |
---|
1203 | ControlInfo/W=VCALC popup_b |
---|
1204 | popStr = S_Value // |
---|
1205 | |
---|
1206 | sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr |
---|
1207 | |
---|
1208 | Execute ("V_Back_IQ_Graph"+str) |
---|
1209 | |
---|
1210 | |
---|
1211 | // plot the results |
---|
1212 | // Execute "Back_IQ_Graph()" |
---|
1213 | |
---|
1214 | |
---|
1215 | |
---|
1216 | Execute "BackPanels_AsQ()" |
---|
1217 | |
---|
1218 | return(0) |
---|
1219 | |
---|
1220 | End |
---|
1221 | |
---|
1222 | // works for Left, works for Right... works for T/B too. |
---|
1223 | // |
---|
1224 | // - TODO: be sure that the Q's are calculated correctly even when the beam is off of the |
---|
1225 | // detector, and on different sides of the detector (or T/B) - since it will be in a different |
---|
1226 | // relative postion to 0,0 on the detector. If the postions are symmetric, then the Q's should be identical. |
---|
1227 | // --- test this... |
---|
1228 | // TODO -- be sure I'm in the right data folder. nothing is set correctly right now |
---|
1229 | // |
---|
1230 | // TODO: make all detector parameters global, not hard-wired |
---|
1231 | // |
---|
1232 | // |
---|
1233 | // --- Panels are all allocated in the initialization. Here, only the q-values are calculated |
---|
1234 | // when anything changes |
---|
1235 | // |
---|
1236 | Function VC_CalculateQBackPanels() |
---|
1237 | |
---|
1238 | Variable xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY |
---|
1239 | Variable B_offset |
---|
1240 | |
---|
1241 | String folderPath = "root:Packages:NIST:VSANS:VCALC" |
---|
1242 | String instPath = ":entry:instrument:detector_" |
---|
1243 | String detStr = "" |
---|
1244 | |
---|
1245 | ControlInfo/W=VCALC VCALCCtrl_4a |
---|
1246 | B_offset = V_Value |
---|
1247 | |
---|
1248 | SDD = VCALC_getSDD("B") //nominal SDD - need offset for TB |
---|
1249 | lam = VCALC_getWavelength() |
---|
1250 | |
---|
1251 | // TODO (make the N along the tube length a variable, since this can be reset @ acquisition) |
---|
1252 | // SetDataFolder root:Packages:NIST:VSANS:VCALC:Back |
---|
1253 | WAVE det_B = $(folderPath+instPath+"B"+":det_B") // this is nominally (680,1656) |
---|
1254 | |
---|
1255 | //Back detector |
---|
1256 | //root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B:qTot_B |
---|
1257 | detStr = "B" |
---|
1258 | Wave qTot_B = $(folderPath+instPath+detStr+":qTot_"+detStr) // 2D q-values |
---|
1259 | Wave qx_B = $(folderPath+instPath+detStr+":qx_"+detStr) |
---|
1260 | Wave qy_B = $(folderPath+instPath+detStr+":qy_"+detStr) |
---|
1261 | Wave qz_B = $(folderPath+instPath+detStr+":qz_"+detStr) |
---|
1262 | |
---|
1263 | qTot_B = 0 |
---|
1264 | qx_B = 0 |
---|
1265 | qy_B = 0 |
---|
1266 | qz_B = 0 |
---|
1267 | |
---|
1268 | // TODO - these are to be set from globals, not hard-wired. N and pixelSize will be known (or pre-measured) |
---|
1269 | // pixel sizes are in cm |
---|
1270 | pixSizeX = VCALC_getPixSizeX("B") |
---|
1271 | pixSizeY = VCALC_getPixSizeY("B") |
---|
1272 | |
---|
1273 | if(kBCTR_CM) |
---|
1274 | xCtr = trunc( DimSize(det_B,0)/2 ) *pixSizeX * 10 |
---|
1275 | yCtr = trunc( DimSize(det_B,1)/2 ) *pixSizeY * 10 //values in mm -- beam is nominally at 0,0 in space |
---|
1276 | else |
---|
1277 | xCtr = trunc( DimSize(det_B,0)/2 ) // |
---|
1278 | yCtr = trunc( DimSize(det_B,1)/2 ) // |
---|
1279 | endif |
---|
1280 | |
---|
1281 | //put these beam center values into the local folder |
---|
1282 | V_putDet_beam_center_x("VCALC","B",xCtr) |
---|
1283 | V_putDet_beam_center_y("VCALC","B",yCtr) |
---|
1284 | |
---|
1285 | // VC_Detector_2Q(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY) |
---|
1286 | // this will always do the linear calculation, since the real-space distance waves do not exist |
---|
1287 | VC_Detector_2Q_NonLin(det_B,qTot_B,qx_B,qy_B,qz_B,xCtr,yCtr,sdd,lam,pixSizeX,pixSizeY,"B") |
---|
1288 | |
---|
1289 | |
---|
1290 | //set the wave scaling for the detector image so that it can be plotted in q-space |
---|
1291 | // TODO: this is only approximate - since the left "edge" is not the same from top to bottom, so I crudely |
---|
1292 | // take the middle value. At very small angles, OK, at 1m, this is a crummy approximation. |
---|
1293 | // since qTot is magnitude only, I need to put in the (-ve) |
---|
1294 | SetScale/I x WaveMin(qx_B),WaveMax(qx_B),"", det_B //this sets the left and right ends of the data scaling |
---|
1295 | SetScale/I y WaveMin(qy_B),WaveMax(qy_B),"", det_B |
---|
1296 | |
---|
1297 | SetDataFolder root: |
---|
1298 | |
---|
1299 | return(0) |
---|
1300 | End |
---|
1301 | |
---|
1302 | |
---|
1303 | Window BackPanels_AsQ() : Graph |
---|
1304 | // DoWindow/F BackPanels_AsQ |
---|
1305 | // if(V_flag == 0) |
---|
1306 | // PauseUpdate; Silent 1 // building window... |
---|
1307 | // Display /W=(1477,44,1978,517) |
---|
1308 | |
---|
1309 | SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B |
---|
1310 | |
---|
1311 | CheckDisplayed /W=VCALC#Panels_Q det_B |
---|
1312 | if(V_flag == 0) |
---|
1313 | AppendImage/W=VCALC#Panels_Q det_B |
---|
1314 | ModifyImage/W=VCALC#Panels_Q det_B ctab= {*,*,ColdWarm,0} |
---|
1315 | endif |
---|
1316 | |
---|
1317 | Variable dval |
---|
1318 | ControlInfo/W=VCALC setVar_b |
---|
1319 | dval = V_Value |
---|
1320 | |
---|
1321 | SetAxis/W=VCALC#Panels_Q left -dval,dval |
---|
1322 | SetAxis/W=VCALC#Panels_Q bottom -dval,dval |
---|
1323 | |
---|
1324 | ControlInfo/W=VCALC check_0a |
---|
1325 | // V_Value == 1 if checked |
---|
1326 | ModifyImage/W=VCALC#Panels_Q det_B log=V_Value |
---|
1327 | |
---|
1328 | SetDataFolder root: |
---|
1329 | |
---|
1330 | // ModifyGraph width={Aspect,1},height={Aspect,1},gbRGB=(56797,56797,56797) |
---|
1331 | // ModifyGraph grid=2 |
---|
1332 | // ModifyGraph mirror=2 |
---|
1333 | // SetAxis left -0.2,0.2 |
---|
1334 | // SetAxis bottom -0.2,0.2 |
---|
1335 | // endif |
---|
1336 | EndMacro |
---|
1337 | |
---|
1338 | // |
---|
1339 | // these routines bin the 2D q data to 1D I(q). Currently the Qtot is magnitude only, no sign (since |
---|
1340 | // it's being binned to I(Q), having a sign makes no sense. If you want the sign, work from qxqyqz |
---|
1341 | // |
---|
1342 | // first - the DeltaQ step is set as the smaller detector resolution (along tube) |
---|
1343 | // which is different for LR / TB geometry. This is not set in stone. |
---|
1344 | // |
---|
1345 | // second - each detector is binned separately |
---|
1346 | // |
---|
1347 | // -- like the routines in CircSectAve, start with 500 points, and trim after binning is done. |
---|
1348 | // you'l end up with < 200 points. |
---|
1349 | // |
---|
1350 | // the results are in iBin_qxqy, qBin_qxqy, and eBin_qxqy, in the folder passed |
---|
1351 | // |
---|
1352 | Function BinAllBackPanels() |
---|
1353 | |
---|
1354 | SetDeltaQ("VCALC","B") |
---|
1355 | |
---|
1356 | Variable binType |
---|
1357 | ControlInfo/W=VCALC popup_b |
---|
1358 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
1359 | |
---|
1360 | String folderStr = "VCALC" |
---|
1361 | |
---|
1362 | switch(binType) |
---|
1363 | case 1: |
---|
1364 | // VC_fDoBinning_QxQy2D(folderStr,"FL") |
---|
1365 | // VC_fDoBinning_QxQy2D(folderStr,"FR") |
---|
1366 | // VC_fDoBinning_QxQy2D(folderStr,"FT") |
---|
1367 | // VC_fDoBinning_QxQy2D(folderStr,"FB") |
---|
1368 | // VC_fDoBinning_QxQy2D(folderStr,"ML") |
---|
1369 | // VC_fDoBinning_QxQy2D(folderStr,"MR") |
---|
1370 | // VC_fDoBinning_QxQy2D(folderStr,"MT") |
---|
1371 | // VC_fDoBinning_QxQy2D(folderStr,"MB") |
---|
1372 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1373 | |
---|
1374 | break |
---|
1375 | case 2: |
---|
1376 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
1377 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
1378 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
1379 | // VC_fDoBinning_QxQy2D(folderStr,"MTB") |
---|
1380 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1381 | |
---|
1382 | break |
---|
1383 | case 3: |
---|
1384 | // VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
1385 | // VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
1386 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1387 | |
---|
1388 | break |
---|
1389 | case 4: /// this is for a tall, narrow slit mode |
---|
1390 | // VC_fBinDetector_byRows(folderStr,"FL") |
---|
1391 | // VC_fBinDetector_byRows(folderStr,"FR") |
---|
1392 | // VC_fBinDetector_byRows(folderStr,"ML") |
---|
1393 | // VC_fBinDetector_byRows(folderStr,"MR") |
---|
1394 | VC_fBinDetector_byRows(folderStr,"B") |
---|
1395 | |
---|
1396 | break |
---|
1397 | case 5: |
---|
1398 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
1399 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
1400 | // VC_fDoBinning_QxQy2D(folderStr,"MLRTB") |
---|
1401 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1402 | |
---|
1403 | break |
---|
1404 | case 6: |
---|
1405 | // VC_fDoBinning_QxQy2D(folderStr,"FLRTB") |
---|
1406 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
1407 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1408 | |
---|
1409 | break |
---|
1410 | case 7: |
---|
1411 | // VC_fDoBinning_QxQy2D(folderStr,"FTB") |
---|
1412 | // VC_fDoBinning_QxQy2D(folderStr,"FLR") |
---|
1413 | // VC_fDoBinning_QxQy2D(folderStr,"MLR") |
---|
1414 | VC_fDoBinning_QxQy2D(folderStr, "B") |
---|
1415 | |
---|
1416 | break |
---|
1417 | |
---|
1418 | default: |
---|
1419 | Abort "Binning mode not found in BinAllFrontPanels "// when no case matches |
---|
1420 | endswitch |
---|
1421 | |
---|
1422 | // VC_BinQxQy_to_1D("VCALC","B") |
---|
1423 | // |
---|
1424 | //// TODO -- this is only a temporary fix for slit mode |
---|
1425 | // if(binType == 4) |
---|
1426 | // /// this is for a tall, narrow slit mode |
---|
1427 | // VC_fBinDetector_byRows("VCALC","B") |
---|
1428 | // endif |
---|
1429 | |
---|
1430 | End |
---|
1431 | |
---|
1432 | ////////////to plot the back panel I(q) |
---|
1433 | Window Back_IQ_Graph() : Graph |
---|
1434 | |
---|
1435 | SetDataFolder root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_B |
---|
1436 | |
---|
1437 | Variable binType |
---|
1438 | |
---|
1439 | ControlInfo/W=VCALC popup_b |
---|
1440 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
1441 | |
---|
1442 | |
---|
1443 | if(binType==1 || binType==2 || binType==3) |
---|
1444 | |
---|
1445 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1446 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_B |
---|
1447 | |
---|
1448 | if(V_flag==0) |
---|
1449 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_B vs qBin_qxqy_B |
---|
1450 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1451 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1452 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_B)=(1,52428,52428) |
---|
1453 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1454 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1455 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1456 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1457 | endif |
---|
1458 | endif |
---|
1459 | |
---|
1460 | //nothing different here since there is ony a single detector to display, but for the future... |
---|
1461 | if(binType==4) |
---|
1462 | |
---|
1463 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1464 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_B |
---|
1465 | |
---|
1466 | if(V_flag==0) |
---|
1467 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_B vs qBin_qxqy_B |
---|
1468 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1469 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1470 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_B)=(1,52428,52428) |
---|
1471 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1472 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1473 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1474 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1475 | endif |
---|
1476 | endif |
---|
1477 | |
---|
1478 | |
---|
1479 | SetDataFolder root: |
---|
1480 | EndMacro |
---|
1481 | |
---|
1482 | |
---|
1483 | ////////////to plot the (4) 2D panels and to plot the I(Q) data on the same plot |
---|
1484 | // |
---|
1485 | // ** but now I need to check and see if these waves exist before trying to append them |
---|
1486 | // since the panels may bave been combined when binned - rather than all separate. |
---|
1487 | // |
---|
1488 | // TODO |
---|
1489 | // -- so maybe I want to clear the traces from the graph? |
---|
1490 | // -- set a flag on the panel to know how the binning is applied? |
---|
1491 | // |
---|
1492 | Window Front_IQ_Graph() : Graph |
---|
1493 | |
---|
1494 | Variable binType |
---|
1495 | String fldr = "VCALC" |
---|
1496 | |
---|
1497 | ControlInfo/W=VCALC popup_b |
---|
1498 | binType = V_Value // V_value counts menu items from 1, so 1=1, 2=2, 3=4 |
---|
1499 | |
---|
1500 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1501 | |
---|
1502 | if(binType==1) |
---|
1503 | ClearIQIfDisplayed("VCALC","FLRTB","") |
---|
1504 | ClearIQIfDisplayed("VCALC","FLR","") |
---|
1505 | ClearIQIfDisplayed("VCALC","FTB","") |
---|
1506 | |
---|
1507 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1508 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_FL |
---|
1509 | |
---|
1510 | if(V_flag==0) |
---|
1511 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_FL vs qBin_qxqy_FL |
---|
1512 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FR vs qBin_qxqy_FR |
---|
1513 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FT vs qBin_qxqy_FT |
---|
1514 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FB vs qBin_qxqy_FB |
---|
1515 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1516 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1517 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1) |
---|
1518 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1519 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8} |
---|
1520 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1521 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1522 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1523 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1524 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1525 | endif |
---|
1526 | |
---|
1527 | endif |
---|
1528 | |
---|
1529 | if(binType==2) |
---|
1530 | ClearIQIfDisplayed("VCALC","FLRTB","") |
---|
1531 | ClearIQIfDisplayed("VCALC","FT","") |
---|
1532 | ClearIQIfDisplayed("VCALC","FL","") |
---|
1533 | ClearIQIfDisplayed("VCALC","FR","") |
---|
1534 | ClearIQIfDisplayed("VCALC","FB","") |
---|
1535 | |
---|
1536 | |
---|
1537 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1538 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_FLR |
---|
1539 | |
---|
1540 | if(V_flag==0) |
---|
1541 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_FLR vs qBin_qxqy_FLR |
---|
1542 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FTB vs qBin_qxqy_FTB |
---|
1543 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1544 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1545 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1) |
---|
1546 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1547 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_FLR)={0,2} |
---|
1548 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1549 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1550 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1551 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1552 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1553 | endif |
---|
1554 | |
---|
1555 | endif |
---|
1556 | |
---|
1557 | if(binType==3) |
---|
1558 | ClearIQIfDisplayed("VCALC","FLR","") |
---|
1559 | ClearIQIfDisplayed("VCALC","FTB","") |
---|
1560 | ClearIQIfDisplayed("VCALC","FT","") |
---|
1561 | ClearIQIfDisplayed("VCALC","FL","") |
---|
1562 | ClearIQIfDisplayed("VCALC","FR","") |
---|
1563 | ClearIQIfDisplayed("VCALC","FB","") |
---|
1564 | |
---|
1565 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1566 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_FLRTB |
---|
1567 | |
---|
1568 | if(V_flag==0) |
---|
1569 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB |
---|
1570 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1571 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1572 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_FLRTB)=(39321,26208,1) |
---|
1573 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1574 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1575 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1576 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1577 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1578 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1579 | endif |
---|
1580 | |
---|
1581 | endif |
---|
1582 | |
---|
1583 | |
---|
1584 | if(binType==4) //slit mode |
---|
1585 | ClearIQIfDisplayed("VCALC","FLRTB","") |
---|
1586 | ClearIQIfDisplayed("VCALC","FLR","") |
---|
1587 | ClearIQIfDisplayed("VCALC","FTB","") |
---|
1588 | |
---|
1589 | SetDataFolder root:Packages:NIST:VSANS:VCALC |
---|
1590 | CheckDisplayed/W=VCALC#Panels_IQ iBin_qxqy_FL |
---|
1591 | |
---|
1592 | if(V_flag==0) |
---|
1593 | AppendtoGraph/W=VCALC#Panels_IQ iBin_qxqy_FL vs qBin_qxqy_FL |
---|
1594 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FR vs qBin_qxqy_FR |
---|
1595 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FT vs qBin_qxqy_FT |
---|
1596 | AppendToGraph/W=VCALC#Panels_IQ iBin_qxqy_FB vs qBin_qxqy_FB |
---|
1597 | ModifyGraph/W=VCALC#Panels_IQ mode=4 |
---|
1598 | ModifyGraph/W=VCALC#Panels_IQ marker=19 |
---|
1599 | ModifyGraph/W=VCALC#Panels_IQ rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1) |
---|
1600 | ModifyGraph/W=VCALC#Panels_IQ msize=2 |
---|
1601 | ModifyGraph/W=VCALC#Panels_IQ muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8} |
---|
1602 | ModifyGraph/W=VCALC#Panels_IQ grid=1 |
---|
1603 | ModifyGraph/W=VCALC#Panels_IQ log=1 |
---|
1604 | ModifyGraph/W=VCALC#Panels_IQ mirror=2 |
---|
1605 | Label/W=VCALC#Panels_IQ left "Intensity (1/cm)" |
---|
1606 | Label/W=VCALC#Panels_IQ bottom "Q (1/A)" |
---|
1607 | endif |
---|
1608 | |
---|
1609 | endif |
---|
1610 | |
---|
1611 | |
---|
1612 | SetDataFolder root: |
---|
1613 | |
---|
1614 | EndMacro |
---|
1615 | |
---|
1616 | |
---|
1617 | // for a given detector binning type ("B", "FLTB", "MTB" etc) |
---|
1618 | // all of the work folders will be checked to see if the data is on the graph |
---|
1619 | // and if it is, it will be removed |
---|
1620 | // |
---|
1621 | // VCALC panel can pass in "" for the winNameStr |
---|
1622 | // |
---|
1623 | Function ClearIQIfDisplayed_AllFldr(type,winNameStr) |
---|
1624 | String type,winNameStr |
---|
1625 | |
---|
1626 | // String folderList = ksWorkFolderListShort |
---|
1627 | String fldr |
---|
1628 | Variable ii |
---|
1629 | |
---|
1630 | String folderList = ksWorkFolderListShort |
---|
1631 | |
---|
1632 | // add in the check on the VCALC folder only if called from that window |
---|
1633 | if(cmpstr(winNameStr[0,4],"VCALC") == 0) |
---|
1634 | folderList = "VCALC;" |
---|
1635 | endif |
---|
1636 | |
---|
1637 | for(ii=0;ii<ItemsInList(folderList);ii+=1) |
---|
1638 | fldr = StringFromList(ii, folderList, ";") |
---|
1639 | ClearIQIfDisplayed(fldr,type,winNameStr) |
---|
1640 | endfor |
---|
1641 | // just in case |
---|
1642 | SetDataFolder root: |
---|
1643 | |
---|
1644 | return(0) |
---|
1645 | end |
---|
1646 | |
---|
1647 | |
---|
1648 | |
---|
1649 | // for a given data folder, all detector binning types |
---|
1650 | // ("B", "FLTB", "MTB" etc) will be checked to see if the data is on the graph |
---|
1651 | // and if it is, it will be removed |
---|
1652 | // |
---|
1653 | // VCALC panel can pass in "" for the winNameStr |
---|
1654 | // |
---|
1655 | Function ClearIQIfDisplayed_AllBin(fldr,winNameStr) |
---|
1656 | String fldr,winNameStr |
---|
1657 | |
---|
1658 | // String folderList = ksWorkFolderListShort |
---|
1659 | String type |
---|
1660 | Variable ii |
---|
1661 | |
---|
1662 | for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1) |
---|
1663 | type = StringFromList(ii, ksPanelBinTypeList, ";") |
---|
1664 | ClearIQIfDisplayed(fldr,type,winNameStr) |
---|
1665 | endfor |
---|
1666 | // just in case |
---|
1667 | SetDataFolder root: |
---|
1668 | |
---|
1669 | return(0) |
---|
1670 | end |
---|
1671 | |
---|
1672 | |
---|
1673 | |
---|
1674 | Function ClearIQIfDisplayed(fldr,type,winNameStr) |
---|
1675 | String fldr,type,winNameStr |
---|
1676 | |
---|
1677 | SetDataFolder $("root:Packages:NIST:VSANS:"+fldr) |
---|
1678 | |
---|
1679 | if(cmpstr(fldr,"VCALC") == 0) |
---|
1680 | CheckDisplayed/W=VCALC#Panels_IQ $("iBin_qxqy_"+type) |
---|
1681 | if(V_flag==1) |
---|
1682 | RemoveFromGraph/W=VCALC#Panels_IQ $("iBin_qxqy_"+type) |
---|
1683 | endif |
---|
1684 | else |
---|
1685 | CheckDisplayed/W=$winNameStr $("iBin_qxqy_"+type) |
---|
1686 | if(V_flag==1) |
---|
1687 | RemoveFromGraph/W=$winNameStr $("iBin_qxqy_"+type) |
---|
1688 | endif |
---|
1689 | endif |
---|
1690 | |
---|
1691 | SetDataFolder root: |
---|
1692 | |
---|
1693 | return(0) |
---|
1694 | end |
---|
1695 | |
---|
1696 | Window Table_of_QBins() : Table |
---|
1697 | PauseUpdate; Silent 1 // building window... |
---|
1698 | String fldrSav0= GetDataFolder(1) |
---|
1699 | SetDataFolder root:Packages:NIST:VSANS:VCALC: |
---|
1700 | Edit/W=(5,44,771,898) qBin_qxqy_FL,qBin_qxqy_FR,qBin_qxqy_FT,qBin_qxqy_FB,qBin_qxqy_FLR |
---|
1701 | AppendToTable qBin_qxqy_FTB,qBin_qxqy_FLRTB |
---|
1702 | ModifyTable format(Point)=1,width(qBin_qxqy_FLR)=136,width(qBin_qxqy_FLRTB)=120 |
---|
1703 | SetDataFolder fldrSav0 |
---|
1704 | EndMacro |
---|
1705 | |
---|
1706 | |
---|
1707 | |
---|
1708 | |
---|