1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // input panels to set and calculate polarization parameters necessary for the |
---|
4 | // matrix corrections to the cross sections |
---|
5 | // |
---|
6 | // |
---|
7 | // -3-Flipper efficiency |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | // **** search for TODO to find items still to be fixed in other procedures ********** |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | // |
---|
16 | // TODO: |
---|
17 | // X- add a way to manually enter the P values into a "blank" condition, in case that the users |
---|
18 | // calculate the values in a different way. This should be as simple as a dialog to enter values and |
---|
19 | // change the wave note (and displayed strings). |
---|
20 | // |
---|
21 | // |
---|
22 | // Polarization parameters for each condition. Results are stored in a wave note for each condition |
---|
23 | // |
---|
24 | // |
---|
25 | // str = "P_sm_f=2,err_P_sm_f=0,P_sm=0.6,err_P_sm=0,T0=asdf,Cell=asdf," |
---|
26 | // |
---|
27 | // two waves per condition "Cond_Name_Cell" and "CondCalc_Name_Cell" |
---|
28 | // |
---|
29 | Proc ShowFlipperPanel() |
---|
30 | |
---|
31 | // init folders |
---|
32 | // ASK before initializing cell constants |
---|
33 | // open the panel |
---|
34 | DoWindow/F FlipperPanel |
---|
35 | if(V_flag == 0) |
---|
36 | InitPolarizationFolders() |
---|
37 | InitFlipperGlobals() |
---|
38 | DrawFlipperPanel() |
---|
39 | endif |
---|
40 | end |
---|
41 | |
---|
42 | Function InitFlipperGlobals() |
---|
43 | |
---|
44 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
45 | |
---|
46 | String/G gPsmPf = "Psm*Pf" |
---|
47 | String/G gPsm = "Psm" |
---|
48 | |
---|
49 | SetDataFolder root: |
---|
50 | return(0) |
---|
51 | End |
---|
52 | |
---|
53 | |
---|
54 | // |
---|
55 | // makes the panel for the calculation of flipper and supermirror efficiencies |
---|
56 | // |
---|
57 | Function DrawFlipperPanel() |
---|
58 | |
---|
59 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
60 | |
---|
61 | PauseUpdate; Silent 1 // building window... |
---|
62 | NewPanel /W=(1023,44,1832,526)/N=FlipperPanel/K=1 as "Flipper and Supermirror" |
---|
63 | ModifyPanel cbRGB=(1,52428,26586) |
---|
64 | |
---|
65 | PopupMenu popup_0,pos={32,18},size={49,20},title="Field Condition",proc=FlipperPanelPopMenuProc |
---|
66 | PopupMenu popup_0,mode=1,value= #"D_ConditionNameList()" |
---|
67 | |
---|
68 | Button button_0,pos={42,310},size={100,20},proc=FlipperAverageButtonProc,title="Do Average" |
---|
69 | |
---|
70 | GroupBox group_0,pos={39,350},size={335,103},title="AVERAGED RESULTS",fSize=10 |
---|
71 | GroupBox group_0,fStyle=1 |
---|
72 | SetVariable setvar_0,pos={49,385},size={250,15},title="Sam_depol*Psm*Pf" |
---|
73 | SetVariable setvar_0,fStyle=1 |
---|
74 | SetVariable setvar_0,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
75 | SetVariable setvar_1,pos={49,417},size={250,15},title="Sam_depol*Psm",fStyle=1 |
---|
76 | SetVariable setvar_1,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsm |
---|
77 | // SetVariable setvar_2,pos={560,518},size={200,13},title="Gamma (h)",fStyle=1 |
---|
78 | // SetVariable setvar_2,limits={0,0,0},barmisc={0,1000} |
---|
79 | // SetVariable setvar_2,value= root:Packages:NIST:Polarization:Cells:gGamma |
---|
80 | // SetVariable setvar_3,pos={560,488},size={200,15},title="T0",fStyle=1 |
---|
81 | // SetVariable setvar_3,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gT0 |
---|
82 | |
---|
83 | |
---|
84 | Button button_1,pos={320,17},size={120,20},proc=AddFlipperConditionButton,title="Add Condition" |
---|
85 | Button button_2,pos={403,295},size={110,20},proc=ClearAllFlipperWavesButton,title="Clear Table" |
---|
86 | Button button_3,pos={183,310},size={120,20},proc=ShowFlipperCalcButton,title="Show Calc" |
---|
87 | Button button_4,pos={540,295},size={110,20},proc=ClearFlipperRowButton,title="Clear Row" |
---|
88 | Button button_5,pos={620,18},size={30,20},proc=FlipperHelpParButtonProc,title="?" |
---|
89 | Button button_6,pos={488,418},size={100,20},proc=WindowSnapshotButton,title="Snapshot" |
---|
90 | Button button_7,pos={488,380},size={130,20},proc=ManualEnterPfPsmButton,title="Manual Entry" |
---|
91 | |
---|
92 | // table |
---|
93 | Edit/W=(14,55,794,275)/HOST=# |
---|
94 | ModifyTable format=1,width=0 |
---|
95 | RenameWindow #,T0 |
---|
96 | SetActiveSubwindow ## |
---|
97 | |
---|
98 | SetDataFolder root: |
---|
99 | return(0) |
---|
100 | End |
---|
101 | |
---|
102 | // now, this does not depend on the cell, just the condition |
---|
103 | Function AddFlipperConditionButton(ba) : ButtonControl |
---|
104 | STRUCT WMButtonAction &ba |
---|
105 | |
---|
106 | switch( ba.eventCode ) |
---|
107 | case 2: // mouse up |
---|
108 | // click code here |
---|
109 | |
---|
110 | |
---|
111 | String condStr//, cellStr |
---|
112 | Prompt condStr,"Condition, <12 characters, NO UNDERSCORES" |
---|
113 | // Prompt cellStr,"Cell",popup,D_CellNameList() |
---|
114 | DoPrompt "Add new condition",condStr//, cellStr |
---|
115 | if(V_Flag==1) |
---|
116 | return 0 // user canceled |
---|
117 | endif |
---|
118 | |
---|
119 | if(strlen(condStr) > 12) |
---|
120 | condStr = condStr[0,11] |
---|
121 | Print "Condition String trimmed to ",condStr |
---|
122 | endif |
---|
123 | |
---|
124 | condStr = ReplaceString("_", condStr, "", 0, inf) |
---|
125 | |
---|
126 | String popStr |
---|
127 | // popStr = condStr+"_"+cellStr |
---|
128 | popStr = condStr |
---|
129 | |
---|
130 | MakeFlipperResultWaves(popStr) |
---|
131 | |
---|
132 | break |
---|
133 | case -1: // control being killed |
---|
134 | break |
---|
135 | endswitch |
---|
136 | |
---|
137 | return 0 |
---|
138 | End |
---|
139 | |
---|
140 | Function FlipperPanelPopMenuProc(pa) : PopupMenuControl |
---|
141 | STRUCT WMPopupAction &pa |
---|
142 | |
---|
143 | switch( pa.eventCode ) |
---|
144 | case 2: // mouse up |
---|
145 | Variable popNum = pa.popNum |
---|
146 | String popStr = pa.popStr |
---|
147 | |
---|
148 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
149 | |
---|
150 | // based on the selected string, display the right set of inputs |
---|
151 | // Print "now I need to display the right set of waves (2D text?) for ",popStr |
---|
152 | |
---|
153 | if(cmpstr(popStr,"no conditions defined") == 0) |
---|
154 | SetDataFolder root: |
---|
155 | return(0) |
---|
156 | endif |
---|
157 | |
---|
158 | |
---|
159 | // for the given cell name, if the wave(s) exist, declare them |
---|
160 | if(exists(popStr) == 1) |
---|
161 | WAVE cond = $(popStr) |
---|
162 | WAVE/T cellW = $("CondCell_"+popStr[5,strlen(popStr)-1]) |
---|
163 | else |
---|
164 | // if not, report an error |
---|
165 | DoAlert 0,"The Cond_ waves should exist, this is an error" |
---|
166 | |
---|
167 | SetDataFolder root: |
---|
168 | return(0) |
---|
169 | //MakeFlipperResultWaves(popStr) |
---|
170 | //WAVE cond = $("root:Packages:NIST:Polarization:Cells:Cond_"+popStr) |
---|
171 | endif |
---|
172 | // append matrix, clearing the old one first |
---|
173 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
174 | |
---|
175 | KillWindow FlipperPanel#T0 |
---|
176 | Edit/W=(14,55,794,275)/HOST=FlipperPanel |
---|
177 | RenameWindow #,T0 |
---|
178 | AppendtoTable/W=FlipperPanel#T0 cellW // |
---|
179 | AppendtoTable/W=FlipperPanel#T0 cond.ld //show the labels |
---|
180 | ModifyTable width(Point)=0 |
---|
181 | ModifyTable width(cond.l)=20 |
---|
182 | |
---|
183 | SetActiveSubwindow ## |
---|
184 | |
---|
185 | SetDataFolder root: |
---|
186 | |
---|
187 | // update the globals that are displayed from the wave note |
---|
188 | String nStr=Note(cond) |
---|
189 | SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
190 | SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm |
---|
191 | sprintf gPsmPf, "%g +/- %g",NumberByKey("P_sm_f", nStr, "=",","),NumberByKey("err_P_sm_f", nStr, "=",",") |
---|
192 | sprintf gPsm, "%g +/- %g",NumberByKey("P_sm", nStr, "=",","),NumberByKey("err_P_sm", nStr, "=",",") |
---|
193 | |
---|
194 | |
---|
195 | break |
---|
196 | case -1: // control being killed |
---|
197 | break |
---|
198 | endswitch |
---|
199 | |
---|
200 | return 0 |
---|
201 | End |
---|
202 | |
---|
203 | // waves are: |
---|
204 | // "Cond_"+popStr |
---|
205 | // and "CondCalc_"+popStr |
---|
206 | // ... and now "CondCell"+popStr |
---|
207 | |
---|
208 | Function MakeFlipperResultWaves(popStr) |
---|
209 | String popStr |
---|
210 | |
---|
211 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
212 | |
---|
213 | Make/O/T/N=1 $("CondCell_"+popStr) |
---|
214 | WAVE/T cell=$("CondCell_"+popStr) |
---|
215 | cell[0] = "Enter cell name" |
---|
216 | // SetDimLabel 0,-1,'Cell Name?',cell |
---|
217 | |
---|
218 | Make/O/D/N=(1,8) $("Cond_"+popStr) |
---|
219 | WAVE cond = $("Cond_"+popStr) |
---|
220 | // set the column labels |
---|
221 | SetDimLabel 1,0,'UU_Trans?',cond |
---|
222 | SetDimLabel 1,1,'DU_Trans?',cond |
---|
223 | SetDimLabel 1,2,'DD_Trans?',cond |
---|
224 | SetDimLabel 1,3,'UD_Trans?',cond |
---|
225 | SetDimLabel 1,4,'Blocked?',cond |
---|
226 | SetDimLabel 1,5,Pol_SM_FL,cond |
---|
227 | SetDimLabel 1,6,Pol_SM,cond //for a mask wave, non-zero is used in the fit |
---|
228 | SetDimLabel 1,7,'Include?',cond |
---|
229 | cond[0][7] = 1 //default to include the point |
---|
230 | |
---|
231 | // generate the dummy wave note now, change as needed |
---|
232 | String cellStr = StringFromList(1, popStr,"_") |
---|
233 | String testStr = "P_sm_f=0,err_P_sm_f=0,P_sm=0,err_P_sm=0,T0=undefined," |
---|
234 | // testStr = ReplaceStringByKey("Cell", testStr, cellStr ,"=", ",", 0) |
---|
235 | Note cond, testStr |
---|
236 | |
---|
237 | // to hold the results of the calculation |
---|
238 | Make/O/D/N=(1,14) $("CondCalc_"+popStr) |
---|
239 | WAVE CondCalc = $("CondCalc_"+popStr) |
---|
240 | SetDimLabel 1,0,CR_UU,CondCalc |
---|
241 | SetDimLabel 1,1,err_CR_UU,CondCalc |
---|
242 | SetDimLabel 1,2,CR_DU,CondCalc |
---|
243 | SetDimLabel 1,3,err_CR_DU,CondCalc |
---|
244 | SetDimLabel 1,4,CR_DD,CondCalc |
---|
245 | SetDimLabel 1,5,err_CR_DD,CondCalc |
---|
246 | SetDimLabel 1,6,CR_UD,CondCalc |
---|
247 | SetDimLabel 1,7,err_CR_UD,CondCalc |
---|
248 | SetDimLabel 1,8,CR_Blocked,CondCalc |
---|
249 | SetDimLabel 1,9,err_CR_Blocked,CondCalc |
---|
250 | SetDimLabel 1,10,P_sm_f,CondCalc |
---|
251 | SetDimLabel 1,11,err_P_sm_f,CondCalc |
---|
252 | SetDimLabel 1,12,P_sm,CondCalc |
---|
253 | SetDimLabel 1,13,err_P_sm,CondCalc |
---|
254 | |
---|
255 | SetDataFolder root: |
---|
256 | |
---|
257 | return(0) |
---|
258 | End |
---|
259 | |
---|
260 | |
---|
261 | // allows manual entry of Psm and Pf values |
---|
262 | // |
---|
263 | Function ManualEnterPfPsmButton(ba) : ButtonControl |
---|
264 | STRUCT WMButtonAction &ba |
---|
265 | |
---|
266 | Variable selRow,err=0 |
---|
267 | String fname, t0str, condStr,noteStr,t1Str,cellStr |
---|
268 | |
---|
269 | switch( ba.eventCode ) |
---|
270 | case 2: // mouse up |
---|
271 | // click code here |
---|
272 | Variable cr1,cr2,cr3,cr4,cr5,err_cr1,err_cr2,err_cr3,err_cr4,err_cr5 |
---|
273 | Variable PsmPf, err_PsmPf, Psm, err_Psm |
---|
274 | |
---|
275 | ControlInfo/W=FlipperPanel popup_0 |
---|
276 | condStr = S_Value |
---|
277 | WAVE w=$("root:Packages:NIST:Polarization:Cells:"+condStr) //the one that is displayed |
---|
278 | WAVE calc=$("root:Packages:NIST:Polarization:Cells:CondCalc_"+condStr[5,strlen(condStr)-1]) //the one that holds results |
---|
279 | |
---|
280 | |
---|
281 | Prompt PsmPf, "Enter PsmPf: " |
---|
282 | Prompt err_PsmPf, "Enter err_PsmPf: " |
---|
283 | Prompt Psm, "Enter Psm: " |
---|
284 | Prompt err_Psm, "Enter err_Psm: " |
---|
285 | DoPrompt "Enter Supermirror and Flipper Parameters", PsmPf, err_PsmPf, Psm, err_Psm |
---|
286 | if (V_Flag) |
---|
287 | return -1 // User canceled |
---|
288 | endif |
---|
289 | |
---|
290 | // this is the format of the note that is attached to the "Cond_" wave |
---|
291 | // String testStr = "P_sm_f=2,err_P_sm_f=0,P_sm=0.6,err_P_sm=0,T0=asdf,Cell=asdf," |
---|
292 | // the "Cell" value was filled in when the Condition was created |
---|
293 | |
---|
294 | |
---|
295 | // Put the average values into the wave note and display on the panel |
---|
296 | SVAR gT0 = root:Packages:NIST:Polarization:Cells:gT0 |
---|
297 | |
---|
298 | noteStr = note(w) |
---|
299 | noteStr = ReplaceNumberByKey("P_sm_f", noteStr, PsmPf ,"=", ",", 0) |
---|
300 | noteStr = ReplaceNumberByKey("P_sm", noteStr, Psm ,"=", ",", 0) |
---|
301 | noteStr = ReplaceNumberByKey("err_P_sm_f", noteStr, err_PsmPf ,"=", ",", 0) |
---|
302 | noteStr = ReplaceNumberByKey("err_P_sm", noteStr, err_Psm ,"=", ",", 0) |
---|
303 | noteStr = ReplaceStringByKey("T0", noteStr, gT0 ,"=", ",", 0) |
---|
304 | |
---|
305 | |
---|
306 | // replace the string |
---|
307 | Note/K w |
---|
308 | Note w, noteStr |
---|
309 | |
---|
310 | //update the global values for display |
---|
311 | SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
312 | SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm |
---|
313 | sprintf gPsmPf, "%g +/- %g",PsmPf,err_PsmPf |
---|
314 | sprintf gPsm, "%g +/- %g",Psm,err_Psm |
---|
315 | |
---|
316 | break |
---|
317 | case -1: // control being killed |
---|
318 | break |
---|
319 | endswitch |
---|
320 | |
---|
321 | return 0 |
---|
322 | End |
---|
323 | |
---|
324 | |
---|
325 | // |
---|
326 | // just recalculate everything, every time |
---|
327 | // |
---|
328 | // -- now that the cell name is entered, I need to try to catch errors where the cell decay parameters are not |
---|
329 | // properly calculated -- right now, invalid cell names are caught, but valid cell names with no decay data |
---|
330 | // behind them just calculate Inf for the polarization values. This is hopefull enough to catch someone's attention... |
---|
331 | // |
---|
332 | Function FlipperAverageButtonProc(ba) : ButtonControl |
---|
333 | STRUCT WMButtonAction &ba |
---|
334 | |
---|
335 | Variable selRow,err=0 |
---|
336 | String fname, t0str, condStr,noteStr,t1Str,cellStr |
---|
337 | |
---|
338 | switch( ba.eventCode ) |
---|
339 | case 2: // mouse up |
---|
340 | // click code here |
---|
341 | Variable cr1,cr2,cr3,cr4,cr5,err_cr1,err_cr2,err_cr3,err_cr4,err_cr5 |
---|
342 | Variable PsmPf, err_PsmPf, Psm, err_Psm |
---|
343 | |
---|
344 | ControlInfo/W=FlipperPanel popup_0 |
---|
345 | condStr = S_Value |
---|
346 | WAVE w=$("root:Packages:NIST:Polarization:Cells:"+condStr) //the one that is displayed |
---|
347 | WAVE calc=$("root:Packages:NIST:Polarization:Cells:CondCalc_"+condStr[5,strlen(condStr)-1]) //the one that holds results |
---|
348 | WAVE/T CellW=$("root:Packages:NIST:Polarization:Cells:CondCell_"+condStr[5,strlen(condStr)-1]) //the textW with cell name |
---|
349 | |
---|
350 | Variable numRows,ncalc,diff |
---|
351 | numRows = DimSize(w,0) //rows in the displayed table |
---|
352 | ncalc = DimSize(calc,0) |
---|
353 | |
---|
354 | // add rows to the ConcCalc_ matrix as needed |
---|
355 | if(numRows != ncalc) |
---|
356 | if(ncalc > numRows) |
---|
357 | DoAlert 0,"The CondCalc_ is larger than displayed. Seek help." |
---|
358 | err = 1 |
---|
359 | return(err) |
---|
360 | else |
---|
361 | diff = numRows - ncalc |
---|
362 | InsertPoints/M=0 ncalc, diff, calc |
---|
363 | endif |
---|
364 | endif |
---|
365 | |
---|
366 | // noteStr=note(w) |
---|
367 | // cellStr = StringByKey("Cell", noteStr, "=", ",", 0) |
---|
368 | // Wave decay = $("root:Packages:NIST:Polarization:Cells:Decay_"+cellStr) |
---|
369 | // noteStr=note(decay) |
---|
370 | // t0Str = StringByKey("T0", noteStr, "=", ",", 0) |
---|
371 | // Print "CellStr, T0 = ",cellStr, t0Str |
---|
372 | |
---|
373 | Variable sum_PsmPf, err_sum_PsmPf, sum_Psm, err_sum_Psm,nRowsIncluded=0 |
---|
374 | sum_PsmPf = 0 |
---|
375 | err_sum_PsmPf = 0 |
---|
376 | sum_Psm = 0 |
---|
377 | err_sum_Psm = 0 |
---|
378 | |
---|
379 | for(selRow=0;selRow<numRows;selRow+=1) |
---|
380 | Print "calculate the row ",selRow |
---|
381 | |
---|
382 | //include this row of data? |
---|
383 | if(w[selRow][%'Include?'] == 1) |
---|
384 | nRowsIncluded += 1 |
---|
385 | |
---|
386 | // now the cell depends on the row |
---|
387 | cellStr = CellW[selRow] |
---|
388 | Wave/Z decay = $("root:Packages:NIST:Polarization:Cells:Decay_"+cellStr) |
---|
389 | if(WaveExists(decay) == 0) // catch gross errors |
---|
390 | Abort "The cell "+cellStr+" in row "+num2str(selRow)+" does not exist" |
---|
391 | endif |
---|
392 | noteStr=note(decay) |
---|
393 | t0Str = StringByKey("T0", noteStr, "=", ",", 0) |
---|
394 | |
---|
395 | // parse the rows, report errors (there, not here), exit if any found |
---|
396 | err = ParseFlipperRow(w,selRow) |
---|
397 | if(err) |
---|
398 | return 0 |
---|
399 | endif |
---|
400 | |
---|
401 | // do the calculations: |
---|
402 | // cr1 = TotalCR_FromRun(w[selRow][%'UU_Trans?'],err_cr1,1) |
---|
403 | // cr2 = TotalCR_FromRun(w[selRow][%'DU_Trans?'],err_cr2,1) |
---|
404 | // cr3 = TotalCR_FromRun(w[selRow][%'DD_Trans?'],err_cr3,1) |
---|
405 | // cr4 = TotalCR_FromRun(w[selRow][%'UD_Trans?'],err_cr4,1) |
---|
406 | // cr5 = TotalCR_FromRun(w[selRow][%'Blocked?'],err_cr5,1) //blocked beam is NOT normalized to zero attenuators |
---|
407 | // Print "The Blocked CR is *NOT* rescaled to zero attenuators -- FlipperAverageButtonProc" |
---|
408 | cr1 = TotalCR_FromRun(w[selRow][%'UU_Trans?'],err_cr1,0) |
---|
409 | cr2 = TotalCR_FromRun(w[selRow][%'DU_Trans?'],err_cr2,0) |
---|
410 | cr3 = TotalCR_FromRun(w[selRow][%'DD_Trans?'],err_cr3,0) |
---|
411 | cr4 = TotalCR_FromRun(w[selRow][%'UD_Trans?'],err_cr4,0) |
---|
412 | cr5 = TotalCR_FromRun(w[selRow][%'Blocked?'],err_cr5,0) //blocked beam is normalized to zero attenuators |
---|
413 | Print "The Blocked CR *IS* rescaled to zero attenuators -- FlipperAverageButtonProc" |
---|
414 | |
---|
415 | calc[selRow][%cr_UU] = cr1 |
---|
416 | calc[selRow][%cr_DU] = cr2 |
---|
417 | calc[selRow][%cr_DD] = cr3 |
---|
418 | calc[selRow][%cr_UD] = cr4 |
---|
419 | calc[selRow][%cr_Blocked] = cr5 |
---|
420 | calc[selRow][%err_cr_UU] = err_cr1 |
---|
421 | calc[selRow][%err_cr_DU] = err_cr2 |
---|
422 | calc[selRow][%err_cr_DD] = err_cr3 |
---|
423 | calc[selRow][%err_cr_UD] = err_cr4 |
---|
424 | calc[selRow][%err_cr_Blocked] = err_cr5 |
---|
425 | |
---|
426 | // Calc PsmPf, and assign the values |
---|
427 | PsmPf = Calc_PsmPf(w,calc,noteStr,selRow,err_PsmPf) |
---|
428 | calc[selRow][%P_sm_f] = PsmPf |
---|
429 | calc[selRow][%err_P_sm_f] = err_PsmPf |
---|
430 | w[selRow][%Pol_SM_FL] = PsmPf |
---|
431 | |
---|
432 | // Calc Psm, and assign the values |
---|
433 | Psm = Calc_Psm(w,calc,noteStr,selRow,err_Psm) |
---|
434 | calc[selRow][%P_sm] = Psm |
---|
435 | calc[selRow][%err_P_sm] = err_Psm |
---|
436 | w[selRow][%Pol_SM] = Psm |
---|
437 | |
---|
438 | // running average of PsmPf and Psm |
---|
439 | sum_PsmPf += PsmPf |
---|
440 | err_sum_PsmPf += err_PsmPf^2 |
---|
441 | sum_Psm += Psm |
---|
442 | err_sum_Psm += err_Psm^2 |
---|
443 | |
---|
444 | endif |
---|
445 | |
---|
446 | endfor //loop over rows |
---|
447 | |
---|
448 | // now get a running average of muP, Po, and the errors |
---|
449 | // use the actual number of rows included |
---|
450 | PsmPf = sum_PsmPf/nRowsIncluded |
---|
451 | Psm = sum_Psm/nRowsIncluded |
---|
452 | err_PsmPf = sqrt(err_sum_PsmPf) / nRowsIncluded |
---|
453 | err_Psm = sqrt(err_sum_Psm) / nRowsIncluded |
---|
454 | |
---|
455 | // this is the format of the note that is attached to the "Cond_" wave |
---|
456 | // String testStr = "P_sm_f=2,err_P_sm_f=0,P_sm=0.6,err_P_sm=0,T0=asdf," |
---|
457 | // the "Cell" value is not longer used |
---|
458 | |
---|
459 | |
---|
460 | // Put the average values into the wave note and display on the panel |
---|
461 | noteStr = note(w) |
---|
462 | noteStr = ReplaceNumberByKey("P_sm_f", noteStr, PsmPf ,"=", ",", 0) |
---|
463 | noteStr = ReplaceNumberByKey("P_sm", noteStr, Psm ,"=", ",", 0) |
---|
464 | noteStr = ReplaceNumberByKey("err_P_sm_f", noteStr, err_PsmPf ,"=", ",", 0) |
---|
465 | noteStr = ReplaceNumberByKey("err_P_sm", noteStr, err_Psm ,"=", ",", 0) |
---|
466 | |
---|
467 | // replace the string |
---|
468 | Note/K w |
---|
469 | Note w, noteStr |
---|
470 | |
---|
471 | //update the global values for display |
---|
472 | SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
473 | SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm |
---|
474 | sprintf gPsmPf, "%g +/- %g",PsmPf,err_PsmPf |
---|
475 | sprintf gPsm, "%g +/- %g",Psm,err_Psm |
---|
476 | |
---|
477 | break |
---|
478 | case -1: // control being killed |
---|
479 | break |
---|
480 | endswitch |
---|
481 | |
---|
482 | return 0 |
---|
483 | End |
---|
484 | |
---|
485 | // gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation |
---|
486 | // |
---|
487 | // TODO: |
---|
488 | // this is only using the measurement at t1 for the calculation! |
---|
489 | // -- do I need to recalculate at the midpoint of the time interval? |
---|
490 | // -- then how do I define the beginning and ending time? |
---|
491 | // |
---|
492 | Function Calc_PsmPf(w,calc,gCellKW,selRow,err_PsmPf) |
---|
493 | WAVE w,calc |
---|
494 | String gCellKW |
---|
495 | Variable selRow,&err_PsmPf |
---|
496 | |
---|
497 | // DD is cr3, DU is cr2, Blocked is cr5 |
---|
498 | String t0Str,t1Str,t2Str,fname |
---|
499 | Variable PsmPf,t1,t2,PCell_t1,PCell_t2,err_PCell_t1,err_PCell_t2 |
---|
500 | Variable muPo,err_muPo,gam,err_gam |
---|
501 | Variable crDD, crDU,err_crDD,err_crDU,crBB, err_crBB |
---|
502 | |
---|
503 | t0Str = StringByKey("T0", gCellKW, "=", ",", 0) |
---|
504 | muPo = NumberByKey("muP", gCellKW, "=", ",", 0) |
---|
505 | err_muPo = NumberByKey("err_muP", gCellKW, "=", ",", 0) |
---|
506 | gam = NumberByKey("gamma", gCellKW, "=", ",", 0) |
---|
507 | err_gam = NumberByKey("err_gamma", gCellKW, "=", ",", 0) |
---|
508 | |
---|
509 | fname = FindFileFromRunNumber(w[selRow][%'UU_Trans?']) |
---|
510 | t1str = getFileCreationDate(fname) |
---|
511 | t1 = ElapsedHours(t0Str,t1Str) |
---|
512 | |
---|
513 | fname = FindFileFromRunNumber(w[selRow][%'DU_Trans?']) |
---|
514 | t2str = getFileCreationDate(fname) |
---|
515 | t2 = ElapsedHours(t0Str,t2Str) |
---|
516 | |
---|
517 | PCell_t1 = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t1,err_PCell_t1) |
---|
518 | PCell_t2 = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t2,err_PCell_t2) |
---|
519 | |
---|
520 | // DD is cr3, DU is cr2, Blocked is cr5 |
---|
521 | crDD = calc[selRow][%cr_DD] |
---|
522 | crDU = calc[selRow][%cr_DU] |
---|
523 | crBB = calc[selRow][%cr_Blocked] |
---|
524 | err_crDD = calc[selRow][%err_cr_DD] |
---|
525 | err_crDU = calc[selRow][%err_cr_DU] |
---|
526 | err_crBB = calc[selRow][%err_cr_Blocked] |
---|
527 | |
---|
528 | // this really needs transmissions |
---|
529 | // PsmPf = (crDD - crDU)/(PCell_t1 + PCell_t2) |
---|
530 | |
---|
531 | // eqn (15) from the SS handout |
---|
532 | Variable tmp,dfdx |
---|
533 | tmp = (crDD - crBB)/(crDU - crBB) |
---|
534 | |
---|
535 | PsmPf = (tmp - 1)/(Pcell_t1*(1+tmp)) |
---|
536 | |
---|
537 | dfdx = 1/(Pcell_t1*(1+tmp)) - (tmp-1)*Pcell_t1/(Pcell_t1^2*(1+tmp)^2) |
---|
538 | |
---|
539 | err_PsmPf = ( (tmp-1)/((1+tmp)*Pcell_t1^2) *err_Pcell_t1 )^2 |
---|
540 | err_PsmPf += ( dfdx / (crDU-crBB) * err_crDD)^2 |
---|
541 | err_PsmPf += ( dfdx*(crDD-crBB)/(crDU-crBB)^2 * err_crDU)^2 |
---|
542 | err_PsmPf += ( dfdx*(-tmp/(crDD-crBB) + tmp/(crDU-crBB)) * err_crBB)^2 |
---|
543 | |
---|
544 | err_PsmPf = sqrt(err_PsmPf) |
---|
545 | Printf "At t1=%g PsmPf = %g +/- %g (%g%)\r",t1,PsmPf,err_PsmPf,err_PsmPf/PsmPf*100 |
---|
546 | |
---|
547 | |
---|
548 | return(PsmPf) |
---|
549 | end |
---|
550 | |
---|
551 | |
---|
552 | // gCellKW passed in has gamma, muPo, etc. needed for PCell(t) calculation |
---|
553 | // |
---|
554 | // TODO: |
---|
555 | // this is only using the measurement at t1 for the calculation! |
---|
556 | // -- do I need to recalculate at the midpoint of the time interval? |
---|
557 | // -- then how do I define the beginning and ending time? |
---|
558 | // |
---|
559 | // |
---|
560 | Function Calc_Psm(w,calc,gCellKW,selRow,err_Psm) |
---|
561 | WAVE w,calc |
---|
562 | String gCellKW |
---|
563 | Variable selRow,&err_Psm |
---|
564 | |
---|
565 | // UU is cr1, UD is cr4, Blocked is cr5 |
---|
566 | String t0Str,t1Str,t2Str,fname |
---|
567 | Variable Psm,t1,t2,PCell_t1,PCell_t2,err_PCell_t1,err_PCell_t2 |
---|
568 | Variable muPo,err_muPo,gam,err_gam |
---|
569 | Variable crUU, crUD,err_crUU,err_crUD,crBB, err_crBB |
---|
570 | |
---|
571 | t0Str = StringByKey("T0", gCellKW, "=", ",", 0) |
---|
572 | muPo = NumberByKey("muP", gCellKW, "=", ",", 0) |
---|
573 | err_muPo = NumberByKey("err_muP", gCellKW, "=", ",", 0) |
---|
574 | gam = NumberByKey("gamma", gCellKW, "=", ",", 0) |
---|
575 | err_gam = NumberByKey("err_gamma", gCellKW, "=", ",", 0) |
---|
576 | |
---|
577 | fname = FindFileFromRunNumber(w[selRow][%UU_Trans]) |
---|
578 | t1str = getFileCreationDate(fname) |
---|
579 | t1 = ElapsedHours(t0Str,t1Str) |
---|
580 | |
---|
581 | fname = FindFileFromRunNumber(w[selRow][%DU_Trans]) |
---|
582 | t2str = getFileCreationDate(fname) |
---|
583 | t2 = ElapsedHours(t0Str,t2Str) |
---|
584 | |
---|
585 | PCell_t1 = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t1,err_PCell_t1) |
---|
586 | PCell_t2 = Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t2,err_PCell_t2) |
---|
587 | |
---|
588 | // UU is cr1, UD is cr4, Blocked is cr5 |
---|
589 | crUU = calc[selRow][%cr_UU] |
---|
590 | crUD = calc[selRow][%cr_UD] |
---|
591 | crBB = calc[selRow][%cr_Blocked] |
---|
592 | err_crUU = calc[selRow][%err_cr_UU] |
---|
593 | err_crUD = calc[selRow][%err_cr_UD] |
---|
594 | err_crBB = calc[selRow][%err_cr_Blocked] |
---|
595 | |
---|
596 | // this really needs transmissions |
---|
597 | |
---|
598 | // eqn (14) from the SS handout |
---|
599 | Variable tmp,dfdx |
---|
600 | tmp = (crUU - crBB)/(crUD - crBB) |
---|
601 | |
---|
602 | Psm = (tmp - 1)/(Pcell_t1*(1+tmp)) |
---|
603 | |
---|
604 | dfdx = 1/(Pcell_t1*(1+tmp)) - (tmp-1)*Pcell_t1/(Pcell_t1^2*(1+tmp)^2) |
---|
605 | |
---|
606 | err_Psm = ( (tmp-1)/((1+tmp)*Pcell_t1^2) *err_Pcell_t1 )^2 |
---|
607 | err_Psm += ( dfdx / (crUD-crBB) * err_crUU)^2 |
---|
608 | err_Psm += ( dfdx*(crUU-crBB)/(crUD-crBB)^2 * err_crUD)^2 |
---|
609 | err_Psm += ( dfdx*(-tmp/(crUU-crBB) + tmp/(crUD-crBB)) * err_crBB)^2 |
---|
610 | |
---|
611 | err_Psm = sqrt(err_Psm) |
---|
612 | Printf "At t1=%g Psm = %g +/- %g (%g%)\r",t1,Psm,err_Psm,err_Psm/Psm*100 |
---|
613 | |
---|
614 | |
---|
615 | return(Psm) |
---|
616 | end |
---|
617 | |
---|
618 | // |
---|
619 | // calculate the (atomic) He polarization at some delta time |
---|
620 | // |
---|
621 | // t2 is in hours, gamma in hours |
---|
622 | // |
---|
623 | Function Calc_PHe_atT(Po,err_Po,gam,err_gam,t2,err_Pt) |
---|
624 | Variable Po,err_Po,gam,err_gam,t2,&err_Pt |
---|
625 | |
---|
626 | |
---|
627 | Variable Pt |
---|
628 | |
---|
629 | Pt = Po*exp(-t2/gam) |
---|
630 | |
---|
631 | Variable arg,tmp2 |
---|
632 | // 2 terms, no error in t2 |
---|
633 | err_Pt = Pt^2/Po^2*err_Po^2 + t2^2/gam^4*Pt^2*err_gam^2 |
---|
634 | |
---|
635 | err_Pt = sqrt(err_Pt) |
---|
636 | |
---|
637 | Printf "At (delta)t=%g P_He(t) = %g +/- %g (%g%)\r",t2,Pt,err_Pt,err_Pt/Pt*100 |
---|
638 | |
---|
639 | return(Pt) |
---|
640 | End |
---|
641 | |
---|
642 | |
---|
643 | |
---|
644 | // |
---|
645 | // t2 is in hours, muP0 is at t0 |
---|
646 | // |
---|
647 | Function Calc_PCell_atT(muPo,err_muPo,gam,err_gam,t2,err_PCell) |
---|
648 | Variable muPo,err_muPo,gam,err_gam,t2,&err_PCell |
---|
649 | |
---|
650 | |
---|
651 | Variable Pcell |
---|
652 | |
---|
653 | PCell = tanh(muPo * exp(-t2/gam)) |
---|
654 | // PCell = (muPo * exp(-t2/gam)) |
---|
655 | |
---|
656 | Variable arg,tmp2 |
---|
657 | arg = PCell |
---|
658 | tmp2 = (1-tanh(arg)^2)^2 |
---|
659 | err_PCell = tmp2 * (exp(-t2/gam) * err_muPo)^2 //dominant term (10x larger) |
---|
660 | err_PCell += tmp2 * (arg*t2/gam/gam * err_gam)^2 |
---|
661 | |
---|
662 | err_PCell = sqrt(err_Pcell) |
---|
663 | |
---|
664 | Printf "At t=%g Pcell = %g +/- %g (%g%)\r",t2,Pcell,err_Pcell,err_Pcell/PCell*100 |
---|
665 | |
---|
666 | return(PCell) |
---|
667 | End |
---|
668 | |
---|
669 | // bring up a table with the calculation results |
---|
670 | Function ShowFlipperCalcButton(ba) : ButtonControl |
---|
671 | STRUCT WMButtonAction &ba |
---|
672 | |
---|
673 | switch( ba.eventCode ) |
---|
674 | case 2: // mouse up |
---|
675 | // click code here |
---|
676 | ControlInfo/W=FlipperPanel popup_0 |
---|
677 | String condStr = S_Value |
---|
678 | condStr = condStr[5,strlen(condStr)-1] // trim off "Calc_" from the beginning of the string |
---|
679 | WAVE calc=$("root:Packages:NIST:Polarization:Cells:CondCalc_"+condStr) |
---|
680 | edit calc.ld |
---|
681 | |
---|
682 | break |
---|
683 | case -1: // control being killed |
---|
684 | break |
---|
685 | endswitch |
---|
686 | |
---|
687 | return 0 |
---|
688 | End |
---|
689 | |
---|
690 | |
---|
691 | |
---|
692 | // clear just the row |
---|
693 | // |
---|
694 | Function ClearFlipperRowButton(ba) : ButtonControl |
---|
695 | STRUCT WMButtonAction &ba |
---|
696 | |
---|
697 | String popStr="" |
---|
698 | Variable selRow |
---|
699 | |
---|
700 | switch( ba.eventCode ) |
---|
701 | case 2: // mouse up |
---|
702 | // click code here |
---|
703 | DoAlert 1,"Clear the selected row?" |
---|
704 | if(V_flag !=1) |
---|
705 | return(0) |
---|
706 | endif |
---|
707 | |
---|
708 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
709 | |
---|
710 | ControlInfo/W=FlipperPanel popup_0 |
---|
711 | popStr = S_Value |
---|
712 | popStr = StringFromList(1,S_Value,"_") //pop is "Cond_<condition>", so get list item 1 |
---|
713 | |
---|
714 | Wave cond = $("Cond_"+popStr) |
---|
715 | Wave calc = $("CondCalc_"+popStr) |
---|
716 | Wave/T cellW = $("CondCell_"+popStr) |
---|
717 | |
---|
718 | // Delete just those points |
---|
719 | |
---|
720 | GetSelection table, FlipperPanel#T0, 1 |
---|
721 | selRow = V_startRow |
---|
722 | DeletePoints selRow,1,cond,calc,cellW |
---|
723 | |
---|
724 | // clear the graph and the results |
---|
725 | SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm |
---|
726 | SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
727 | gPsm = "0" |
---|
728 | gPsmPf = "0" |
---|
729 | |
---|
730 | SetDataFolder root: |
---|
731 | break |
---|
732 | case -1: // control being killed |
---|
733 | break |
---|
734 | endswitch |
---|
735 | |
---|
736 | return 0 |
---|
737 | End |
---|
738 | |
---|
739 | |
---|
740 | |
---|
741 | // for this, do I want to clear everything, or just a selected row?? |
---|
742 | // |
---|
743 | // |
---|
744 | Function ClearAllFlipperWavesButton(ba) : ButtonControl |
---|
745 | STRUCT WMButtonAction &ba |
---|
746 | |
---|
747 | String popStr="" |
---|
748 | |
---|
749 | switch( ba.eventCode ) |
---|
750 | case 2: // mouse up |
---|
751 | // click code here |
---|
752 | DoAlert 1,"Clear all of the flipper waves for the selected cell?" |
---|
753 | if(V_flag !=1) |
---|
754 | return(0) |
---|
755 | endif |
---|
756 | |
---|
757 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
758 | |
---|
759 | ControlInfo/W=FlipperPanel popup_0 |
---|
760 | popStr = StringFromList(1,S_Value,"_") //pop is "Cond_<condition>", so get list item 1 |
---|
761 | |
---|
762 | Wave cond = $("Cond_"+popStr) |
---|
763 | Wave calc = $("CondCalc_"+popStr) |
---|
764 | Wave/T cellW = $("CondCell_"+popStr) |
---|
765 | |
---|
766 | // re-initialize the flipper waves, so it appears as a blank, initialized table |
---|
767 | |
---|
768 | MakeFlipperResultWaves(popStr) |
---|
769 | cond = 0 |
---|
770 | calc = 0 |
---|
771 | // cellW = "" |
---|
772 | cond[0][7] = 1 //default to include the point |
---|
773 | |
---|
774 | // clear the graph and the results? |
---|
775 | |
---|
776 | |
---|
777 | SVAR gPsm = root:Packages:NIST:Polarization:Cells:gPsm |
---|
778 | SVAR gPsmPf = root:Packages:NIST:Polarization:Cells:gPsmPf |
---|
779 | gPsm = "0" |
---|
780 | gPsmPf = "0" |
---|
781 | |
---|
782 | SetDataFolder root: |
---|
783 | break |
---|
784 | case -1: // control being killed |
---|
785 | break |
---|
786 | endswitch |
---|
787 | |
---|
788 | return 0 |
---|
789 | End |
---|
790 | |
---|
791 | |
---|
792 | Function FlipperHelpParButtonProc(ba) : ButtonControl |
---|
793 | STRUCT WMButtonAction &ba |
---|
794 | |
---|
795 | switch( ba.eventCode ) |
---|
796 | case 2: // mouse up |
---|
797 | // click code here |
---|
798 | DisplayHelpTopic/Z/K=1 "Flipper States Panel" |
---|
799 | if(V_flag !=0) |
---|
800 | DoAlert 0,"The Flipper States Panel Help file could not be found" |
---|
801 | endif |
---|
802 | break |
---|
803 | case -1: // control being killed |
---|
804 | break |
---|
805 | endswitch |
---|
806 | |
---|
807 | return 0 |
---|
808 | End |
---|
809 | |
---|
810 | |
---|
811 | |
---|
812 | // null condition is not right. if the loop fails, then the |
---|
813 | // retStr will be ";;;;", not zero length. What's the proper test? |
---|
814 | // Does it matter? the list of default gCell_sss should already be there. |
---|
815 | // |
---|
816 | Function/S D_ConditionNameList() |
---|
817 | |
---|
818 | String listStr="" |
---|
819 | |
---|
820 | SetDataFolder root:Packages:NIST:Polarization:Cells |
---|
821 | |
---|
822 | // get a list of the Condition waves |
---|
823 | listStr=WaveList("Cond_*",";","") |
---|
824 | // print listStr |
---|
825 | |
---|
826 | if(strlen(listStr) == 0) |
---|
827 | listStr = "no conditions defined;" |
---|
828 | endif |
---|
829 | |
---|
830 | SetDataFolder root: |
---|
831 | return(listStr) |
---|
832 | End |
---|
833 | |
---|
834 | |
---|
835 | // parse the row to be sure that: |
---|
836 | // |
---|
837 | // - files are valid numbers |
---|
838 | // - files are all at same SDD |
---|
839 | // - files are all with same attenuation (just print a warning to cmd) |
---|
840 | // - files all use the same cell |
---|
841 | // - files are all within 20 minutes of each other |
---|
842 | // |
---|
843 | // |
---|
844 | // SetDimLabel 1,0,UU_Trans,cond |
---|
845 | // SetDimLabel 1,1,DU_Trans,cond |
---|
846 | // SetDimLabel 1,2,DD_Trans,cond |
---|
847 | // SetDimLabel 1,3,UD_Trans,cond |
---|
848 | // SetDimLabel 1,4,Blocked,cond |
---|
849 | // SetDimLabel 1,5,Pol_SM_FL,cond |
---|
850 | // SetDimLabel 1,6,Pol_SM,cond //for a mask wave, non-zero is used in the fit |
---|
851 | // SetDimLabel 1,7,Include,cond |
---|
852 | // |
---|
853 | // There are 5 separate files now |
---|
854 | // |
---|
855 | Function ParseFlipperRow(w,selRow) |
---|
856 | Wave w |
---|
857 | Variable selRow |
---|
858 | |
---|
859 | Variable err=0 |
---|
860 | Variable atten1,atten2,atten3,atten4,atten5 |
---|
861 | Variable sdd1,sdd2,sdd3,sdd4,sdd5 |
---|
862 | Variable t1,t2,t3,t4,t5 |
---|
863 | String cell1,cell2,cell3,cell4,cell5 |
---|
864 | |
---|
865 | |
---|
866 | String fname="" |
---|
867 | |
---|
868 | |
---|
869 | // are all file numbers valid? |
---|
870 | fname = FindFileFromRunNumber(w[selRow][%'UU_Trans?']) |
---|
871 | if(cmpstr(fname,"")==0) |
---|
872 | DoAlert 0,"UU_Trans run "+num2str(w[selRow][%'UU_Trans?'])+" is not a valid run number" |
---|
873 | err = 1 |
---|
874 | else |
---|
875 | atten1 = getAttenNumber(fname) |
---|
876 | sdd1 = getSDD(fname) |
---|
877 | endif |
---|
878 | |
---|
879 | fname = FindFileFromRunNumber(w[selRow][%'DU_Trans?']) |
---|
880 | if(cmpstr(fname,"")==0) |
---|
881 | DoAlert 0,"DU_Trans run "+num2str(w[selRow][%'DU_Trans?'])+" is not a valid run number" |
---|
882 | err = 1 |
---|
883 | else |
---|
884 | atten2 = getAttenNumber(fname) |
---|
885 | sdd2 = getSDD(fname) |
---|
886 | endif |
---|
887 | |
---|
888 | fname = FindFileFromRunNumber(w[selRow][%'DD_Trans?']) |
---|
889 | if(cmpstr(fname,"")==0) |
---|
890 | DoAlert 0,"DD_Trans run "+num2str(w[selRow][%'DD_Trans?'])+" is not a valid run number" |
---|
891 | err = 1 |
---|
892 | else |
---|
893 | atten3 = getAttenNumber(fname) |
---|
894 | sdd3 = getSDD(fname) |
---|
895 | endif |
---|
896 | |
---|
897 | fname = FindFileFromRunNumber(w[selRow][%'UD_Trans?']) |
---|
898 | if(cmpstr(fname,"")==0) |
---|
899 | DoAlert 0,"UD_Trans run "+num2str(w[selRow][%'UD_Trans?'])+" is not a valid run number" |
---|
900 | err = 1 |
---|
901 | else |
---|
902 | atten4 = getAttenNumber(fname) |
---|
903 | sdd4 = getSDD(fname) |
---|
904 | endif |
---|
905 | |
---|
906 | fname = FindFileFromRunNumber(w[selRow][%'Blocked?']) |
---|
907 | if(cmpstr(fname,"")==0) |
---|
908 | DoAlert 0,"Blocked run "+num2str(w[selRow][%'Blocked?'])+" is not a valid run number" |
---|
909 | err = 1 |
---|
910 | else |
---|
911 | atten5 = getAttenNumber(fname) |
---|
912 | sdd5 = getSDD(fname) |
---|
913 | endif |
---|
914 | |
---|
915 | |
---|
916 | |
---|
917 | // do a check of the elapsed time from start to finish |
---|
918 | |
---|
919 | if( (sdd1 != sdd2) || (sdd2 != sdd3) || (sdd1 != sdd3) ) |
---|
920 | DoAlert 0,"Files in row "+num2str(selRow)+" are not all at the same detector distance" |
---|
921 | err = 1 |
---|
922 | endif |
---|
923 | |
---|
924 | |
---|
925 | if( (atten1 != atten2) || (atten2 != atten3) || (atten1 != atten3) ) |
---|
926 | DoAlert 0,"Files in row "+num2str(selRow)+" are not all collected with the same attenuation. Just so you know." |
---|
927 | err = 0 |
---|
928 | endif |
---|
929 | |
---|
930 | return(err) |
---|
931 | end |
---|
932 | |
---|
933 | |
---|
934 | //////////////////////////////////////////// |
---|
935 | |
---|
936 | |
---|
937 | |
---|
938 | /////////////////////// |
---|
939 | // |
---|
940 | // |
---|
941 | // Utilities to write out waves as Igor Text |
---|
942 | // |
---|
943 | // |
---|
944 | // -- TODO |
---|
945 | // -- add flags for SetScale, Note, DimLabels, text? (or a separate function) |
---|
946 | // x- add a function for 2D waves. wfprintf is not 2D aware... |
---|
947 | |
---|
948 | |
---|
949 | Function testWriteITX() |
---|
950 | |
---|
951 | Variable refnum |
---|
952 | String fname="a_test.itx" |
---|
953 | // WAVE w=root:testMat |
---|
954 | // WAVE/T w=root:testText |
---|
955 | WAVE/T w=root:Packages:NIST:Polarization:ListWave_0_UU |
---|
956 | |
---|
957 | |
---|
958 | Open/P=home refnum as fname // creates a new file, or overwrites the existing file |
---|
959 | |
---|
960 | fprintf refNum,"IGOR\r" |
---|
961 | |
---|
962 | // Write1DWaveToITX(w,refnum) |
---|
963 | // Write2DWaveToITX(w,refnum) |
---|
964 | // Write1DTextWaveToITX(w,refnum) |
---|
965 | Write2DTextWaveToITX(w,refnum) |
---|
966 | Close refnum |
---|
967 | |
---|
968 | return(0) |
---|
969 | end |
---|
970 | |
---|
971 | // writes out a 1D wave as Igor Text |
---|
972 | // |
---|
973 | // the wave and a valid refNum to an open file are passed |
---|
974 | // |
---|
975 | // the file is NOT closed when exiting |
---|
976 | // |
---|
977 | Function Write1DWaveToITX(w,refnum) |
---|
978 | Wave w |
---|
979 | Variable refNum |
---|
980 | |
---|
981 | String tmpStr,waveStr |
---|
982 | waveStr=NameOfWave(w) |
---|
983 | |
---|
984 | fprintf refNum,"WAVES/D\t%s\r",waveStr |
---|
985 | |
---|
986 | fprintf refNum,"BEGIN\r" |
---|
987 | |
---|
988 | wfprintf refnum, "\t%g\r",w |
---|
989 | |
---|
990 | fprintf refNum,"END\r" |
---|
991 | |
---|
992 | fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale y 0,0,\"\", %s\r",waveStr,waveStr |
---|
993 | |
---|
994 | // X SetScale/P x 0,1,"", fyy; SetScale y 0,0,"", fyy |
---|
995 | |
---|
996 | |
---|
997 | return(0) |
---|
998 | End |
---|
999 | |
---|
1000 | // writes out a 1D TEXT wave as Igor Text |
---|
1001 | // |
---|
1002 | // the wave and a valid refNum to an open file are passed |
---|
1003 | // |
---|
1004 | // the file is NOT closed when exiting |
---|
1005 | // |
---|
1006 | Function Write1DTextWaveToITX(w,refnum) |
---|
1007 | Wave/T w |
---|
1008 | Variable refNum |
---|
1009 | |
---|
1010 | String tmpStr,waveStr |
---|
1011 | waveStr=NameOfWave(w) |
---|
1012 | |
---|
1013 | fprintf refNum,"WAVES/T\t%s\r",waveStr |
---|
1014 | |
---|
1015 | fprintf refNum,"BEGIN\r" |
---|
1016 | |
---|
1017 | wfprintf refnum, "\t\"%s\"\r",w |
---|
1018 | |
---|
1019 | fprintf refNum,"END\r" |
---|
1020 | |
---|
1021 | fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale y 0,0,\"\", %s\r",waveStr,waveStr |
---|
1022 | |
---|
1023 | return(0) |
---|
1024 | End |
---|
1025 | |
---|
1026 | // writes out a 2D TEXT wave as Igor Text |
---|
1027 | // |
---|
1028 | // the wave and a valid refNum to an open file are passed |
---|
1029 | // |
---|
1030 | // the file is NOT closed when exiting |
---|
1031 | // |
---|
1032 | Function Write2DTextWaveToITX(w,refnum) |
---|
1033 | Wave/T w |
---|
1034 | Variable refNum |
---|
1035 | |
---|
1036 | String tmpStr,waveStr |
---|
1037 | Variable row,col,ii,jj,tmp |
---|
1038 | |
---|
1039 | row=DimSize(w, 0 ) |
---|
1040 | col=DimSize(w, 1 ) |
---|
1041 | waveStr=NameOfWave(w) |
---|
1042 | |
---|
1043 | fprintf refNum,"WAVES/T/N=(%d,%d)\t%s\r",row,col,waveStr |
---|
1044 | fprintf refNum,"BEGIN\r" |
---|
1045 | |
---|
1046 | for(ii=0;ii<row;ii+=1) |
---|
1047 | for(jj=0;jj<col;jj+=1) |
---|
1048 | fprintf refnum, "\t\"%s\"",w[ii][jj] |
---|
1049 | endfor |
---|
1050 | fprintf refnum, "\r" |
---|
1051 | endfor |
---|
1052 | |
---|
1053 | |
---|
1054 | fprintf refNum,"END\r" |
---|
1055 | |
---|
1056 | fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",waveStr,waveStr,waveStr |
---|
1057 | |
---|
1058 | // X SetScale/P x 0,1,"", testMat; SetScale/P y 0,1,"", testMat; SetScale d 0,0,"", testMat |
---|
1059 | |
---|
1060 | |
---|
1061 | |
---|
1062 | return(0) |
---|
1063 | End |
---|
1064 | |
---|
1065 | // writes out a 2D wave as Igor Text |
---|
1066 | // |
---|
1067 | // the wave and a valid refNum to an open file are passed |
---|
1068 | // |
---|
1069 | // the file is NOT closed when exiting |
---|
1070 | // |
---|
1071 | Function Write2DWaveToITX(w,refnum) |
---|
1072 | Wave w |
---|
1073 | Variable refNum |
---|
1074 | |
---|
1075 | String tmpStr,waveStr |
---|
1076 | Variable row,col,ii,jj,tmp |
---|
1077 | |
---|
1078 | row=DimSize(w, 0 ) |
---|
1079 | col=DimSize(w, 1 ) |
---|
1080 | waveStr=NameOfWave(w) |
---|
1081 | |
---|
1082 | fprintf refNum,"WAVES/D/N=(%d,%d)\t%s\r",row,col,waveStr |
---|
1083 | fprintf refNum,"BEGIN\r" |
---|
1084 | |
---|
1085 | for(ii=0;ii<row;ii+=1) |
---|
1086 | for(jj=0;jj<col;jj+=1) |
---|
1087 | fprintf refnum, "\t%g",w[ii][jj] |
---|
1088 | endfor |
---|
1089 | fprintf refnum, "\r" |
---|
1090 | endfor |
---|
1091 | |
---|
1092 | |
---|
1093 | fprintf refNum,"END\r" |
---|
1094 | |
---|
1095 | fprintf refnum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",waveStr,waveStr,waveStr |
---|
1096 | |
---|
1097 | // X SetScale/P x 0,1,"", testMat; SetScale/P y 0,1,"", testMat; SetScale d 0,0,"", testMat |
---|
1098 | |
---|
1099 | |
---|
1100 | |
---|
1101 | return(0) |
---|
1102 | End |
---|
1103 | |
---|
1104 | // root:Packages:NIST:Polarization:Cells: |
---|
1105 | // save the state of the pink panel, as CellParamSaveState.itx |
---|
1106 | Function SaveCellParameterTable() |
---|
1107 | |
---|
1108 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1109 | |
---|
1110 | // the waves are: |
---|
1111 | // CellName (T) |
---|
1112 | // lambda |
---|
1113 | // Te, err_Te |
---|
1114 | // mu, err_mu |
---|
1115 | |
---|
1116 | Variable refnum |
---|
1117 | String fname="CellParamSaveState.itx" |
---|
1118 | // WAVE w=root:testMat |
---|
1119 | WAVE/T cellName=root:Packages:NIST:Polarization:Cells:CellName |
---|
1120 | WAVE lambda=root:Packages:NIST:Polarization:Cells:lambda |
---|
1121 | WAVE Te=root:Packages:NIST:Polarization:Cells:Te |
---|
1122 | WAVE err_Te=root:Packages:NIST:Polarization:Cells:err_Te |
---|
1123 | WAVE mu=root:Packages:NIST:Polarization:Cells:mu |
---|
1124 | WAVE err_mu=root:Packages:NIST:Polarization:Cells:err_mu |
---|
1125 | |
---|
1126 | Open/P=home refnum as fname // creates a new file, or overwrites the existing file |
---|
1127 | fprintf refNum,"IGOR\r" |
---|
1128 | |
---|
1129 | Write1DTextWaveToITX(cellName,refnum) |
---|
1130 | fprintf refNum,"\r" |
---|
1131 | |
---|
1132 | Write1DWaveToITX(lambda,refnum) |
---|
1133 | fprintf refNum,"\r" |
---|
1134 | |
---|
1135 | Write1DWaveToITX(Te,refnum) |
---|
1136 | fprintf refNum,"\r" |
---|
1137 | |
---|
1138 | Write1DWaveToITX(err_Te,refnum) |
---|
1139 | fprintf refNum,"\r" |
---|
1140 | |
---|
1141 | Write1DWaveToITX(mu,refnum) |
---|
1142 | fprintf refNum,"\r" |
---|
1143 | |
---|
1144 | Write1DWaveToITX(err_mu,refnum) |
---|
1145 | |
---|
1146 | Close refnum |
---|
1147 | |
---|
1148 | SetDataFolder root: |
---|
1149 | |
---|
1150 | return(0) |
---|
1151 | End |
---|
1152 | |
---|
1153 | //could use /P=home, but the whole point is that this is for users without Igor licenses, that can't save... so "home" won't exist... |
---|
1154 | Function RestoreCellParameterTable() |
---|
1155 | |
---|
1156 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1157 | String fname="CellParamSaveState.itx" |
---|
1158 | |
---|
1159 | // LoadWave/P=home/O/T fname |
---|
1160 | LoadWave/O/T fname |
---|
1161 | |
---|
1162 | SetDataFolder root: |
---|
1163 | return(0) |
---|
1164 | End |
---|
1165 | |
---|
1166 | |
---|
1167 | // saves the parameters for the cell decay table |
---|
1168 | // |
---|
1169 | // fname = "CellDecayPanelSaveState.itx" |
---|
1170 | // |
---|
1171 | // |
---|
1172 | Function SaveCellDecayTable() |
---|
1173 | |
---|
1174 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1175 | |
---|
1176 | String listStr,item,fname,noteStr,wStr |
---|
1177 | Variable num,ii,refnum |
---|
1178 | |
---|
1179 | fname = "CellDecayPanelSaveState.itx" |
---|
1180 | |
---|
1181 | // get a list of the Decay waves |
---|
1182 | listStr=WaveList("Decay_*",";","") |
---|
1183 | num=ItemsInList(listStr,";") |
---|
1184 | // print listStr |
---|
1185 | |
---|
1186 | Open/P=home refnum as fname // creates a new file, or overwrites the existing file |
---|
1187 | fprintf refNum,"IGOR\r" |
---|
1188 | |
---|
1189 | // Save each of the decay waves, then be sure to add the DimLabels and Wave Note |
---|
1190 | for(ii=0;ii<num;ii+=1) |
---|
1191 | item = StringFromList(ii, listStr,";") |
---|
1192 | Wave w = $item |
---|
1193 | wStr=NameOfWave(w) |
---|
1194 | noteStr = note(w) |
---|
1195 | |
---|
1196 | Write2DWaveToITX(w,refnum) |
---|
1197 | |
---|
1198 | // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr |
---|
1199 | fprintf refNum,"X SetDimLabel 1, 0, 'Trans_He_In?', %s\r",wStr |
---|
1200 | fprintf refNum,"X SetDimLabel 1, 1, 'Trans_He_Out?', %s\r",wStr |
---|
1201 | fprintf refNum,"X SetDimLabel 1, 2, 'Blocked?', %s\r",wStr |
---|
1202 | fprintf refNum,"X SetDimLabel 1, 3, mu_star, %s\r",wStr |
---|
1203 | fprintf refNum,"X SetDimLabel 1, 4, Effective_Pol, %s\r",wStr |
---|
1204 | fprintf refNum,"X SetDimLabel 1, 5, Atomic_Pol, %s\r",wStr |
---|
1205 | fprintf refNum,"X SetDimLabel 1, 6, T_Major, %s\r",wStr |
---|
1206 | fprintf refNum,"X SetDimLabel 1, 7, 'Include?', %s\r",wStr |
---|
1207 | fprintf refNum,"X SetDimLabel 1, 8, elapsed_hr, %s\r",wStr |
---|
1208 | fprintf refNum,"X Note %s, \"%s\"\r",wStr,noteStr |
---|
1209 | |
---|
1210 | fprintf refNum,"\r" //space between waves |
---|
1211 | endfor |
---|
1212 | |
---|
1213 | // get a list of the DecayCalc_ waves |
---|
1214 | listStr=WaveList("DecayCalc_*",";","") |
---|
1215 | num=ItemsInList(listStr,";") |
---|
1216 | |
---|
1217 | // Save each of the DecayCalc waves, and add all of the proper dim labels |
---|
1218 | for(ii=0;ii<num;ii+=1) |
---|
1219 | item = StringFromList(ii, listStr,";") |
---|
1220 | Wave w = $item |
---|
1221 | wStr=NameOfWave(w) |
---|
1222 | |
---|
1223 | Write2DWaveToITX(w,refnum) |
---|
1224 | |
---|
1225 | // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr |
---|
1226 | fprintf refNum,"X SetDimLabel 1, 0, CR_Trans_He_In, %s\r",wStr |
---|
1227 | fprintf refNum,"X SetDimLabel 1, 1, err_CR_Trans_He_In, %s\r",wStr |
---|
1228 | fprintf refNum,"X SetDimLabel 1, 2, CR_Trans_He_Out, %s\r",wStr |
---|
1229 | fprintf refNum,"X SetDimLabel 1, 3, err_CR_Trans_He_Out, %s\r",wStr |
---|
1230 | fprintf refNum,"X SetDimLabel 1, 4, CR_Blocked, %s\r",wStr |
---|
1231 | fprintf refNum,"X SetDimLabel 1, 5, err_CR_Blocked, %s\r",wStr |
---|
1232 | fprintf refNum,"X SetDimLabel 1, 6, muPo, %s\r",wStr |
---|
1233 | fprintf refNum,"X SetDimLabel 1, 7, err_muPo, %s\r",wStr |
---|
1234 | fprintf refNum,"X SetDimLabel 1, 8, Po, %s\r",wStr |
---|
1235 | fprintf refNum,"X SetDimLabel 1, 9, err_Po, %s\r",wStr |
---|
1236 | fprintf refNum,"X SetDimLabel 1, 10, Tmaj, %s\r",wStr |
---|
1237 | fprintf refNum,"X SetDimLabel 1, 11, err_Tmaj, %s\r",wStr |
---|
1238 | fprintf refNum,"X SetDimLabel 1, 12, gamm, %s\r",wStr |
---|
1239 | fprintf refNum,"X SetDimLabel 1, 13, err_gamm, %s\r",wStr |
---|
1240 | |
---|
1241 | fprintf refNum,"\r" |
---|
1242 | endfor |
---|
1243 | |
---|
1244 | Close refnum |
---|
1245 | |
---|
1246 | SetDataFolder root: |
---|
1247 | return(0) |
---|
1248 | End |
---|
1249 | |
---|
1250 | // restores the waves for the cell decay table |
---|
1251 | // |
---|
1252 | // fname = "CellDecayPanelSaveState.itx" |
---|
1253 | // |
---|
1254 | // |
---|
1255 | Function RestoreCellDecayTable() |
---|
1256 | |
---|
1257 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1258 | |
---|
1259 | String listStr,item,fname,noteStr,wStr |
---|
1260 | Variable num,ii,refnum |
---|
1261 | |
---|
1262 | fname = "CellDecayPanelSaveState.itx" |
---|
1263 | LoadWave/O/T fname |
---|
1264 | |
---|
1265 | SetDataFolder root: |
---|
1266 | return(0) |
---|
1267 | End |
---|
1268 | |
---|
1269 | |
---|
1270 | |
---|
1271 | //////// |
---|
1272 | // |
---|
1273 | // save the state of the Flipper panel |
---|
1274 | // |
---|
1275 | // fname = "FlipperPanelSaveState.itx" |
---|
1276 | // |
---|
1277 | Function SaveFlipperTable() |
---|
1278 | |
---|
1279 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1280 | |
---|
1281 | String listStr,item,fname,noteStr,wStr |
---|
1282 | Variable num,ii,refnum |
---|
1283 | |
---|
1284 | fname = "FlipperPanelSaveState.itx" |
---|
1285 | |
---|
1286 | // get a list of the "Condition" waves |
---|
1287 | listStr=WaveList("Cond_*",";","") |
---|
1288 | num=ItemsInList(listStr,";") |
---|
1289 | // print listStr |
---|
1290 | |
---|
1291 | Open/P=home refnum as fname // creates a new file, or overwrites the existing file |
---|
1292 | fprintf refNum,"IGOR\r" |
---|
1293 | |
---|
1294 | // Save each of the cond waves, then be sure to add the DimLabels and Wave Note |
---|
1295 | for(ii=0;ii<num;ii+=1) |
---|
1296 | item = StringFromList(ii, listStr,";") |
---|
1297 | Wave w = $item |
---|
1298 | wStr=NameOfWave(w) |
---|
1299 | noteStr = note(w) |
---|
1300 | |
---|
1301 | Write2DWaveToITX(w,refnum) |
---|
1302 | |
---|
1303 | // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr |
---|
1304 | fprintf refNum,"X SetDimLabel 1, 0, 'UU_Trans?', %s\r",wStr |
---|
1305 | fprintf refNum,"X SetDimLabel 1, 1, 'DU_Trans?', %s\r",wStr |
---|
1306 | fprintf refNum,"X SetDimLabel 1, 2, 'DD_Trans?', %s\r",wStr |
---|
1307 | fprintf refNum,"X SetDimLabel 1, 3, 'UD_Trans?', %s\r",wStr |
---|
1308 | fprintf refNum,"X SetDimLabel 1, 4, 'Blocked?', %s\r",wStr |
---|
1309 | fprintf refNum,"X SetDimLabel 1, 5, Pol_SM_FL, %s\r",wStr |
---|
1310 | fprintf refNum,"X SetDimLabel 1, 6, Pol_SM, %s\r",wStr |
---|
1311 | fprintf refNum,"X SetDimLabel 1, 7, 'Include?', %s\r",wStr |
---|
1312 | fprintf refNum,"X Note %s, \"%s\"\r",wStr,noteStr |
---|
1313 | |
---|
1314 | fprintf refNum,"\r" //space between waves |
---|
1315 | endfor |
---|
1316 | |
---|
1317 | // get a list of the CondCalc_ waves (2d, with dimlabels) |
---|
1318 | listStr=WaveList("CondCalc_*",";","") |
---|
1319 | num=ItemsInList(listStr,";") |
---|
1320 | |
---|
1321 | // Save each of the DecayCalc waves, and add all of the proper dim labels |
---|
1322 | for(ii=0;ii<num;ii+=1) |
---|
1323 | item = StringFromList(ii, listStr,";") |
---|
1324 | Wave w = $item |
---|
1325 | wStr=NameOfWave(w) |
---|
1326 | |
---|
1327 | Write2DWaveToITX(w,refnum) |
---|
1328 | |
---|
1329 | // fprintf refNum,"X SetScale/P x 0,1,\"\", %s; SetScale/P y 0,1,\"\", %s; SetScale d 0,0,\"\", %s\r",wStr,wStr,wStr |
---|
1330 | fprintf refNum,"X SetDimLabel 1, 0, CR_UU, %s\r",wStr |
---|
1331 | fprintf refNum,"X SetDimLabel 1, 1, err_CR_UU, %s\r",wStr |
---|
1332 | fprintf refNum,"X SetDimLabel 1, 2, CR_DU, %s\r",wStr |
---|
1333 | fprintf refNum,"X SetDimLabel 1, 3, err_CR_DU, %s\r",wStr |
---|
1334 | fprintf refNum,"X SetDimLabel 1, 4, CR_DD, %s\r",wStr |
---|
1335 | fprintf refNum,"X SetDimLabel 1, 5, err_CR_DD, %s\r",wStr |
---|
1336 | fprintf refNum,"X SetDimLabel 1, 6, CR_UD, %s\r",wStr |
---|
1337 | fprintf refNum,"X SetDimLabel 1, 7, err_CR_UD, %s\r",wStr |
---|
1338 | fprintf refNum,"X SetDimLabel 1, 8, CR_Blocked, %s\r",wStr |
---|
1339 | fprintf refNum,"X SetDimLabel 1, 9, err_CR_Blocked, %s\r",wStr |
---|
1340 | fprintf refNum,"X SetDimLabel 1, 10, P_sm_f, %s\r",wStr |
---|
1341 | fprintf refNum,"X SetDimLabel 1, 11, err_P_sm_f, %s\r",wStr |
---|
1342 | fprintf refNum,"X SetDimLabel 1, 12, P_sm, %s\r",wStr |
---|
1343 | fprintf refNum,"X SetDimLabel 1, 13, err_P_sm, %s\r",wStr |
---|
1344 | |
---|
1345 | fprintf refNum,"\r" |
---|
1346 | endfor |
---|
1347 | |
---|
1348 | // get a list of the CondCell_ waves (these are text, 1d) |
---|
1349 | listStr=WaveList("CondCell_*",";","") |
---|
1350 | num=ItemsInList(listStr,";") |
---|
1351 | |
---|
1352 | // Save each of the DecayCalc waves, and add all of the proper dim labels |
---|
1353 | for(ii=0;ii<num;ii+=1) |
---|
1354 | item = StringFromList(ii, listStr,";") |
---|
1355 | Wave w = $item |
---|
1356 | wStr=NameOfWave(w) |
---|
1357 | |
---|
1358 | Write1DTextWaveToITX(w,refnum) |
---|
1359 | |
---|
1360 | // fprintf refnum,"X SetScale/P x 0,1,\"\", wStr; SetScale y 0,0,\"\", %s\r",wStr |
---|
1361 | |
---|
1362 | fprintf refNum,"\r" |
---|
1363 | endfor |
---|
1364 | |
---|
1365 | Close refnum |
---|
1366 | |
---|
1367 | SetDataFolder root: |
---|
1368 | return(0) |
---|
1369 | end |
---|
1370 | |
---|
1371 | |
---|
1372 | |
---|
1373 | // restores the state of the Flipper panel |
---|
1374 | // |
---|
1375 | // fname = "FlipperPanelSaveState.itx" |
---|
1376 | // |
---|
1377 | // |
---|
1378 | Function RestoreFlipperTable() |
---|
1379 | |
---|
1380 | SetDataFolder root:Packages:NIST:Polarization:Cells: |
---|
1381 | |
---|
1382 | String listStr,item,fname,noteStr,wStr |
---|
1383 | Variable num,ii,refnum |
---|
1384 | |
---|
1385 | fname = "FlipperPanelSaveState.itx" |
---|
1386 | LoadWave/O/T fname |
---|
1387 | |
---|
1388 | SetDataFolder root: |
---|
1389 | return(0) |
---|
1390 | End |
---|