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