1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // These procedures and calculations duplicate the work of K. Krycka and WC Chen |
---|
4 | // in calculating the state of the He cell and subsequent correction of scattering data |
---|
5 | // |
---|
6 | // |
---|
7 | // SRK May 2011 |
---|
8 | // |
---|
9 | // |
---|
10 | // |
---|
11 | // there is a particular sequence of things that need to be calculated |
---|
12 | // lots of constants, and lots of confusing, similar notation. |
---|
13 | // |
---|
14 | // |
---|
15 | // for this implementation, I'll follow what is described in the "PASANS" |
---|
16 | // writeup by K. Krycka, and I'll try to follow the equations as numbered there |
---|
17 | // and keep the notation as close as possible. |
---|
18 | // |
---|
19 | // error propagation was written up elsewhere, and will be implemented as well |
---|
20 | // - each of the calculations based on transmissions will need to have errors |
---|
21 | // brought in, and carried through the calculations. Some will be simple, some |
---|
22 | // will probably be easiest with expansions. |
---|
23 | // |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | // This is a first pass at the input panel (step 3) |
---|
30 | // to gather all of the files and conditions necessary to do the polarization correction |
---|
31 | // |
---|
32 | // |
---|
33 | |
---|
34 | // I'll need space for 4 input files in, say SAM |
---|
35 | // - load in all of the UU files, adding together |
---|
36 | // - rename the UU data, error |
---|
37 | // |
---|
38 | // - repeat for the other three cross sections, in the SAM folder, there will be |
---|
39 | // scattering data for all four cross sections present. |
---|
40 | // |
---|
41 | // then add together the values for the coefficient matrix. |
---|
42 | // -- this can be tricky with rescaling for time, and adding to the proper row of the |
---|
43 | // coefficient matrix. I'll need to re-read either the monitor or the time from the header |
---|
44 | // of each file that was added |
---|
45 | // |
---|
46 | // Then everything is set to do the inversion. |
---|
47 | // -- the result of the inversion is 4 corrected data sets, with no polarization effects. "_pc" |
---|
48 | // |
---|
49 | // Now I can one-by-one, copy the correct UU, UD, etc. into "data" and "linear_data" (and the Reals, etc) |
---|
50 | // and run through the corrections as if it was normal SANS data |
---|
51 | // |
---|
52 | // this whole procedure is going to be essentially a big script of existing procedures |
---|
53 | // |
---|
54 | // |
---|
55 | // |
---|
56 | // TODO: |
---|
57 | // - need a better way of flowing through the process, to be sure that values are set |
---|
58 | // as needed and that one step won't fail because a previous step wasn't done yet. Combining the |
---|
59 | // first three panels into one w/ tabs would help a lot, but that is rather complex to implement. |
---|
60 | // and is still not a fool-proof situation |
---|
61 | // |
---|
62 | // X- mathod to save and restore the panel state - especially the popup selections |
---|
63 | // |
---|
64 | // -- should I force the Polarization correction to be re-done just before the protocol is |
---|
65 | // executed? Then I'm sure that the PC is done. Must do for each tab (only if part of the protocol) |
---|
66 | // Except that the procedures work on the "active" tab... |
---|
67 | // |
---|
68 | // -- When multiple files are added together, there are changes made to the RealsRead (monCts, etc.). Are these |
---|
69 | // properly made, and then properly copied to the "_UU", and then properly copied back to the untagged waves |
---|
70 | // for use in the reduction? |
---|
71 | // |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | // main entry to the PolCor Panel |
---|
77 | Macro ShowPolCorSetup() |
---|
78 | |
---|
79 | Variable restore=0 |
---|
80 | DoWindow/F PolCor_Panel |
---|
81 | if(V_flag==0) |
---|
82 | |
---|
83 | InitProtocolPanel() //this will reset the strings. |
---|
84 | |
---|
85 | restore=Initialize_PolCorPanel() |
---|
86 | PolCor_Panel() |
---|
87 | SetWindow PolCor_Panel hook(kill)=PolCorPanelHook //to save the state when panel is killed |
---|
88 | //disable the controls on other tabs |
---|
89 | ToggleSelControls("_1_",1) |
---|
90 | ToggleSelControls("_2_",1) |
---|
91 | |
---|
92 | //restore the entries |
---|
93 | if(restore) |
---|
94 | RestorePolCorPanel() |
---|
95 | endif |
---|
96 | |
---|
97 | |
---|
98 | endif |
---|
99 | End |
---|
100 | |
---|
101 | |
---|
102 | Function RestorePolCorPanel() |
---|
103 | //restore the popup state |
---|
104 | Wave/T/Z w=root:Packages:NIST:Polarization:PolCor_popState |
---|
105 | |
---|
106 | Variable ii,num |
---|
107 | String name,popStr,list |
---|
108 | |
---|
109 | list = P_GetConditionNameList() //list of conditions |
---|
110 | if(WaveExists(w)) |
---|
111 | num = DimSize(w,0) |
---|
112 | for(ii=0;ii<num;ii+=1) |
---|
113 | name = w[ii][0] |
---|
114 | popStr = w[ii][1] |
---|
115 | if(cmpstr("none",popStr) !=0 ) |
---|
116 | PopupMenu $name,win=PolCor_Panel,mode=WhichListItem(popStr, list,";",0,0),popvalue=popStr |
---|
117 | endif |
---|
118 | endfor |
---|
119 | endif |
---|
120 | return(0) |
---|
121 | End |
---|
122 | |
---|
123 | |
---|
124 | // |
---|
125 | // TODO: |
---|
126 | // X- only re-initialize values if user wants to. maybe ask. |
---|
127 | // |
---|
128 | Function Initialize_PolCorPanel() |
---|
129 | |
---|
130 | |
---|
131 | Variable ii,num |
---|
132 | String name,popStr |
---|
133 | |
---|
134 | DoAlert 1,"Do you want to initialize, wiping out all of your entries?" |
---|
135 | if(V_flag != 1) //1== yes initialize, so everything else, restore the entries |
---|
136 | return(1) |
---|
137 | endif |
---|
138 | |
---|
139 | //initialize all of the strings for the input |
---|
140 | SetDataFolder root:Packages:NIST:Polarization |
---|
141 | |
---|
142 | //controls are labeled "name_#_UU_#" where name is the type of control, # is the tab #, and (2nd) # is the control # |
---|
143 | |
---|
144 | /// new method using a listBox for each state |
---|
145 | Make/O/T/N=2 lbTitles |
---|
146 | lbTitles[0] = "Run #" |
---|
147 | lbTitles[1] = "Cell" |
---|
148 | |
---|
149 | Make/O/N=(10,2) lbSelWave |
---|
150 | lbSelWave[][0] = 2 //Run # column is editable |
---|
151 | lbSelWave[][1] = 1 //Cell name is a popup, not editable |
---|
152 | |
---|
153 | Make/O/T/N=(10,2) ListWave_0_UU="" |
---|
154 | Make/O/T/N=(10,2) ListWave_0_DU="" |
---|
155 | Make/O/T/N=(10,2) ListWave_0_DD="" |
---|
156 | Make/O/T/N=(10,2) ListWave_0_UD="" |
---|
157 | Make/O/N=(10,2) lbSelWave_0_UU |
---|
158 | Make/O/N=(10,2) lbSelWave_0_DU |
---|
159 | Make/O/N=(10,2) lbSelWave_0_DD |
---|
160 | Make/O/N=(10,2) lbSelWave_0_UD |
---|
161 | lbSelWave_0_UU[][0] = 2 //Run # column is editable |
---|
162 | lbSelWave_0_DU[][0] = 2 //Run # column is editable |
---|
163 | lbSelWave_0_DD[][0] = 2 //Run # column is editable |
---|
164 | lbSelWave_0_UD[][0] = 2 //Run # column is editable |
---|
165 | lbSelWave_0_UU[][1] = 1 //Cell name is a popup, not editable |
---|
166 | lbSelWave_0_DU[][1] = 1 //Cell name is a popup, not editable |
---|
167 | lbSelWave_0_DD[][1] = 1 //Cell name is a popup, not editable |
---|
168 | lbSelWave_0_UD[][1] = 1 //Cell name is a popup, not editable |
---|
169 | |
---|
170 | Make/O/T/N=(10,2) ListWave_1_UU="" |
---|
171 | Make/O/T/N=(10,2) ListWave_1_DU="" |
---|
172 | Make/O/T/N=(10,2) ListWave_1_DD="" |
---|
173 | Make/O/T/N=(10,2) ListWave_1_UD="" |
---|
174 | Make/O/N=(10,2) lbSelWave_1_UU |
---|
175 | Make/O/N=(10,2) lbSelWave_1_DU |
---|
176 | Make/O/N=(10,2) lbSelWave_1_DD |
---|
177 | Make/O/N=(10,2) lbSelWave_1_UD |
---|
178 | lbSelWave_1_UU[][0] = 2 //Run # column is editable |
---|
179 | lbSelWave_1_DU[][0] = 2 //Run # column is editable |
---|
180 | lbSelWave_1_DD[][0] = 2 //Run # column is editable |
---|
181 | lbSelWave_1_UD[][0] = 2 //Run # column is editable |
---|
182 | lbSelWave_1_UU[][1] = 1 //Cell name is a popup, not editable |
---|
183 | lbSelWave_1_DU[][1] = 1 //Cell name is a popup, not editable |
---|
184 | lbSelWave_1_DD[][1] = 1 //Cell name is a popup, not editable |
---|
185 | lbSelWave_1_UD[][1] = 1 //Cell name is a popup, not editable |
---|
186 | |
---|
187 | Make/O/T/N=(10,2) ListWave_2_UU="" |
---|
188 | Make/O/T/N=(10,2) ListWave_2_DU="" |
---|
189 | Make/O/T/N=(10,2) ListWave_2_DD="" |
---|
190 | Make/O/T/N=(10,2) ListWave_2_UD="" |
---|
191 | Make/O/N=(10,2) lbSelWave_2_UU |
---|
192 | Make/O/N=(10,2) lbSelWave_2_DU |
---|
193 | Make/O/N=(10,2) lbSelWave_2_DD |
---|
194 | Make/O/N=(10,2) lbSelWave_2_UD |
---|
195 | lbSelWave_2_UU[][0] = 2 //Run # column is editable |
---|
196 | lbSelWave_2_DU[][0] = 2 //Run # column is editable |
---|
197 | lbSelWave_2_DD[][0] = 2 //Run # column is editable |
---|
198 | lbSelWave_2_UD[][0] = 2 //Run # column is editable |
---|
199 | lbSelWave_2_UU[][1] = 1 //Cell name is a popup, not editable |
---|
200 | lbSelWave_2_DU[][1] = 1 //Cell name is a popup, not editable |
---|
201 | lbSelWave_2_DD[][1] = 1 //Cell name is a popup, not editable |
---|
202 | lbSelWave_2_UD[][1] = 1 //Cell name is a popup, not editable |
---|
203 | |
---|
204 | |
---|
205 | ////// old method using individual setVars and popups |
---|
206 | // for(ii=0;ii<5;ii+=1) |
---|
207 | // String/G $("gStr_PolCor_0_UU_"+num2str(ii)) = "none" |
---|
208 | // String/G $("gStr_PolCor_0_DU_"+num2str(ii)) = "none" |
---|
209 | // String/G $("gStr_PolCor_0_DD_"+num2str(ii)) = "none" |
---|
210 | // String/G $("gStr_PolCor_0_UD_"+num2str(ii)) = "none" |
---|
211 | // endfor |
---|
212 | // |
---|
213 | // for(ii=0;ii<5;ii+=1) |
---|
214 | // String/G $("gStr_PolCor_1_UU_"+num2str(ii)) = "none" |
---|
215 | // String/G $("gStr_PolCor_1_DU_"+num2str(ii)) = "none" |
---|
216 | // String/G $("gStr_PolCor_1_DD_"+num2str(ii)) = "none" |
---|
217 | // String/G $("gStr_PolCor_1_UD_"+num2str(ii)) = "none" |
---|
218 | // endfor |
---|
219 | // |
---|
220 | // for(ii=0;ii<5;ii+=1) |
---|
221 | // String/G $("gStr_PolCor_2_UU_"+num2str(ii)) = "none" |
---|
222 | // String/G $("gStr_PolCor_2_DU_"+num2str(ii)) = "none" |
---|
223 | // String/G $("gStr_PolCor_2_DD_"+num2str(ii)) = "none" |
---|
224 | // String/G $("gStr_PolCor_2_UD_"+num2str(ii)) = "none" |
---|
225 | // endfor |
---|
226 | //////////// |
---|
227 | |
---|
228 | SetDataFolder root: |
---|
229 | |
---|
230 | |
---|
231 | return(0) |
---|
232 | |
---|
233 | end |
---|
234 | |
---|
235 | |
---|
236 | |
---|
237 | |
---|
238 | // controls are labeled "name_#_UU_#" where name is the type of control, # is the tab #, and (2nd) # is the control # |
---|
239 | // -- this will allow for future use of tabs. right now 0 will be the "SAM" data |
---|
240 | // |
---|
241 | // - always visible controls will have no "_" characters |
---|
242 | // |
---|
243 | // TODO: |
---|
244 | // X- tabs for SAM, EMP, and BGD |
---|
245 | // X- input fields for the other protocol items, like the Protocol Panel |
---|
246 | // X- save the popup state |
---|
247 | // X- need a way of saving the "protocol" since the setup is so complex. |
---|
248 | // - generate a report of the setup. |
---|
249 | // - 4-panel display (maybe a layout with labels?) Maybe a panel with 4 subwindows. Can I use color bars in them? |
---|
250 | // |
---|
251 | // |
---|
252 | Window PolCor_Panel() |
---|
253 | PauseUpdate; Silent 1 // building window... |
---|
254 | NewPanel /W=(925,44,1662,800) /K=1 |
---|
255 | ModifyPanel cbRGB=(64349,63913,44660) |
---|
256 | // ShowTools/A |
---|
257 | SetDrawEnv linethick= 2.00 |
---|
258 | DrawLine 10,510,600,510 |
---|
259 | |
---|
260 | TabControl PolCorTab,pos={15,27},size={708,401},proc=PolCorTabProc |
---|
261 | TabControl PolCorTab,tabLabel(0)="SAM",tabLabel(1)="EMP",tabLabel(2)="BGD" |
---|
262 | TabControl PolCorTab,value= 0 |
---|
263 | |
---|
264 | // always visible |
---|
265 | Button button0,pos={26,445},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." |
---|
266 | Button button1,pos={26,473},size={130,20},proc=PolCorButton,title="Pol Correct Data" |
---|
267 | Button button2,pos={222,445},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" |
---|
268 | Button button3,pos={222,473},size={160,20},proc=ChangeDisplayedPolData,title="Change Displayed Data" |
---|
269 | Button button4,pos={620,18},size={30,20},proc=PolCorHelpParButtonProc,title="?" |
---|
270 | Button button12,pos={440,473},size={120,20},proc=Display4XSButton,title="Display 4 XS" |
---|
271 | |
---|
272 | PopupMenu popup1,pos={210,24},size={102,20},title="Condition" |
---|
273 | PopupMenu popup1, mode=1,popvalue="none",value= #"P_GetConditionNameList()" |
---|
274 | |
---|
275 | TitleBox title0,pos={100,66},size={24,24},title="\\f01UU or + +",fSize=12 |
---|
276 | TitleBox title1,pos={430,66},size={24,24},title="\\f01DU or - +",fSize=12 |
---|
277 | TitleBox title2,pos={100,250},size={25,24},title="\\f01DD or - -",fSize=12 |
---|
278 | TitleBox title3,pos={430,250},size={24,24},title="\\f01UD or + -",fSize=12 |
---|
279 | |
---|
280 | // bits to set up reduction protocol |
---|
281 | Button button5,pos={126,560},size={100,20},proc=PickDIVButton,title="set DIV file" |
---|
282 | Button button5,help={"This button will set the file selected in the File Catalog table to be the sensitivity file."} |
---|
283 | Button button6,pos={126,590},size={100,20},proc=PickMASKButton,title="set MASK file" |
---|
284 | Button button6,help={"This button will set the file selected in the File Catalog table to be the mask file."} |
---|
285 | Button button7,pos={126,620},size={110,20},proc=SetABSParamsButton,title="set ABS params" |
---|
286 | Button button7,help={"This button will prompt the user for absolute scaling parameters"} |
---|
287 | Button button8,pos={126,650},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" |
---|
288 | Button button8,help={"Prompts the user for the type of 1-D averaging to perform, as well as saving options"} |
---|
289 | Button button9,pos={80,690},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data" |
---|
290 | Button button9,help={"Reduce PolCor data"} |
---|
291 | Button button10,pos={226,690},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol" |
---|
292 | Button button10,help={"Save the PolCor protocol"} |
---|
293 | Button button11,pos={370,690},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol" |
---|
294 | Button button11,help={"Recall the PolCor protocol"} |
---|
295 | |
---|
296 | SetVariable setvar0,pos={322,560},size={250,15},title="file:" |
---|
297 | SetVariable setvar0,help={"Filename of the detector sensitivity file to be used in the data reduction"} |
---|
298 | SetVariable setvar0,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gDIV |
---|
299 | SetVariable setvar1,pos={322,590},size={250,15},title="file:" |
---|
300 | SetVariable setvar1,help={"Filename of the mask file to be used in the data reduction"} |
---|
301 | SetVariable setvar1,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gMASK |
---|
302 | SetVariable setvar2,pos={322,620},size={250,15},title="parameters:" |
---|
303 | SetVariable setvar2,help={"Keyword-string of values necessary for absolute scaling of data. Remaining parameters are taken from the sample file."} |
---|
304 | SetVariable setvar2,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAbsStr |
---|
305 | SetVariable setvar3,pos={322,650},size={250,15},title="parameters:" |
---|
306 | SetVariable setvar3,help={"Keyword-string of choices used for averaging and saving the 1-D data files"} |
---|
307 | SetVariable setvar3,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAVE |
---|
308 | |
---|
309 | CheckBox check0,pos={10,560},size={72,14},title="Sensitivity" |
---|
310 | CheckBox check0,help={"If checked, the specified detector sensitivity file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} |
---|
311 | CheckBox check0,value= 1 |
---|
312 | CheckBox check1,pos={10,590},size={72,14},title="Mask" |
---|
313 | CheckBox check1,help={""} |
---|
314 | CheckBox check1,value= 1 |
---|
315 | CheckBox check2,pos={10,620},size={72,14},title="Absolute Scale" |
---|
316 | CheckBox check2,help={""} |
---|
317 | CheckBox check2,value= 1 |
---|
318 | CheckBox check3,pos={10,650},size={72,14},title="Average and Save" |
---|
319 | CheckBox check3,help={""} |
---|
320 | CheckBox check3,value= 1 |
---|
321 | CheckBox check4,pos={10,530},size={72,14},title="Use EMP?" |
---|
322 | CheckBox check4,help={""} |
---|
323 | CheckBox check4,value= 1 |
---|
324 | CheckBox check5,pos={100,530},size={72,14},title="Use BGD?" |
---|
325 | CheckBox check5,help={""} |
---|
326 | CheckBox check5,value= 1 |
---|
327 | |
---|
328 | |
---|
329 | |
---|
330 | // SAM Tab |
---|
331 | // UU |
---|
332 | ListBox ListBox_0_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
333 | ListBox ListBox_0_UU,listWave=root:Packages:NIST:Polarization:ListWave_0_UU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
334 | ListBox ListBox_0_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
335 | // SetVariable setvar_0_UU_0,pos={34,102},size={70,16},title="File",fSize=10 |
---|
336 | // SetVariable setvar_0_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_0 |
---|
337 | // SetVariable setvar_0_UU_1,pos={34,125},size={70,16},title="File",fSize=10 |
---|
338 | // SetVariable setvar_0_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_1 |
---|
339 | // SetVariable setvar_0_UU_2,pos={34,149},size={70,16},title="File",fSize=10 |
---|
340 | // SetVariable setvar_0_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_2 |
---|
341 | // SetVariable setvar_0_UU_3,pos={34,173},size={70,16},title="File",fSize=10 |
---|
342 | // SetVariable setvar_0_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_3 |
---|
343 | // SetVariable setvar_0_UU_4,pos={34,197},size={70,16},title="File",fSize=10 |
---|
344 | // SetVariable setvar_0_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_4 |
---|
345 | // PopupMenu popup_0_UU_0,pos={142,99},size={210,20},title="Cell" |
---|
346 | // PopupMenu popup_0_UU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
347 | // PopupMenu popup_0_UU_1,pos={142,122},size={102,20},title="Cell" |
---|
348 | // PopupMenu popup_0_UU_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
349 | // PopupMenu popup_0_UU_2,pos={142,146},size={102,20},title="Cell" |
---|
350 | // PopupMenu popup_0_UU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
351 | // PopupMenu popup_0_UU_3,pos={142,170},size={102,20},title="Cell" |
---|
352 | // PopupMenu popup_0_UU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
353 | // PopupMenu popup_0_UU_4,pos={142,194},size={102,20},title="Cell" |
---|
354 | // PopupMenu popup_0_UU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
355 | |
---|
356 | // DU |
---|
357 | ListBox ListBox_0_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
358 | ListBox ListBox_0_DU,listWave=root:Packages:NIST:Polarization:ListWave_0_DU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
359 | ListBox ListBox_0_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
360 | // SetVariable setvar_0_DU_0,pos={368,102},size={70,16},title="File",fSize=10 |
---|
361 | // SetVariable setvar_0_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_0 |
---|
362 | // SetVariable setvar_0_DU_1,pos={368,125},size={70,16},title="File",fSize=10 |
---|
363 | // SetVariable setvar_0_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_1 |
---|
364 | // SetVariable setvar_0_DU_2,pos={368,149},size={70,16},title="File",fSize=10 |
---|
365 | // SetVariable setvar_0_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_2 |
---|
366 | // SetVariable setvar_0_DU_3,pos={368,173},size={70,16},title="File",fSize=10 |
---|
367 | // SetVariable setvar_0_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_3 |
---|
368 | // SetVariable setvar_0_DU_4,pos={368,197},size={70,16},title="File",fSize=10 |
---|
369 | // SetVariable setvar_0_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_4 |
---|
370 | // PopupMenu popup_0_DU_0,pos={476,99},size={210,20},title="Cell" |
---|
371 | // PopupMenu popup_0_DU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
372 | // PopupMenu popup_0_DU_1,pos={476,122},size={210,20},title="Cell" |
---|
373 | // PopupMenu popup_0_DU_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
374 | // PopupMenu popup_0_DU_2,pos={476,146},size={102,20},title="Cell" |
---|
375 | // PopupMenu popup_0_DU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
376 | // PopupMenu popup_0_DU_3,pos={476,170},size={102,20},title="Cell" |
---|
377 | // PopupMenu popup_0_DU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
378 | // PopupMenu popup_0_DU_4,pos={476,194},size={102,20},title="Cell" |
---|
379 | // PopupMenu popup_0_DU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
380 | |
---|
381 | // DD |
---|
382 | ListBox ListBox_0_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
383 | ListBox ListBox_0_DD,listWave=root:Packages:NIST:Polarization:ListWave_0_DD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
384 | ListBox ListBox_0_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
385 | // SetVariable setvar_0_DD_0,pos={33,286},size={70,16},title="File",fSize=10 |
---|
386 | // SetVariable setvar_0_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_0 |
---|
387 | // SetVariable setvar_0_DD_1,pos={33,309},size={70,16},title="File",fSize=10 |
---|
388 | // SetVariable setvar_0_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_1 |
---|
389 | // SetVariable setvar_0_DD_2,pos={33,333},size={70,16},title="File",fSize=10 |
---|
390 | // SetVariable setvar_0_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_2 |
---|
391 | // SetVariable setvar_0_DD_3,pos={33,357},size={70,16},title="File",fSize=10 |
---|
392 | // SetVariable setvar_0_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_3 |
---|
393 | // SetVariable setvar_0_DD_4,pos={33,381},size={70,16},title="File",fSize=10 |
---|
394 | // SetVariable setvar_0_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_4 |
---|
395 | // PopupMenu popup_0_DD_0,pos={141,283},size={210,20},title="Cell" |
---|
396 | // PopupMenu popup_0_DD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
397 | // PopupMenu popup_0_DD_1,pos={141,306},size={102,20},title="Cell" |
---|
398 | // PopupMenu popup_0_DD_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
399 | // PopupMenu popup_0_DD_2,pos={141,330},size={102,20},title="Cell" |
---|
400 | // PopupMenu popup_0_DD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
401 | // PopupMenu popup_0_DD_3,pos={141,354},size={102,20},title="Cell" |
---|
402 | // PopupMenu popup_0_DD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
403 | // PopupMenu popup_0_DD_4,pos={141,378},size={102,20},title="Cell" |
---|
404 | // PopupMenu popup_0_DD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
405 | |
---|
406 | // UD |
---|
407 | ListBox ListBox_0_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
408 | ListBox ListBox_0_UD,listWave=root:Packages:NIST:Polarization:ListWave_0_UD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
409 | ListBox ListBox_0_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
410 | // SetVariable setvar_0_UD_0,pos={368,286},size={70,16},title="File",fSize=10 |
---|
411 | // SetVariable setvar_0_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_0 |
---|
412 | // SetVariable setvar_0_UD_1,pos={368,309},size={70,16},title="File",fSize=10 |
---|
413 | // SetVariable setvar_0_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_1 |
---|
414 | // SetVariable setvar_0_UD_2,pos={368,333},size={70,16},title="File",fSize=10 |
---|
415 | // SetVariable setvar_0_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_2 |
---|
416 | // SetVariable setvar_0_UD_3,pos={368,357},size={70,16},title="File",fSize=10 |
---|
417 | // SetVariable setvar_0_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_3 |
---|
418 | // SetVariable setvar_0_UD_4,pos={368,381},size={70,16},title="File",fSize=10 |
---|
419 | // SetVariable setvar_0_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_4 |
---|
420 | // PopupMenu popup_0_UD_0,pos={476,283},size={210,20},title="Cell" |
---|
421 | // PopupMenu popup_0_UD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
422 | // PopupMenu popup_0_UD_1,pos={476,306},size={210,20},title="Cell" |
---|
423 | // PopupMenu popup_0_UD_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
424 | // PopupMenu popup_0_UD_2,pos={476,330},size={102,20},title="Cell" |
---|
425 | // PopupMenu popup_0_UD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
426 | // PopupMenu popup_0_UD_3,pos={476,354},size={102,20},title="Cell" |
---|
427 | // PopupMenu popup_0_UD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
428 | // PopupMenu popup_0_UD_4,pos={476,378},size={102,20},title="Cell" |
---|
429 | // PopupMenu popup_0_UD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
430 | |
---|
431 | |
---|
432 | // EMP Tab |
---|
433 | // UU |
---|
434 | ListBox ListBox_1_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
435 | ListBox ListBox_1_UU,listWave=root:Packages:NIST:Polarization:ListWave_1_UU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
436 | ListBox ListBox_1_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
437 | // SetVariable setvar_1_UU_0,pos={34,102},size={70,16},title="File",fSize=10 |
---|
438 | // SetVariable setvar_1_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_0 |
---|
439 | // SetVariable setvar_1_UU_1,pos={34,125},size={70,16},title="File",fSize=10 |
---|
440 | // SetVariable setvar_1_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_1 |
---|
441 | // SetVariable setvar_1_UU_2,pos={34,149},size={70,16},title="File",fSize=10 |
---|
442 | // SetVariable setvar_1_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_2 |
---|
443 | // SetVariable setvar_1_UU_3,pos={34,173},size={70,16},title="File",fSize=10 |
---|
444 | // SetVariable setvar_1_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_3 |
---|
445 | // SetVariable setvar_1_UU_4,pos={34,197},size={70,16},title="File",fSize=10 |
---|
446 | // SetVariable setvar_1_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_4 |
---|
447 | // PopupMenu popup_1_UU_0,pos={142,99},size={210,20},title="Cell" |
---|
448 | // PopupMenu popup_1_UU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
449 | // PopupMenu popup_1_UU_1,pos={142,122},size={102,20},title="Cell" |
---|
450 | // PopupMenu popup_1_UU_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
451 | // PopupMenu popup_1_UU_2,pos={142,146},size={102,20},title="Cell" |
---|
452 | // PopupMenu popup_1_UU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
453 | // PopupMenu popup_1_UU_3,pos={142,170},size={102,20},title="Cell" |
---|
454 | // PopupMenu popup_1_UU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
455 | // PopupMenu popup_1_UU_4,pos={142,194},size={102,20},title="Cell" |
---|
456 | // PopupMenu popup_1_UU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
457 | |
---|
458 | // DU |
---|
459 | ListBox ListBox_1_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
460 | ListBox ListBox_1_DU,listWave=root:Packages:NIST:Polarization:ListWave_1_DU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
461 | ListBox ListBox_1_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
462 | // SetVariable setvar_1_DU_0,pos={368,102},size={70,16},title="File",fSize=10 |
---|
463 | // SetVariable setvar_1_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_0 |
---|
464 | // SetVariable setvar_1_DU_1,pos={368,125},size={70,16},title="File",fSize=10 |
---|
465 | // SetVariable setvar_1_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_1 |
---|
466 | // SetVariable setvar_1_DU_2,pos={368,149},size={70,16},title="File",fSize=10 |
---|
467 | // SetVariable setvar_1_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_2 |
---|
468 | // SetVariable setvar_1_DU_3,pos={368,173},size={70,16},title="File",fSize=10 |
---|
469 | // SetVariable setvar_1_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_3 |
---|
470 | // SetVariable setvar_1_DU_4,pos={368,197},size={70,16},title="File",fSize=10 |
---|
471 | // SetVariable setvar_1_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_4 |
---|
472 | // PopupMenu popup_1_DU_0,pos={476,99},size={210,20},title="Cell" |
---|
473 | // PopupMenu popup_1_DU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
474 | // PopupMenu popup_1_DU_1,pos={476,122},size={210,20},title="Cell" |
---|
475 | // PopupMenu popup_1_DU_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
476 | // PopupMenu popup_1_DU_2,pos={476,146},size={102,20},title="Cell" |
---|
477 | // PopupMenu popup_1_DU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
478 | // PopupMenu popup_1_DU_3,pos={476,170},size={102,20},title="Cell" |
---|
479 | // PopupMenu popup_1_DU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
480 | // PopupMenu popup_1_DU_4,pos={476,194},size={102,20},title="Cell" |
---|
481 | // PopupMenu popup_1_DU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
482 | |
---|
483 | // DD |
---|
484 | ListBox ListBox_1_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
485 | ListBox ListBox_1_DD,listWave=root:Packages:NIST:Polarization:ListWave_1_DD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
486 | ListBox ListBox_1_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
487 | // SetVariable setvar_1_DD_0,pos={33,286},size={70,16},title="File",fSize=10 |
---|
488 | // SetVariable setvar_1_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_0 |
---|
489 | // SetVariable setvar_1_DD_1,pos={33,309},size={70,16},title="File",fSize=10 |
---|
490 | // SetVariable setvar_1_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_1 |
---|
491 | // SetVariable setvar_1_DD_2,pos={33,333},size={70,16},title="File",fSize=10 |
---|
492 | // SetVariable setvar_1_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_2 |
---|
493 | // SetVariable setvar_1_DD_3,pos={33,357},size={70,16},title="File",fSize=10 |
---|
494 | // SetVariable setvar_1_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_3 |
---|
495 | // SetVariable setvar_1_DD_4,pos={33,381},size={70,16},title="File",fSize=10 |
---|
496 | // SetVariable setvar_1_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_4 |
---|
497 | // PopupMenu popup_1_DD_0,pos={141,283},size={210,20},title="Cell" |
---|
498 | // PopupMenu popup_1_DD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
499 | // PopupMenu popup_1_DD_1,pos={141,306},size={102,20},title="Cell" |
---|
500 | // PopupMenu popup_1_DD_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
501 | // PopupMenu popup_1_DD_2,pos={141,330},size={102,20},title="Cell" |
---|
502 | // PopupMenu popup_1_DD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
503 | // PopupMenu popup_1_DD_3,pos={141,354},size={102,20},title="Cell" |
---|
504 | // PopupMenu popup_1_DD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
505 | // PopupMenu popup_1_DD_4,pos={141,378},size={102,20},title="Cell" |
---|
506 | // PopupMenu popup_1_DD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
507 | |
---|
508 | // UD |
---|
509 | ListBox ListBox_1_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
510 | ListBox ListBox_1_UD,listWave=root:Packages:NIST:Polarization:ListWave_1_UD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
511 | ListBox ListBox_1_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
512 | // SetVariable setvar_1_UD_0,pos={368,286},size={70,16},title="File",fSize=10 |
---|
513 | // SetVariable setvar_1_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_0 |
---|
514 | // SetVariable setvar_1_UD_1,pos={368,309},size={70,16},title="File",fSize=10 |
---|
515 | // SetVariable setvar_1_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_1 |
---|
516 | // SetVariable setvar_1_UD_2,pos={368,333},size={70,16},title="File",fSize=10 |
---|
517 | // SetVariable setvar_1_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_2 |
---|
518 | // SetVariable setvar_1_UD_3,pos={368,357},size={70,16},title="File",fSize=10 |
---|
519 | // SetVariable setvar_1_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_3 |
---|
520 | // SetVariable setvar_1_UD_4,pos={368,381},size={70,16},title="File",fSize=10 |
---|
521 | // SetVariable setvar_1_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_4 |
---|
522 | // PopupMenu popup_1_UD_0,pos={476,283},size={210,20},title="Cell" |
---|
523 | // PopupMenu popup_1_UD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
524 | // PopupMenu popup_1_UD_1,pos={476,306},size={210,20},title="Cell" |
---|
525 | // PopupMenu popup_1_UD_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
526 | // PopupMenu popup_1_UD_2,pos={476,330},size={102,20},title="Cell" |
---|
527 | // PopupMenu popup_1_UD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
528 | // PopupMenu popup_1_UD_3,pos={476,354},size={102,20},title="Cell" |
---|
529 | // PopupMenu popup_1_UD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
530 | // PopupMenu popup_1_UD_4,pos={476,378},size={102,20},title="Cell" |
---|
531 | // PopupMenu popup_1_UD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
532 | |
---|
533 | |
---|
534 | // BKG Tab |
---|
535 | // UU |
---|
536 | ListBox ListBox_2_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
537 | ListBox ListBox_2_UU,listWave=root:Packages:NIST:Polarization:ListWave_2_UU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
538 | ListBox ListBox_2_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
539 | // SetVariable setvar_2_UU_0,pos={34,102},size={70,16},title="File",fSize=10 |
---|
540 | // SetVariable setvar_2_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_0 |
---|
541 | // SetVariable setvar_2_UU_1,pos={34,125},size={70,16},title="File",fSize=10 |
---|
542 | // SetVariable setvar_2_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_1 |
---|
543 | // SetVariable setvar_2_UU_2,pos={34,149},size={70,16},title="File",fSize=10 |
---|
544 | // SetVariable setvar_2_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_2 |
---|
545 | // SetVariable setvar_2_UU_3,pos={34,173},size={70,16},title="File",fSize=10 |
---|
546 | // SetVariable setvar_2_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_3 |
---|
547 | // SetVariable setvar_2_UU_4,pos={34,197},size={70,16},title="File",fSize=10 |
---|
548 | // SetVariable setvar_2_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_4 |
---|
549 | // PopupMenu popup_2_UU_0,pos={142,99},size={210,20},title="Cell" |
---|
550 | // PopupMenu popup_2_UU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
551 | // PopupMenu popup_2_UU_1,pos={142,122},size={102,20},title="Cell" |
---|
552 | // PopupMenu popup_2_UU_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
553 | // PopupMenu popup_2_UU_2,pos={142,146},size={102,20},title="Cell" |
---|
554 | // PopupMenu popup_2_UU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
555 | // PopupMenu popup_2_UU_3,pos={142,170},size={102,20},title="Cell" |
---|
556 | // PopupMenu popup_2_UU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
557 | // PopupMenu popup_2_UU_4,pos={142,194},size={102,20},title="Cell" |
---|
558 | // PopupMenu popup_2_UU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
559 | |
---|
560 | // DU |
---|
561 | ListBox ListBox_2_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
562 | ListBox ListBox_2_DU,listWave=root:Packages:NIST:Polarization:ListWave_2_DU,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
563 | ListBox ListBox_2_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
564 | // SetVariable setvar_2_DU_0,pos={368,102},size={70,16},title="File",fSize=10 |
---|
565 | // SetVariable setvar_2_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_0 |
---|
566 | // SetVariable setvar_2_DU_1,pos={368,125},size={70,16},title="File",fSize=10 |
---|
567 | // SetVariable setvar_2_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_1 |
---|
568 | // SetVariable setvar_2_DU_2,pos={368,149},size={70,16},title="File",fSize=10 |
---|
569 | // SetVariable setvar_2_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_2 |
---|
570 | // SetVariable setvar_2_DU_3,pos={368,173},size={70,16},title="File",fSize=10 |
---|
571 | // SetVariable setvar_2_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_3 |
---|
572 | // SetVariable setvar_2_DU_4,pos={368,197},size={70,16},title="File",fSize=10 |
---|
573 | // SetVariable setvar_2_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_4 |
---|
574 | // PopupMenu popup_2_DU_0,pos={476,99},size={210,20},title="Cell" |
---|
575 | // PopupMenu popup_2_DU_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
576 | // PopupMenu popup_2_DU_1,pos={476,122},size={210,20},title="Cell" |
---|
577 | // PopupMenu popup_2_DU_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
578 | // PopupMenu popup_2_DU_2,pos={476,146},size={102,20},title="Cell" |
---|
579 | // PopupMenu popup_2_DU_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
580 | // PopupMenu popup_2_DU_3,pos={476,170},size={102,20},title="Cell" |
---|
581 | // PopupMenu popup_2_DU_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
582 | // PopupMenu popup_2_DU_4,pos={476,194},size={102,20},title="Cell" |
---|
583 | // PopupMenu popup_2_DU_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
584 | |
---|
585 | // DD |
---|
586 | ListBox ListBox_2_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
587 | ListBox ListBox_2_DD,listWave=root:Packages:NIST:Polarization:ListWave_2_DD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
588 | ListBox ListBox_2_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
589 | // SetVariable setvar_2_DD_0,pos={33,286},size={70,16},title="File",fSize=10 |
---|
590 | // SetVariable setvar_2_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_0 |
---|
591 | // SetVariable setvar_2_DD_1,pos={33,309},size={70,16},title="File",fSize=10 |
---|
592 | // SetVariable setvar_2_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_1 |
---|
593 | // SetVariable setvar_2_DD_2,pos={33,333},size={70,16},title="File",fSize=10 |
---|
594 | // SetVariable setvar_2_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_2 |
---|
595 | // SetVariable setvar_2_DD_3,pos={33,357},size={70,16},title="File",fSize=10 |
---|
596 | // SetVariable setvar_2_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_3 |
---|
597 | // SetVariable setvar_2_DD_4,pos={33,381},size={70,16},title="File",fSize=10 |
---|
598 | // SetVariable setvar_2_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_4 |
---|
599 | // PopupMenu popup_2_DD_0,pos={141,283},size={210,20},title="Cell" |
---|
600 | // PopupMenu popup_2_DD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
601 | // PopupMenu popup_2_DD_1,pos={141,306},size={102,20},title="Cell" |
---|
602 | // PopupMenu popup_2_DD_1,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
603 | // PopupMenu popup_2_DD_2,pos={141,330},size={102,20},title="Cell" |
---|
604 | // PopupMenu popup_2_DD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
605 | // PopupMenu popup_2_DD_3,pos={141,354},size={102,20},title="Cell" |
---|
606 | // PopupMenu popup_2_DD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
607 | // PopupMenu popup_2_DD_4,pos={141,378},size={102,20},title="Cell" |
---|
608 | // PopupMenu popup_2_DD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
609 | |
---|
610 | // UD |
---|
611 | ListBox ListBox_2_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 |
---|
612 | ListBox ListBox_2_UD,listWave=root:Packages:NIST:Polarization:ListWave_2_UD,titleWave=root:Packages:NIST:Polarization:lbTitles |
---|
613 | ListBox ListBox_2_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 |
---|
614 | // SetVariable setvar_2_UD_0,pos={368,286},size={70,16},title="File",fSize=10 |
---|
615 | // SetVariable setvar_2_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_0 |
---|
616 | // SetVariable setvar_2_UD_1,pos={368,309},size={70,16},title="File",fSize=10 |
---|
617 | // SetVariable setvar_2_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_1 |
---|
618 | // SetVariable setvar_2_UD_2,pos={368,333},size={70,16},title="File",fSize=10 |
---|
619 | // SetVariable setvar_2_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_2 |
---|
620 | // SetVariable setvar_2_UD_3,pos={368,357},size={70,16},title="File",fSize=10 |
---|
621 | // SetVariable setvar_2_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_3 |
---|
622 | // SetVariable setvar_2_UD_4,pos={368,381},size={70,16},title="File",fSize=10 |
---|
623 | // SetVariable setvar_2_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_4 |
---|
624 | // PopupMenu popup_2_UD_0,pos={476,283},size={210,20},title="Cell" |
---|
625 | // PopupMenu popup_2_UD_0,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
626 | // PopupMenu popup_2_UD_1,pos={476,306},size={210,20},title="Cell" |
---|
627 | // PopupMenu popup_2_UD_1,mode=3,popvalue="none",value= #"D_CellNameList()" |
---|
628 | // PopupMenu popup_2_UD_2,pos={476,330},size={102,20},title="Cell" |
---|
629 | // PopupMenu popup_2_UD_2,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
630 | // PopupMenu popup_2_UD_3,pos={476,354},size={102,20},title="Cell" |
---|
631 | // PopupMenu popup_2_UD_3,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
632 | // PopupMenu popup_2_UD_4,pos={476,378},size={102,20},title="Cell" |
---|
633 | // PopupMenu popup_2_UD_4,mode=1,popvalue="none",value= #"D_CellNameList()" |
---|
634 | |
---|
635 | EndMacro |
---|
636 | |
---|
637 | // action procedure for the list box that allows the popup menu |
---|
638 | // -- much easier to make a contextual popup with a list box than on a table/subwindow hook |
---|
639 | // |
---|
640 | Function PolCor_FileListBoxProc(lba) : ListBoxControl |
---|
641 | STRUCT WMListboxAction &lba |
---|
642 | |
---|
643 | Variable row = lba.row |
---|
644 | Variable col = lba.col |
---|
645 | WAVE/T/Z listWave = lba.listWave |
---|
646 | WAVE/Z selWave = lba.selWave |
---|
647 | |
---|
648 | switch( lba.eventCode ) |
---|
649 | case -1: // control being killed |
---|
650 | break |
---|
651 | case 1: // mouse down |
---|
652 | if (lba.col == 1) // cell list |
---|
653 | // SelWave[][][0] = SelWave[p][q] & ~9 // de-select everything to make sure we don't leave something selected in another column |
---|
654 | // SelWave[][s.col][0] = SelWave[p][s.col] | 1 // select all rows |
---|
655 | // ControlUpdate/W=$(s.win) $(s.ctrlName) |
---|
656 | PopupContextualMenu D_CellNameList() |
---|
657 | if (V_flag > 0) |
---|
658 | listWave[lba.row][lba.col] = S_Selection |
---|
659 | endif |
---|
660 | endif |
---|
661 | break |
---|
662 | case 3: // double click |
---|
663 | break |
---|
664 | case 4: // cell selection |
---|
665 | case 5: // cell selection plus shift key |
---|
666 | break |
---|
667 | case 6: // begin edit |
---|
668 | break |
---|
669 | case 7: // finish edit |
---|
670 | break |
---|
671 | case 13: // checkbox clicked (Igor 6.2 or later) |
---|
672 | break |
---|
673 | endswitch |
---|
674 | |
---|
675 | return 0 |
---|
676 | End |
---|
677 | |
---|
678 | |
---|
679 | // This hook is activated when the whole window is killed. It saves the state of the popups and list boxes. |
---|
680 | // -- the protocol is not saved since it can be recalled |
---|
681 | // |
---|
682 | Function PolCorPanelHook(s) |
---|
683 | STRUCT WMWinHookStruct &s |
---|
684 | |
---|
685 | Variable hookResult = 0 |
---|
686 | |
---|
687 | switch(s.eventCode) |
---|
688 | // case 0: // Activate |
---|
689 | // // Handle activate |
---|
690 | // break |
---|
691 | // |
---|
692 | // case 1: // Deactivate |
---|
693 | // // Handle deactivate |
---|
694 | // break |
---|
695 | case 2: // kill |
---|
696 | // Handle kill |
---|
697 | |
---|
698 | // the variables with the run numbers are automatically saved and restored if not re-initialized |
---|
699 | // get a list of all of the popups |
---|
700 | String popList="",item |
---|
701 | Variable num,ii |
---|
702 | |
---|
703 | // -- old way, with popups for the conditions |
---|
704 | // popList=ControlNameList("PolCor_Panel",";","popup_*") |
---|
705 | // -- new way - list boxes automatically saved, condition popup needs to be saved |
---|
706 | popList=ControlNameList("PolCor_Panel",";","popup*") |
---|
707 | num=ItemsInList(popList,";") |
---|
708 | Make/O/T/N=(num,2) root:Packages:NIST:Polarization:PolCor_popState |
---|
709 | Wave/T w=root:Packages:NIST:Polarization:PolCor_popState |
---|
710 | for(ii=0;ii<num;ii+=1) |
---|
711 | item=StringFromList(ii, popList,";") |
---|
712 | ControlInfo/W=PolCor_Panel $item |
---|
713 | w[ii][0] = item |
---|
714 | w[ii][1] = S_Value |
---|
715 | endfor |
---|
716 | |
---|
717 | break |
---|
718 | |
---|
719 | endswitch |
---|
720 | |
---|
721 | return hookResult // 0 if nothing done, else 1 |
---|
722 | End |
---|
723 | |
---|
724 | // val = 1 to disable |
---|
725 | // val = 0 to show |
---|
726 | Function ToggleSelControls(str,val) |
---|
727 | String str |
---|
728 | Variable val |
---|
729 | |
---|
730 | String listStr |
---|
731 | listStr = ControlNameList("PolCor_Panel", ";", "*"+str+"*") |
---|
732 | // print listStr |
---|
733 | |
---|
734 | ModifyControlList/Z listStr , disable=(val) |
---|
735 | return(0) |
---|
736 | end |
---|
737 | |
---|
738 | |
---|
739 | Function PolCorTabProc(tca) : TabControl |
---|
740 | STRUCT WMTabControlAction &tca |
---|
741 | |
---|
742 | switch( tca.eventCode ) |
---|
743 | case 2: // mouse up |
---|
744 | Variable tab = tca.tab |
---|
745 | Variable val |
---|
746 | // Print "Selected tab = ",tab |
---|
747 | |
---|
748 | val = (tab != 0) |
---|
749 | // Print "tab 0 val = ",val |
---|
750 | ToggleSelControls("_0_",val) |
---|
751 | |
---|
752 | val = (tab != 1) |
---|
753 | // Print "tab 1 val = ",val |
---|
754 | ToggleSelControls("_1_",val) |
---|
755 | |
---|
756 | val = (tab != 2) |
---|
757 | // Print "tab 2 val = ",val |
---|
758 | ToggleSelControls("_2_",val) |
---|
759 | |
---|
760 | break |
---|
761 | case -1: // control being killed |
---|
762 | break |
---|
763 | endswitch |
---|
764 | |
---|
765 | return 0 |
---|
766 | End |
---|
767 | |
---|
768 | |
---|
769 | |
---|
770 | Function PolCorHelpParButtonProc(ba) : ButtonControl |
---|
771 | STRUCT WMButtonAction &ba |
---|
772 | |
---|
773 | switch( ba.eventCode ) |
---|
774 | case 2: // mouse up |
---|
775 | // click code here |
---|
776 | DoAlert 0,"Help for PolCor Panel not written yet" |
---|
777 | break |
---|
778 | case -1: // control being killed |
---|
779 | break |
---|
780 | endswitch |
---|
781 | |
---|
782 | return 0 |
---|
783 | End |
---|
784 | |
---|
785 | |
---|
786 | // loads the specified type of data (SAM, EMP, BGD) based on the active tab |
---|
787 | // loads either specified spin type or all four |
---|
788 | // (( now, defaults to trying to load ALL four data spin states )) |
---|
789 | // - I'll have to fix this later if only 2 of the four are needed |
---|
790 | // -- during loading, the proper row of the PolMatrix is filled, based on pType |
---|
791 | // |
---|
792 | // then after all data is loaded: |
---|
793 | // -the inverse Inv_PolMatrix is calculated |
---|
794 | // -the error in the PolMatrix is calculated |
---|
795 | // -the error in Inv_PolMatrix is calculated |
---|
796 | // |
---|
797 | Function LoadRawPolarizedButton(ba) : ButtonControl |
---|
798 | STRUCT WMButtonAction &ba |
---|
799 | |
---|
800 | switch( ba.eventCode ) |
---|
801 | case 2: // mouse up |
---|
802 | // click code here |
---|
803 | |
---|
804 | // depends on which tab you're on |
---|
805 | // (maybe) select UD type, maybe force all to load |
---|
806 | |
---|
807 | String pType |
---|
808 | // Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;All;" |
---|
809 | // DoPrompt "Type to load",pType |
---|
810 | // if (V_Flag) |
---|
811 | // return 0 // user canceled |
---|
812 | // endif |
---|
813 | |
---|
814 | pType = "All" |
---|
815 | |
---|
816 | if(cmpstr(pType,"All") == 0) |
---|
817 | LoadPolarizedData("UU") |
---|
818 | LoadPolarizedData("DU") |
---|
819 | LoadPolarizedData("DD") |
---|
820 | LoadPolarizedData("UD") |
---|
821 | else |
---|
822 | LoadPolarizedData(pType) |
---|
823 | endif |
---|
824 | |
---|
825 | String type |
---|
826 | Variable row,col,flag=1 |
---|
827 | Variable ii,jj,aa,bb |
---|
828 | |
---|
829 | // The PolMatrix is filled on loading the data sets |
---|
830 | // once all files are added, take the SQRT of the error matrix |
---|
831 | // now calculate its inverse |
---|
832 | // -- first checking to be sure that no rows are zero - this will result in a singular matrix otherwise |
---|
833 | ControlInfo/W=PolCor_Panel PolCorTab |
---|
834 | type = S_value |
---|
835 | WAVE matA = $("root:Packages:NIST:"+type+":PolMatrix") |
---|
836 | WAVE matA_err = $("root:Packages:NIST:"+type+":PolMatrix_err") |
---|
837 | matA_err = sqrt(matA_err) |
---|
838 | |
---|
839 | // check for zero rows before inverting -- means not all data loaded |
---|
840 | for(row=0;row<4;row+=1) |
---|
841 | if(matA[row][0] == 0 && matA[row][1] == 0 && matA[row][2] == 0 && matA[row][3] == 0) |
---|
842 | Print "**** some elements of PolMatrix are zero. Inverse not calculated. Be sure that all four XS are loaded." |
---|
843 | row=10 |
---|
844 | flag=0 |
---|
845 | endif |
---|
846 | endfor |
---|
847 | if(flag) //PolMatrix OK |
---|
848 | // calculate the inverse of the coefficient matrix |
---|
849 | SetDataFolder $("root:Packages:NIST:"+type) |
---|
850 | MatrixInverse/G matA |
---|
851 | Duplicate/O M_Inverse Inv_PolMatrix |
---|
852 | |
---|
853 | // now calculate the error of the inverse matrix |
---|
854 | Duplicate/O Inv_PolMatrix Inv_PolMatrix_err |
---|
855 | Inv_PolMatrix_err=0 |
---|
856 | |
---|
857 | for(aa=0;aa<4;aa+=1) |
---|
858 | for(bb=0;bb<4;bb+=1) |
---|
859 | for(ii=0;ii<4;ii+=1) |
---|
860 | for(jj=0;jj<4;jj+=1) |
---|
861 | Inv_PolMatrix_err[aa][bb] += (Inv_PolMatrix[aa][ii])^2 * (matA_err[ii][jj])^2 * (Inv_PolMatrix[jj][bb])^2 |
---|
862 | endfor |
---|
863 | endfor |
---|
864 | // Inv_PolMatrix_err[aa][bb] = sqrt(Inv_PolMatrix_err[aa][bb]) |
---|
865 | endfor |
---|
866 | endfor |
---|
867 | |
---|
868 | Inv_PolMatrix_err = sqrt(Inv_PolMatrix_err) |
---|
869 | |
---|
870 | |
---|
871 | endif |
---|
872 | |
---|
873 | |
---|
874 | |
---|
875 | SetDataFolder root: |
---|
876 | |
---|
877 | break |
---|
878 | case -1: // control being killed |
---|
879 | break |
---|
880 | endswitch |
---|
881 | |
---|
882 | return 0 |
---|
883 | End |
---|
884 | |
---|
885 | // Loading of the polarized scattering data |
---|
886 | // |
---|
887 | // with the file numbers set |
---|
888 | // and the conditions specified |
---|
889 | // |
---|
890 | // -- For the specified pType of data (=UU, DU, DD, UD) |
---|
891 | // |
---|
892 | // -the time midpoint is found from the list of runs (needed for PCell(t) later) |
---|
893 | // -raw data is loaded (from a list of run numbers) |
---|
894 | // -data and loaded waves are tagged with a suffix (_UU, _DU, etc.) |
---|
895 | // -the PolMatrix of coefficients is filled (the specified row) |
---|
896 | // |
---|
897 | // TODO: |
---|
898 | // X- pre-parsing is not done to check for valid file numbers. This should be done gracefully. |
---|
899 | // X- SAM folder is currently hard-wired |
---|
900 | // X- if all of the conditions are "none" - stop and report the error |
---|
901 | // |
---|
902 | Function LoadPolarizedData(pType) |
---|
903 | String pType |
---|
904 | |
---|
905 | |
---|
906 | String listStr="",runList="",parsedRuns,condStr |
---|
907 | Variable ii,num,err,row |
---|
908 | |
---|
909 | // get the current tab |
---|
910 | String type,runStr,cellStr |
---|
911 | Variable tabNum |
---|
912 | ControlInfo/W=PolCor_Panel PolCorTab |
---|
913 | type = S_value |
---|
914 | Print "selected data type = ",type |
---|
915 | tabNum = V_Value |
---|
916 | |
---|
917 | |
---|
918 | // get a list of the file numbers to load, must be in proper data folder |
---|
919 | SetDataFolder root:Packages:NIST:Polarization |
---|
920 | // Print "Searching "+"gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*" |
---|
921 | // listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) |
---|
922 | |
---|
923 | Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) |
---|
924 | num = DimSize(lb,0) //should be 10, as initialized |
---|
925 | |
---|
926 | // if the condition (for all of the sets) is "none", get out |
---|
927 | ControlInfo/W=PolCor_Panel popup1 |
---|
928 | condStr = S_Value |
---|
929 | if(cmpstr(condStr, "none" ) == 0) |
---|
930 | DoAlert 0,"Condition is not set." |
---|
931 | SetDataFolder root: |
---|
932 | return(0) |
---|
933 | endif |
---|
934 | |
---|
935 | // step through, stop at the first null run number or missing cell specification |
---|
936 | for(row=0;row<num;row+=1) |
---|
937 | runStr = lb[row][0] |
---|
938 | CellStr = lb[row][1] |
---|
939 | |
---|
940 | if(strlen(runStr) > 0 && strlen(cellStr) > 0) //non-null entries, go on |
---|
941 | runList += runStr+"," // this is a comma-delimited list |
---|
942 | else |
---|
943 | if(strlen(runStr) == 0 && strlen(cellStr) == 0) |
---|
944 | // not a problem, don't bother reporting |
---|
945 | else |
---|
946 | //report the error and stop |
---|
947 | DoAlert 0,"run number or cell is not set in row "+num2str(row)+" for type "+pType |
---|
948 | SetDataFolder root: |
---|
949 | return(0) |
---|
950 | endif |
---|
951 | endif |
---|
952 | endfor |
---|
953 | |
---|
954 | Print runList |
---|
955 | // check for errors |
---|
956 | parsedRuns =ParseRunNumberList(runlist) |
---|
957 | if(strlen(parsedRuns) == 0) |
---|
958 | Print "enter a valid file number before proceeding" |
---|
959 | SetDataFolder root: |
---|
960 | return(0) |
---|
961 | endif |
---|
962 | SetDataFolder root: |
---|
963 | |
---|
964 | |
---|
965 | // find time midpoint for the files to load |
---|
966 | Variable tMid |
---|
967 | tMid = getTimeMidpoint(runList) |
---|
968 | Print/D "time midpoint",tmid |
---|
969 | |
---|
970 | // this adds multiple raw data files, as specified by the list |
---|
971 | err = AddFilesInList(type,parsedRuns) // adds to a work file = type, not RAW |
---|
972 | UpdateDisplayInformation(type) |
---|
973 | |
---|
974 | TagLoadedData(type,pType) //see also DisplayTaggedData() |
---|
975 | |
---|
976 | // now add the appropriate bits to the matrix |
---|
977 | if(!WaveExists($("root:Packages:NIST:"+type+":PolMatrix"))) |
---|
978 | Make/O/D/N=(4,4) $("root:Packages:NIST:"+type+":PolMatrix") |
---|
979 | Make/O/D/N=(4,4) $("root:Packages:NIST:"+type+":PolMatrix_err") |
---|
980 | endif |
---|
981 | WAVE matA = $("root:Packages:NIST:"+type+":PolMatrix") |
---|
982 | WAVE matA_err = $("root:Packages:NIST:"+type+":PolMatrix_err") |
---|
983 | |
---|
984 | // listStr = ControlNameList("PolCor_Panel",";","*"+pType+"*") |
---|
985 | |
---|
986 | //This loops over all of the files and adds the coefficients to the PolMatrix |
---|
987 | // the PolMatrix rows are cleared on pass 0 as each pType data is loaded. |
---|
988 | // this way repeated loading will always result in the correct fill |
---|
989 | // returns the error matrix as the squared error (take sqrt in calling function) |
---|
990 | AddToPolMatrix(matA,matA_err,pType,tMid) |
---|
991 | |
---|
992 | |
---|
993 | SetDataFolder root: |
---|
994 | |
---|
995 | return(0) |
---|
996 | End |
---|
997 | |
---|
998 | |
---|
999 | // by definition-- the rows are: |
---|
1000 | // |
---|
1001 | // UU = 0 |
---|
1002 | // DU = 1 |
---|
1003 | // DD = 2 |
---|
1004 | // UD = 3 |
---|
1005 | // |
---|
1006 | // -- check all of the math |
---|
1007 | // not yet using the midpoint time |
---|
1008 | // |
---|
1009 | // -- the PolMatrix_err returned from here is the squared error! |
---|
1010 | // |
---|
1011 | Function AddToPolMatrix(matA,matA_err,pType,tMid) |
---|
1012 | Wave matA,matA_err |
---|
1013 | String pType |
---|
1014 | Variable tMid |
---|
1015 | |
---|
1016 | Variable row,Psm, PsmPf, PCell,err_Psm, err_PsmPf, err_PCell |
---|
1017 | Variable ii,jj,muPo,err_muPo,gam,err_gam,monCts,t1,num |
---|
1018 | |
---|
1019 | Variable ea_uu, ea_ud, ea_dd, ea_du |
---|
1020 | Variable ec_uu, ec_ud, ec_dd, ec_du |
---|
1021 | |
---|
1022 | String listStr,fname="",condStr,condNote,decayNote,cellStr,t0Str,t1Str,runStr |
---|
1023 | |
---|
1024 | // get the current tab |
---|
1025 | String type |
---|
1026 | Variable tabNum |
---|
1027 | ControlInfo/W=PolCor_Panel PolCorTab |
---|
1028 | type = S_value |
---|
1029 | Print "selected data type = ",type |
---|
1030 | tabNum = V_Value |
---|
1031 | |
---|
1032 | SetDataFolder root:Packages:NIST:Polarization |
---|
1033 | // listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) |
---|
1034 | |
---|
1035 | |
---|
1036 | Wave/T lb=$("ListWave_"+num2str(tabNum)+"_"+pType) |
---|
1037 | num = DimSize(lb,0) //should be 10, as initialized |
---|
1038 | |
---|
1039 | // if the condition (for all of the sets) is "none", get out |
---|
1040 | ControlInfo/W=PolCor_Panel popup1 |
---|
1041 | condStr = S_Value |
---|
1042 | if(cmpstr(condStr, "none" ) == 0) |
---|
1043 | DoAlert 0,"Condition is not set." |
---|
1044 | SetDataFolder root: |
---|
1045 | return(0) |
---|
1046 | endif |
---|
1047 | |
---|
1048 | Wave condition = $("root:Packages:NIST:Polarization:Cells:"+condStr) |
---|
1049 | // get wave note from condition |
---|
1050 | condNote = note(condition) |
---|
1051 | // get P's from note |
---|
1052 | Psm = NumberByKey("P_sm", condNote, "=", ",", 0) |
---|
1053 | PsmPf = NumberByKey("P_sm_f", condNote, "=", ",", 0) |
---|
1054 | err_Psm = NumberByKey("err_P_sm", condNote, "=", ",", 0) |
---|
1055 | err_PsmPf = NumberByKey("err_P_sm_f", condNote, "=", ",", 0) |
---|
1056 | |
---|
1057 | |
---|
1058 | // loop over the (10) rows in the listWave |
---|
1059 | for(ii=0;ii<num;ii+=1) |
---|
1060 | runStr = lb[ii][0] //the run number |
---|
1061 | if(cmpstr(runStr, "" ) != 0) |
---|
1062 | |
---|
1063 | // get run number (str) |
---|
1064 | // get file name |
---|
1065 | fname = FindFileFromRunNumber(str2num(runStr)) |
---|
1066 | |
---|
1067 | // get the cell string to get the Decay wave |
---|
1068 | cellStr = lb[ii][1] |
---|
1069 | // print "Cell = ",cellStr |
---|
1070 | // get info to calc Pcell (from the Decay wave) |
---|
1071 | Wave decay = $("root:Packages:NIST:Polarization:Cells:Decay_"+cellStr) |
---|
1072 | decayNote=note(decay) |
---|
1073 | |
---|
1074 | t0Str = StringByKey("T0", decayNote, "=", ",", 0) |
---|
1075 | muPo = NumberByKey("muP", decayNote, "=", ",", 0) |
---|
1076 | err_muPo = NumberByKey("err_muP", decayNote, "=", ",", 0) |
---|
1077 | gam = NumberByKey("gamma", decayNote, "=", ",", 0) |
---|
1078 | err_gam = NumberByKey("err_gamma", decayNote, "=", ",", 0) |
---|
1079 | // get the elapsed time to calculate PCell at the current file time |
---|
1080 | t1str = getFileCreationDate(fname) |
---|
1081 | t1 = ElapsedHours(t0Str,t1Str) |
---|
1082 | |
---|
1083 | PCell = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t1,err_PCell) |
---|
1084 | |
---|
1085 | // get file info (monitor counts) |
---|
1086 | monCts = getMonitorCount(fname) |
---|
1087 | monCts /= 1e8 //just to get reasonable values |
---|
1088 | |
---|
1089 | Variable err_monCts |
---|
1090 | err_monCts = sqrt(monCts) |
---|
1091 | // add appropriate values to matrix elements (switch on UU, DD, etc) |
---|
1092 | // error in monCts is a negligible contribution |
---|
1093 | strswitch(pType) |
---|
1094 | case "UU": |
---|
1095 | row = 0 |
---|
1096 | if(ii==0) |
---|
1097 | matA[row][] = 0 |
---|
1098 | matA_err[row][] = 0 |
---|
1099 | endif |
---|
1100 | ea_uu = (1+Psm)/2 |
---|
1101 | ea_du = (1-Psm)/2 |
---|
1102 | ec_uu = (1+Pcell)/2 |
---|
1103 | ec_du = (1-Pcell)/2 |
---|
1104 | |
---|
1105 | matA[row][0] += ea_uu*ec_uu*monCts |
---|
1106 | matA[row][1] += ea_du*ec_uu*monCts |
---|
1107 | matA[row][2] += ea_du*ec_du*monCts |
---|
1108 | matA[row][3] += ea_uu*ec_du*monCts |
---|
1109 | |
---|
1110 | // this seems to be too large... |
---|
1111 | // matA_err[row][0] += (1/2*ec_uu*monCts)^2*err_Psm^2 + (1/2*ea_uu*monCts)^2*err_Pcell^2 |
---|
1112 | // matA_err[row][1] += (1/2*ec_uu*monCts)^2*err_Psm^2 + (1/2*ea_du*monCts)^2*err_Pcell^2 |
---|
1113 | // matA_err[row][2] += (1/2*ec_du*monCts)^2*err_Psm^2 + (1/2*ea_du*monCts)^2*err_Pcell^2 |
---|
1114 | // matA_err[row][3] += (1/2*ec_du*monCts)^2*err_Psm^2 + (1/2*ea_uu*monCts)^2*err_Pcell^2 |
---|
1115 | |
---|
1116 | matA_err[row][0] += (ea_uu*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1117 | matA_err[row][1] += (ea_du*ec_uu*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1118 | matA_err[row][2] += (ea_du*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1119 | matA_err[row][3] += (ea_uu*ec_du*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1120 | |
---|
1121 | break |
---|
1122 | case "DU": |
---|
1123 | row = 1 |
---|
1124 | if(ii==0) |
---|
1125 | matA[row][] = 0 |
---|
1126 | matA_err[row][] = 0 |
---|
1127 | endif |
---|
1128 | ea_ud = (1-PsmPf)/2 |
---|
1129 | ea_dd = (1+PsmPf)/2 |
---|
1130 | ec_uu = (1+Pcell)/2 |
---|
1131 | ec_du = (1-Pcell)/2 |
---|
1132 | |
---|
1133 | matA[row][0] += ea_ud*ec_uu*monCts |
---|
1134 | matA[row][1] += ea_dd*ec_uu*monCts |
---|
1135 | matA[row][2] += ea_dd*ec_du*monCts |
---|
1136 | matA[row][3] += ea_ud*ec_du*monCts |
---|
1137 | |
---|
1138 | // matA_err[row][0] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1139 | // matA_err[row][1] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1140 | // matA_err[row][2] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1141 | // matA_err[row][3] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1142 | |
---|
1143 | matA_err[row][0] += (ea_ud*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1144 | matA_err[row][1] += (ea_dd*ec_uu*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1145 | matA_err[row][2] += (ea_dd*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1146 | matA_err[row][3] += (ea_ud*ec_du*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1147 | |
---|
1148 | break |
---|
1149 | case "DD": |
---|
1150 | row = 2 |
---|
1151 | if(ii==0) |
---|
1152 | matA[row][] = 0 |
---|
1153 | matA_err[row][] = 0 |
---|
1154 | endif |
---|
1155 | ea_ud = (1-PsmPf)/2 |
---|
1156 | ea_dd = (1+PsmPf)/2 |
---|
1157 | ec_ud = (1-Pcell)/2 |
---|
1158 | ec_dd = (1+Pcell)/2 |
---|
1159 | |
---|
1160 | matA[row][0] += ea_ud*ec_ud*monCts |
---|
1161 | matA[row][1] += ea_dd*ec_ud*monCts |
---|
1162 | matA[row][2] += ea_dd*ec_dd*monCts |
---|
1163 | matA[row][3] += ea_ud*ec_dd*monCts |
---|
1164 | |
---|
1165 | // matA_err[row][0] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1166 | // matA_err[row][1] += (1/2*(1-Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1167 | // matA_err[row][2] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1+PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1168 | // matA_err[row][3] += (1/2*(1+Pcell)/2*monCts)^2*err_PsmPf^2 + (1/2*(1-PsmPf)/2*monCts)^2*err_Pcell^2 |
---|
1169 | |
---|
1170 | matA_err[row][0] += (ea_ud*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1171 | matA_err[row][1] += (ea_dd*ec_ud*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1172 | matA_err[row][2] += (ea_dd*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1173 | matA_err[row][3] += (ea_ud*ec_dd*monCts)^2 * (err_PsmPf^2/PsmPf^2 + err_Pcell^2/Pcell^2) |
---|
1174 | |
---|
1175 | break |
---|
1176 | case "UD": |
---|
1177 | row = 3 |
---|
1178 | if(ii==0) |
---|
1179 | matA[row][] = 0 |
---|
1180 | matA_err[row][] = 0 |
---|
1181 | endif |
---|
1182 | ea_uu = (1+Psm)/2 |
---|
1183 | ea_du = (1-Psm)/2 |
---|
1184 | ec_ud = (1-Pcell)/2 |
---|
1185 | ec_dd = (1+Pcell)/2 |
---|
1186 | |
---|
1187 | matA[row][0] += ea_uu*ec_ud*monCts |
---|
1188 | matA[row][1] += ea_du*ec_ud*monCts |
---|
1189 | matA[row][2] += ea_du*ec_dd*monCts |
---|
1190 | matA[row][3] += ea_uu*ec_dd*monCts |
---|
1191 | |
---|
1192 | // matA_err[row][0] += (1/2*(1-Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1+Psm)/2*monCts)^2*err_Pcell^2 |
---|
1193 | // matA_err[row][1] += (1/2*(1-Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1-Psm)/2*monCts)^2*err_Pcell^2 |
---|
1194 | // matA_err[row][2] += (1/2*(1+Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1-Psm)/2*monCts)^2*err_Pcell^2 |
---|
1195 | // matA_err[row][3] += (1/2*(1+Pcell)/2*monCts)^2*err_Psm^2 + (1/2*(1+Psm)/2*monCts)^2*err_Pcell^2 |
---|
1196 | |
---|
1197 | matA_err[row][0] += (ea_uu*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1198 | matA_err[row][1] += (ea_du*ec_ud*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1199 | matA_err[row][2] += (ea_du*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1200 | matA_err[row][3] += (ea_uu*ec_dd*monCts)^2 * (err_Psm^2/Psm^2 + err_Pcell^2/Pcell^2) |
---|
1201 | |
---|
1202 | break |
---|
1203 | endswitch |
---|
1204 | |
---|
1205 | |
---|
1206 | endif |
---|
1207 | endfor |
---|
1208 | |
---|
1209 | // can't take the SQRT here, since the matrix won't necessarily be full yet, |
---|
1210 | |
---|
1211 | |
---|
1212 | SetDataFolder root: |
---|
1213 | return(0) |
---|
1214 | End |
---|
1215 | |
---|
1216 | |
---|
1217 | // duplicate the correct waves for use as the PolCor result |
---|
1218 | // lots of extra waves, but it makes things easier down the road |
---|
1219 | // type is the data folder (=SAM, etc) |
---|
1220 | // pType is the pol extension (=UU, etc.) |
---|
1221 | Function MakePCResultWaves(type,pType) |
---|
1222 | String type,pType |
---|
1223 | |
---|
1224 | ptype = "_" + pType // add an extra underscore |
---|
1225 | String pcExt = "_pc" |
---|
1226 | String destPath = "root:Packages:NIST:" + type |
---|
1227 | Duplicate/O $(destPath + ":data"+pType), $(destPath + ":data"+pType+pcExt) |
---|
1228 | Duplicate/O $(destPath + ":linear_data"+pType),$(destPath + ":linear_data"+pType+pcExt) |
---|
1229 | Duplicate/O $(destPath + ":linear_data_error"+pType),$(destPath + ":linear_data_error"+pType+pcExt) |
---|
1230 | Duplicate/O $(destPath + ":textread"+pType),$(destPath + ":textread"+pType+pcExt) |
---|
1231 | Duplicate/O $(destPath + ":integersread"+pType),$(destPath + ":integersread"+pType+pcExt) |
---|
1232 | Duplicate/O $(destPath + ":realsread"+pType),$(destPath + ":realsread"+pType+pcExt) |
---|
1233 | |
---|
1234 | return(0) |
---|
1235 | End |
---|
1236 | |
---|
1237 | |
---|
1238 | // a function to tag the data in a particular folder with the UD state |
---|
1239 | Function TagLoadedData(type,pType) |
---|
1240 | String type,pType |
---|
1241 | |
---|
1242 | ConvertFolderToLinearScale(type) |
---|
1243 | |
---|
1244 | ptype = "_" + pType // add an extra underscore |
---|
1245 | String destPath = "root:Packages:NIST:" + type |
---|
1246 | Duplicate/O $(destPath + ":data"), $(destPath + ":data"+pType) |
---|
1247 | Duplicate/O $(destPath + ":linear_data"),$(destPath + ":linear_data"+pType) |
---|
1248 | Duplicate/O $(destPath + ":linear_data_error"),$(destPath + ":linear_data_error"+pType) |
---|
1249 | Duplicate/O $(destPath + ":textread"),$(destPath + ":textread"+pType) |
---|
1250 | Duplicate/O $(destPath + ":integersread"),$(destPath + ":integersread"+pType) |
---|
1251 | Duplicate/O $(destPath + ":realsread"),$(destPath + ":realsread"+pType) |
---|
1252 | |
---|
1253 | return(0) |
---|
1254 | End |
---|
1255 | |
---|
1256 | |
---|
1257 | // a procedure (easier than a function) to point the current data to the tagged data |
---|
1258 | Proc DisplayTaggedData(type,pType) |
---|
1259 | String type="SAM",pType="UU" |
---|
1260 | |
---|
1261 | String/G root:myGlobals:gDataDisplayType=type |
---|
1262 | ConvertFolderToLinearScale(type) |
---|
1263 | |
---|
1264 | ptype = "_" + pType // add an extra underscore |
---|
1265 | String destPath = "root:Packages:NIST:" + type |
---|
1266 | $(destPath + ":linear_data") = $(destPath + ":linear_data"+pType) |
---|
1267 | $(destPath + ":linear_data_error") = $(destPath + ":linear_data_error"+pType) |
---|
1268 | $(destPath + ":textread") = $(destPath + ":textread"+pType) |
---|
1269 | $(destPath + ":integersread") = $(destPath + ":integersread"+pType) |
---|
1270 | $(destPath + ":realsread") = $(destPath + ":realsread"+pType) |
---|
1271 | |
---|
1272 | // make the data equal to linear data |
---|
1273 | $(destPath + ":data") = $(destPath + ":linear_data"+pType) |
---|
1274 | |
---|
1275 | UpdateDisplayInformation(type) |
---|
1276 | // using fRawWindowHook() gets the log/lin correct |
---|
1277 | // fRawWindowHook() |
---|
1278 | |
---|
1279 | |
---|
1280 | End |
---|
1281 | |
---|
1282 | |
---|
1283 | // this takes the 4 loaded experimental cross sections, and solves for the |
---|
1284 | // polarization corrected result. |
---|
1285 | // |
---|
1286 | // exp cross sections have _UU extensions |
---|
1287 | // polCor result has _UU_pc |
---|
1288 | // |
---|
1289 | // |
---|
1290 | Function PolCorButton(ba) : ButtonControl |
---|
1291 | STRUCT WMButtonAction &ba |
---|
1292 | |
---|
1293 | switch( ba.eventCode ) |
---|
1294 | case 2: // mouse up |
---|
1295 | // click code here |
---|
1296 | |
---|
1297 | Variable ii,jj,numRows,numCols,row,kk |
---|
1298 | |
---|
1299 | // get the current tab |
---|
1300 | String type |
---|
1301 | Variable tabNum |
---|
1302 | ControlInfo/W=PolCor_Panel PolCorTab |
---|
1303 | type = S_value |
---|
1304 | Print "selected data type = ",type |
---|
1305 | tabNum = V_Value |
---|
1306 | |
---|
1307 | // make waves for the result |
---|
1308 | // these duplicate the data and add "_pc" for later use |
---|
1309 | // linear_data_error_UU_pc etc. are created |
---|
1310 | MakePCResultWaves(type,"UU") |
---|
1311 | MakePCResultWaves(type,"DU") |
---|
1312 | MakePCResultWaves(type,"DD") |
---|
1313 | MakePCResultWaves(type,"UD") |
---|
1314 | |
---|
1315 | |
---|
1316 | SetDataFolder $("root:Packages:NIST:"+type) |
---|
1317 | |
---|
1318 | // the linear data and its errors, declare and initialize |
---|
1319 | WAVE linear_data_UU_pc = linear_data_UU_pc |
---|
1320 | WAVE linear_data_DU_pc = linear_data_DU_pc |
---|
1321 | WAVE linear_data_DD_pc = linear_data_DD_pc |
---|
1322 | WAVE linear_data_UD_pc = linear_data_UD_pc |
---|
1323 | WAVE linear_data_error_UU_pc = linear_data_error_UU_pc |
---|
1324 | WAVE linear_data_error_DU_pc = linear_data_error_DU_pc |
---|
1325 | WAVE linear_data_error_DD_pc = linear_data_error_DD_pc |
---|
1326 | WAVE linear_data_error_UD_pc = linear_data_error_UD_pc |
---|
1327 | |
---|
1328 | linear_data_UU_pc = 0 |
---|
1329 | linear_data_DU_pc = 0 |
---|
1330 | linear_data_DD_pc = 0 |
---|
1331 | linear_data_UD_pc = 0 |
---|
1332 | linear_data_error_UU_pc = 0 |
---|
1333 | linear_data_error_DU_pc = 0 |
---|
1334 | linear_data_error_DD_pc = 0 |
---|
1335 | linear_data_error_UD_pc = 0 |
---|
1336 | |
---|
1337 | // make a temp wave for the experimental data vector |
---|
1338 | Make/O/D/N=4 vecB |
---|
1339 | WAVE vecB = vecB |
---|
1340 | |
---|
1341 | // the coefficient matrix and the experimental data |
---|
1342 | WAVE matA = $("root:Packages:NIST:"+type+":PolMatrix") |
---|
1343 | WAVE linear_data_UU = linear_data_UU |
---|
1344 | WAVE linear_data_DU = linear_data_DU |
---|
1345 | WAVE linear_data_DD = linear_data_DD |
---|
1346 | WAVE linear_data_UD = linear_data_UD |
---|
1347 | |
---|
1348 | // everything needed for the error calculation |
---|
1349 | // the PolMatrix error matrices |
---|
1350 | // and the data error |
---|
1351 | WAVE inv = Inv_PolMatrix |
---|
1352 | WAVE inv_err = Inv_PolMatrix_err |
---|
1353 | WAVE linear_data_error_UU = linear_data_error_UU |
---|
1354 | WAVE linear_data_error_DU = linear_data_error_DU |
---|
1355 | WAVE linear_data_error_DD = linear_data_error_DD |
---|
1356 | WAVE linear_data_error_UD = linear_data_error_UD |
---|
1357 | |
---|
1358 | numRows = DimSize(linear_data_UU_pc, 0 ) |
---|
1359 | numCols = DimSize(linear_data_UU_pc, 1 ) |
---|
1360 | |
---|
1361 | // this is certainly not slow. takes < 1 second to complete the double loop. |
---|
1362 | for(ii=0;ii<numRows;ii+=1) |
---|
1363 | for(jj=0;jj<numCols;jj+=1) |
---|
1364 | vecB[0] = linear_data_UU[ii][jj] |
---|
1365 | vecB[1] = linear_data_DU[ii][jj] |
---|
1366 | vecB[2] = linear_data_DD[ii][jj] |
---|
1367 | vecB[3] = linear_data_UD[ii][jj] |
---|
1368 | |
---|
1369 | MatrixLinearSolve/M=1 matA vecB |
---|
1370 | // result is M_B[][0] |
---|
1371 | WAVE M_B = M_B |
---|
1372 | linear_data_UU_pc[ii][jj] = M_B[0][0] |
---|
1373 | linear_data_DU_pc[ii][jj] = M_B[1][0] |
---|
1374 | linear_data_DD_pc[ii][jj] = M_B[2][0] |
---|
1375 | linear_data_UD_pc[ii][jj] = M_B[3][0] |
---|
1376 | |
---|
1377 | |
---|
1378 | // and the error at each pixel, once for each of the four |
---|
1379 | row = 0 //== UU |
---|
1380 | for(kk=0;kk<4;kk+=1) |
---|
1381 | linear_data_error_UU_pc[ii][jj] += inv_err[row][kk]^2*linear_data_UU[ii][jj]^2 + inv[row][kk]^2*linear_data_error_UU[ii][jj]^2 |
---|
1382 | endfor |
---|
1383 | row = 1 //== DU |
---|
1384 | for(kk=0;kk<4;kk+=1) |
---|
1385 | linear_data_error_DU_pc[ii][jj] += inv_err[row][kk]^2*linear_data_DU[ii][jj]^2 + inv[row][kk]^2*linear_data_error_DU[ii][jj]^2 |
---|
1386 | endfor |
---|
1387 | row = 2 //== DD |
---|
1388 | for(kk=0;kk<4;kk+=1) |
---|
1389 | linear_data_error_DD_pc[ii][jj] += inv_err[row][kk]^2*linear_data_DD[ii][jj]^2 + inv[row][kk]^2*linear_data_error_DD[ii][jj]^2 |
---|
1390 | endfor |
---|
1391 | row = 3 //== UD |
---|
1392 | for(kk=0;kk<4;kk+=1) |
---|
1393 | linear_data_error_UD_pc[ii][jj] += inv_err[row][kk]^2*linear_data_UD[ii][jj]^2 + inv[row][kk]^2*linear_data_error_UD[ii][jj]^2 |
---|
1394 | endfor |
---|
1395 | |
---|
1396 | |
---|
1397 | endfor |
---|
1398 | // Print ii |
---|
1399 | endfor |
---|
1400 | |
---|
1401 | // sqrt of the squared error... |
---|
1402 | linear_data_error_UU_pc = sqrt(linear_data_error_UU_pc) |
---|
1403 | linear_data_error_DU_pc = sqrt(linear_data_error_DU_pc) |
---|
1404 | linear_data_error_DD_pc = sqrt(linear_data_error_DD_pc) |
---|
1405 | linear_data_error_UD_pc = sqrt(linear_data_error_UD_pc) |
---|
1406 | |
---|
1407 | |
---|
1408 | //update the data as log of the linear. more correct to use the default scaling |
---|
1409 | // this is necessary for proper display of the data |
---|
1410 | WAVE data_UU_pc = data_UU_pc |
---|
1411 | WAVE data_DU_pc = data_DU_pc |
---|
1412 | WAVE data_DD_pc = data_DD_pc |
---|
1413 | WAVE data_UD_pc = data_UD_pc |
---|
1414 | data_UU_pc = log(linear_data_UU_pc) |
---|
1415 | data_DU_pc = log(linear_data_DU_pc) |
---|
1416 | data_DD_pc = log(linear_data_DD_pc) |
---|
1417 | data_UD_pc = log(linear_data_UD_pc) |
---|
1418 | |
---|
1419 | |
---|
1420 | SetDataFolder root: |
---|
1421 | |
---|
1422 | break |
---|
1423 | case -1: // control being killed |
---|
1424 | break |
---|
1425 | endswitch |
---|
1426 | |
---|
1427 | return 0 |
---|
1428 | End |
---|
1429 | |
---|
1430 | |
---|
1431 | // display all 4 XS at once in the same graph |
---|
1432 | // - crude right now |
---|
1433 | // |
---|
1434 | Function Display4XSButton(ba) : ButtonControl |
---|
1435 | STRUCT WMButtonAction &ba |
---|
1436 | |
---|
1437 | switch( ba.eventCode ) |
---|
1438 | case 2: // mouse up |
---|
1439 | // click code here |
---|
1440 | String dataType,pType,str,scaling |
---|
1441 | Prompt dataType,"Display WORK data type",popup,"SAM;EMP;BGD;DIV;COR;CAL;RAW;ABS;STO;SUB;DRK;SAS;" |
---|
1442 | // Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;UU_pc;DU_pc;DD_pc;UD_pc;" |
---|
1443 | Prompt scaling,"scaling",popup,"log;linear;" |
---|
1444 | DoPrompt "Change Display",dataType,scaling |
---|
1445 | |
---|
1446 | Display_4(dataType,scaling) |
---|
1447 | |
---|
1448 | break |
---|
1449 | case -1: // control being killed |
---|
1450 | break |
---|
1451 | endswitch |
---|
1452 | |
---|
1453 | return 0 |
---|
1454 | End |
---|
1455 | |
---|
1456 | |
---|
1457 | // Change the displayed SANS data by pointing the data with the |
---|
1458 | // specified tag (suffix) at data, linear_data, etc. |
---|
1459 | // all of the read waves are pointed too. |
---|
1460 | // |
---|
1461 | Function ChangeDisplayedPolData(ba) : ButtonControl |
---|
1462 | STRUCT WMButtonAction &ba |
---|
1463 | |
---|
1464 | switch( ba.eventCode ) |
---|
1465 | case 2: // mouse up |
---|
1466 | // click code here |
---|
1467 | String dataType,pType,str |
---|
1468 | Prompt dataType,"Display WORK data type",popup,"SAM;EMP;BGD;DIV;COR;CAL;RAW;ABS;STO;SUB;DRK;SAS;" |
---|
1469 | Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;UU_pc;DU_pc;DD_pc;UD_pc;" |
---|
1470 | DoPrompt "Change Display",dataType,pType |
---|
1471 | |
---|
1472 | sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType |
---|
1473 | Execute str |
---|
1474 | |
---|
1475 | break |
---|
1476 | case -1: // control being killed |
---|
1477 | break |
---|
1478 | endswitch |
---|
1479 | |
---|
1480 | return 0 |
---|
1481 | End |
---|
1482 | |
---|
1483 | |
---|
1484 | // display the 4x4 polariztion efficiency matrix in a table, and its inverse (if it exists) |
---|
1485 | Function ShowPolMatrixButton(ba) : ButtonControl |
---|
1486 | STRUCT WMButtonAction &ba |
---|
1487 | |
---|
1488 | switch( ba.eventCode ) |
---|
1489 | case 2: // mouse up |
---|
1490 | // click code here |
---|
1491 | |
---|
1492 | // get the current tab |
---|
1493 | String type |
---|
1494 | Variable tabNum |
---|
1495 | ControlInfo/W=PolCor_Panel PolCorTab |
---|
1496 | type = S_value |
---|
1497 | Print "selected data type = ",type |
---|
1498 | tabNum = V_Value |
---|
1499 | |
---|
1500 | Wave/Z Pol = $("root:Packages:NIST:"+type+":PolMatrix") |
---|
1501 | if(WaveExists(Pol)) |
---|
1502 | Edit/W=(5,44,510,251)/K=1 Pol |
---|
1503 | endif |
---|
1504 | Wave/Z Inv_Pol = $("root:Packages:NIST:"+type+":Inv_PolMatrix") |
---|
1505 | if(WaveExists(Inv_Pol)) |
---|
1506 | Edit/W=(6,506,511,713)/K=1 Inv_Pol |
---|
1507 | endif |
---|
1508 | Wave/Z Pol_err = $("root:Packages:NIST:"+type+":PolMatrix_err") |
---|
1509 | if(WaveExists(Pol_err)) |
---|
1510 | Edit/W=(5,275,510,482)/K=1 Pol_err |
---|
1511 | endif |
---|
1512 | Wave/Z Inv_Pol_err = $("root:Packages:NIST:"+type+":Inv_PolMatrix_err") |
---|
1513 | if(WaveExists(Inv_Pol_err)) |
---|
1514 | Edit/W=(6,736,511,943)/K=1 Inv_Pol_err |
---|
1515 | endif |
---|
1516 | |
---|
1517 | break |
---|
1518 | case -1: // control being killed |
---|
1519 | break |
---|
1520 | endswitch |
---|
1521 | |
---|
1522 | return 0 |
---|
1523 | End |
---|
1524 | |
---|
1525 | // return a list of conditions, prepended with "none" for use in a popup menu |
---|
1526 | Function/S P_GetConditionNameList() |
---|
1527 | return("none;"+D_ConditionNameList()) |
---|
1528 | End |
---|
1529 | |
---|
1530 | |
---|
1531 | // for a run, or a list of runs, determine the midpoint of the data collection |
---|
1532 | // |
---|
1533 | // list is passed COMMA-delimited, like normal lists of run numbers |
---|
1534 | // |
---|
1535 | // the time is returned in seconds (equivalent to a VAX date and time) |
---|
1536 | // |
---|
1537 | Function getTimeMidpoint(listStr) |
---|
1538 | String listStr |
---|
1539 | |
---|
1540 | Variable ii,t_first,runt_first,t_last,runt_last,elap,run,t1,num,tMid |
---|
1541 | String fname |
---|
1542 | |
---|
1543 | t1=0 |
---|
1544 | t_first = 1e100 |
---|
1545 | t_last = 0 |
---|
1546 | |
---|
1547 | num=itemsinlist(listStr,",") |
---|
1548 | for(ii=0;ii<num;ii+=1) |
---|
1549 | run = str2num( StringFromList(ii, listStr ,",") ) |
---|
1550 | fname = FindFileFromRunNumber(run) |
---|
1551 | t1 = ConvertVAXDateTime2Secs(getFileCreationDate(fname)) |
---|
1552 | if(t1 < t_first) |
---|
1553 | t_first = t1 |
---|
1554 | endif |
---|
1555 | if(t1 > t_last) |
---|
1556 | t_last = t1 |
---|
1557 | runt_last = getCountTime(fname) //seconds |
---|
1558 | endif |
---|
1559 | |
---|
1560 | endfor |
---|
1561 | // print/D t_last |
---|
1562 | // Print/D runt_last |
---|
1563 | // print/D t_first |
---|
1564 | |
---|
1565 | elap = (t_last + runt_last) - t_first // from start of first file, to end of last |
---|
1566 | |
---|
1567 | tMid = t_first + elap/2 |
---|
1568 | return(tMid) |
---|
1569 | End |
---|
1570 | |
---|
1571 | // options to reduce one or all types, in the same manner as the load. |
---|
1572 | // |
---|
1573 | // largely copied from ReduceAFile() |
---|
1574 | // |
---|
1575 | Function ReducePolCorDataButton(ctrlName) : ButtonControl |
---|
1576 | String ctrlName |
---|
1577 | |
---|
1578 | // depends on which tab you're on |
---|
1579 | // (maybe) select UD type |
---|
1580 | |
---|
1581 | String pType |
---|
1582 | // Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;All;" |
---|
1583 | // DoPrompt "Type to load",pType |
---|
1584 | // if (V_Flag) |
---|
1585 | // return 0 // user canceled |
---|
1586 | // endif |
---|
1587 | // Print pType |
---|
1588 | |
---|
1589 | |
---|
1590 | pType = "All" |
---|
1591 | |
---|
1592 | // get the protocol to use |
---|
1593 | // this is pulled from ReduceAFile() |
---|
1594 | Variable err |
---|
1595 | String waveStr |
---|
1596 | |
---|
1597 | //pick a protocol wave from the Protocols folder |
---|
1598 | //must switch to protocols folder to get wavelist (missing parameter) |
---|
1599 | SetDataFolder root:myGlobals:Protocols |
---|
1600 | Execute "PickAProtocol()" |
---|
1601 | |
---|
1602 | //get the selected protocol wave choice through a global string variable |
---|
1603 | SVAR protocolName = root:myGlobals:Protocols:gProtoStr |
---|
1604 | |
---|
1605 | //If "CreateNew" was selected, go to the questionnare, to make a new set |
---|
1606 | //and put the name of the new Protocol wave in gProtoStr |
---|
1607 | if(cmpstr("CreateNew",protocolName) == 0) |
---|
1608 | return(0) |
---|
1609 | Endif |
---|
1610 | |
---|
1611 | //give the full path:name to the executeProtocol function |
---|
1612 | waveStr = "root:myGlobals:Protocols:"+protocolName |
---|
1613 | //samStr is set at top to "ask", since this is the action always desired from "ReduceAFile" |
---|
1614 | |
---|
1615 | //return data folder to root before Macro is done |
---|
1616 | SetDataFolder root: |
---|
1617 | |
---|
1618 | if(cmpstr(pType,"All") == 0) |
---|
1619 | ExecutePolarizedProtocol(waveStr,"UU") |
---|
1620 | ExecutePolarizedProtocol(waveStr,"DU") |
---|
1621 | ExecutePolarizedProtocol(waveStr,"DD") |
---|
1622 | ExecutePolarizedProtocol(waveStr,"UD") |
---|
1623 | else |
---|
1624 | ExecutePolarizedProtocol(waveStr,pType) |
---|
1625 | endif |
---|
1626 | |
---|
1627 | |
---|
1628 | return(0) |
---|
1629 | End |
---|
1630 | |
---|
1631 | // very similar to ExecuteProtocol |
---|
1632 | // |
---|
1633 | // -- SAM, EMP, and BGD do not need to be loaded |
---|
1634 | // -- but they do need to be "moved" into the regular data positions |
---|
1635 | // rather then their tagged locations. |
---|
1636 | // |
---|
1637 | // -- the "extensions" now all are "_UU_pc" and similar, to use the polarization corrected data and errors |
---|
1638 | // |
---|
1639 | Function ExecutePolarizedProtocol(protStr,pType) |
---|
1640 | String protStr,pType |
---|
1641 | |
---|
1642 | //protStr is the full path to the selected protocol wave |
---|
1643 | WAVE/T prot = $protStr |
---|
1644 | SetDataFolder root:myGlobals:Protocols |
---|
1645 | |
---|
1646 | Variable filesOK,err,notDone |
---|
1647 | String activeType, msgStr, junkStr, pathStr="", samStr="" |
---|
1648 | PathInfo catPathName //this is where the files are |
---|
1649 | pathStr=S_path |
---|
1650 | |
---|
1651 | NVAR useXMLOutput = root:Packages:NIST:gXML_Write |
---|
1652 | |
---|
1653 | //Parse the instructions in the prot wave |
---|
1654 | //0 - bkg |
---|
1655 | //1 - emp |
---|
1656 | //2 - div |
---|
1657 | //3 - mask |
---|
1658 | //4 - abs params c2-c5 |
---|
1659 | //5 - average params |
---|
1660 | //6 = DRK file (**out of sequence) |
---|
1661 | |
---|
1662 | // don't load the SAM data, just re-tag it |
---|
1663 | // the Polarization corrected data is UU_pc, DU_pc, etc. |
---|
1664 | // this tags it for display, and puts it in the correctly named waves |
---|
1665 | String dataType,str |
---|
1666 | |
---|
1667 | dataType="SAM" |
---|
1668 | sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" |
---|
1669 | Execute str |
---|
1670 | |
---|
1671 | |
---|
1672 | |
---|
1673 | // don't load the BGD data, just re-tag it |
---|
1674 | if(cmpstr(prot[0],"none") != 0) //if BGD is used, protStr[0] = "" |
---|
1675 | dataType="BGD" |
---|
1676 | sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" |
---|
1677 | Execute str |
---|
1678 | endif |
---|
1679 | |
---|
1680 | // don't load the EMP data, just re-tag it |
---|
1681 | // |
---|
1682 | if(cmpstr(prot[1],"none") != 0) //if EMP is used, protStr[1] = "" |
---|
1683 | dataType="EMP" |
---|
1684 | sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" |
---|
1685 | Execute str |
---|
1686 | endif |
---|
1687 | |
---|
1688 | // |
---|
1689 | // from here down, the steps are identical |
---|
1690 | // |
---|
1691 | // - with the exceptions of: |
---|
1692 | // - file naming. Names are additionally tagged with pType |
---|
1693 | // - if the protocol[0] or [1] are "" <null>, then the step will be used |
---|
1694 | // the step is only skipped if the protocol is "none" |
---|
1695 | // |
---|
1696 | |
---|
1697 | |
---|
1698 | //do the CORRECT step based on the answers to emp and bkg subtraction |
---|
1699 | //by setting the proper"mode" |
---|
1700 | //1 = both emp and bgd subtraction |
---|
1701 | //2 = only bgd subtraction |
---|
1702 | //3 = only emp subtraction |
---|
1703 | //4 = no subtraction |
---|
1704 | //additional modes 091301 |
---|
1705 | // ------currently, for polarized reduction, DRK mode is not allowed or recognized at all... |
---|
1706 | //11 = emp, bgd, drk |
---|
1707 | //12 = bgd and drk |
---|
1708 | //13 = emp and drk |
---|
1709 | //14 = no subtractions |
---|
1710 | //work.drk is from proto[6] |
---|
1711 | // |
---|
1712 | //subtracting just the DRK data is NOT an option - it doesnt' really make any physical sense |
---|
1713 | // - in this case, DRK is skipped (equivalent to mode==4) |
---|
1714 | // automatically accounts for attenuators given the lookup tables and the |
---|
1715 | //desired subtractions |
---|
1716 | //Attenuator lookup tables are alredy implemented (NG1 = NG7) |
---|
1717 | // |
---|
1718 | |
---|
1719 | //dispatch to the proper "mode" of Correct() |
---|
1720 | Variable mode=4,val |
---|
1721 | do |
---|
1722 | if( (cmpstr("none",prot[0]) == 0) && (cmpstr("none",prot[1]) == 0) ) |
---|
1723 | //no subtraction (mode = 4), |
---|
1724 | mode = 4 |
---|
1725 | Endif |
---|
1726 | If((cmpstr(prot[0],"none") != 0) && (cmpstr(prot[1],"none") == 0)) |
---|
1727 | //subtract BGD only |
---|
1728 | mode=2 |
---|
1729 | Endif |
---|
1730 | If((cmpstr(prot[0],"none") == 0) && (cmpstr(prot[1],"none") != 0)) |
---|
1731 | //subtract EMP only |
---|
1732 | mode=3 |
---|
1733 | Endif |
---|
1734 | If((cmpstr(prot[0],"none") != 0) && (cmpstr(prot[1],"none") != 0)) |
---|
1735 | // bkg and emp subtraction are to be done (BOTH not "none") |
---|
1736 | mode=1 |
---|
1737 | Endif |
---|
1738 | activeType = "COR" |
---|
1739 | // //add in DRK mode (0= no used, 10 = used) |
---|
1740 | // val = NumberByKey("DRKMODE",prot[6],"=","," ) |
---|
1741 | // mode += val |
---|
1742 | // print "Correct mode = ",mode |
---|
1743 | err = Correct(mode) |
---|
1744 | if(err) |
---|
1745 | SetDataFolder root: |
---|
1746 | Abort "error in Correct, called from executeprotocol, normal cor" |
---|
1747 | endif |
---|
1748 | TagLoadedData(activeType,pType+"_pc") |
---|
1749 | UpdateDisplayInformation(ActiveType) //update before breaking from loop |
---|
1750 | While(0) |
---|
1751 | |
---|
1752 | //check for work.div file (prot[2]) |
---|
1753 | //add if needed |
---|
1754 | // can't properly check the filename - so for now add and divide, if anything other than "none" |
---|
1755 | //do/skip divide step based on div answer |
---|
1756 | If(cmpstr("none",prot[2])!=0) // if !0, then there's a file requested |
---|
1757 | If(cmpstr("ask",prot[2]) == 0) |
---|
1758 | //ask user for file |
---|
1759 | junkStr = PromptForPath("Select the detector sensitivity file") |
---|
1760 | If(strlen(junkStr)==0) |
---|
1761 | SetDataFolder root: |
---|
1762 | Abort "No file selected, data reduction aborted" |
---|
1763 | Endif |
---|
1764 | ReadHeaderAndWork("DIV", junkStr) |
---|
1765 | else |
---|
1766 | //assume it's a path, and that the first (and only) item is the path:file |
---|
1767 | //list processing is necessary to remove any final comma |
---|
1768 | junkStr = pathStr + StringFromList(0, prot[2],"," ) |
---|
1769 | ReadHeaderAndWork("DIV",junkStr) |
---|
1770 | Endif |
---|
1771 | //got a DIV file, select the proper type of work data to DIV (= activeType) |
---|
1772 | err = Divide_work(activeType) //returns err = 1 if data doesn't exist in specified folders |
---|
1773 | If(err) |
---|
1774 | SetDataFolder root: |
---|
1775 | Abort "data missing in DIV step, call from executeProtocol" |
---|
1776 | Endif |
---|
1777 | activeType = "CAL" |
---|
1778 | TagLoadedData(activeType,pType+"_pc") |
---|
1779 | UpdateDisplayInformation(ActiveType) //update before breaking from loop |
---|
1780 | Endif |
---|
1781 | |
---|
1782 | Variable c2,c3,c4,c5,kappa_err |
---|
1783 | //do absolute scaling if desired |
---|
1784 | if(cmpstr("none",prot[4])!=0) |
---|
1785 | if(cmpstr("ask",prot[4])==0) |
---|
1786 | //get the params from the user |
---|
1787 | Execute "AskForAbsoluteParams_Quest()" |
---|
1788 | //then from the list |
---|
1789 | SVAR junkAbsStr = root:myGlobals:Protocols:gAbsStr |
---|
1790 | c2 = NumberByKey("TSTAND", junkAbsStr, "=", ";") //parse the list of values |
---|
1791 | c3 = NumberByKey("DSTAND", junkAbsStr, "=", ";") |
---|
1792 | c4 = NumberByKey("IZERO", junkAbsStr, "=", ";") |
---|
1793 | c5 = NumberByKey("XSECT", junkAbsStr, "=", ";") |
---|
1794 | kappa_err = NumberByKey("SDEV", junkAbsStr, "=", ";") |
---|
1795 | else |
---|
1796 | //get the parames from the list |
---|
1797 | c2 = NumberByKey("TSTAND", prot[4], "=", ";") //parse the list of values |
---|
1798 | c3 = NumberByKey("DSTAND", prot[4], "=", ";") |
---|
1799 | c4 = NumberByKey("IZERO", prot[4], "=", ";") |
---|
1800 | c5 = NumberByKey("XSECT", prot[4], "=", ";") |
---|
1801 | kappa_err = NumberByKey("SDEV", prot[4], "=", ";") |
---|
1802 | Endif |
---|
1803 | //get the sample trans and thickness from the activeType folder |
---|
1804 | String destStr = "root:Packages:NIST:"+activeType+":realsread" |
---|
1805 | Wave dest = $destStr |
---|
1806 | Variable c0 = dest[4] //sample transmission |
---|
1807 | Variable c1 = dest[5] //sample thickness |
---|
1808 | |
---|
1809 | err = Absolute_Scale(activeType,c0,c1,c2,c3,c4,c5,kappa_err) |
---|
1810 | if(err) |
---|
1811 | SetDataFolder root: |
---|
1812 | Abort "Error in Absolute_Scale(), called from executeProtocol" |
---|
1813 | endif |
---|
1814 | activeType = "ABS" |
---|
1815 | TagLoadedData(activeType,pType+"_pc") |
---|
1816 | UpdateDisplayInformation(ActiveType) //update before breaking from loop |
---|
1817 | Endif |
---|
1818 | |
---|
1819 | //check for mask |
---|
1820 | //add mask if needed |
---|
1821 | // can't properly check the filename - so for now always add |
---|
1822 | //doesn't change the activeType |
---|
1823 | if(cmpstr("none",prot[3])!=0) |
---|
1824 | If(cmpstr("ask",prot[3])==0) |
---|
1825 | //get file from user |
---|
1826 | junkStr = PromptForPath("Select Mask file") |
---|
1827 | If(strlen(junkStr)==0) |
---|
1828 | //no selection of mask file is not a fatal error, keep going, and let cirave() |
---|
1829 | //make a "null" mask |
---|
1830 | //if none desired, make sure that the old mask is deleted |
---|
1831 | //junkStr = GetDataFolder(1) |
---|
1832 | //SetDataFolder root:Packages:NIST:MSK |
---|
1833 | KillWaves/Z root:Packages:NIST:MSK:data |
---|
1834 | //SetDataFolder junkStr |
---|
1835 | DoAlert 0,"No Mask file selected, data not masked" |
---|
1836 | else |
---|
1837 | //read in the file from the dialog |
---|
1838 | ReadMCID_MASK(junkStr) |
---|
1839 | Endif |
---|
1840 | else |
---|
1841 | //just read it in from the protocol |
---|
1842 | //list processing is necessary to remove any final comma |
---|
1843 | junkStr = pathStr + StringFromList(0, prot[3],"," ) |
---|
1844 | ReadMCID_MASK(junkStr) |
---|
1845 | Endif |
---|
1846 | else |
---|
1847 | //if none desired, make sure that the old mask is deleted |
---|
1848 | //junkStr = GetDataFolder(1) |
---|
1849 | //SetDataFolder root:Packages:NIST:MSK |
---|
1850 | KillWaves/Z root:Packages:NIST:MSK:data |
---|
1851 | //SetDataFolder junkStr |
---|
1852 | Endif |
---|
1853 | |
---|
1854 | //mask data if desired (this is done automatically in the average step) and is |
---|
1855 | //not done explicitly here (if no mask in MSK folder, a null mask is created and "used") |
---|
1856 | |
---|
1857 | // average/save data as specified |
---|
1858 | |
---|
1859 | //Parse the keyword=<Value> string as needed, based on AVTYPE |
---|
1860 | |
---|
1861 | //average/plot first |
---|
1862 | String av_type = StringByKey("AVTYPE",prot[5],"=",";") |
---|
1863 | If(cmpstr(av_type,"none") != 0) |
---|
1864 | If (cmpstr(av_type,"")==0) //if the key could not be found... (if "ask" the string) |
---|
1865 | //get the averaging parameters from the user, as if the set button was hit |
---|
1866 | //in the panel |
---|
1867 | SetAverageParamsButtonProc("dummy") //from "ProtocolAsPanel" |
---|
1868 | SVAR tempAveStr = root:myGlobals:Protocols:gAvgInfoStr |
---|
1869 | av_type = StringByKey("AVTYPE",tempAveStr,"=",";") |
---|
1870 | else |
---|
1871 | //there is info in the string, use the protocol |
---|
1872 | //set the global keyword-string to prot[5] |
---|
1873 | String/G root:myGlobals:Protocols:gAvgInfoStr = prot[5] |
---|
1874 | Endif |
---|
1875 | Endif |
---|
1876 | |
---|
1877 | //convert the folder to linear scale before averaging, then revert by calling the window hook |
---|
1878 | ConvertFolderToLinearScale(activeType) |
---|
1879 | |
---|
1880 | strswitch(av_type) //dispatch to the proper routine to average to 1D data |
---|
1881 | case "none": |
---|
1882 | //still do nothing |
---|
1883 | break |
---|
1884 | case "2D_ASCII": |
---|
1885 | //do nothing |
---|
1886 | break |
---|
1887 | case "QxQy_ASCII": |
---|
1888 | //do nothing |
---|
1889 | break |
---|
1890 | case "PNG_Graphic": |
---|
1891 | //do nothing |
---|
1892 | break |
---|
1893 | case "Rectangular": |
---|
1894 | RectangularAverageTo1D(activeType) |
---|
1895 | break |
---|
1896 | case "Annular": |
---|
1897 | AnnularAverageTo1D(activeType) |
---|
1898 | break |
---|
1899 | case "Circular": |
---|
1900 | CircularAverageTo1D(activeType) |
---|
1901 | break |
---|
1902 | case "Sector": |
---|
1903 | CircularAverageTo1D(activeType) |
---|
1904 | break |
---|
1905 | case "Sector_PlusMinus": |
---|
1906 | Sector_PlusMinus1D(activeType) |
---|
1907 | break |
---|
1908 | default: |
---|
1909 | //do nothing |
---|
1910 | endswitch |
---|
1911 | ///// end of averaging dispatch |
---|
1912 | // put data back on log or lin scale as set by default |
---|
1913 | fRawWindowHook() |
---|
1914 | |
---|
1915 | //save data if desired |
---|
1916 | String fullpath = "", newfileName="" |
---|
1917 | String item = StringByKey("SAVE",prot[5],"=",";") //does user want to save data? |
---|
1918 | If( (cmpstr(item,"Yes")==0) && (cmpstr(av_type,"none") != 0) ) |
---|
1919 | //then save |
---|
1920 | //get name from textwave of the activeType dataset |
---|
1921 | String textStr = "root:Packages:NIST:"+activeType+":textread" |
---|
1922 | Wave/T textPath = $textStr |
---|
1923 | String tempFilename = samStr |
---|
1924 | If(WaveExists(textPath) == 1) |
---|
1925 | #if (exists("QUOKKA")==6) |
---|
1926 | newFileName = ReplaceString(".nx.hdf", tempFilename, "") |
---|
1927 | #elif (exists("HFIR")==6) |
---|
1928 | // newFileName = ReplaceString(".xml",textPath[0],"") //removes 4 chars |
---|
1929 | // newFileName = ReplaceString("SANS",newFileName,"") //removes 4 more chars = 8 |
---|
1930 | // newFileName = ReplaceString("exp",newFileName,"") //removes 3 more chars = 11 |
---|
1931 | // newFileName = ReplaceString("scan",newFileName,"") //removes 4 more chars = 15, should be enough? |
---|
1932 | newFileName = GetPrefixStrFromFile(textPath[0])+GetRunNumStrFromFile(textPath[0]) |
---|
1933 | #else |
---|
1934 | newFileName = UpperStr(GetNameFromHeader(textPath[0])) //NCNR data drops here, trims to 8 chars |
---|
1935 | #endif |
---|
1936 | else |
---|
1937 | newFileName = "" //if the header is missing? |
---|
1938 | //Print "can't read the header - newfilename is null" |
---|
1939 | Endif |
---|
1940 | |
---|
1941 | //pick ABS or AVE extension |
---|
1942 | String exten = activeType |
---|
1943 | if(cmpstr(exten,"ABS") != 0) |
---|
1944 | exten = "AVE" |
---|
1945 | endif |
---|
1946 | if(cmpstr(av_type,"2D_ASCII") == 0) |
---|
1947 | exten = "ASC" |
---|
1948 | endif |
---|
1949 | if(cmpstr(av_type,"QxQy_ASCII") == 0) |
---|
1950 | exten = "DAT" |
---|
1951 | endif |
---|
1952 | |
---|
1953 | // add an "x" to the file extension if the output is XML |
---|
1954 | // currently (2010), only for ABS and AVE (1D) output |
---|
1955 | if( cmpstr(exten,"ABS") == 0 || cmpstr(exten,"AVE") == 0 ) |
---|
1956 | if(useXMLOutput == 1) |
---|
1957 | exten += "x" |
---|
1958 | endif |
---|
1959 | endif |
---|
1960 | |
---|
1961 | //Path is catPathName, symbolic path |
---|
1962 | //if this doesn't exist, a dialog will be presented by setting dialog = 1 |
---|
1963 | // |
---|
1964 | // -- add in pType tag to the name |
---|
1965 | // |
---|
1966 | Variable dialog = 0 |
---|
1967 | PathInfo/S catPathName |
---|
1968 | item = StringByKey("NAME",prot[5],"=",";") //Auto or Manual naming |
---|
1969 | String autoname = StringByKey("AUTONAME",prot[5],"=",";") //autoname - will get empty string if not present |
---|
1970 | If((cmpstr(item,"Manual")==0) || (cmpstr(newFileName,"") == 0)) |
---|
1971 | //manual name if requested or if no name can be derived from header |
---|
1972 | fullPath = newfileName + pType + "."+ exten //puts possible new name or null string in dialog |
---|
1973 | dialog = 1 //force dialog for user to enter name |
---|
1974 | else |
---|
1975 | //auto-generate name and prepend path - won't put up any dialogs since it has all it needs |
---|
1976 | //use autoname if present |
---|
1977 | if (cmpstr(autoname,"") != 0) |
---|
1978 | fullPath = S_Path + autoname + pType + "." +exten |
---|
1979 | else |
---|
1980 | fullPath = S_Path + newFileName + pType + "." + exten |
---|
1981 | endif |
---|
1982 | Endif |
---|
1983 | // |
---|
1984 | strswitch(av_type) |
---|
1985 | case "Annular": |
---|
1986 | WritePhiave_W_Protocol(activeType,fullPath,dialog) |
---|
1987 | break |
---|
1988 | case "2D_ASCII": |
---|
1989 | Fast2DExport(activeType,fullPath,dialog) |
---|
1990 | break |
---|
1991 | case "QxQy_ASCII": |
---|
1992 | QxQy_Export(activeType,fullPath,dialog) |
---|
1993 | break |
---|
1994 | case "PNG_Graphic": |
---|
1995 | SaveAsPNG(activeType,fullpath,dialog) |
---|
1996 | break |
---|
1997 | default: |
---|
1998 | if (useXMLOutput == 1) |
---|
1999 | WriteXMLWaves_W_Protocol(activeType,fullPath,dialog) |
---|
2000 | else |
---|
2001 | WriteWaves_W_Protocol(activeType,fullpath,dialog) |
---|
2002 | endif |
---|
2003 | endswitch |
---|
2004 | |
---|
2005 | //Print "data written to: "+ fullpath |
---|
2006 | Endif |
---|
2007 | |
---|
2008 | //done with everything in protocol list |
---|
2009 | return(0) |
---|
2010 | End |
---|
2011 | |
---|
2012 | |
---|
2013 | // just like the RecallProtocolButton |
---|
2014 | // - the reset function is different |
---|
2015 | // |
---|
2016 | Function RecallPolCorProtocolButton(ctrlName) : ButtonControl |
---|
2017 | String ctrlName |
---|
2018 | |
---|
2019 | //will reset panel values based on a previously saved protocol |
---|
2020 | //pick a protocol wave from the Protocols folder |
---|
2021 | //MUST move to Protocols folder to get wavelist |
---|
2022 | SetDataFolder root:myGlobals:Protocols |
---|
2023 | Execute "PickAProtocol()" |
---|
2024 | |
---|
2025 | //get the selected protocol wave choice through a global string variable |
---|
2026 | SVAR protocolName = root:myGlobals:Protocols:gProtoStr |
---|
2027 | |
---|
2028 | //If "CreateNew" was selected, ask user to try again |
---|
2029 | if(cmpstr("CreateNew",protocolName) == 0) |
---|
2030 | Abort "CreateNew is for making a new Protocol. Select a previously saved Protocol" |
---|
2031 | Endif |
---|
2032 | |
---|
2033 | //reset the panel based on the protocol textwave (currently a string) |
---|
2034 | ResetToSavedPolProtocol(protocolName) |
---|
2035 | |
---|
2036 | SetDataFolder root: |
---|
2037 | return(0) |
---|
2038 | end |
---|
2039 | |
---|
2040 | //function that actually parses the protocol specified by nameStr |
---|
2041 | //which is just the name of the wave, without a datafolder path |
---|
2042 | // |
---|
2043 | Function ResetToSavedPolProtocol(nameStr) |
---|
2044 | String nameStr |
---|
2045 | |
---|
2046 | //allow special cases of Base and DoAll Protocols to be recalled to panel - since they "ask" |
---|
2047 | //and don't need paths |
---|
2048 | |
---|
2049 | String catPathStr |
---|
2050 | PathInfo catPathName |
---|
2051 | catPathStr=S_path |
---|
2052 | |
---|
2053 | //SetDataFolder root:myGlobals:Protocols //on windows, data folder seems to get reset (erratically) to root: |
---|
2054 | Wave/T w=$("root:myGlobals:Protocols:" + nameStr) |
---|
2055 | |
---|
2056 | String fullPath="",comma=",",list="",nameList="",PathStr="",item="" |
---|
2057 | Variable ii=0,numItems,checked,specialProtocol=0 |
---|
2058 | |
---|
2059 | if((cmpstr(nameStr,"Base")==0) || (cmpstr(nameStr,"DoAll")==0)) |
---|
2060 | return(0) //don't allow these |
---|
2061 | Endif |
---|
2062 | |
---|
2063 | //background = check5 |
---|
2064 | checked = 1 |
---|
2065 | nameList = w[0] |
---|
2066 | If(cmpstr(nameList,"none") ==0) |
---|
2067 | checked = 0 |
---|
2068 | Endif |
---|
2069 | |
---|
2070 | //set the global string to display and checkbox |
---|
2071 | CheckBox check5 win=PolCor_Panel,value=checked |
---|
2072 | |
---|
2073 | //EMP = check4 |
---|
2074 | checked = 1 |
---|
2075 | nameList = w[1] |
---|
2076 | If(cmpstr(nameList,"none") ==0) |
---|
2077 | checked = 0 |
---|
2078 | Endif |
---|
2079 | |
---|
2080 | //set the global string to display and checkbox |
---|
2081 | CheckBox check4 win=PolCor_Panel,value=checked |
---|
2082 | |
---|
2083 | |
---|
2084 | //DIV file |
---|
2085 | checked = 1 |
---|
2086 | nameList = w[2] |
---|
2087 | If(cmpstr(nameList,"none") ==0) |
---|
2088 | checked = 0 |
---|
2089 | Endif |
---|
2090 | |
---|
2091 | //set the global string to display and checkbox |
---|
2092 | String/G root:myGlobals:Protocols:gDIV = nameList |
---|
2093 | CheckBox check0 win=PolCor_Panel,value=checked |
---|
2094 | |
---|
2095 | //Mask file |
---|
2096 | checked = 1 |
---|
2097 | nameList = w[3] |
---|
2098 | If(cmpstr(nameList,"none") ==0) |
---|
2099 | checked = 0 |
---|
2100 | Endif |
---|
2101 | |
---|
2102 | //set the global string to display and checkbox |
---|
2103 | String/G root:myGlobals:Protocols:gMASK = nameList |
---|
2104 | CheckBox check1 win=PolCor_Panel,value=checked |
---|
2105 | |
---|
2106 | //4 = abs parameters |
---|
2107 | list = w[4] |
---|
2108 | numItems = ItemsInList(list,";") |
---|
2109 | checked = 1 |
---|
2110 | if(numitems == 4 || numitems == 5) //allow for protocols with no SDEV list item |
---|
2111 | //correct number of parameters, assume ok |
---|
2112 | String/G root:myGlobals:Protocols:gAbsStr = list |
---|
2113 | CheckBox check2 win=PolCor_Panel,value=checked |
---|
2114 | else |
---|
2115 | item = StringFromList(0,list,";") |
---|
2116 | if(cmpstr(item,"none")==0) |
---|
2117 | checked = 0 |
---|
2118 | list = "none" |
---|
2119 | String/G root:myGlobals:Protocols:gAbsStr = list |
---|
2120 | CheckBox check2 win=PolCor_Panel,value=checked |
---|
2121 | else |
---|
2122 | //force to "ask" |
---|
2123 | checked = 1 |
---|
2124 | String/G root:myGlobals:Protocols:gAbsStr = "ask" |
---|
2125 | CheckBox check2 win=PolCor_Panel,value=checked |
---|
2126 | Endif |
---|
2127 | Endif |
---|
2128 | |
---|
2129 | //5 = averaging choices |
---|
2130 | list = w[5] |
---|
2131 | item = StringByKey("AVTYPE",list,"=",";") |
---|
2132 | if(cmpstr(item,"none") == 0) |
---|
2133 | checked = 0 |
---|
2134 | String/G root:myGlobals:Protocols:gAVE = "none" |
---|
2135 | CheckBox check3 win=PolCor_Panel,value=checked |
---|
2136 | else |
---|
2137 | checked = 1 |
---|
2138 | String/G root:myGlobals:Protocols:gAVE = list |
---|
2139 | CheckBox check3 win=PolCor_Panel,value=checked |
---|
2140 | Endif |
---|
2141 | |
---|
2142 | //6 = DRK choice |
---|
2143 | |
---|
2144 | //7 = unused |
---|
2145 | |
---|
2146 | //all has been reset, get out |
---|
2147 | Return (0) |
---|
2148 | End |
---|
2149 | |
---|
2150 | // at a first pass, uses the regular reduction protocol SaveProtocolButton(ctrlName) |
---|
2151 | // |
---|
2152 | // -- won't work, as it uses the MakeProtocolFromPanel function... so replace this |
---|
2153 | // |
---|
2154 | Function SavePolCorProtocolButton(ctrlName) : ButtonControl |
---|
2155 | String ctrlName |
---|
2156 | |
---|
2157 | |
---|
2158 | Variable notDone=1, newProto=1 |
---|
2159 | //will prompt for protocol name, and save the protocol as a text wave |
---|
2160 | //prompt for name of new protocol wave to save |
---|
2161 | do |
---|
2162 | Execute "AskForName()" |
---|
2163 | SVAR newProtocol = root:myGlobals:Protocols:gNewStr |
---|
2164 | |
---|
2165 | //make sure it's a valid IGOR name |
---|
2166 | newProtocol = CleanupName(newProtocol,0) //strict naming convention |
---|
2167 | String/G root:myGlobals:Protocols:gNewStr=newProtocol //reassign, if changed |
---|
2168 | Print "newProtocol = ",newProtocol |
---|
2169 | |
---|
2170 | SetDataFolder root:myGlobals:Protocols |
---|
2171 | if(WaveExists( $("root:myGlobals:Protocols:" + newProtocol) ) == 1) |
---|
2172 | //wave already exists |
---|
2173 | DoAlert 1,"That name is already in use. Do you wish to overwrite the existing protocol?" |
---|
2174 | if(V_Flag==1) |
---|
2175 | notDone = 0 |
---|
2176 | newProto = 0 |
---|
2177 | else |
---|
2178 | notDone = 1 |
---|
2179 | endif |
---|
2180 | else |
---|
2181 | //name is good |
---|
2182 | notDone = 0 |
---|
2183 | Endif |
---|
2184 | while(notDone) |
---|
2185 | |
---|
2186 | //current data folder is root:myGlobals:Protocols |
---|
2187 | if(newProto) |
---|
2188 | Make/O/T/N=8 $("root:myGlobals:Protocols:" + newProtocol) |
---|
2189 | Endif |
---|
2190 | |
---|
2191 | // MakeProtocolFromPanel( $("root:myGlobals:Protocols:" + newProtocol) ) |
---|
2192 | MakePolProtocolFromPanel( $("root:myGlobals:Protocols:" + newProtocol) ) |
---|
2193 | String/G root:myGlobals:Protocols:gProtoStr = newProtocol |
---|
2194 | |
---|
2195 | //the data folder WAS changed above, this must be reset to root: |
---|
2196 | SetDatafolder root: |
---|
2197 | |
---|
2198 | return(0) |
---|
2199 | End |
---|
2200 | |
---|
2201 | //function that does the guts of reading the panel controls and globals |
---|
2202 | //to create the necessary text fields for a protocol |
---|
2203 | //Wave/T w (input) is an empty text wave of 8 elements for the protocol |
---|
2204 | //on output, w[] is filled with the protocol strings as needed from the panel |
---|
2205 | // |
---|
2206 | Function MakePolProtocolFromPanel(w) |
---|
2207 | Wave/T w |
---|
2208 | |
---|
2209 | //construct the protocol text wave form the panel |
---|
2210 | //it is to be parsed by ExecuteProtocol() for the actual data reduction |
---|
2211 | PathInfo catPathName //this is where the files came from |
---|
2212 | String pathstr=S_path,tempStr,curList |
---|
2213 | Variable checked,ii,numItems |
---|
2214 | |
---|
2215 | //look for checkboxes, then take each item in list and prepend the path |
---|
2216 | //w[0] = background |
---|
2217 | ControlInfo/W=PolCor_Panel check5 |
---|
2218 | checked = V_Value |
---|
2219 | if(checked) |
---|
2220 | w[0] = "" // BKG will be used |
---|
2221 | else |
---|
2222 | w[0] = "none" // BKG will not be used |
---|
2223 | endif |
---|
2224 | |
---|
2225 | //w[1] = empty |
---|
2226 | ControlInfo/W=PolCor_Panel check4 |
---|
2227 | checked = V_Value |
---|
2228 | if(checked) |
---|
2229 | w[1] = "" // EMP will be used |
---|
2230 | else |
---|
2231 | w[1] = "none" // EMP will not be used |
---|
2232 | endif |
---|
2233 | |
---|
2234 | |
---|
2235 | //w[2] = div file |
---|
2236 | ControlInfo/W=PolCor_Panel check0 |
---|
2237 | checked = V_value |
---|
2238 | if(checked) |
---|
2239 | //build the list |
---|
2240 | //just read the global |
---|
2241 | SVAR str=root:myGlobals:Protocols:gDIV |
---|
2242 | if(cmpstr(str,"ask")==0) |
---|
2243 | w[2] = str |
---|
2244 | else |
---|
2245 | tempStr = ParseRunNumberList(str) |
---|
2246 | if(strlen(tempStr)==0) |
---|
2247 | return(1) |
---|
2248 | else |
---|
2249 | w[2] = tempstr |
---|
2250 | str=tempstr |
---|
2251 | endif |
---|
2252 | endif |
---|
2253 | else |
---|
2254 | //none used - set textwave (and global?) |
---|
2255 | w[2] = "none" |
---|
2256 | String/G root:myGlobals:Protocols:gDIV = "none" |
---|
2257 | endif |
---|
2258 | |
---|
2259 | //w[3] = mask file |
---|
2260 | ControlInfo/W=PolCor_Panel check1 |
---|
2261 | checked = V_value |
---|
2262 | if(checked) |
---|
2263 | //build the list |
---|
2264 | //just read the global |
---|
2265 | SVAR str=root:myGlobals:Protocols:gMASK |
---|
2266 | if(cmpstr(str,"ask")==0) |
---|
2267 | w[3] = str |
---|
2268 | else |
---|
2269 | tempstr = ParseRunNumberList(str) |
---|
2270 | if(strlen(tempstr)==0) |
---|
2271 | return(1) |
---|
2272 | else |
---|
2273 | w[3] = tempstr |
---|
2274 | str = tempstr |
---|
2275 | endif |
---|
2276 | endif |
---|
2277 | else |
---|
2278 | //none used - set textwave (and global?) |
---|
2279 | w[3] = "none" |
---|
2280 | String/G root:myGlobals:Protocols:gMASK = "none" |
---|
2281 | endif |
---|
2282 | |
---|
2283 | //w[4] = abs parameters |
---|
2284 | ControlInfo/W=PolCor_Panel check2 |
---|
2285 | checked = V_value |
---|
2286 | if(checked) |
---|
2287 | //build the list |
---|
2288 | //just read the global |
---|
2289 | SVAR str=root:myGlobals:Protocols:gAbsStr |
---|
2290 | w[4] = str |
---|
2291 | else |
---|
2292 | //none used - set textwave (and global?) |
---|
2293 | w[4] = "none" |
---|
2294 | String/G root:myGlobals:Protocols:gAbsStr = "none" |
---|
2295 | endif |
---|
2296 | |
---|
2297 | //w[5] = averaging choices |
---|
2298 | ControlInfo/W=PolCor_Panel check3 |
---|
2299 | checked = V_value |
---|
2300 | if(checked) |
---|
2301 | //just read the global |
---|
2302 | SVAR avestr=root:myGlobals:Protocols:gAVE |
---|
2303 | w[5] = avestr |
---|
2304 | else |
---|
2305 | //none used - set textwave |
---|
2306 | w[5] = "AVTYPE=none;" |
---|
2307 | endif |
---|
2308 | |
---|
2309 | //w[6] |
---|
2310 | //work.DRK information |
---|
2311 | SVAR drkStr=root:myGlobals:Protocols:gDRK |
---|
2312 | w[6] = "" |
---|
2313 | |
---|
2314 | //w[7] |
---|
2315 | //currently unused |
---|
2316 | w[7] = "" |
---|
2317 | |
---|
2318 | return(0) |
---|
2319 | End |
---|
2320 | |
---|
2321 | |
---|
2322 | |
---|
2323 | // the data in the SAM, EMP, BKG folders will be either _UU or _UU_pc, depending if the data |
---|
2324 | // is as-loaded, or if it's been polarization corrected. This is to display the polarization-corrected "_pc" |
---|
2325 | // data sets ONLY. If you want to see the individual data sets, well that's just the SAM, EMP, BGD files. |
---|
2326 | // look at thum one-by-one... |
---|
2327 | // |
---|
2328 | // -- data in subsequent correction step folders do have the _pc extensions, the _pc data is |
---|
2329 | // used for each step, so the _pc is redundant, but consistent |
---|
2330 | // |
---|
2331 | Function Display_4(type,scaling) |
---|
2332 | String type,scaling |
---|
2333 | |
---|
2334 | String dest = "root:Packages:NIST:"+type |
---|
2335 | NVAR isLogscale = $(dest + ":gIsLogScale") |
---|
2336 | |
---|
2337 | SetDataFolder $("root:Packages:NIST:"+type) |
---|
2338 | |
---|
2339 | wave uu = linear_data_uu_pc |
---|
2340 | wave d_uu = data_uu_pc |
---|
2341 | |
---|
2342 | wave du = linear_data_du_pc |
---|
2343 | wave d_du = data_du_pc |
---|
2344 | |
---|
2345 | wave dd = linear_data_dd_pc |
---|
2346 | wave d_dd = data_dd_pc |
---|
2347 | |
---|
2348 | wave ud = linear_data_ud_pc |
---|
2349 | wave d_ud = data_ud_pc |
---|
2350 | |
---|
2351 | if(cmpstr(scaling,"log") == 0) |
---|
2352 | |
---|
2353 | d_uu = log(uu) |
---|
2354 | d_du = log(du) |
---|
2355 | d_dd = log(dd) |
---|
2356 | d_ud = log(ud) |
---|
2357 | |
---|
2358 | isLogScale = 1 |
---|
2359 | |
---|
2360 | else |
---|
2361 | |
---|
2362 | d_uu = uu |
---|
2363 | d_du = du |
---|
2364 | d_dd = dd |
---|
2365 | d_ud = ud |
---|
2366 | |
---|
2367 | isLogScale = 0 |
---|
2368 | |
---|
2369 | endif |
---|
2370 | |
---|
2371 | DoWindow/F SANS_X4 |
---|
2372 | if(V_flag==0) |
---|
2373 | Display /W=(811,44,1479,758)/K=1 |
---|
2374 | ControlBar 100 |
---|
2375 | DoWindow/C SANS_X4 |
---|
2376 | DoWindow/T SANS_X4,type+"_pc" |
---|
2377 | Button button0 pos={130,65},size={50,20},title="Do It",proc=Change4xsButtonProc |
---|
2378 | PopupMenu popup0 pos={20,35},title="Data Type",value="SAM;EMP;BGD;COR;CAL;ABS;" //RAW, SAS, DIV, etc, won't have _pc data and are not valid |
---|
2379 | PopupMenu popup1 pos={190,35},title="Scaling",value="log;linear;" |
---|
2380 | TitleBox title0 title="Only Polarization-corrected sets are displayed",pos={5,5} |
---|
2381 | |
---|
2382 | else |
---|
2383 | RemoveImage/Z data_uu_pc //remove the old images (different data folder) |
---|
2384 | RemoveImage/Z data_du_pc |
---|
2385 | RemoveImage/Z data_dd_pc |
---|
2386 | RemoveImage/Z data_ud_pc |
---|
2387 | |
---|
2388 | DoWindow/T SANS_X4,type+"_pc" |
---|
2389 | |
---|
2390 | endif |
---|
2391 | |
---|
2392 | AppendImage/B=bot_uu/L=left_uu data_UU_pc |
---|
2393 | ModifyImage data_UU_pc ctab= {*,*,YellowHot,0} |
---|
2394 | AppendImage/B=bot_dd/L=left_dd data_DD_pc |
---|
2395 | ModifyImage data_DD_pc ctab= {*,*,YellowHot,0} |
---|
2396 | AppendImage/B=bot_du/L=left_du data_DU_pc |
---|
2397 | ModifyImage data_DU_pc ctab= {*,*,YellowHot,0} |
---|
2398 | AppendImage/B=bot_ud/L=left_ud data_UD_pc |
---|
2399 | ModifyImage data_UD_pc ctab= {*,*,YellowHot,0} |
---|
2400 | |
---|
2401 | DoUpdate |
---|
2402 | |
---|
2403 | ModifyGraph freePos(left_uu)={0,kwFraction},freePos(bot_uu)={0.6,kwFraction} |
---|
2404 | ModifyGraph freePos(left_dd)={0,kwFraction},freePos(bot_dd)={0,kwFraction} |
---|
2405 | ModifyGraph freePos(left_du)={0.6,kwFraction},freePos(bot_du)={0.6,kwFraction} |
---|
2406 | ModifyGraph freePos(left_ud)={0.6,kwFraction},freePos(bot_ud)={0,kwFraction} |
---|
2407 | |
---|
2408 | ModifyGraph axisEnab(left_uu)={0.6,1},axisEnab(bot_uu)={0,0.4} |
---|
2409 | ModifyGraph axisEnab(left_dd)={0,0.4},axisEnab(bot_dd)={0,0.4} |
---|
2410 | ModifyGraph axisEnab(left_du)={0.6,1},axisEnab(bot_du)={0.6,1} |
---|
2411 | ModifyGraph axisEnab(left_ud)={0,0.4},axisEnab(bot_ud)={0.6,1} |
---|
2412 | |
---|
2413 | ModifyGraph standoff=0 |
---|
2414 | ModifyGraph lblPosMode(left_uu)=4,lblPosMode(left_dd)=4,lblPosMode(left_du)=4,lblPosMode(left_ud)=4 |
---|
2415 | ModifyGraph lblPos(left_uu)=40,lblPos(left_dd)=40,lblPos(left_du)=40,lblPos(left_ud)=40 |
---|
2416 | Label left_uu "UU" |
---|
2417 | Label left_dd "DD" |
---|
2418 | Label left_du "DU" |
---|
2419 | Label left_ud "UD" |
---|
2420 | |
---|
2421 | ModifyGraph fSize=16 |
---|
2422 | // force a redraw to get the axes in the right spot |
---|
2423 | DoUpdate |
---|
2424 | |
---|
2425 | SetDataFolder root: |
---|
2426 | return(0) |
---|
2427 | End |
---|
2428 | |
---|
2429 | Function Change4xsButtonProc(ba) : ButtonControl |
---|
2430 | STRUCT WMButtonAction &ba |
---|
2431 | |
---|
2432 | String dataType,scaling |
---|
2433 | |
---|
2434 | switch( ba.eventCode ) |
---|
2435 | case 2: // mouse up |
---|
2436 | // click code here |
---|
2437 | ControlInfo popup0 |
---|
2438 | dataType = S_Value |
---|
2439 | ControlInfo popup1 |
---|
2440 | scaling = S_Value |
---|
2441 | Display_4(dataType,scaling) |
---|
2442 | |
---|
2443 | break |
---|
2444 | case -1: // control being killed |
---|
2445 | break |
---|
2446 | endswitch |
---|
2447 | |
---|
2448 | return 0 |
---|
2449 | End |
---|
2450 | |
---|
2451 | |
---|
2452 | |
---|
2453 | |
---|
2454 | |
---|
2455 | |
---|
2456 | |
---|
2457 | |
---|
2458 | |
---|
2459 | |
---|
2460 | |
---|
2461 | |
---|
2462 | |
---|
2463 | |
---|
2464 | |
---|
2465 | |
---|
2466 | |
---|
2467 | |
---|
2468 | |
---|
2469 | |
---|
2470 | |
---|
2471 | |
---|
2472 | |
---|
2473 | |
---|
2474 | |
---|
2475 | |
---|
2476 | |
---|
2477 | |
---|
2478 | |
---|
2479 | |
---|
2480 | |
---|
2481 | |
---|
2482 | |
---|
2483 | |
---|
2484 | |
---|
2485 | |
---|
2486 | |
---|
2487 | |
---|
2488 | |
---|
2489 | |
---|
2490 | |
---|
2491 | |
---|
2492 | |
---|
2493 | |
---|
2494 | |
---|
2495 | |
---|
2496 | |
---|
2497 | |
---|
2498 | |
---|
2499 | |
---|
2500 | |
---|
2501 | |
---|
2502 | ////////////////////////////////////////////////////////////// |
---|
2503 | // |
---|
2504 | /////////// all of the functions below are unused. See the procedures for the |
---|
2505 | //// panels for the functions that interact with the input and calculated matrices |
---|
2506 | // |
---|
2507 | // |
---|
2508 | // |
---|
2509 | // |
---|
2510 | // |
---|
2511 | //// |
---|
2512 | //// (/S) FindFileFromRunNumber(num) gets fname |
---|
2513 | //// [4] is trans, [41] is trans error, [40] is Twhole |
---|
2514 | //// |
---|
2515 | // |
---|
2516 | // |
---|
2517 | // |
---|
2518 | //Constant kTe = 0.87 // transmission of the unfilled cell |
---|
2519 | // |
---|
2520 | // |
---|
2521 | // |
---|
2522 | //// calculation of mu |
---|
2523 | //// |
---|
2524 | //// Known: Te ===> Global constant currently, may change later |
---|
2525 | //// |
---|
2526 | //// Input: T He (unpolarized), using unpolarized beam |
---|
2527 | //// T He cell out, using unpolarized beam |
---|
2528 | //// T background, using unpolarized beam |
---|
2529 | //// |
---|
2530 | //// Equation 7 |
---|
2531 | //// |
---|
2532 | //Function opacity_mu(T_he,T_out,T_bk) |
---|
2533 | // Variable T_he,T_out,T_bk |
---|
2534 | // |
---|
2535 | // Variable mu |
---|
2536 | // |
---|
2537 | //// using the global constant! |
---|
2538 | // |
---|
2539 | // mu = (1/kTe)*(T_he - T_bk)/(T_out - t_bk) |
---|
2540 | // mu = -1*ln(mu) |
---|
2541 | // |
---|
2542 | // return(mu) |
---|
2543 | //End |
---|
2544 | // |
---|
2545 | // |
---|
2546 | // |
---|
2547 | //Proc calc_muP(mu, runT_he, runT_out, runT_bk) |
---|
2548 | // Variable mu=3.108, runT_he, runT_out, runT_bk |
---|
2549 | // |
---|
2550 | // Variable muP,T_he, T_out, T_bk |
---|
2551 | // String fname |
---|
2552 | // |
---|
2553 | // fname = FindFileFromRunNumber(runT_he) |
---|
2554 | // T_he = getDetCount(fname)/getMonitorCount(fname)/getCountTime(fname) //use CR, not trans (since no real empty condition) |
---|
2555 | // |
---|
2556 | // fname = FindFileFromRunNumber(runT_out) |
---|
2557 | // T_out = getDetCount(fname)/getMonitorCount(fname)/getCountTime(fname) |
---|
2558 | // |
---|
2559 | // fname = FindFileFromRunNumber(runT_bk) |
---|
2560 | // T_bk = getDetCount(fname)/getMonitorCount(fname)/getCountTime(fname) |
---|
2561 | // |
---|
2562 | // muP = Cell_muP(mu, T_he, T_out, T_bk) |
---|
2563 | // |
---|
2564 | // Print "Count rates T_he, T_out, T_bk = ",T_he, T_out, T_bk |
---|
2565 | // Print "Mu*P = ",muP |
---|
2566 | // Print "Time = ",getFileCreationDate(fname) |
---|
2567 | // |
---|
2568 | //end |
---|
2569 | // |
---|
2570 | // |
---|
2571 | //// ???? is this correct ???? |
---|
2572 | //// -- check the form of the equation. It's not the same in some documents |
---|
2573 | //// |
---|
2574 | //// calculation of mu.P(t) from exerimental measurements |
---|
2575 | //// |
---|
2576 | //// Known: Te and mu |
---|
2577 | //// Input: T He cell (polarized cell), using unpolarized beam |
---|
2578 | //// T He cell OUT, using unpolarized beam |
---|
2579 | //// T background, using unpolarized beam |
---|
2580 | //// |
---|
2581 | //// Equation 9, modified by multiplying the result by mu + moving tmp inside the acosh() |
---|
2582 | //// |
---|
2583 | //Function Cell_muP(mu, T_he, T_out, T_bk) |
---|
2584 | // Variable mu, T_he, T_out, T_bk |
---|
2585 | // |
---|
2586 | //// using the global constant! |
---|
2587 | // |
---|
2588 | // Variable muP,tmp |
---|
2589 | // |
---|
2590 | // tmp = kTe*exp(-mu) //note mu has been moved |
---|
2591 | // muP = acosh( (T_he - T_bk)/(T_out - T_bk) * (1/tmp)) |
---|
2592 | // |
---|
2593 | // return(muP) |
---|
2594 | //End |
---|
2595 | // |
---|
2596 | // |
---|
2597 | //// |
---|
2598 | //// calculation of mu.P(t) from Gamma and t=0 value |
---|
2599 | //// |
---|
2600 | //// Known: Gamma, muP_t0, t0, tn |
---|
2601 | //// |
---|
2602 | //// times are in hours, Gamma [=] hours |
---|
2603 | //// tn is later than t0, so t0-tn is negative |
---|
2604 | //// |
---|
2605 | //// Equation 11 |
---|
2606 | //// |
---|
2607 | //Function muP_at_t(Gam_He, muP_t0, t0, tn) |
---|
2608 | // Variable Gam_He, muP_t0, t0, tn |
---|
2609 | // |
---|
2610 | // Variable muP |
---|
2611 | // |
---|
2612 | // muP = muP_t0 * exp( (t0 - tn)/Gam_He ) |
---|
2613 | // |
---|
2614 | // return(muP) |
---|
2615 | //End |
---|
2616 | // |
---|
2617 | //// Calculation of Pcell(t) |
---|
2618 | //// note that this is a time dependent quantity |
---|
2619 | //// |
---|
2620 | //// Known: muP(t) |
---|
2621 | //// Input: nothing additional |
---|
2622 | //// |
---|
2623 | //// Equation 10 |
---|
2624 | //// |
---|
2625 | //Function PCell(muP) |
---|
2626 | // Variable muP |
---|
2627 | // |
---|
2628 | // Variable PCell |
---|
2629 | // PCell = tanh(muP) |
---|
2630 | // |
---|
2631 | // return(PCell) |
---|
2632 | //End |
---|
2633 | // |
---|
2634 | // |
---|
2635 | //// calculation of Pf (flipper) |
---|
2636 | //// |
---|
2637 | //// Known: nothing |
---|
2638 | //// Input: Tuu, Tdu, and Tdd, Tud |
---|
2639 | //// (but exactly what measurement conditions?) |
---|
2640 | //// ( are these T's also calculated quantities???? -- Equation(s) 12--) |
---|
2641 | //// |
---|
2642 | //// Equation 14 |
---|
2643 | //// |
---|
2644 | //// (implementation of equation 13 is more complicated, and not implemented yet) |
---|
2645 | //// |
---|
2646 | //Function Flipper_Pf(Tuu, Tdu, Tdd, Tud) |
---|
2647 | // Variable Tuu, Tdu, Tdd, Tud |
---|
2648 | // |
---|
2649 | // Variable pf |
---|
2650 | // |
---|
2651 | // pf = (Tdd - Tdu)/(Tuu - Tud) |
---|
2652 | // |
---|
2653 | // return(pf) |
---|
2654 | //End |
---|
2655 | // |
---|
2656 | // |
---|
2657 | // |
---|
2658 | //// (this is only one of 4 methods, simply the first one listed) |
---|
2659 | //// ???? this equation doesn't match up with the equation in the SS handout |
---|
2660 | //// |
---|
2661 | //// calculation of P'sm (supermirror) |
---|
2662 | //// |
---|
2663 | //// Known: Pcell(t1), Pcell(t2) (some implementations need Pf ) |
---|
2664 | //// Input: Tuu(t1), Tud(t2) |
---|
2665 | //// |
---|
2666 | //// Equation 15?? |
---|
2667 | //// |
---|
2668 | //Function SupMir_Psm(Pcell1,Pcell2,Tuu,Tud) |
---|
2669 | // Variable Pcell1,Pcell2,Tuu,Tud |
---|
2670 | // |
---|
2671 | // Variable Psm |
---|
2672 | // |
---|
2673 | // Psm = (Tuu - Tud)/(PCell1 + PCell2) |
---|
2674 | // |
---|
2675 | // return(Psm) |
---|
2676 | //End |
---|