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 | //////////////////////////////////////////// |
---|