1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma version=1.13 |
---|
3 | |
---|
4 | //*************************************************************************\ |
---|
5 | //* Copyright (c) 2005 - 2013, Argonne National Laboratory |
---|
6 | //* This file is distributed subject to a Software License Agreement found |
---|
7 | //* in the file LICENSE that is included with this distribution. |
---|
8 | //*************************************************************************/ |
---|
9 | |
---|
10 | //1.13 modified data stored in wavenote to minimize stuff saved there. |
---|
11 | //1.12 removed exp[ress calls to font and fsize for panels to enable user controls over these parameters |
---|
12 | //1.11 Modifed local Guinier and Power law fits to handle multiple contrasts for data when using multiple input data sets. |
---|
13 | //1.10 Added Scripting tool button and features around it, it is enabled ONLY for Single Data set input |
---|
14 | //1.09 fixed bug in fitting local P and B in unified model which was setting wrong limits. Added ability to remove points from data. |
---|
15 | //1.08 Modified for Scripting tool |
---|
16 | //1.07 added button to graph to select fitting Q range with cursors from the graph |
---|
17 | //1.06 modified to 10 populations, changed handling of Unified fit and diffraction peaks. |
---|
18 | //1.05 fix problem with "Use" checkbox and not redrawing the tab view. Fixed display of G limits when using Unified level. |
---|
19 | //1.04 fix the popup for help notebook when users select User FF |
---|
20 | //1.03 fix logging into logbook (someone is actually using it!) where it wrongly choose distribution type. |
---|
21 | //1.02 added Unified Fit level as Form factor |
---|
22 | //1.01 added license for ANL |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | //***************************************************************************************************************** |
---|
27 | //***************************************************************************************************************** |
---|
28 | //***************************************************************************************************************** |
---|
29 | //***************************************************************************************************************** |
---|
30 | //***************************************************************************************************************** |
---|
31 | |
---|
32 | Function IR2L_InputGraphButtonProc(ctrlName) : ButtonControl |
---|
33 | String ctrlName |
---|
34 | |
---|
35 | string oldDf=GetDataFolder(1) |
---|
36 | setDataFolder root:Packages:IR2L_NLSQF |
---|
37 | |
---|
38 | if(cmpstr(ctrlName,"AutoSetAxis")==0) |
---|
39 | IR2L_AutosetGraphAxis(1) |
---|
40 | endif |
---|
41 | if(cmpstr(ctrlName,"SetAxis")==0) |
---|
42 | IR2L_AutosetGraphAxis(0) |
---|
43 | endif |
---|
44 | if(cmpstr(ctrlName,"SelectQRangeofData")==0) |
---|
45 | // NEED TO FIGURE OUT IF THE CURSORS ARE SET ON Intensity and same one, which data set it is and then pass it to the right function... |
---|
46 | if(strlen(csrInfo(A))<1 || strlen(csrInfo(B))<1) |
---|
47 | Abort "Cursors are not set correctly. Place cursors on Intensity data and try again" |
---|
48 | endif |
---|
49 | string TnameA=stringByKey("TNAME",csrinfo(A)) |
---|
50 | string TnameB=stringByKey("TNAME",csrinfo(B)) |
---|
51 | if(!stringmatch(TnameA,TnameB) || !stringmatch(TnameA,"Intensity_set*") || !stringmatch(TnameB,"Intensity_set*")) |
---|
52 | abort "Cursors are not set correctly. Set cursors on SAME Intensity data and try again" |
---|
53 | endif |
---|
54 | variable setValue=str2num(ReplaceString("Intensity_set", TnameA, "")) |
---|
55 | print setValue |
---|
56 | IR2L_SetQminQmaxWCursors(setValue) |
---|
57 | endif |
---|
58 | |
---|
59 | |
---|
60 | DoWIndow/F LSQF_MainGraph |
---|
61 | setDataFolder oldDF |
---|
62 | end |
---|
63 | //****************************************************************************************** |
---|
64 | //****************************************************************************************** |
---|
65 | //****************************************************************************************** |
---|
66 | //****************************************************************************************** |
---|
67 | //****************************************************************************************** |
---|
68 | Function IR2L_RemovePntCsrA(DataTabNumber) |
---|
69 | variable DataTabNumber |
---|
70 | |
---|
71 | variable DataSetNumber=DataTabNumber+1 |
---|
72 | |
---|
73 | DoWIndow LSQF_MainGraph |
---|
74 | if(!V_flag) |
---|
75 | print "Modeling II main graph does not exist" |
---|
76 | return 0 |
---|
77 | endif |
---|
78 | if (strlen(csrInfo(A,"LSQF_MainGraph"))<1) |
---|
79 | print "Cursor A is not set in the graph, set onto data point you want to remove" |
---|
80 | DoAlert 0, "Cursor A is not set in the graph, set onto data point you want to remove first" |
---|
81 | return 0 |
---|
82 | else //cursor A is set, now check if it is on the right wave |
---|
83 | String IntWvName="Intensity_set"+num2str(DataSetNumber) |
---|
84 | if(!stringMatch(IntWvName,StringByKey("TNAME", csrInfo(A,"LSQF_MainGraph") ))) |
---|
85 | print "Cursor A is not set on the right wave, expected to be set on : "+IntWvName |
---|
86 | DoAlert 0, "Cursor A is not set on the right wave, expected to be set on : "+IntWvName |
---|
87 | return 0 |
---|
88 | else //OK, it is on the right wave, need to remove the point from the three waves and return 1 to recalculate model... |
---|
89 | Wave IntWv = $("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(DataSetNumber)) |
---|
90 | Wave QWv = $("root:Packages:IR2L_NLSQF:Q_set"+num2str(DataSetNumber)) |
---|
91 | Wave EWv = $("root:Packages:IR2L_NLSQF:Error_set"+num2str(DataSetNumber)) |
---|
92 | Wave MaskWv = $("root:Packages:IR2L_NLSQF:IntensityMask_set"+num2str(DataSetNumber)) |
---|
93 | Duplicate/Free MaskWv, tempWvF |
---|
94 | IntWv[pcsr(A,"LSQF_MainGraph")]=NaN |
---|
95 | print "removed Point number " + num2str(pcsr(A,"LSQF_MainGraph")) +" from wave : "+IntWvName |
---|
96 | IN2G_RemoveNaNsFrom5Waves(IntWv,QWv,EWv,MaskWv,tempWvF) |
---|
97 | return 1 |
---|
98 | endif |
---|
99 | |
---|
100 | endif |
---|
101 | |
---|
102 | end |
---|
103 | //****************************************************************************************** |
---|
104 | //****************************************************************************************** |
---|
105 | //****************************************************************************************** |
---|
106 | //****************************************************************************************** |
---|
107 | //****************************************************************************************** |
---|
108 | |
---|
109 | Function IR2L_InputPanelButtonProc(ctrlName) : ButtonControl |
---|
110 | String ctrlName |
---|
111 | |
---|
112 | string oldDf=GetDataFolder(1) |
---|
113 | setDataFolder root:Packages:IR2L_NLSQF |
---|
114 | variable i |
---|
115 | |
---|
116 | |
---|
117 | if(cmpstr(ctrlName,"RemovePointWcsrA")==0) |
---|
118 | //here we load the data and create default values |
---|
119 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
120 | //IR2L_LoadDataIntoSet(V_Value+1,0) |
---|
121 | //NVAR UseTheData_set=$("UseTheData_set"+num2str(V_Value+1)) |
---|
122 | //UseTheData_set=1 |
---|
123 | IR2L_Data_TabPanelControl("",V_Value) |
---|
124 | if(IR2L_RemovePntCsrA(V_Value)) |
---|
125 | IR2L_RecalculateIfSelected() |
---|
126 | endif |
---|
127 | //IR2L_AppendDataIntoGraph(V_Value+1) |
---|
128 | //IR2L_AppendOrRemoveLocalPopInts() |
---|
129 | //IR2L_FormatInputGraph() |
---|
130 | //IR2L_FormatLegend() |
---|
131 | //DoWIndow LSQF_MainGraph |
---|
132 | //if(V_Flag) |
---|
133 | //AutoPositionWindow/R=LSQF2_MainPanel LSQF_MainGraph |
---|
134 | //endif |
---|
135 | endif |
---|
136 | |
---|
137 | if(cmpstr(ctrlName,"AddDataSet")==0) |
---|
138 | //here we load the data and create default values |
---|
139 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
140 | IR2L_LoadDataIntoSet(V_Value+1,0) |
---|
141 | NVAR UseTheData_set=$("UseTheData_set"+num2str(V_Value+1)) |
---|
142 | UseTheData_set=1 |
---|
143 | IR2L_Data_TabPanelControl("",V_Value) |
---|
144 | IR2L_AppendDataIntoGraph(V_Value+1) |
---|
145 | IR2L_AppendOrRemoveLocalPopInts() |
---|
146 | IR2L_FormatInputGraph() |
---|
147 | IR2L_FormatLegend() |
---|
148 | DoWIndow LSQF_MainGraph |
---|
149 | if(V_Flag) |
---|
150 | AutoPositionWindow/R=LSQF2_MainPanel LSQF_MainGraph |
---|
151 | endif |
---|
152 | endif |
---|
153 | if(cmpstr(ctrlName,"AddDataSetSkipRecover")==0) |
---|
154 | //here we load the data and create default values |
---|
155 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
156 | IR2L_LoadDataIntoSet(V_Value+1,1) |
---|
157 | NVAR UseTheData_set=$("UseTheData_set"+num2str(V_Value+1)) |
---|
158 | UseTheData_set=1 |
---|
159 | IR2L_Data_TabPanelControl("",V_Value) |
---|
160 | IR2L_AppendDataIntoGraph(V_Value+1) |
---|
161 | IR2L_AppendOrRemoveLocalPopInts() |
---|
162 | IR2L_FormatInputGraph() |
---|
163 | IR2L_FormatLegend() |
---|
164 | DoWIndow LSQF_MainGraph |
---|
165 | if(V_Flag) |
---|
166 | AutoPositionWindow/R=LSQF2_MainPanel LSQF_MainGraph |
---|
167 | endif |
---|
168 | endif |
---|
169 | if(stringmatch(ctrlName,"FitRgandG")) |
---|
170 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
171 | IR2L_FitLocalGuinier(V_Value+1) |
---|
172 | IR2L_CalculateIntensity(0,0) |
---|
173 | endif |
---|
174 | if(stringmatch(ctrlName,"FitPandB")) |
---|
175 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
176 | IR2L_FitLocalPorod(V_Value+1) |
---|
177 | IR2L_CalculateIntensity(0,0) |
---|
178 | endif |
---|
179 | |
---|
180 | if(stringmatch(ctrlName,"ScriptingTool")) |
---|
181 | IR2S_ScriptingTool() |
---|
182 | AutoPositionWindow/M=1/R=LSQF2_MainPanel IR2S_ScriptingToolPnl |
---|
183 | NVAR GUseIndra2data=root:Packages:IR2L_NLSQF:UseIndra2Data |
---|
184 | NVAR GUseQRSdata=root:Packages:IR2L_NLSQF:UseQRSdata |
---|
185 | NVAR STUseIndra2Data=root:Packages:Irena:ScriptingTool:UseIndra2Data |
---|
186 | NVAR STUseQRSData = root:Packages:Irena:ScriptingTool:UseQRSdata |
---|
187 | STUseIndra2Data = GUseIndra2data |
---|
188 | STUseQRSData = GUseQRSdata |
---|
189 | if(STUseIndra2Data+STUseQRSData!=1) |
---|
190 | Abort "At this time this scripting can be used ONLY for QRS and Indra2 data" |
---|
191 | STUseQRSData=1 |
---|
192 | GUseQRSdata=1 |
---|
193 | endif |
---|
194 | IR2S_UpdateListOfAvailFiles() |
---|
195 | |
---|
196 | endif |
---|
197 | if(stringmatch(ctrlName,"Recalculate")) |
---|
198 | IR2L_CalculateIntensity(0,0) |
---|
199 | endif |
---|
200 | if(stringmatch(ctrlName,"ReverseFit")) |
---|
201 | IR2L_ResetParamsAfterBadFit() |
---|
202 | endif |
---|
203 | if(stringmatch(ctrlName,"FitModel")) |
---|
204 | IR2L_Fitting(0) |
---|
205 | endif |
---|
206 | if(stringmatch(ctrlName,"FitModelSkipDialogs")) |
---|
207 | IR2L_Fitting(1) |
---|
208 | endif |
---|
209 | if(cmpstr(ctrlName,"RemoveAllDataSets")==0) |
---|
210 | IR2L_RemoveAllDataSets() |
---|
211 | endif |
---|
212 | if(cmpstr(ctrlName,"UnuseAllDataSets")==0) |
---|
213 | IR2L_unUseAllDataSets() |
---|
214 | endif |
---|
215 | if(cmpstr(ctrlName,"SaveInDataFolder")==0) |
---|
216 | IR2L_SaveResultsInDataFolder(0) |
---|
217 | endif |
---|
218 | if(cmpstr(ctrlName,"SaveInDataFolderSkipDialog")==0) |
---|
219 | IR2L_SaveResultsInDataFolder(1) |
---|
220 | endif |
---|
221 | if(cmpstr(ctrlName,"SaveInWaves")==0) |
---|
222 | IR2L_SaveResultsInWaves(0) |
---|
223 | endif |
---|
224 | if(cmpstr(ctrlName,"SaveInWavesSkipDialog")==0) |
---|
225 | IR2L_SaveResultsInWaves(1) |
---|
226 | endif |
---|
227 | if(cmpstr(ctrlName,"PasteTagsToGraph")==0) |
---|
228 | IR2L_AddRemoveTagsToGraph(1) |
---|
229 | endif |
---|
230 | if(cmpstr(ctrlName,"RemoveTagsFromGraph")==0) |
---|
231 | IR2L_AddRemoveTagsToGraph(0) |
---|
232 | endif |
---|
233 | if(cmpstr(ctrlName,"FixLimitsTight")==0) |
---|
234 | IR2L_FixLimits(1) |
---|
235 | endif |
---|
236 | if(cmpstr(ctrlName,"FixLimitsLoose")==0) |
---|
237 | IR2L_FixLimits(3) |
---|
238 | endif |
---|
239 | if(cmpstr(ctrlName,"AnalyzeUncertainities")==0) |
---|
240 | IR2L_AnalyzeUncertainities() |
---|
241 | endif |
---|
242 | |
---|
243 | if(cmpstr(ctrlName,"ReadCursors")==0) |
---|
244 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
245 | IR2L_SetQminQmaxWCursors(V_Value+1) |
---|
246 | endif |
---|
247 | if(cmpstr(ctrlName,"ConfigureGraph")==0) |
---|
248 | IR2C_ConfigMain() |
---|
249 | PauseForUser IR2C_MainConfigPanel |
---|
250 | IR2L_FormatInputGraph() |
---|
251 | IR2L_FormatLegend() |
---|
252 | endif |
---|
253 | if(cmpstr(ctrlName,"ReGraph")==0) |
---|
254 | DoWindow LSQF_MainGraph |
---|
255 | if(V_Flag) |
---|
256 | DoWindow/K LSQF_MainGraph |
---|
257 | endif |
---|
258 | NVAR MultipleInputData = root:Packages:IR2L_NLSQF:MultipleInputData |
---|
259 | variable MaxDataSets=10 |
---|
260 | if(!MultipleInputData) |
---|
261 | MaxDataSets=1 |
---|
262 | endif |
---|
263 | For(i=1;i<=MaxDataSets;i+=1) |
---|
264 | NVAR UseTheData_set=$("UseTheData_set"+num2str(i)) |
---|
265 | if(UseTheData_set) |
---|
266 | IR2L_AppendDataIntoGraph(i) |
---|
267 | endif |
---|
268 | endfor |
---|
269 | IR2L_AppendOrRemoveLocalPopInts() |
---|
270 | IR2L_FormatInputGraph() |
---|
271 | IR2L_FormatLegend() |
---|
272 | DoWIndow LSQF_MainGraph |
---|
273 | if(V_Flag) |
---|
274 | AutoPositionWindow/R=LSQF2_MainPanel LSQF_MainGraph |
---|
275 | endif |
---|
276 | endif |
---|
277 | |
---|
278 | if(cmpstr(ctrlName,"SaveInNotebook")==0) |
---|
279 | IR2L_SaveResultsInNotebook() |
---|
280 | endif |
---|
281 | |
---|
282 | |
---|
283 | DoWindow/F LSQF2_MainPanel |
---|
284 | setDataFolder oldDF |
---|
285 | end |
---|
286 | |
---|
287 | //**************************************************************************************************************** |
---|
288 | //**************************************************************************************************************** |
---|
289 | |
---|
290 | |
---|
291 | Function IR2L_FitLocalGuinier(Level) |
---|
292 | variable level |
---|
293 | string oldDf=GetDataFolder(1) |
---|
294 | setDataFolder root:Packages:IR2L_NLSQF |
---|
295 | |
---|
296 | //first set to display local fits |
---|
297 | //check if the cursors are set... |
---|
298 | if(strlen(CsrWave(A , "LSQF_MainGraph" ))<1 || strlen(CsrWave(B , "LSQF_MainGraph" ))<1) |
---|
299 | beep |
---|
300 | Abort "Set cursors for fitting first first. Both need to be on the same wave." |
---|
301 | endif |
---|
302 | if(!stringMatch(CsrWave(A , "LSQF_MainGraph" ), CsrWave(B , "LSQF_MainGraph" ))) |
---|
303 | beep |
---|
304 | Abort "Set cursors on the same wave first" |
---|
305 | endif |
---|
306 | Wave/Z OriginalIntensity=CsrWaveRef(A , "LSQF_MainGraph" ) |
---|
307 | Wave/Z OriginalQvector=CsrXWaveRef(A , "LSQF_MainGraph" ) |
---|
308 | |
---|
309 | Duplicate/O OriginalIntensity, $("FitLevel"+num2str(Level)+"Guinier") |
---|
310 | |
---|
311 | Wave FitInt=$("root:Packages:IR2L_NLSQF:FitLevel"+num2str(Level)+"Guinier") |
---|
312 | string FitIntName="FitLevel"+num2str(Level)+"Guinier" |
---|
313 | |
---|
314 | NVAR Rg=$("root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(level)) |
---|
315 | NVAR G=$("root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(level)) |
---|
316 | NVAR RgMin=$("root:Packages:IR2L_NLSQF:UF_RgMin_pop"+num2str(level)) |
---|
317 | NVAR GMin=$("root:Packages:IR2L_NLSQF:UF_GMin_pop"+num2str(level)) |
---|
318 | NVAR RgMax=$("root:Packages:IR2L_NLSQF:UF_RgMax_pop"+num2str(level)) |
---|
319 | NVAR GMax=$("root:Packages:IR2L_NLSQF:UF_GMax_pop"+num2str(level)) |
---|
320 | |
---|
321 | NVAR FitRg=$("root:Packages:IR2L_NLSQF:UF_RgFit_pop"+num2str(level)) |
---|
322 | NVAR FitG=$("root:Packages:IR2L_NLSQF:UF_GFit_pop"+num2str(level)) |
---|
323 | |
---|
324 | if (!FitG && !FitRg) |
---|
325 | beep |
---|
326 | abort "No fitting parameter allowed to vary, select parameters to vary and set fitting limits" |
---|
327 | endif |
---|
328 | DoWIndow/F LSQF_MainGraph |
---|
329 | Make/D/O/N=2 New_FitCoefficients, CoefficientInput, LocalEwave |
---|
330 | Make/O/T/N=2 CoefNames |
---|
331 | New_FitCoefficients[0] = G |
---|
332 | New_FitCoefficients[1] = Rg |
---|
333 | LocalEwave[0]=(G/20) |
---|
334 | LocalEwave[1]=(Rg/20) |
---|
335 | CoefficientInput[0]={G,Rg} |
---|
336 | CoefNames={"UF_G_pop"+num2str(level),"UF_Rg_pop"+num2str(level)} |
---|
337 | variable tempLength |
---|
338 | |
---|
339 | Variable V_FitError=0 //This should prevent errors from being generated |
---|
340 | //modifed 12 20 2004 to use fit at once function to allow use on smeared data |
---|
341 | |
---|
342 | FuncFit/Q/H=(num2str(abs(FitG-1))+num2str(abs(FitRg-1)))/N IR2L_GuinierFitAllAtOnce New_FitCoefficients OriginalIntensity[pcsr(A),pcsr(B)] /X=OriginalQvector /E=LocalEwave // /W=OriginalError/I=1 |
---|
343 | |
---|
344 | if (V_FitError!=0) //there was error in fitting |
---|
345 | beep |
---|
346 | Abort "Fitting error, check starting parameters and fitting limits" |
---|
347 | endif |
---|
348 | IR2L_GuinierFitAllAtOnce(New_FitCoefficients,FitInt,OriginalQvector) |
---|
349 | //terminate data outside user intensity range... |
---|
350 | NVAR GraphYmin |
---|
351 | NVAR GraphYMax |
---|
352 | FitInt = (FitInt[p]<GraphYMax && FitInt[p]>GraphYMin) ? FitInt[p] : NaN |
---|
353 | |
---|
354 | CheckDisplayed FitInt |
---|
355 | if(!V_Flag) |
---|
356 | AppendToGraph/W=LSQF_MainGraph FitInt vs OriginalQvector |
---|
357 | String name = NameOfWave(FitInt) |
---|
358 | ModifyGraph mode($name)=0,lstyle($name)=7 |
---|
359 | ModifyGraph lsize($name)=2,rgb($name)=(1,16019,65535) |
---|
360 | endif |
---|
361 | // SetAxis left GraphYmin, GraphYMax |
---|
362 | // SetAxis bottom GraphXmin, GraphXMax |
---|
363 | G=abs(New_FitCoefficients[0]) |
---|
364 | Rg=abs(New_FitCoefficients[1]) |
---|
365 | RgMin=Rg/5 |
---|
366 | RgMax=Rg*5 |
---|
367 | GMin=G/5 |
---|
368 | GMax=G*5 |
---|
369 | |
---|
370 | SetDataFolder oldDf |
---|
371 | end |
---|
372 | |
---|
373 | //**************************************************************************************************************** |
---|
374 | //**************************************************************************************************************** |
---|
375 | //**************************************************************************************************************** |
---|
376 | //**************************************************************************************************************** |
---|
377 | //**************************************************************************************************************** |
---|
378 | //**************************************************************************************************************** |
---|
379 | //**************************************************************************************************************** |
---|
380 | |
---|
381 | |
---|
382 | Function IR2L_FitLocalPorod(Level) |
---|
383 | variable level |
---|
384 | string oldDf=GetDataFolder(1) |
---|
385 | |
---|
386 | setDataFolder root:Packages:IR2L_NLSQF |
---|
387 | |
---|
388 | //first set to display local fits |
---|
389 | //check if the cursors are set... |
---|
390 | if(strlen(CsrWave(A , "LSQF_MainGraph" ))<1 || strlen(CsrWave(B , "LSQF_MainGraph" ))<1) |
---|
391 | beep |
---|
392 | Abort "Set cursors for fitting first first. Both need to be on the same wave." |
---|
393 | endif |
---|
394 | if(!stringMatch(CsrWave(A , "LSQF_MainGraph" ), CsrWave(B , "LSQF_MainGraph" ))) |
---|
395 | beep |
---|
396 | Abort "Set cursors on the same wave first" |
---|
397 | endif |
---|
398 | Wave/Z OriginalIntensity=CsrWaveRef(A , "LSQF_MainGraph" ) |
---|
399 | Wave/Z OriginalQvector=CsrXWaveRef(A , "LSQF_MainGraph" ) |
---|
400 | |
---|
401 | Duplicate/O OriginalIntensity, $("FitLevel"+num2str(Level)+"PowerLaw") |
---|
402 | |
---|
403 | Wave FitInt=$("root:Packages:IR2L_NLSQF:FitLevel"+num2str(Level)+"PowerLaw") |
---|
404 | string FitIntName="FitLevel"+num2str(Level)+"Powerlaw" |
---|
405 | |
---|
406 | NVAR Pval=$("root:Packages:IR2L_NLSQF:UF_P_pop"+num2str(level)) |
---|
407 | NVAR B=$("root:Packages:IR2L_NLSQF:UF_B_pop"+num2str(level)) |
---|
408 | NVAR PMin=$("root:Packages:IR2L_NLSQF:UF_PMin_pop"+num2str(level)) |
---|
409 | NVAR BMin=$("root:Packages:IR2L_NLSQF:UF_BMin_pop"+num2str(level)) |
---|
410 | NVAR PMax=$("root:Packages:IR2L_NLSQF:UF_PMax_pop"+num2str(level)) |
---|
411 | NVAR BMax=$("root:Packages:IR2L_NLSQF:UF_BMax_pop"+num2str(level)) |
---|
412 | |
---|
413 | NVAR FitP=$("root:Packages:IR2L_NLSQF:UF_PFit_pop"+num2str(level)) |
---|
414 | NVAR FitB=$("root:Packages:IR2L_NLSQF:UF_BFit_pop"+num2str(level)) |
---|
415 | |
---|
416 | if (!FitP && !FitB) |
---|
417 | beep |
---|
418 | abort "No fitting parameter allowed to vary, select parameters to vary and set fitting limits" |
---|
419 | endif |
---|
420 | |
---|
421 | Make/D/O/N=2 CoefficientInput, New_FitCoefficients, LocalEwave |
---|
422 | Make/O/T/N=2 CoefNames |
---|
423 | CoefficientInput[0]=B |
---|
424 | CoefficientInput[1]=Pval |
---|
425 | LocalEwave[0]=B/20 |
---|
426 | LocalEwave[1]=Pval/20 |
---|
427 | CoefNames={"UF_B_pop"+num2str(level),"UF_P_pop"+num2str(level)} |
---|
428 | |
---|
429 | Make/D/O/N=2 New_FitCoefficients |
---|
430 | New_FitCoefficients[0] = {B,Pval} |
---|
431 | Make/O/T/N=2 T_Constraints |
---|
432 | T_Constraints = {"K1 > 1","K1 < 4.2"} |
---|
433 | |
---|
434 | Variable V_FitError=0 //This should prevent errors from being generated |
---|
435 | DoWIndow/F LSQF_MainGraph |
---|
436 | if (FitP) |
---|
437 | FuncFit/H=(num2str(abs(FitB-1))+num2str(abs(FitP-1)))/N IR2L_PowerLawFitAllATOnce New_FitCoefficients OriginalIntensity[pcsr(A),pcsr(B)] /X=OriginalQvector /E=LocalEwave /C=T_Constraints ///W=OriginalError /I=1 |
---|
438 | else |
---|
439 | FuncFit/H=(num2str(abs(FitB-1))+num2str(abs(FitP-1)))/N IR2L_PowerLawFitAllATOnce New_FitCoefficients OriginalIntensity[pcsr(A),pcsr(B)] /X=OriginalQvector //W=OriginalError /I=1 //E=LocalEwave |
---|
440 | endif |
---|
441 | |
---|
442 | if (V_FitError!=0) //there was error in fitting |
---|
443 | beep |
---|
444 | Abort "Fitting error, check starting parameters and fitting limits" |
---|
445 | endif |
---|
446 | |
---|
447 | IR2L_PowerLawFitAllATOnce(New_FitCoefficients,FitInt,OriginalQvector) |
---|
448 | //terminate data outside user intensity range... |
---|
449 | NVAR GraphYmin |
---|
450 | NVAR GraphYMax |
---|
451 | FitInt = (FitInt[p]<GraphYMax && FitInt[p]>GraphYMin) ? FitInt[p] : NaN |
---|
452 | |
---|
453 | CheckDisplayed FitInt |
---|
454 | if(!V_Flag) |
---|
455 | AppendToGraph/W=LSQF_MainGraph FitInt vs OriginalQvector |
---|
456 | String name = NameOfWave(FitInt) |
---|
457 | ModifyGraph mode($name)=0,lstyle($name)=9 |
---|
458 | ModifyGraph lsize($name)=2,rgb($name)=(1,4,52428) |
---|
459 | endif |
---|
460 | |
---|
461 | B=abs(New_FitCoefficients[0]) |
---|
462 | PVal=abs(New_FitCoefficients[1]) |
---|
463 | PMin=1 |
---|
464 | PMax=4.2 |
---|
465 | BMin=B/5 |
---|
466 | BMax=B*5 |
---|
467 | |
---|
468 | SetDataFolder oldDf |
---|
469 | end |
---|
470 | //**************************************************************************************************************** |
---|
471 | //**************************************************************************************************************** |
---|
472 | //**************************************************************************************************************** |
---|
473 | //**************************************************************************************************************** |
---|
474 | |
---|
475 | Function IR2L_PowerLawFitAllATOnce(parwave,ywave,xwave) : FitFunc |
---|
476 | Wave parwave,xwave,ywave |
---|
477 | |
---|
478 | //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will |
---|
479 | //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog. |
---|
480 | //CurveFitDialog/ Equation: |
---|
481 | //CurveFitDialog/ Prefactor=abs(Prefactor) |
---|
482 | //CurveFitDialog/ Slope=abs(slope) |
---|
483 | //CurveFitDialog/ f(q) = Prefactor*q^(-Slope) |
---|
484 | //CurveFitDialog/ End of Equation |
---|
485 | //CurveFitDialog/ Independent Variables 1 |
---|
486 | //CurveFitDialog/ q |
---|
487 | //CurveFitDialog/ Coefficients 2 |
---|
488 | //CurveFitDialog/ w[0] = Prefactor |
---|
489 | //CurveFitDialog/ w[1] = Slope |
---|
490 | |
---|
491 | variable Prefactor=abs(parwave[0]) |
---|
492 | variable slope=abs(parwave[1]) |
---|
493 | |
---|
494 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
495 | string IntWaveName=CsrWave(A , "LSQF_MainGraph" ) |
---|
496 | variable SetVar = str2num(IntWaveName[strsearch( IntWaveName, "_set", 0)+4,inf]) |
---|
497 | NVAR UseSMRData=$("root:Packages:IR2L_NLSQF:SlitSmeared_set"+num2str(SetVar)) |
---|
498 | NVAR SlitLengthUnif=$("root:Packages:IR2L_NLSQF:SlitLength_set"+num2str(SetVar)) |
---|
499 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
500 | variable currentTab=V_Value+1 |
---|
501 | NVAR Contrast=$("root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(currentTab)) |
---|
502 | NVAR MultipleInputData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
503 | if(MultipleInputData) |
---|
504 | string setNum=NameOfWave(CsrWaveRef(A , "LSQF_MainGraph" ) )[13,inf] |
---|
505 | NVAR Contrast=$("root:Packages:IR2L_NLSQF:Contrast_set"+setNum+"_pop"+num2str(currentTab)) |
---|
506 | endif |
---|
507 | Wave OriginalQvector=CsrXWaveRef(A , "LSQF_MainGraph" ) |
---|
508 | |
---|
509 | Duplicate/O OriginalQvector, tempPowerLawInt |
---|
510 | // w[0]*q^(-w[1]) |
---|
511 | tempPowerLawInt =Contrast* Prefactor * OriginalQvector^(-slope) |
---|
512 | if(UseSMRData) |
---|
513 | duplicate/O tempPowerLawInt, tempPowerLawIntSM |
---|
514 | IR1B_SmearData(tempPowerLawInt, OriginalQvector, SlitLengthUnif, tempPowerLawIntSM) |
---|
515 | tempPowerLawInt=tempPowerLawIntSM |
---|
516 | endif |
---|
517 | |
---|
518 | ywave = tempPowerLawInt[binarysearch(OriginalQvector,xwave[0])+p] |
---|
519 | KillWaves/Z tempGunIntSM, tempGunInt |
---|
520 | End |
---|
521 | |
---|
522 | //**************************************************************************************************************** |
---|
523 | //**************************************************************************************************************** |
---|
524 | //**************************************************************************************************************** |
---|
525 | //**************************************************************************************************************** |
---|
526 | Function IR2L_GuinierFitAllAtOnce(parwave,ywave,xwave) : FitFunc |
---|
527 | Wave parwave,xwave,ywave |
---|
528 | |
---|
529 | //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will |
---|
530 | //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog. |
---|
531 | //CurveFitDialog/ Equation: |
---|
532 | //CurveFitDialog/ Prefactor=abs(Prefactor) |
---|
533 | //CurveFitDialog/ Rg=abs(Rg) |
---|
534 | //CurveFitDialog/ f(q) = Prefactor*exp(-q^2*Rg^2/3)) |
---|
535 | //CurveFitDialog/ End of Equation |
---|
536 | //CurveFitDialog/ Independent Variables 1 |
---|
537 | //CurveFitDialog/ q |
---|
538 | //CurveFitDialog/ Coefficients 2 |
---|
539 | //CurveFitDialog/ w[0] = Prefactor |
---|
540 | //CurveFitDialog/ w[1] = Rg |
---|
541 | |
---|
542 | variable Prefactor=abs(parwave[0]) |
---|
543 | variable Rg=abs(parwave[1]) |
---|
544 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
545 | string IntWaveName=CsrWave(A , "LSQF_MainGraph" ) |
---|
546 | variable SetVar = str2num(IntWaveName[strsearch( IntWaveName, "_set", 0)+4,inf]) |
---|
547 | NVAR UseSMRData=$("root:Packages:IR2L_NLSQF:SlitSmeared_set"+num2str(SetVar)) |
---|
548 | NVAR SlitLengthUnif=$("root:Packages:IR2L_NLSQF:SlitLength_set"+num2str(SetVar)) |
---|
549 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
550 | variable currentTab=V_Value+1 |
---|
551 | NVAR Contrast=$("root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(currentTab)) |
---|
552 | NVAR MultipleInputData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
553 | if(MultipleInputData) |
---|
554 | string setNum=NameOfWave(CsrWaveRef(A , "LSQF_MainGraph" ) )[13,inf] |
---|
555 | NVAR Contrast=$("root:Packages:IR2L_NLSQF:Contrast_set"+setNum+"_pop"+num2str(currentTab)) |
---|
556 | endif |
---|
557 | |
---|
558 | Wave OriginalQvector=CsrXWaveRef(A , "LSQF_MainGraph" ) |
---|
559 | Duplicate/O OriginalQvector, tempGunInt |
---|
560 | //w[0]*exp(-q^2*w[1]^2/3) |
---|
561 | tempGunInt = Contrast* Prefactor * exp(-OriginalQvector^2 * Rg^2/3) |
---|
562 | if(UseSMRData) |
---|
563 | duplicate/O tempGunInt, tempGunIntSM |
---|
564 | IR1B_SmearData(tempGunInt, OriginalQvector, SlitLengthUnif, tempGunIntSM) |
---|
565 | tempGunInt=tempGunIntSM |
---|
566 | endif |
---|
567 | |
---|
568 | ywave = tempGunInt[binarysearch(OriginalQvector,xwave[0])+p] |
---|
569 | KillWaves/Z tempGunIntSM, tempGunInt |
---|
570 | |
---|
571 | return 1 |
---|
572 | End |
---|
573 | //**************************************************************************************************************** |
---|
574 | //**************************************************************************************************************** |
---|
575 | |
---|
576 | //***************************************************************************************************************** |
---|
577 | //***************************************************************************************************************** |
---|
578 | //***************************************************************************************************************** |
---|
579 | //***************************************************************************************************************** |
---|
580 | //***************************************************************************************************************** |
---|
581 | |
---|
582 | Function IR2L_RemoveAllDataSets() |
---|
583 | |
---|
584 | string oldDf=GetDataFolder(1) |
---|
585 | setDataFolder root:Packages:IR2L_NLSQF |
---|
586 | variable i |
---|
587 | DoAlert 1, "All data sets will be removed. Do you really want to do it?" |
---|
588 | if(V_Flag==1) |
---|
589 | |
---|
590 | For(i=1;i<11;i+=1) |
---|
591 | IR2L_RemoveDataFromGraph(i) //remove the data from graph |
---|
592 | NVAR UseTheData_set=$("UseTheData_set"+num2str(i)) //set them not to be used |
---|
593 | UseTheData_set=0 |
---|
594 | SVAR Fldr=$("root:Packages:IR2L_NLSQF:FolderName_set"+num2str(i)) |
---|
595 | SVAR Int=$("root:Packages:IR2L_NLSQF:IntensityDataName_set"+num2str(i)) |
---|
596 | SVAR Qvec=$("root:Packages:IR2L_NLSQF:QvecDataName_set"+num2str(i)) |
---|
597 | SVAR Err = $("root:Packages:IR2L_NLSQF:ErrorDataName_set"+num2str(i)) |
---|
598 | Fldr="" |
---|
599 | Int="" |
---|
600 | Qvec="" |
---|
601 | Err="" |
---|
602 | Wave/Z IntWv=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(i)) |
---|
603 | Wave/Z QWv=$("root:Packages:IR2L_NLSQF:Q_set"+num2str(i)) |
---|
604 | Wave/Z ErrWv=$("root:Packages:IR2L_NLSQF:Error_set"+num2str(i)) |
---|
605 | if(WaveExists(IntWv)) |
---|
606 | KillWaves/Z IntWv |
---|
607 | endif |
---|
608 | if(WaveExists(QWv)) |
---|
609 | KillWaves/Z QWv |
---|
610 | endif |
---|
611 | if(WaveExists(ErrWv)) |
---|
612 | KillWaves/Z ErrWv |
---|
613 | endif |
---|
614 | endfor |
---|
615 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
616 | IR2L_Data_TabPanelControl("",V_Value) |
---|
617 | endif |
---|
618 | setDataFolder oldDF |
---|
619 | end |
---|
620 | |
---|
621 | //***************************************************************************************************************** |
---|
622 | //***************************************************************************************************************** |
---|
623 | //***************************************************************************************************************** |
---|
624 | //***************************************************************************************************************** |
---|
625 | //***************************************************************************************************************** |
---|
626 | |
---|
627 | Function IR2L_unUseAllDataSets() |
---|
628 | string oldDf=GetDataFolder(1) |
---|
629 | setDataFolder root:Packages:IR2L_NLSQF |
---|
630 | variable i |
---|
631 | For(i=1;i<11;i+=1) |
---|
632 | IR2L_RemoveDataFromGraph(i) |
---|
633 | NVAR UseTheData_set=$("UseTheData_set"+num2str(i)) |
---|
634 | UseTheData_set=0 |
---|
635 | endfor |
---|
636 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
637 | IR2L_Data_TabPanelControl("",V_Value) |
---|
638 | setDataFolder oldDF |
---|
639 | end |
---|
640 | |
---|
641 | |
---|
642 | //***************************************************************************************************************** |
---|
643 | //***************************************************************************************************************** |
---|
644 | Function IR2L_CheckForTooManyUniflevels() |
---|
645 | //let use know that only one unified level should be used. |
---|
646 | string oldDf=GetDataFolder(1) |
---|
647 | setDataFolder root:Packages:IR2L_NLSQF |
---|
648 | variable i, numberOfUFs |
---|
649 | numberOfUFs=0 |
---|
650 | For(i=1;i<11;i+=1) |
---|
651 | SVAR Model=$("root:Packages:IR2L_NLSQF:Model_pop"+num2str(i)) |
---|
652 | if(stringMatch(Model,"Unified level")) |
---|
653 | numberOfUFs+=1 |
---|
654 | endif |
---|
655 | endfor |
---|
656 | if(numberOfUFs>1) //raise allert, but only sometimes |
---|
657 | NVAR/Z LastChecked |
---|
658 | if(NVAR_Exists(LastChecked)&& (DateTime - LastChecked)<60*60*24) |
---|
659 | print "NOTE: Only one Unified level should be used at once in Modeling II. For more levels use Unified Fit tool" |
---|
660 | else |
---|
661 | DoAlert 0, "NOTE: Only one Unified level should be used at once in Modeling II. For more levels use Unified Fit tool" |
---|
662 | endif |
---|
663 | variable/g LastChecked |
---|
664 | LastChecked = DateTime |
---|
665 | endif |
---|
666 | setDataFolder oldDF |
---|
667 | end |
---|
668 | //***************************************************************************************************************** |
---|
669 | //***************************************************************************************************************** |
---|
670 | //***************************************************************************************************************** |
---|
671 | |
---|
672 | |
---|
673 | Function IR2L_PanelPopupControl(ctrlName,popNum,popStr) : PopupMenuControl |
---|
674 | String ctrlName |
---|
675 | Variable popNum |
---|
676 | String popStr |
---|
677 | |
---|
678 | string oldDf=GetDataFolder(1) |
---|
679 | setDataFolder root:Packages:IR2L_NLSQF |
---|
680 | if (stringmatch(ctrlName,"FormFactorPop")) |
---|
681 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
682 | SVAR FormFactor = $("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(V_Value+1)) |
---|
683 | FormFactor = popStr |
---|
684 | IR2L_Model_TabPanelControl("",V_Value) |
---|
685 | IR2L_CallPanelFromFFpackage(V_Value+1) |
---|
686 | if(stringmatch(FormFactor,"User")) |
---|
687 | IR1T_GenerateHelpForUserFF() |
---|
688 | endif |
---|
689 | |
---|
690 | endif |
---|
691 | |
---|
692 | if (stringmatch(ctrlName,"DiffPeakProfile")) |
---|
693 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
694 | SVAR DiffPeakProfile = $("root:Packages:IR2L_NLSQF:DiffPeakProfile_pop"+num2str(V_Value+1)) |
---|
695 | DiffPeakProfile = popStr |
---|
696 | IR2L_Model_TabPanelControl("",V_Value) |
---|
697 | endif |
---|
698 | |
---|
699 | |
---|
700 | if (stringmatch(ctrlName,"KFactor")) |
---|
701 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
702 | NVAR UF_K = $("root:Packages:IR2L_NLSQF:UF_K_pop"+num2str(V_Value+1)) |
---|
703 | UF_K = str2num(popStr) |
---|
704 | endif |
---|
705 | |
---|
706 | if (stringmatch(ctrlName,"PopSizeDistShape")) |
---|
707 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
708 | SVAR PopSizeDistShape = $("root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(V_Value+1)) |
---|
709 | PopSizeDistShape = popStr |
---|
710 | //IR2L_FixDistTypeFittingChckbxs(V_Value+1, PopSizeDistShape) |
---|
711 | IR2L_Model_TabPanelControl("",V_Value) |
---|
712 | endif |
---|
713 | if (stringmatch(ctrlName,"PopulationType")) |
---|
714 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
715 | SVAR Model = $("root:Packages:IR2L_NLSQF:Model_pop"+num2str(V_Value+1)) |
---|
716 | Model = popStr |
---|
717 | IR2L_Model_TabPanelControl("",V_Value) |
---|
718 | if(stringmatch(popStr,"Unified level")) |
---|
719 | IR2L_CheckForTooManyUniflevels() |
---|
720 | endif |
---|
721 | endif |
---|
722 | |
---|
723 | if(stringmatch(ctrlName,"StructureFactorModel") ) |
---|
724 | variable whichDataSet |
---|
725 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
726 | whichDataSet= V_Value+1 |
---|
727 | SVAR StrFac=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(whichDataSet)) |
---|
728 | StrFac = popStr |
---|
729 | DoWindow StructureFactorControlScreen |
---|
730 | if(V_Flag) |
---|
731 | DoWindow/K StructureFactorControlScreen |
---|
732 | endif |
---|
733 | // ListOfPopulationVariables+="StructureParam3;StructureParam3Fit;StructureParam3Min;StructureParam3Max;StructureParam4;StructureParam4Fit;StructureParam4Min;StructureParam4Max;" |
---|
734 | /// ListOfPopulationVariables+="StructureParam5;StructureParam5Fit;StructureParam5Min;StructureParam5Max;" |
---|
735 | |
---|
736 | string TitleStr= "Structure Factor for Pop"+num2str(whichDataSet)+" of LSQF2 modeling" |
---|
737 | string SFStr = "root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(whichDataSet) |
---|
738 | string P1Str = "root:Packages:IR2L_NLSQF:StructureParam1_pop"+num2str(whichDataSet) |
---|
739 | string FitP1Str = "root:Packages:IR2L_NLSQF:StructureParam1Fit_pop"+num2str(whichDataSet) |
---|
740 | string LowP1Str = "root:Packages:IR2L_NLSQF:StructureParam1Min_pop"+num2str(whichDataSet) |
---|
741 | string HighP1Str = "root:Packages:IR2L_NLSQF:StructureParam1Max_pop"+num2str(whichDataSet) |
---|
742 | string P2Str = "root:Packages:IR2L_NLSQF:StructureParam2_pop"+num2str(whichDataSet) |
---|
743 | string FitP2Str = "root:Packages:IR2L_NLSQF:StructureParam2Fit_pop"+num2str(whichDataSet) |
---|
744 | string LowP2Str = "root:Packages:IR2L_NLSQF:StructureParam2Min_pop"+num2str(whichDataSet) |
---|
745 | string HighP2Str = "root:Packages:IR2L_NLSQF:StructureParam2Max_pop"+num2str(whichDataSet) |
---|
746 | |
---|
747 | string P3Str = "root:Packages:IR2L_NLSQF:StructureParam3_pop"+num2str(whichDataSet) |
---|
748 | string FitP3Str = "root:Packages:IR2L_NLSQF:StructureParam3Fit_pop"+num2str(whichDataSet) |
---|
749 | string LowP3Str = "root:Packages:IR2L_NLSQF:StructureParam3Min_pop"+num2str(whichDataSet) |
---|
750 | string HighP3Str = "root:Packages:IR2L_NLSQF:StructureParam3Max_pop"+num2str(whichDataSet) |
---|
751 | |
---|
752 | string P4Str = "root:Packages:IR2L_NLSQF:StructureParam4_pop"+num2str(whichDataSet) |
---|
753 | string FitP4Str = "root:Packages:IR2L_NLSQF:StructureParam4Fit_pop"+num2str(whichDataSet) |
---|
754 | string LowP4Str = "root:Packages:IR2L_NLSQF:StructureParam4Min_pop"+num2str(whichDataSet) |
---|
755 | string HighP4Str = "root:Packages:IR2L_NLSQF:StructureParam4Max_pop"+num2str(whichDataSet) |
---|
756 | |
---|
757 | string P5Str = "root:Packages:IR2L_NLSQF:StructureParam5_pop"+num2str(whichDataSet) |
---|
758 | string FitP5Str = "root:Packages:IR2L_NLSQF:StructureParam5Fit_pop"+num2str(whichDataSet) |
---|
759 | string LowP5Str = "root:Packages:IR2L_NLSQF:StructureParam5Min_pop"+num2str(whichDataSet) |
---|
760 | string HighP5Str = "root:Packages:IR2L_NLSQF:StructureParam5Max_pop"+num2str(whichDataSet) |
---|
761 | |
---|
762 | string P6Str = "root:Packages:IR2L_NLSQF:StructureParam6_pop"+num2str(whichDataSet) |
---|
763 | string FitP6Str = "root:Packages:IR2L_NLSQF:StructureParam6Fit_pop"+num2str(whichDataSet) |
---|
764 | string LowP6Str = "root:Packages:IR2L_NLSQF:StructureParam6Min_pop"+num2str(whichDataSet) |
---|
765 | string HighP6Str = "root:Packages:IR2L_NLSQF:StructureParam6Max_pop"+num2str(whichDataSet) |
---|
766 | |
---|
767 | string SFUserSFformula = "root:Packages:IR2L_NLSQF:SFUserSQFormula_pop"+num2str(whichDataSet) |
---|
768 | //the Structure factor package will take of making the fit parameters fo hidden parameters uncheckedm if they are checked. |
---|
769 | IR2S_MakeSFParamPanel(TitleStr,SFStr,P1Str,FitP1Str,LowP1Str,HighP1Str,P2Str,FitP2Str,LowP2Str,HighP2Str,P3Str,FitP3Str,LowP3Str,HighP3Str,P4Str,FitP4Str,LowP4Str,HighP4Str,P5Str,FitP5Str,LowP5Str,HighP5Str,P6Str,FitP6Str,LowP6Str,HighP6Str,SFUserSFformula) |
---|
770 | DoWIndow StructureFactorControlScreen |
---|
771 | if(V_Flag) |
---|
772 | SetWindow StructureFactorControlScreen hook(Update)=IR2L_UpdateHook |
---|
773 | SetDrawEnv /W=StructureFactorControlScreen fstyle= 3 |
---|
774 | // DrawText/W=StructureFactorControlScreen 4,220,"Hit enter twice to auto recalculate (if Auto recalculate is selected)" |
---|
775 | endif |
---|
776 | endif |
---|
777 | IR2L_RecalculateIfSelected() |
---|
778 | DoWIndow UserDefinedSQ_Help |
---|
779 | if(V_Flag) |
---|
780 | DoWIndow/F UserDefinedSQ_Help |
---|
781 | endif |
---|
782 | setDataFolder OldDf |
---|
783 | end |
---|
784 | //***************************************************************************************************************** |
---|
785 | //***************************************************************************************************************** |
---|
786 | //***************************************************************************************************************** |
---|
787 | //***************************************************************************************************************** |
---|
788 | |
---|
789 | // |
---|
790 | //Function IR2L_FixDistTypeFittingChckbxs(PopNumber, PopSizeDistShape) |
---|
791 | // variable popNumber |
---|
792 | // string PopSizeDistShape |
---|
793 | // |
---|
794 | // //LogNormal;Gauss;LSW;Schulz-Zimm |
---|
795 | // |
---|
796 | // |
---|
797 | // if(!stringmatch(PopSizeDistShape,"LogNormal")) |
---|
798 | // NVAR FitPar1=$("root:Packages:IR2L_NLSQF:LNMinSizeFit_pop"+num2str(popNumber)) |
---|
799 | // NVAR FitPar2=$("root:Packages:IR2L_NLSQF:LNMeanSizeFit_pop"+num2str(popNumber)) |
---|
800 | // NVAR FitPar3=$("root:Packages:IR2L_NLSQF:LNSdeviationFit_pop"+num2str(popNumber)) |
---|
801 | // FitPar1 = 0 |
---|
802 | // FitPar2 = 0 |
---|
803 | // FitPar3 = 0 |
---|
804 | // endif |
---|
805 | // if(!stringmatch(PopSizeDistShape,"Gauss")) |
---|
806 | // NVAR FitPar1=$("root:Packages:IR2L_NLSQF:GMeanSizeFit_pop"+num2str(popNumber)) |
---|
807 | // NVAR FitPar2=$("root:Packages:IR2L_NLSQF:GWidthFit_pop"+num2str(popNumber)) |
---|
808 | // FitPar1 = 0 |
---|
809 | // FitPar2 = 0 |
---|
810 | // endif |
---|
811 | // if(!stringmatch(PopSizeDistShape,"Schulz-Zimm")) |
---|
812 | // NVAR FitPar1=$("root:Packages:IR2L_NLSQF:SZMeanSizeFit_pop"+num2str(popNumber)) |
---|
813 | // NVAR FitPar2=$("root:Packages:IR2L_NLSQF:SZWidthFit_pop"+num2str(popNumber)) |
---|
814 | // FitPar1 = 0 |
---|
815 | // FitPar2 = 0 |
---|
816 | // endif |
---|
817 | // if(!stringmatch(PopSizeDistShape,"LSW")) |
---|
818 | // NVAR FitPar1=$("root:Packages:IR2L_NLSQF:LSWLocationFit_pop"+num2str(popNumber)) |
---|
819 | // FitPar1 = 0 |
---|
820 | // endif |
---|
821 | // |
---|
822 | // |
---|
823 | // |
---|
824 | //end |
---|
825 | |
---|
826 | //***************************************************************************************************************** |
---|
827 | //***************************************************************************************************************** |
---|
828 | //***************************************************************************************************************** |
---|
829 | //***************************************************************************************************************** |
---|
830 | Function IR2L_UpdateHook(H_Struct) |
---|
831 | STRUCT WMWinHookStruct &H_Struct |
---|
832 | |
---|
833 | if(stringmatch(H_Struct.eventName,"Keyboard")) |
---|
834 | IR2L_RecalculateIfSelected() |
---|
835 | endif |
---|
836 | // <code to test and process events> |
---|
837 | // ... |
---|
838 | // return statusCode // 0 if nothing done, else 1 |
---|
839 | End |
---|
840 | |
---|
841 | //***************************************************************************************************************** |
---|
842 | //***************************************************************************************************************** |
---|
843 | //***************************************************************************************************************** |
---|
844 | |
---|
845 | Function IR2L_CallPanelFromFFpackage(which) |
---|
846 | variable which |
---|
847 | |
---|
848 | SVAR FormFactor = $("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(which)) |
---|
849 | if(stringmatch(FormFactor,"Unified_Level")) |
---|
850 | string TitleStr11="Unified Fit parameters for Population "+num2str(which) |
---|
851 | //UF_RGCO;UF_K;UF_LinkRGCO;UF_LinkRGCOLevel |
---|
852 | IR2L_MakeFFParamPanel(TitleStr11, which) |
---|
853 | else |
---|
854 | string TitleStr="Form factor parameters for Population "+num2str(which) |
---|
855 | string FFStr="root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(which) |
---|
856 | string P1Str="root:Packages:IR2L_NLSQF:FormFactor_Param1_pop"+num2str(which) |
---|
857 | string FitP1Str="root:Packages:IR2L_NLSQF:FormFactor_Param1Fit_pop"+num2str(which) |
---|
858 | string LowP1Str="root:Packages:IR2L_NLSQF:FormFactor_Param1Min_pop"+num2str(which) |
---|
859 | string HighP1Str="root:Packages:IR2L_NLSQF:FormFactor_Param1Max_pop"+num2str(which) |
---|
860 | string P2Str="root:Packages:IR2L_NLSQF:FormFactor_Param2_pop"+num2str(which) |
---|
861 | string FitP2Str="root:Packages:IR2L_NLSQF:FormFactor_Param2Fit_pop"+num2str(which) |
---|
862 | string LowP2Str="root:Packages:IR2L_NLSQF:FormFactor_Param2Min_pop"+num2str(which) |
---|
863 | string HighP2Str="root:Packages:IR2L_NLSQF:FormFactor_Param2Max_pop"+num2str(which) |
---|
864 | string P3Str="root:Packages:IR2L_NLSQF:FormFactor_Param3_pop"+num2str(which) |
---|
865 | string FitP3Str="root:Packages:IR2L_NLSQF:FormFactor_Param3Fit_pop"+num2str(which) |
---|
866 | string LowP3Str="root:Packages:IR2L_NLSQF:FormFactor_Param3Min_pop"+num2str(which) |
---|
867 | string HighP3Str="root:Packages:IR2L_NLSQF:FormFactor_Param3Max_pop"+num2str(which) |
---|
868 | string P4Str="root:Packages:IR2L_NLSQF:FormFactor_Param4_pop"+num2str(which) |
---|
869 | string FitP4Str="root:Packages:IR2L_NLSQF:FormFactor_Param4Fit_pop"+num2str(which) |
---|
870 | string LowP4Str="root:Packages:IR2L_NLSQF:FormFactor_Param4Min_pop"+num2str(which) |
---|
871 | string HighP4Str="root:Packages:IR2L_NLSQF:FormFactor_Param4Max_pop"+num2str(which) |
---|
872 | string P5Str="root:Packages:IR2L_NLSQF:FormFactor_Param5_pop"+num2str(which) |
---|
873 | string FitP5Str="root:Packages:IR2L_NLSQF:FormFactor_Param5Fit_pop"+num2str(which) |
---|
874 | string LowP5Str="root:Packages:IR2L_NLSQF:FormFactor_Param5Min_pop"+num2str(which) |
---|
875 | string HighP5Str="root:Packages:IR2L_NLSQF:FormFactor_Param5Max_pop"+num2str(which) |
---|
876 | string FFUserFFformula="root:Packages:IR2L_NLSQF:FFUserFFformula_pop"+num2str(which) |
---|
877 | string FFUserVolumeFormula="root:Packages:IR2L_NLSQF:FFUserVolumeFormula_pop"+num2str(which) |
---|
878 | |
---|
879 | string P6Str="root:Packages:IR2L_NLSQF:FormFactor_Param6_pop"+num2str(which) |
---|
880 | string FitP6Str="root:Packages:IR2L_NLSQF:FormFactor_Param6Fit_pop"+num2str(which) |
---|
881 | string LowP6Str="root:Packages:IR2L_NLSQF:FormFactor_Param6Min_pop"+num2str(which) |
---|
882 | string HighP6Str="root:Packages:IR2L_NLSQF:FormFactor_Param6Max_pop"+num2str(which) |
---|
883 | |
---|
884 | IR1T_MakeFFParamPanel(TitleStr,FFStr,P1Str,FitP1Str,LowP1Str,HighP1Str,P2Str,FitP2Str,LowP2Str,HighP2Str,P3Str,FitP3Str,LowP3Str,HighP3Str,P4Str,FitP4Str,LowP4Str,HighP4Str,P5Str,FitP5Str,LowP5Str,HighP5Str,FFUserFFformula,FFUserVolumeFormula, P6Str=P6Str,FitP6Str=FitP6Str,LowP6Str=LowP6Str,HighP6Str=HighP6Str) |
---|
885 | endif |
---|
886 | |
---|
887 | DoWIndow FormFactorControlScreen |
---|
888 | if(V_Flag) |
---|
889 | SetWindow FormFactorControlScreen hook(Update)=IR2L_UpdateHook |
---|
890 | SetDrawEnv /W=FormFactorControlScreen fstyle= 3 |
---|
891 | endif |
---|
892 | |
---|
893 | end |
---|
894 | //***************************************************************************************************************** |
---|
895 | //***************************************************************************************************************** |
---|
896 | Function IR2L_MakeFFParamPanel(TitleStr, which) |
---|
897 | variable which |
---|
898 | string TitleStr |
---|
899 | |
---|
900 | string OldDf=GetDataFolder(1) |
---|
901 | |
---|
902 | DoWindow FormFactorControlScreen |
---|
903 | if(V_Flag) |
---|
904 | DoWindow/K FormFactorControlScreen |
---|
905 | endif |
---|
906 | //make the new panel |
---|
907 | NewPanel/K=1 /W=(96,94,530,370) as "FormFactorControlScreen" |
---|
908 | DoWindow/C FormFactorControlScreen |
---|
909 | SetDrawLayer UserBack |
---|
910 | SetDrawEnv fsize= 18,fstyle= 3,textrgb= (0,12800,52224) |
---|
911 | DrawText 32,34,TitleStr |
---|
912 | SetDrawEnv fstyle= 1 |
---|
913 | DrawText 80,93,"Parameter value" |
---|
914 | SetDrawEnv fstyle= 1 |
---|
915 | DrawText 201,93,"Fit?" |
---|
916 | SetDrawEnv fstyle= 1 |
---|
917 | DrawText 236,93,"Low limit?" |
---|
918 | SetDrawEnv fstyle= 1 |
---|
919 | DrawText 326,93,"High Limit" |
---|
920 | //UF_RGCO;UF_K;UF_LinkRGCO;UF_LinkRGCOLevel |
---|
921 | //first variable...... |
---|
922 | NVAR UF_RGCO=$("root:Packages:IR2L_NLSQF:UF_RGCO_pop"+num2str(which)) |
---|
923 | SetVariable UF_RGCO,limits={0,Inf,0},variable= $("root:Packages:IR2L_NLSQF:UF_RGCO_pop"+num2str(which)), noproc//=IR1T_FFCntrlPnlSetVarProc |
---|
924 | SetVariable UF_RGCO,pos={5,100},size={180,15},title="Rg cut off = ", help={"Rg cut off for higher Unified levels, see reference or manual for meaning"} |
---|
925 | CheckBox FitP1Value,pos={200,100},size={25,16},title=" ",noproc//=IR1T_FFCntrlPnlCheckboxProc |
---|
926 | CheckBox FitP1Value,variable= $("root:Packages:IR2L_NLSQF:UF_RGCOFit_pop"+num2str(which)), help={"Fit this parameter?"} |
---|
927 | SetVariable P1LowLim,limits={0,Inf,0},variable=$("root:Packages:IR2L_NLSQF:UF_RGCOMin_pop"+num2str(which))//, disable=!disableMe |
---|
928 | SetVariable P1LowLim,pos={220,100},size={80,15},title=" ", help={"Low limit for fitting param 1"} |
---|
929 | SetVariable P1HighLim,limits={0,Inf,0},variable= $("root:Packages:IR2L_NLSQF:UF_RGCOMax_pop"+num2str(which))//, disable=!disableMe |
---|
930 | SetVariable P1HighLim,pos={320,100},size={80,15},title=" ", help={"High limit for fitting param 1"} |
---|
931 | |
---|
932 | PopupMenu KFactor,pos={10,135},size={170,21},proc=IR2L_PanelPopupControl,title="k factor :" |
---|
933 | PopupMenu KFactor,mode=2,popvalue="1",value= #"\"1;1.06;\"", help={"This value is usually 1, for weak decays and mass fractals 1.06"} |
---|
934 | |
---|
935 | setDataFolder OldDf |
---|
936 | end |
---|
937 | //***************************************************************************************************************** |
---|
938 | //***************************************************************************************************************** |
---|
939 | //***************************************************************************************************************** |
---|
940 | |
---|
941 | Function IR2L_Data_TabPanelControl(name,tab) |
---|
942 | String name |
---|
943 | Variable tab |
---|
944 | |
---|
945 | string oldDf=GetDataFolder(1) |
---|
946 | setDataFolder root:Packages:IR2L_NLSQF |
---|
947 | |
---|
948 | SVAR rgbIntensity_set=$("root:Packages:IR2L_NLSQF:rgbIntensity_set"+num2str(tab+1)) |
---|
949 | Execute("Button AddDataSet,win=LSQF2_MainPanel, fColor="+rgbIntensity_set) |
---|
950 | variable i |
---|
951 | NVAR DisplayInputDataControls=root:Packages:IR2L_NLSQF:DisplayInputDataControls |
---|
952 | NVAR DisplayModelControls=root:Packages:IR2L_NLSQF:DisplayModelControls |
---|
953 | NVAR displayControls = $("UseTheData_set"+num2str(tab+1)) |
---|
954 | NVAR DisplayFitRange = $("BackgroundFit_set"+num2str(tab+1)) |
---|
955 | NVAR DisplaySlitSmeared = $("SlitSmeared_set"+num2str(tab+1)) |
---|
956 | Wave/Z InputIntensity= $("Intensity_set"+num2str(tab+1)) |
---|
957 | Wave/Z InputQ=$("Q_set"+num2str(tab+1)) |
---|
958 | Wave/Z InputError= $("Error_set"+num2str(tab+1)) |
---|
959 | variable displayUseCheckbox=1 |
---|
960 | if(!WaveExists(InputIntensity) || !WaveExists(InputQ) || !WaveExists(InputError)) |
---|
961 | displayUseCheckbox=0 |
---|
962 | displayControls = 0 |
---|
963 | endif |
---|
964 | |
---|
965 | Button AddDataSet, win=LSQF2_MainPanel, disable=( !DisplayInputDataControls) |
---|
966 | Button RemovePointWcsrA, win=LSQF2_MainPanel, disable=( !DisplayInputDataControls || !displayControls) |
---|
967 | Button ReadCursors, win=LSQF2_MainPanel,disable=( !DisplayInputDataControls || !displayControls) |
---|
968 | Execute("CheckBox UseTheData_set ,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(tab+1)+", disable=( !"+num2str(DisplayInputDataControls)+"||!"+num2str(displayUseCheckbox)+")") |
---|
969 | Execute("CheckBox SlitSmeared_set ,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:SlitSmeared_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
970 | Execute("SetVariable SlitLength_set ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:SlitLength_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"|| !"+num2str(DisplaySlitSmeared)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
971 | Execute("SetVariable FolderName_set ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:FolderName_set"+num2str(tab+1)+", disable=( !"+num2str(DisplayInputDataControls)+"||!"+num2str(displayUseCheckbox)+")") |
---|
972 | Execute("SetVariable UserDataSetName_set ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:UserDataSetName_set"+num2str(tab+1)+", disable=( !"+num2str(DisplayInputDataControls)+"||!"+num2str(displayUseCheckbox)+")") |
---|
973 | Execute("SetVariable Qmin_set ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:Qmin_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
974 | Execute("SetVariable Qmax_set ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:Qmax_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
975 | Execute("SetVariable Background ,win=LSQF2_MainPanel ,limits={0,Inf,root:Packages:IR2L_NLSQF:BackgStep_set"+num2str(tab+1)+"}, variable=root:Packages:IR2L_NLSQF:Background_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
976 | // Execute("SetVariable BackgStep ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:BackgStep_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
977 | Execute("SetVariable BackgroundMin ,win=LSQF2_MainPanel ,value= root:Packages:IR2L_NLSQF:BackgroundMin_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayFitRange)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
978 | Execute("SetVariable BackgroundMax ,win=LSQF2_MainPanel ,variable=root:Packages:IR2L_NLSQF:BackgroundMax_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayFitRange)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
979 | Execute("CheckBox BackgroundFit_set ,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:BackgroundFit_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
980 | |
---|
981 | Execute("SetVariable DataScalingFactor_set,win=LSQF2_MainPanel,value= root:Packages:IR2L_NLSQF:DataScalingFactor_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
982 | Execute("CheckBox UseUserErrors_set,win=LSQF2_MainPanel, variable= root:Packages:IR2L_NLSQF:UseUserErrors_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
983 | Execute("CheckBox UseSQRTErrors_set,win=LSQF2_MainPanel, variable= root:Packages:IR2L_NLSQF:UseSQRTErrors_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
984 | Execute("CheckBox UsePercentErrors_set,win=LSQF2_MainPanel, variable= root:Packages:IR2L_NLSQF:UsePercentErrors_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
985 | Execute("SetVariable ErrorScalingFactor_set,win=LSQF2_MainPanel,value= root:Packages:IR2L_NLSQF:ErrorScalingFactor_set"+num2str(tab+1)+", disable=( !"+num2str(displayControls)+"||!"+num2str(DisplayInputDataControls)+")") |
---|
986 | |
---|
987 | setDataFolder OldDf |
---|
988 | IR2L_AppendOrRemoveLocalPopInts() |
---|
989 | DoWindow/F LSQF2_MainPanel |
---|
990 | end |
---|
991 | |
---|
992 | //***************************************************************************************************************** |
---|
993 | //***************************************************************************************************************** |
---|
994 | //***************************************************************************************************************** |
---|
995 | //***************************************************************************************************************** |
---|
996 | //***************************************************************************************************************** |
---|
997 | |
---|
998 | Function IR2L_Model_TabPanelControl(name,tab) |
---|
999 | String name |
---|
1000 | Variable tab |
---|
1001 | |
---|
1002 | string oldDf=GetDataFolder(1) |
---|
1003 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1004 | |
---|
1005 | NVAR DisplayInputDataControls=root:Packages:IR2L_NLSQF:DisplayInputDataControls |
---|
1006 | NVAR DisplayModelControls=root:Packages:IR2L_NLSQF:DisplayModelControls |
---|
1007 | NVAR UsePop=$("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(tab+1)) |
---|
1008 | NVAR RdistAuto=$("root:Packages:IR2L_NLSQF:RdistAuto_pop"+num2str(tab+1)) |
---|
1009 | NVAR RdistManual=$("root:Packages:IR2L_NLSQF:RdistMan_pop"+num2str(tab+1)) |
---|
1010 | NVAR DisplayVolumeLims=$("root:Packages:IR2L_NLSQF:VolumeFit_pop"+num2str(tab+1)) |
---|
1011 | NVAR SameContr=root:Packages:IR2L_NLSQF:SameContrastForDataSets |
---|
1012 | NVAR MID=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
1013 | NVAR UD1=UseTheData_set1 |
---|
1014 | NVAR UD2=UseTheData_set2 |
---|
1015 | NVAR UD3=UseTheData_set3 |
---|
1016 | NVAR UD4=UseTheData_set4 |
---|
1017 | NVAR UD5=UseTheData_set5 |
---|
1018 | NVAR UD6=UseTheData_set6 |
---|
1019 | NVAR UD7=UseTheData_set7 |
---|
1020 | NVAR UD8=UseTheData_set8 |
---|
1021 | NVAR UD9=UseTheData_set9 |
---|
1022 | NVAR UD10=UseTheData_set10 |
---|
1023 | SVAR Shape=$("root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(tab+1)) |
---|
1024 | SVAR FormFactor=$("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(tab+1)) |
---|
1025 | SVAR Model=$("root:Packages:IR2L_NLSQF:Model_pop"+num2str(tab+1)) |
---|
1026 | SVAR PeakProfile=$("root:Packages:IR2L_NLSQF:DiffPeakProfile_pop"+num2str(tab+1)) |
---|
1027 | variable S_sw, F_sw,CS_sw, Dif_sw |
---|
1028 | if(stringmatch(PeakProfile, "Pseudo-Voigt")||stringmatch(PeakProfile, "Pearson_VII")||stringmatch(PeakProfile, "Modif_Gauss")||stringmatch(PeakProfile, "SkewedNormal")) |
---|
1029 | Dif_sw=1 |
---|
1030 | else |
---|
1031 | Dif_sw=0 |
---|
1032 | endif |
---|
1033 | |
---|
1034 | |
---|
1035 | if(stringmatch(Model, "Unified level")) |
---|
1036 | F_sw=0 |
---|
1037 | elseif(stringmatch(Model, "Size dist.")) |
---|
1038 | F_sw=1 //we have Particulate system. |
---|
1039 | elseif(stringmatch(Model, "Diffraction Peak")) |
---|
1040 | F_sw=2 //we have Diffraction peak. |
---|
1041 | else |
---|
1042 | F_sw=3 //unused yet. |
---|
1043 | endif |
---|
1044 | if(stringmatch(FormFactor, "CoreShell*")) |
---|
1045 | CS_sw=0 |
---|
1046 | else |
---|
1047 | CS_sw=1 //we have delta rho squared not rho here. |
---|
1048 | endif |
---|
1049 | |
---|
1050 | if(stringmatch(Shape, "LogNormal")) |
---|
1051 | S_sw=1 |
---|
1052 | elseif(stringmatch(Shape, "Gauss")) |
---|
1053 | S_sw=2 |
---|
1054 | elseif(stringmatch(Shape, "Schulz-Zimm")) |
---|
1055 | S_sw=4 |
---|
1056 | else |
---|
1057 | S_sw=3 //we have LSW.... |
---|
1058 | endif |
---|
1059 | |
---|
1060 | |
---|
1061 | Execute("CheckBox UseThePop,win=LSQF2_MainPanel ,variable=root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+")") |
---|
1062 | Execute("PopupMenu PopulationType,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:Model_pop"+num2str(tab+1)+",\"Size dist.;Unified level;Diffraction Peak;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(UsePop)+")") |
---|
1063 | |
---|
1064 | |
---|
1065 | Execute("CheckBox RdistAuto,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:RdistAuto_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1066 | Execute("CheckBox RdistrSemiAuto,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:RdistrSemiAuto_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1067 | Execute("CheckBox RdistMan,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:RdistMan_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1068 | |
---|
1069 | Execute("SetVariable RdistNumPnts,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:RdistNumPnts_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1070 | Execute("SetVariable RdistManMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:RdistManMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1071 | Execute("SetVariable RdistManMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:RdistManMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+"|| "+num2str(!RdistManual)+")") |
---|
1072 | |
---|
1073 | Execute("SetVariable RdistNeglectTails,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:RdistNeglectTails_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+"|| "+num2str(RdistManual)+")") |
---|
1074 | |
---|
1075 | Execute("CheckBox RdistLog,win=LSQF2_MainPanel ,variable= root:Packages:IR2L_NLSQF:RdistLog_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1076 | |
---|
1077 | Execute("PopupMenu FormFactorPop,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(tab+1)+",root:Packages:FormFactorCalc:ListOfFormFactors+\"Unified_Level;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1078 | |
---|
1079 | Execute("PopupMenu PopSizeDistShape,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(tab+1)+",\"LogNormal;Gauss;LSW;Schulz-Zimm;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1080 | //diffraction stuff |
---|
1081 | Execute("PopupMenu DiffPeakProfile,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:DiffPeakProfile_pop"+num2str(tab+1)+",root:Packages:IR2L_NLSQF:ListOfKnownPeakShapes)+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1082 | Execute("SetVariable DiffPeakPar1,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar1_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1083 | Execute("SetVariable DiffPeakPar1,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:DiffPeakPar1_pop"+num2str(tab+1)+"}") |
---|
1084 | Execute("Checkbox DiffPeakPar1Fit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar1Fit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1085 | Execute("SetVariable DiffPeakPar1Min,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar1Min_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1086 | Execute("SetVariable DiffPeakPar1Max,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar1Max_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1087 | |
---|
1088 | Execute("SetVariable DiffPeakPar2,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar2_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1089 | Execute("SetVariable DiffPeakPar2,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:DiffPeakPar2_pop"+num2str(tab+1)+"}") |
---|
1090 | Execute("Checkbox DiffPeakPar2Fit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar2Fit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1091 | Execute("SetVariable DiffPeakPar2Min,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar2Min_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1092 | Execute("SetVariable DiffPeakPar2Max,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar2Max_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1093 | |
---|
1094 | Execute("SetVariable DiffPeakPar3,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar3_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1095 | Execute("SetVariable DiffPeakPar3,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:DiffPeakPar3_pop"+num2str(tab+1)+"}") |
---|
1096 | Execute("Checkbox DiffPeakPar3Fit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar3Fit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1097 | Execute("SetVariable DiffPeakPar3Min,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar3Min_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1098 | Execute("SetVariable DiffPeakPar3Max,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar3Max_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1099 | |
---|
1100 | if(stringmatch(PeakProfile, "Pseudo-Voigt")) |
---|
1101 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel, title=\"Eta = \"") |
---|
1102 | elseif(stringmatch(PeakProfile, "Pearson_VII")||stringmatch(PeakProfile, "Modif_Gauss")) |
---|
1103 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel, title=\"Tail Param = \"") |
---|
1104 | elseif(stringmatch(PeakProfile, "SkewedNormal")) |
---|
1105 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel, title=\"Skewness = \"") |
---|
1106 | endif |
---|
1107 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar4_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(Dif_sw==1)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1108 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:DiffPeakPar4_pop"+num2str(tab+1)+"}") |
---|
1109 | Execute("Checkbox DiffPeakPar4Fit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar4Fit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(Dif_sw==1)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1110 | Execute("SetVariable DiffPeakPar4Min,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar4Min_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(Dif_sw==1)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1111 | Execute("SetVariable DiffPeakPar4Max,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakPar4Max_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(Dif_sw==1)+"|| !"+num2str(F_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1112 | variable tempSw |
---|
1113 | if((DisplayModelControls)&&(F_sw==2)&&(UsePop==1)) |
---|
1114 | tempSw=2 |
---|
1115 | else |
---|
1116 | tempSw=1 |
---|
1117 | endif |
---|
1118 | Execute("SetVariable DiffPeakDPos,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakDPos_pop"+num2str(tab+1)+", disable=("+num2str(tempSw)) |
---|
1119 | Execute("SetVariable DiffPeakQPos,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakQPos_pop"+num2str(tab+1)+", disable=("+num2str(tempSw)) |
---|
1120 | Execute("SetVariable DiffPeakQFWHM,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakQFWHM_pop"+num2str(tab+1)+", disable=("+num2str(tempSw)) |
---|
1121 | Execute("SetVariable DiffPeakIntgInt,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:DiffPeakIntgInt_pop"+num2str(tab+1)+", disable=("+num2str(tempSw)) |
---|
1122 | |
---|
1123 | //size dist controls |
---|
1124 | |
---|
1125 | Execute("SetVariable Volume,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Volume_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1126 | Execute("SetVariable Volume,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:Volume_pop"+num2str(tab+1)+"}") |
---|
1127 | Execute("Checkbox FitVolume,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:VolumeFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1128 | Execute("SetVariable VolumeMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:VolumeMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DisplayVolumeLims)+")") |
---|
1129 | Execute("SetVariable VolumeMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:VolumeMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DisplayVolumeLims)+")") |
---|
1130 | |
---|
1131 | NVAR DLNM1=$("root:Packages:IR2L_NLSQF:LNMinSizeFit_pop"+num2str(tab+1)) |
---|
1132 | Execute("SetVariable LNMinSize,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMinSize_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1133 | Execute("SetVariable LNMinSize,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:LNMinSize_pop"+num2str(tab+1)+"}") |
---|
1134 | Execute("Checkbox LNMinSizeFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMinSizeFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1135 | Execute("SetVariable LNMinSizeMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMinSizeMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM1)+")") |
---|
1136 | Execute("SetVariable LNMinSizeMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMinSizeMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM1)+")") |
---|
1137 | |
---|
1138 | NVAR DLNM2=$("root:Packages:IR2L_NLSQF:LNMeanSizeFit_pop"+num2str(tab+1)) |
---|
1139 | Execute("SetVariable LNMeanSize,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMeanSize_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1140 | Execute("SetVariable LNMeanSize,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:LNMeanSize_pop"+num2str(tab+1)+"}") |
---|
1141 | Execute("Checkbox LNMeanSizeFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMeanSizeFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1142 | Execute("SetVariable LNMeanSizeMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMeanSizeMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM2)+")") |
---|
1143 | Execute("SetVariable LNMeanSizeMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNMeanSizeMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM2)+")") |
---|
1144 | |
---|
1145 | NVAR DLNM3=$("root:Packages:IR2L_NLSQF:LNSdeviationFit_pop"+num2str(tab+1)) |
---|
1146 | Execute("SetVariable LNSdeviation,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNSdeviation_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1147 | Execute("SetVariable LNSdeviation,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:LNSdeviation_pop"+num2str(tab+1)+"}") |
---|
1148 | Execute("Checkbox LNSdeviationFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNSdeviationFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+")") |
---|
1149 | Execute("SetVariable LNSdeviationMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNSdeviationMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM3)+")") |
---|
1150 | Execute("SetVariable LNSdeviationMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LNSdeviationMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==1)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLNM3)+")") |
---|
1151 | |
---|
1152 | NVAR DGM1=$("root:Packages:IR2L_NLSQF:GMeanSizeFit_pop"+num2str(tab+1)) |
---|
1153 | Execute("SetVariable GMeanSize,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GMeanSize_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1154 | Execute("SetVariable GMeanSize,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:GMeanSize_pop"+num2str(tab+1)+"}") |
---|
1155 | Execute("Checkbox GMeanSizeFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GMeanSizeFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1156 | Execute("SetVariable GMeanSizeMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GMeanSizeMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+"|| !"+num2str(DGM1)+")") |
---|
1157 | Execute("SetVariable GMeanSizeMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GMeanSizeMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+"|| !"+num2str(DGM1)+")") |
---|
1158 | |
---|
1159 | NVAR DGM2=$("root:Packages:IR2L_NLSQF:GWidthFit_pop"+num2str(tab+1)) |
---|
1160 | Execute("SetVariable GWidth,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GWidth_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1161 | Execute("SetVariable GWidth,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:GWidth_pop"+num2str(tab+1)+"}") |
---|
1162 | Execute("Checkbox GWidthFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GWidthFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+")") |
---|
1163 | Execute("SetVariable GWidthMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GWidthMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+"|| !"+num2str(DGM2)+")") |
---|
1164 | Execute("SetVariable GWidthMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:GWidthMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==2)+"|| !"+num2str(UsePop)+"|| !"+num2str(DGM2)+")") |
---|
1165 | |
---|
1166 | NVAR DSZM1=$("root:Packages:IR2L_NLSQF:SZMeanSizeFit_pop"+num2str(tab+1)) |
---|
1167 | Execute("SetVariable SZMeanSize,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZMeanSize_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+")") |
---|
1168 | Execute("SetVariable SZMeanSize,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:SZMeanSize_pop"+num2str(tab+1)+"}") |
---|
1169 | Execute("Checkbox SZMeanSizeFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZMeanSizeFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+")") |
---|
1170 | Execute("SetVariable SZMeanSizeMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZMeanSizeMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+"|| !"+num2str(DSZM1)+")") |
---|
1171 | Execute("SetVariable SZMeanSizeMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZMeanSizeMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+"|| !"+num2str(DSZM1)+")") |
---|
1172 | |
---|
1173 | NVAR DSZM2=$("root:Packages:IR2L_NLSQF:SZWidthFit_pop"+num2str(tab+1)) |
---|
1174 | Execute("SetVariable SZWidth,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZWidth_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+")") |
---|
1175 | Execute("SetVariable SZWidth,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:SZWidth_pop"+num2str(tab+1)+"}") |
---|
1176 | Execute("Checkbox SZWidthFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZWidthFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+")") |
---|
1177 | Execute("SetVariable SZWidthMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZWidthMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+"|| !"+num2str(DSZM2)+")") |
---|
1178 | Execute("SetVariable SZWidthMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:SZWidthMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==4)+"|| !"+num2str(UsePop)+"|| !"+num2str(DSZM2)+")") |
---|
1179 | |
---|
1180 | |
---|
1181 | NVAR DLSW1=$("root:Packages:IR2L_NLSQF:LSWLocationFit_pop"+num2str(tab+1)) |
---|
1182 | Execute("SetVariable LSWLocation,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LSWLocation_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==3)+"|| !"+num2str(UsePop)+")") |
---|
1183 | Execute("SetVariable LSWLocation,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:LSWLocation_pop"+num2str(tab+1)+"}") |
---|
1184 | Execute("Checkbox LSWLocationFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LSWLocationFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==3)+"|| !"+num2str(UsePop)+")") |
---|
1185 | Execute("SetVariable LSWLocationMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LSWLocationMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==3)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLSW1)+")") |
---|
1186 | Execute("SetVariable LSWLocationMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:LSWLocationMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(S_sw==3)+"|| !"+num2str(UsePop)+"|| !"+num2str(DLSW1)+")") |
---|
1187 | //unified fit controls |
---|
1188 | Execute("Button FitRgAndG,win=LSQF2_MainPanel,"+" disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1189 | Execute("Button FitPandB,win=LSQF2_MainPanel,"+" disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1190 | |
---|
1191 | NVAR UNF1=$("root:Packages:IR2L_NLSQF:UF_GFit_pop"+num2str(tab+1)) |
---|
1192 | Execute("SetVariable UF_G,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1193 | Execute("SetVariable UF_G,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(tab+1)+"}") |
---|
1194 | Execute("Checkbox UF_GFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_GFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1195 | Execute("SetVariable UF_GMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_GMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF1)+")") |
---|
1196 | Execute("SetVariable UF_GMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_GMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF1)+")") |
---|
1197 | |
---|
1198 | NVAR UNF2=$("root:Packages:IR2L_NLSQF:UF_RgFit_pop"+num2str(tab+1)) |
---|
1199 | Execute("SetVariable UF_Rg,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1200 | Execute("SetVariable UF_Rg,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(tab+1)+"}") |
---|
1201 | Execute("Checkbox UF_RgFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RgFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1202 | Execute("SetVariable UF_RgMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RgMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF2)+")") |
---|
1203 | Execute("SetVariable UF_RgMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RgMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF2)+")") |
---|
1204 | |
---|
1205 | NVAR UNF3=$("root:Packages:IR2L_NLSQF:UF_BFit_pop"+num2str(tab+1)) |
---|
1206 | Execute("SetVariable UF_B,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_B_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1207 | Execute("SetVariable UF_B,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:UF_B_pop"+num2str(tab+1)+"}") |
---|
1208 | Execute("Checkbox UF_BFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_BFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1209 | Execute("SetVariable UF_BMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_BMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF3)+")") |
---|
1210 | Execute("SetVariable UF_BMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_BMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF3)+")") |
---|
1211 | |
---|
1212 | NVAR UNF4=$("root:Packages:IR2L_NLSQF:UF_PFit_pop"+num2str(tab+1)) |
---|
1213 | Execute("SetVariable UF_P,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_P_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1214 | Execute("SetVariable UF_P,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:UF_P_pop"+num2str(tab+1)+"}") |
---|
1215 | Execute("Checkbox UF_PFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_PFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1216 | Execute("SetVariable UF_PMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_PMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF4)+")") |
---|
1217 | Execute("SetVariable UF_PMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_PMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF4)+")") |
---|
1218 | |
---|
1219 | NVAR UNF5=$("root:Packages:IR2L_NLSQF:UF_RGCOFit_pop"+num2str(tab+1)) |
---|
1220 | Execute("SetVariable UF_RGCO,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RGCO_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1221 | Execute("SetVariable UF_RGCO,win=LSQF2_MainPanel, Limits= {0,inf,0.05*root:Packages:IR2L_NLSQF:UF_RGCO_pop"+num2str(tab+1)+"}") |
---|
1222 | Execute("Checkbox UF_RGCOFit,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RGCOFit_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1223 | Execute("SetVariable UF_RGCOMin,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RGCOMin_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF5)+")") |
---|
1224 | Execute("SetVariable UF_RGCOMax,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:UF_RGCOMax_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(UNF5)+")") |
---|
1225 | |
---|
1226 | NVAR UF_K=$("root:Packages:IR2L_NLSQF:UF_K_pop"+num2str(tab+1)) |
---|
1227 | Execute("PopupMenu KFactor,win=LSQF2_MainPanel, mode=(WhichListItem(\""+num2str(UF_K)+"\",\"1;1.06;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| "+num2str(F_sw)+"|| !"+num2str(UsePop)+")") |
---|
1228 | |
---|
1229 | SVAR StrA=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(tab+1)) |
---|
1230 | SVAR StrB=root:Packages:StructureFactorCalc:ListOfStructureFactors |
---|
1231 | Execute("PopupMenu StructureFactorModel win=LSQF2_MainPanel, mode=WhichListItem(\""+StrA+"\",\""+StrB+"\" )+1, disable=(!"+num2str(DisplayModelControls)+"||! "+num2str(F_sw<=1)+"|| !"+num2str(UsePop)+")") |
---|
1232 | //contrasts |
---|
1233 | Execute("SetVariable Contrast,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(!SameContr || !MID)+")") |
---|
1234 | |
---|
1235 | Execute("SetVariable Contrast_set1,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set1_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD1)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1236 | Execute("SetVariable Contrast_set2,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set2_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD2)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1237 | Execute("SetVariable Contrast_set3,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set3_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD3)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1238 | Execute("SetVariable Contrast_set4,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set4_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD4)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1239 | Execute("SetVariable Contrast_set5,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set5_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD5)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1240 | Execute("SetVariable Contrast_set6,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set6_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD6)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1241 | Execute("SetVariable Contrast_set7,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set7_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD7)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1242 | Execute("SetVariable Contrast_set8,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set8_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD8)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1243 | Execute("SetVariable Contrast_set9,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set9_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD9)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1244 | Execute("SetVariable Contrast_set10,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_set10_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UD10)+"|| !"+num2str(UsePop)+"|| "+num2str(!SameContr || !MID)+")") |
---|
1245 | |
---|
1246 | setDataFolder OldDf |
---|
1247 | |
---|
1248 | //update the graph with displayed Mean mode etc... |
---|
1249 | IR2L_RemoveLocalGunierPorodFits() |
---|
1250 | IR2L_GraphSizeDistUpdate() |
---|
1251 | IR2L_AppendOrRemoveLocalPopInts() |
---|
1252 | DoWindow/F LSQF2_MainPanel |
---|
1253 | end |
---|
1254 | //***************************************************************************************************************** |
---|
1255 | //***************************************************************************************************************** |
---|
1256 | Function IR2L_RemoveLocalGunierPorodFits() |
---|
1257 | //remove Local fits from LSQF_MainGraph |
---|
1258 | string ListOFDisplayedWave=TraceNameList("LSQF_MainGraph", ";", 5) |
---|
1259 | variable i |
---|
1260 | For(i=ItemsInList(ListOFDisplayedWave);i>=0;i-=1) |
---|
1261 | if(stringmatch(stringfromList(i,ListOFDisplayedWave), "*PowerLaw*" )||stringmatch(stringfromList(i,ListOFDisplayedWave), "*Guinier*" )) |
---|
1262 | RemoveFromGraph/W=LSQF_MainGraph $(stringfromList(i,ListOFDisplayedWave)) |
---|
1263 | endif |
---|
1264 | endfor |
---|
1265 | |
---|
1266 | end |
---|
1267 | |
---|
1268 | //***************************************************************************************************************** |
---|
1269 | //***************************************************************************************************************** |
---|
1270 | //***************************************************************************************************************** |
---|
1271 | Function IR2L_SetQminQmaxWCursors(WhichDataSet) |
---|
1272 | variable WhichDataSet |
---|
1273 | string oldDf=GetDataFolder(1) |
---|
1274 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1275 | |
---|
1276 | Wave CurQ=$("Q_set"+num2str(whichDataSet)) |
---|
1277 | NVAR Qmax_set=$("Qmax_set"+num2str(whichDataSet)) |
---|
1278 | NVAR Qmin_set=$("Qmin_set"+num2str(whichDataSet)) |
---|
1279 | |
---|
1280 | if(cmpstr("Intensity_set"+num2str(whichDataSet),stringByKey("TNAME",CsrInfo(A ,"LSQF_MainGraph")))==0) |
---|
1281 | Qmin_set=CurQ[pcsr(A, "LSQF_MainGraph")] |
---|
1282 | endif |
---|
1283 | if(cmpstr("Intensity_set"+num2str(whichDataSet),stringByKey("TNAME",CsrInfo(B ,"LSQF_MainGraph")))==0) |
---|
1284 | Qmax_set=CurQ[pcsr(B, "LSQF_MainGraph")] |
---|
1285 | endif |
---|
1286 | if(Qmin_set>Qmax_set) |
---|
1287 | variable tempS |
---|
1288 | tempS=Qmin_set |
---|
1289 | Qmin_set=Qmax_set |
---|
1290 | Qmax_set=tempS |
---|
1291 | endif |
---|
1292 | IR2L_setQMinMax(whichDataSet) |
---|
1293 | setDataFolder OldDf |
---|
1294 | end |
---|
1295 | //***************************************************************************************************************** |
---|
1296 | //***************************************************************************************************************** |
---|
1297 | //***************************************************************************************************************** |
---|
1298 | //***************************************************************************************************************** |
---|
1299 | Function IR2L_PopSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl |
---|
1300 | String ctrlName |
---|
1301 | Variable varNum |
---|
1302 | String varStr |
---|
1303 | String varName |
---|
1304 | |
---|
1305 | string OldDf=GetDataFolder(1) |
---|
1306 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1307 | variable whichDataSet |
---|
1308 | //BackgStep_set |
---|
1309 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
1310 | whichDataSet= V_Value+1 |
---|
1311 | if(stringmatch(ctrlName,"UF_G")) |
---|
1312 | //set volume limits... |
---|
1313 | NVAR UF_G=$("root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(whichDataSet)) |
---|
1314 | NVAR UF_Rg=$("root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(whichDataSet)) |
---|
1315 | NVAR UF_GFit=$("root:Packages:IR2L_NLSQF:UF_GFit_pop"+num2str(whichDataSet)) |
---|
1316 | NVAR UF_RgFit=$("root:Packages:IR2L_NLSQF:UF_RgFit_pop"+num2str(whichDataSet)) |
---|
1317 | if(UF_G<=0) |
---|
1318 | UF_Rg=1e10 |
---|
1319 | UF_GFit=0 |
---|
1320 | UF_RgFit=0 |
---|
1321 | IR2L_Model_TabPanelControl("",V_Value) |
---|
1322 | else |
---|
1323 | NVAR UF_GMin=$("root:Packages:IR2L_NLSQF:UF_GMin_pop"+num2str(whichDataSet)) |
---|
1324 | NVAR UF_GMax=$("root:Packages:IR2L_NLSQF:UF_GMax_pop"+num2str(whichDataSet)) |
---|
1325 | UF_GMin= varNum*0.1 |
---|
1326 | UF_GMax=varNum*10 |
---|
1327 | Execute("SetVariable UF_G,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1328 | endif |
---|
1329 | endif |
---|
1330 | if(stringmatch(ctrlName,"UF_Rg")) |
---|
1331 | //set volume limits... |
---|
1332 | NVAR UF_RgMin=$("root:Packages:IR2L_NLSQF:UF_RgMin_pop"+num2str(whichDataSet)) |
---|
1333 | NVAR UF_RgMax=$("root:Packages:IR2L_NLSQF:UF_RgMax_pop"+num2str(whichDataSet)) |
---|
1334 | UF_RgMin= varNum*0.1 |
---|
1335 | UF_RgMax=varNum*10 |
---|
1336 | Execute("SetVariable UF_Rg,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1337 | endif |
---|
1338 | if(stringmatch(ctrlName,"UF_RgCO")) |
---|
1339 | //set volume limits... |
---|
1340 | NVAR UF_RgCOMin=$("root:Packages:IR2L_NLSQF:UF_RgCOMin_pop"+num2str(whichDataSet)) |
---|
1341 | NVAR UF_RgCOMax=$("root:Packages:IR2L_NLSQF:UF_RgCOMax_pop"+num2str(whichDataSet)) |
---|
1342 | UF_RgCOMin= varNum*0.1 |
---|
1343 | UF_RgCOMax=varNum*10 |
---|
1344 | Execute("SetVariable UF_RgCO,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1345 | endif |
---|
1346 | if(stringmatch(ctrlName,"UF_B")) |
---|
1347 | //set volume limits... |
---|
1348 | NVAR UF_BMin=$("root:Packages:IR2L_NLSQF:UF_BMin_pop"+num2str(whichDataSet)) |
---|
1349 | NVAR UF_BMax=$("root:Packages:IR2L_NLSQF:UF_BMax_pop"+num2str(whichDataSet)) |
---|
1350 | UF_BMin= varNum*0.1 |
---|
1351 | UF_BMax=varNum*10 |
---|
1352 | Execute("SetVariable UF_B,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1353 | endif |
---|
1354 | if(stringmatch(ctrlName,"UF_P")) |
---|
1355 | //set volume limits... |
---|
1356 | NVAR UF_PMin=$("root:Packages:IR2L_NLSQF:UF_PMin_pop"+num2str(whichDataSet)) |
---|
1357 | NVAR UF_PMax=$("root:Packages:IR2L_NLSQF:UF_PMax_pop"+num2str(whichDataSet)) |
---|
1358 | UF_PMin= (varNum*0.2)>1 ? varNum*0.2 : 1 |
---|
1359 | UF_PMax=(varNum*2)<4.5 ? (varNum*2) : 4.5 |
---|
1360 | Execute("SetVariable UF_P,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1361 | endif |
---|
1362 | |
---|
1363 | if(stringmatch(ctrlName,"DiffPeakPar1")) |
---|
1364 | //set volume limits... |
---|
1365 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:DiffPeakPar1Min_pop"+num2str(whichDataSet)) |
---|
1366 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:DiffPeakPar1Max_pop"+num2str(whichDataSet)) |
---|
1367 | VolMin= varNum*0.5 |
---|
1368 | VolMax=varNum*2 |
---|
1369 | Execute("SetVariable DiffPeakPar1,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1370 | endif |
---|
1371 | if(stringmatch(ctrlName,"DiffPeakPar2")) |
---|
1372 | //set volume limits... |
---|
1373 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:DiffPeakPar2Min_pop"+num2str(whichDataSet)) |
---|
1374 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:DiffPeakPar2Max_pop"+num2str(whichDataSet)) |
---|
1375 | VolMin= varNum*0.5 |
---|
1376 | VolMax=varNum*2 |
---|
1377 | Execute("SetVariable DiffPeakPar2,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1378 | endif |
---|
1379 | if(stringmatch(ctrlName,"DiffPeakPar3")) |
---|
1380 | //set volume limits... |
---|
1381 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:DiffPeakPar3Min_pop"+num2str(whichDataSet)) |
---|
1382 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:DiffPeakPar3Max_pop"+num2str(whichDataSet)) |
---|
1383 | VolMin= varNum*0.5 |
---|
1384 | VolMax=varNum*2 |
---|
1385 | Execute("SetVariable DiffPeakPar3,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1386 | endif |
---|
1387 | if(stringmatch(ctrlName,"DiffPeakPar4")) |
---|
1388 | //set volume limits... |
---|
1389 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:DiffPeakPar4Min_pop"+num2str(whichDataSet)) |
---|
1390 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:DiffPeakPar4Max_pop"+num2str(whichDataSet)) |
---|
1391 | VolMin= varNum*0.5 |
---|
1392 | VolMax=varNum*2 |
---|
1393 | Execute("SetVariable DiffPeakPar4,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1394 | endif |
---|
1395 | |
---|
1396 | |
---|
1397 | |
---|
1398 | if(stringmatch(ctrlName,"Volume")) |
---|
1399 | //set volume limits... |
---|
1400 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:VolumeMin_pop"+num2str(whichDataSet)) |
---|
1401 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:VolumeMax_pop"+num2str(whichDataSet)) |
---|
1402 | VolMin= varNum*0.5 |
---|
1403 | VolMax=varNum*2 |
---|
1404 | Execute("SetVariable Volume,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1405 | endif |
---|
1406 | //LN controls... |
---|
1407 | if(stringmatch(ctrlName,"LNMinSize")) |
---|
1408 | //set LNMinSize limits... |
---|
1409 | NVAR LNMinSizeMin=$("root:Packages:IR2L_NLSQF:LNMinSizeMin_pop"+num2str(whichDataSet)) |
---|
1410 | NVAR LNMinSizeMax=$("root:Packages:IR2L_NLSQF:LNMinSizeMax_pop"+num2str(whichDataSet)) |
---|
1411 | LNMinSizeMin= varNum*0.5 |
---|
1412 | LNMinSizeMax=varNum*2 |
---|
1413 | Execute("SetVariable LNMinSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1414 | endif |
---|
1415 | if(stringmatch(ctrlName,"LNMeanSize")) |
---|
1416 | //set LNMeanSize limits... |
---|
1417 | NVAR LNMeanSizeMin=$("root:Packages:IR2L_NLSQF:LNMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1418 | NVAR LNMeanSizeMax=$("root:Packages:IR2L_NLSQF:LNMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1419 | LNMeanSizeMin= varNum*0.5 |
---|
1420 | LNMeanSizeMax=varNum*2 |
---|
1421 | Execute("SetVariable LNMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1422 | endif |
---|
1423 | if(stringmatch(ctrlName,"LNSdeviation")) |
---|
1424 | //set LNSdeviation limits... |
---|
1425 | NVAR LNSdeviationMin=$("root:Packages:IR2L_NLSQF:LNSdeviationMin_pop"+num2str(whichDataSet)) |
---|
1426 | NVAR LNSdeviationMax=$("root:Packages:IR2L_NLSQF:LNSdeviationMax_pop"+num2str(whichDataSet)) |
---|
1427 | LNSdeviationMin= varNum*0.5 |
---|
1428 | LNSdeviationMax=varNum*2 |
---|
1429 | Execute("SetVariable LNSdeviation,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1430 | endif |
---|
1431 | //GW controls |
---|
1432 | if(stringmatch(ctrlName,"GMeanSize")) |
---|
1433 | //set GMeanSize limits... |
---|
1434 | NVAR GMeanSizeMin=$("root:Packages:IR2L_NLSQF:GMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1435 | NVAR GMeanSizeMax=$("root:Packages:IR2L_NLSQF:GMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1436 | GMeanSizeMin= varNum*0.5 |
---|
1437 | GMeanSizeMax=varNum*2 |
---|
1438 | Execute("SetVariable GMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1439 | endif |
---|
1440 | if(stringmatch(ctrlName,"GWidth")) |
---|
1441 | //set GWidth limits... |
---|
1442 | NVAR GWidthMin=$("root:Packages:IR2L_NLSQF:GWidthMin_pop"+num2str(whichDataSet)) |
---|
1443 | NVAR GWidthMax=$("root:Packages:IR2L_NLSQF:GWidthMax_pop"+num2str(whichDataSet)) |
---|
1444 | GWidthMin= varNum*0.5 |
---|
1445 | GWidthMax=varNum*2 |
---|
1446 | Execute("SetVariable GWidth,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1447 | endif |
---|
1448 | //SZ controls |
---|
1449 | if(stringmatch(ctrlName,"SZMeanSize")) |
---|
1450 | //set GMeanSize limits... |
---|
1451 | NVAR GMeanSizeMin=$("root:Packages:IR2L_NLSQF:SZMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1452 | NVAR GMeanSizeMax=$("root:Packages:IR2L_NLSQF:SZMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1453 | GMeanSizeMin= varNum*0.5 |
---|
1454 | GMeanSizeMax=varNum*2 |
---|
1455 | Execute("SetVariable SZMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1456 | endif |
---|
1457 | if(stringmatch(ctrlName,"SZWidth")) |
---|
1458 | //set GWidth limits... |
---|
1459 | NVAR GWidthMin=$("root:Packages:IR2L_NLSQF:SZWidthMin_pop"+num2str(whichDataSet)) |
---|
1460 | NVAR GWidthMax=$("root:Packages:IR2L_NLSQF:SZWidthMax_pop"+num2str(whichDataSet)) |
---|
1461 | GWidthMin= varNum*0.5 |
---|
1462 | GWidthMax=varNum*2 |
---|
1463 | Execute("SetVariable SZWidth,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1464 | endif |
---|
1465 | //LSW params |
---|
1466 | if(stringmatch(ctrlName,"LSWLocation")) |
---|
1467 | //set LSWLocation limits... |
---|
1468 | NVAR LSWLocationMin=$("root:Packages:IR2L_NLSQF:LSWLocationMin_pop"+num2str(whichDataSet)) |
---|
1469 | NVAR LSWLocationMax=$("root:Packages:IR2L_NLSQF:LSWLocationMax_pop"+num2str(whichDataSet)) |
---|
1470 | LSWLocationMin= varNum*0.5 |
---|
1471 | LSWLocationMax=varNum*2 |
---|
1472 | Execute("SetVariable LSWLocation,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1473 | endif |
---|
1474 | if(stringmatch(ctrlName,"StructureParam1")) |
---|
1475 | //set LSWLocation limits... |
---|
1476 | NVAR StructureParam1Min=$("root:Packages:IR2L_NLSQF:StructureParam1Min_pop"+num2str(whichDataSet)) |
---|
1477 | NVAR StructureParam1Max=$("root:Packages:IR2L_NLSQF:StructureParam1Max_pop"+num2str(whichDataSet)) |
---|
1478 | StructureParam1Min= varNum*0.5 |
---|
1479 | StructureParam1Max=varNum*2 |
---|
1480 | Execute("SetVariable StructureParam1,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1481 | endif |
---|
1482 | if(stringmatch(ctrlName,"StructureParam2")) |
---|
1483 | //set LSWLocation limits... |
---|
1484 | NVAR StructureParam2Min=$("root:Packages:IR2L_NLSQF:StructureParam2Min_pop"+num2str(whichDataSet)) |
---|
1485 | NVAR StructureParam2Max=$("root:Packages:IR2L_NLSQF:StructureParam2Max_pop"+num2str(whichDataSet)) |
---|
1486 | StructureParam2Min= varNum*0.5 |
---|
1487 | StructureParam2Max=varNum*2 |
---|
1488 | Execute("SetVariable StructureParam2,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1489 | endif |
---|
1490 | //contrasts |
---|
1491 | |
---|
1492 | setDataFolder OldDf |
---|
1493 | IR2L_RecalculateIfSelected() |
---|
1494 | End |
---|
1495 | |
---|
1496 | //***************************************************************************************************************** |
---|
1497 | //***************************************************************************************************************** |
---|
1498 | //***************************************************************************************************************** |
---|
1499 | //***************************************************************************************************************** |
---|
1500 | //***************************************************************************************************************** |
---|
1501 | |
---|
1502 | Function IR2L_DataTabSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl |
---|
1503 | String ctrlName |
---|
1504 | Variable varNum |
---|
1505 | String varStr |
---|
1506 | String varName |
---|
1507 | |
---|
1508 | string oldDf=GetDataFolder(1) |
---|
1509 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1510 | variable whichDataSet |
---|
1511 | //BackgStep_set |
---|
1512 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
1513 | whichDataSet= V_Value+1 |
---|
1514 | if(stringmatch(ctrlName, "BackgStep_set")) |
---|
1515 | Execute("SetVariable Background_set,limits={0,Inf,root:Packages:IR2L_NLSQF:BackgStep_set"+num2str(whichDataSet)+"},win=LSQF2_MainPanel") |
---|
1516 | endif |
---|
1517 | if(stringmatch(ctrlName, "Qmin_set")) |
---|
1518 | IR2L_setQMinMax(whichDataSet) |
---|
1519 | IR2L_RecalculateIfSelected() |
---|
1520 | endif |
---|
1521 | if(stringmatch(ctrlName, "Qmax_set")) |
---|
1522 | IR2L_setQMinMax(whichDataSet) |
---|
1523 | IR2L_RecalculateIfSelected() |
---|
1524 | endif |
---|
1525 | if(stringmatch(ctrlName, "Background")) |
---|
1526 | //set Background limits... |
---|
1527 | NVAR BackgroundMin_set=$("root:Packages:IR2L_NLSQF:BackgroundMin_set"+num2str(whichDataSet)) |
---|
1528 | NVAR BackgroundMax_set=$("root:Packages:IR2L_NLSQF:BackgroundMax_set"+num2str(whichDataSet)) |
---|
1529 | BackgroundMin_set= varNum*0.01 |
---|
1530 | BackgroundMax_set=varNum*10 |
---|
1531 | Execute("SetVariable Background,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(varNum*0.05)+"}") |
---|
1532 | IR2L_RecalculateIfSelected() |
---|
1533 | endif |
---|
1534 | if(stringmatch(ctrlName, "UserDataSetName_set")) |
---|
1535 | IR2L_FormatLegend() |
---|
1536 | endif |
---|
1537 | if(stringmatch(ctrlName, "ErrorScalingFactor_set")) |
---|
1538 | IR2L_RecalculateErrors(WhichDataSet) |
---|
1539 | endif |
---|
1540 | |
---|
1541 | if(stringMatch(ctrlName,"GraphXMin") ||stringMatch(ctrlName,"GraphXMax") ||stringMatch(ctrlName,"GraphYMin") ||stringMatch(ctrlName,"GraphYMax")) |
---|
1542 | IR2L_FormatInputGraph() |
---|
1543 | endif |
---|
1544 | |
---|
1545 | setDataFolder OldDf |
---|
1546 | end |
---|
1547 | |
---|
1548 | |
---|
1549 | //***************************************************************************************************************** |
---|
1550 | //***************************************************************************************************************** |
---|
1551 | //***************************************************************************************************************** |
---|
1552 | //***************************************************************************************************************** |
---|
1553 | //***************************************************************************************************************** |
---|
1554 | Function IR2L_setQMinMax(whichDataSet) |
---|
1555 | variable whichDataSet |
---|
1556 | string oldDf=GetDataFolder(1) |
---|
1557 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1558 | Wave CurMask=$("IntensityMask_set"+num2str(whichDataSet)) |
---|
1559 | Wave CurQ=$("Q_set"+num2str(whichDataSet)) |
---|
1560 | NVAR Qmax_set=$("Qmax_set"+num2str(whichDataSet)) |
---|
1561 | NVAR Qmin_set=$("Qmin_set"+num2str(whichDataSet)) |
---|
1562 | |
---|
1563 | variable QminPoint=binarysearch(CurQ, Qmin_set) |
---|
1564 | if(QminPoint<0) |
---|
1565 | Qmin_set=CurQ[0] |
---|
1566 | endif |
---|
1567 | if(CurQ[QminPoint]<0) |
---|
1568 | QminPoint=binarysearch(CurQ, 0)+1 |
---|
1569 | Qmin_set = CurQ[QminPoint] |
---|
1570 | endif |
---|
1571 | |
---|
1572 | variable QmaxPoint=binarysearch(CurQ, Qmax_set) |
---|
1573 | if(QmaxPoint<0) |
---|
1574 | QmaxPoint=numpnts(CurQ) |
---|
1575 | Qmax_set=CurQ[inf] |
---|
1576 | endif |
---|
1577 | |
---|
1578 | CurMask[0,QminPoint]=1 |
---|
1579 | CurMask[QminPoint,QmaxPoint+1]=5 |
---|
1580 | CurMask[QmaxPoint,inf]=1 |
---|
1581 | DoWindow LSQF_MainGraph |
---|
1582 | if(V_Flag) |
---|
1583 | ModifyGraph/Z/W=LSQF_MainGraph zmrkSize( $("Intensity_set"+num2str(whichDataSet)))={$("IntensityMask_set"+num2str(whichDataSet)),0,5,0.5,3} |
---|
1584 | endif |
---|
1585 | |
---|
1586 | setDataFolder OldDf |
---|
1587 | end |
---|
1588 | |
---|
1589 | //***************************************************************************************************************** |
---|
1590 | //***************************************************************************************************************** |
---|
1591 | //***************************************************************************************************************** |
---|
1592 | //***************************************************************************************************************** |
---|
1593 | //***************************************************************************************************************** |
---|
1594 | |
---|
1595 | |
---|
1596 | |
---|
1597 | |
---|
1598 | //***************************************************************************************************************** |
---|
1599 | //***************************************************************************************************************** |
---|
1600 | //***************************************************************************************************************** |
---|
1601 | //***************************************************************************************************************** |
---|
1602 | //***************************************************************************************************************** |
---|
1603 | |
---|
1604 | |
---|
1605 | |
---|
1606 | Function IR2L_ModelTabCheckboxProc(ctrlName,checked) : CheckBoxControl |
---|
1607 | String ctrlName |
---|
1608 | Variable checked |
---|
1609 | |
---|
1610 | string oldDf=GetDataFolder(1) |
---|
1611 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1612 | |
---|
1613 | |
---|
1614 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
1615 | variable WhichPopSet= V_Value+1 |
---|
1616 | |
---|
1617 | if (stringMatch(ctrlName,"UseThePop")) |
---|
1618 | |
---|
1619 | endif |
---|
1620 | //RdistrSemiAuto, RdistMan, RdistAuto |
---|
1621 | NVAR RdistrSemiAuto=$("root:Packages:IR2L_NLSQF:RdistrSemiAuto_pop"+num2str(WhichPopSet)) |
---|
1622 | NVAR RdistMan=$("root:Packages:IR2L_NLSQF:RdistMan_pop"+num2str(WhichPopSet)) |
---|
1623 | NVAR RdistAuto=$("root:Packages:IR2L_NLSQF:RdistAuto_pop"+num2str(WhichPopSet)) |
---|
1624 | if (stringMatch(ctrlName,"RdistAuto")) |
---|
1625 | if(checked) |
---|
1626 | RdistAuto=1 |
---|
1627 | RdistrSemiAuto=0 |
---|
1628 | RdistMan = 0 |
---|
1629 | else |
---|
1630 | RdistAuto=0 |
---|
1631 | RdistrSemiAuto=1 |
---|
1632 | RdistMan = 0 |
---|
1633 | endif |
---|
1634 | Execute("SetVariable RdistManMin,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1635 | Execute("SetVariable RdistManMax,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1636 | Execute("SetVariable RdistNeglectTails,win=LSQF2_MainPanel, disable=(!"+num2str(RdistAuto)+")") |
---|
1637 | endif |
---|
1638 | if (stringMatch(ctrlName,"RdistrSemiAuto")) |
---|
1639 | if(checked) |
---|
1640 | RdistAuto=0 |
---|
1641 | RdistrSemiAuto=1 |
---|
1642 | RdistMan = 0 |
---|
1643 | else |
---|
1644 | RdistAuto=1 |
---|
1645 | RdistrSemiAuto=0 |
---|
1646 | RdistMan = 0 |
---|
1647 | endif |
---|
1648 | Execute("SetVariable RdistManMin,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1649 | Execute("SetVariable RdistManMax,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1650 | Execute("SetVariable RdistNeglectTails,win=LSQF2_MainPanel, disable=(!"+num2str(RdistAuto)+")") |
---|
1651 | endif |
---|
1652 | if (stringMatch(ctrlName,"RdistMan")) |
---|
1653 | if(checked) |
---|
1654 | RdistAuto=0 |
---|
1655 | RdistrSemiAuto=0 |
---|
1656 | RdistMan = 1 |
---|
1657 | else |
---|
1658 | RdistAuto=1 |
---|
1659 | RdistrSemiAuto=0 |
---|
1660 | RdistMan = 0 |
---|
1661 | endif |
---|
1662 | Execute("SetVariable RdistManMin,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1663 | Execute("SetVariable RdistManMax,win=LSQF2_MainPanel,disable=("+num2str(RdistAuto)+")") |
---|
1664 | Execute("SetVariable RdistNeglectTails,win=LSQF2_MainPanel, disable=(!"+num2str(RdistAuto)+")") |
---|
1665 | endif |
---|
1666 | |
---|
1667 | ///////////////////////////// |
---|
1668 | variable whichDataSet |
---|
1669 | //BackgStep_set |
---|
1670 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
1671 | whichDataSet= V_Value+1 |
---|
1672 | |
---|
1673 | if(stringmatch(ctrlName,"FitVolume")) |
---|
1674 | //set volume limits... |
---|
1675 | NVAR Vol=$("root:Packages:IR2L_NLSQF:Volume_pop"+num2str(whichDataSet)) |
---|
1676 | NVAR VolMin=$("root:Packages:IR2L_NLSQF:VolumeMin_pop"+num2str(whichDataSet)) |
---|
1677 | NVAR VolMax=$("root:Packages:IR2L_NLSQF:VolumeMax_pop"+num2str(whichDataSet)) |
---|
1678 | VolMin= Vol*0.2 |
---|
1679 | VolMax=Vol*5 |
---|
1680 | Execute("SetVariable Volume,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(Vol*0.05)+"}") |
---|
1681 | endif |
---|
1682 | //LN controls... |
---|
1683 | if(stringmatch(ctrlName,"LNMinSizeFit")) |
---|
1684 | //set LNMinSize limits... |
---|
1685 | NVAR LNMinSize=$("root:Packages:IR2L_NLSQF:LNMinSize_pop"+num2str(whichDataSet)) |
---|
1686 | NVAR LNMinSizeMin=$("root:Packages:IR2L_NLSQF:LNMinSizeMin_pop"+num2str(whichDataSet)) |
---|
1687 | NVAR LNMinSizeMax=$("root:Packages:IR2L_NLSQF:LNMinSizeMax_pop"+num2str(whichDataSet)) |
---|
1688 | LNMinSizeMin= LNMinSize*0.1 |
---|
1689 | LNMinSizeMax=LNMinSize*10 |
---|
1690 | Execute("SetVariable LNMinSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(LNMinSize*0.05)+"}") |
---|
1691 | endif |
---|
1692 | if(stringmatch(ctrlName,"LNMeanSizeFit")) |
---|
1693 | //set LNMeanSize limits... |
---|
1694 | NVAR LNMeanSize=$("root:Packages:IR2L_NLSQF:LNMeanSize_pop"+num2str(whichDataSet)) |
---|
1695 | NVAR LNMeanSizeMin=$("root:Packages:IR2L_NLSQF:LNMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1696 | NVAR LNMeanSizeMax=$("root:Packages:IR2L_NLSQF:LNMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1697 | LNMeanSizeMin= LNMeanSize*0.1 |
---|
1698 | LNMeanSizeMax=LNMeanSize*10 |
---|
1699 | Execute("SetVariable LNMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(LNMeanSize*0.05)+"}") |
---|
1700 | endif |
---|
1701 | if(stringmatch(ctrlName,"LNSdeviationFit")) |
---|
1702 | //set LNSdeviation limits... |
---|
1703 | NVAR LNSdeviation=$("root:Packages:IR2L_NLSQF:LNSdeviation_pop"+num2str(whichDataSet)) |
---|
1704 | NVAR LNSdeviationMin=$("root:Packages:IR2L_NLSQF:LNSdeviationMin_pop"+num2str(whichDataSet)) |
---|
1705 | NVAR LNSdeviationMax=$("root:Packages:IR2L_NLSQF:LNSdeviationMax_pop"+num2str(whichDataSet)) |
---|
1706 | LNSdeviationMin= LNSdeviation*0.1 |
---|
1707 | LNSdeviationMax=LNSdeviation*10 |
---|
1708 | Execute("SetVariable LNSdeviation,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(LNSdeviation*0.05)+"}") |
---|
1709 | endif |
---|
1710 | //GW controls |
---|
1711 | if(stringmatch(ctrlName,"GMeanSizeFit")) |
---|
1712 | //set GMeanSize limits... |
---|
1713 | NVAR GMeanSize=$("root:Packages:IR2L_NLSQF:GMeanSize_pop"+num2str(whichDataSet)) |
---|
1714 | NVAR GMeanSizeMin=$("root:Packages:IR2L_NLSQF:GMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1715 | NVAR GMeanSizeMax=$("root:Packages:IR2L_NLSQF:GMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1716 | GMeanSizeMin= GMeanSize*0.1 |
---|
1717 | GMeanSizeMax=GMeanSize*10 |
---|
1718 | Execute("SetVariable GMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(GMeanSize*0.05)+"}") |
---|
1719 | endif |
---|
1720 | if(stringmatch(ctrlName,"GWidthFit")) |
---|
1721 | //set GWidth limits... |
---|
1722 | NVAR GWidth=$("root:Packages:IR2L_NLSQF:GWidth_pop"+num2str(whichDataSet)) |
---|
1723 | NVAR GWidthMin=$("root:Packages:IR2L_NLSQF:GWidthMin_pop"+num2str(whichDataSet)) |
---|
1724 | NVAR GWidthMax=$("root:Packages:IR2L_NLSQF:GWidthMax_pop"+num2str(whichDataSet)) |
---|
1725 | GWidthMin= GWidth*0.1 |
---|
1726 | GWidthMax=GWidth*10 |
---|
1727 | Execute("SetVariable GWidth,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(GWidth*0.05)+"}") |
---|
1728 | endif |
---|
1729 | //SZ controls |
---|
1730 | if(stringmatch(ctrlName,"SZMeanSizeFit")) |
---|
1731 | //set GMeanSize limits... |
---|
1732 | NVAR SZMeanSize=$("root:Packages:IR2L_NLSQF:SZMeanSize_pop"+num2str(whichDataSet)) |
---|
1733 | NVAR SZMeanSizeMin=$("root:Packages:IR2L_NLSQF:SZMeanSizeMin_pop"+num2str(whichDataSet)) |
---|
1734 | NVAR SZMeanSizeMax=$("root:Packages:IR2L_NLSQF:SZMeanSizeMax_pop"+num2str(whichDataSet)) |
---|
1735 | SZMeanSizeMin= SZMeanSize*0.1 |
---|
1736 | SZMeanSizeMax=SZMeanSize*10 |
---|
1737 | Execute("SetVariable SZMeanSize,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(SZMeanSize*0.05)+"}") |
---|
1738 | endif |
---|
1739 | if(stringmatch(ctrlName,"SZWidthFit")) |
---|
1740 | //set GWidth limits... |
---|
1741 | NVAR SZWidth=$("root:Packages:IR2L_NLSQF:SZWidth_pop"+num2str(whichDataSet)) |
---|
1742 | NVAR SZWidthMin=$("root:Packages:IR2L_NLSQF:SZWidthMin_pop"+num2str(whichDataSet)) |
---|
1743 | NVAR SZWidthMax=$("root:Packages:IR2L_NLSQF:SZWidthMax_pop"+num2str(whichDataSet)) |
---|
1744 | SZWidthMin= SZWidth*0.1 |
---|
1745 | SZWidthMax=SZWidth*10 |
---|
1746 | Execute("SetVariable SZWidth,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(SZWidth*0.05)+"}") |
---|
1747 | endif |
---|
1748 | //LSW params |
---|
1749 | if(stringmatch(ctrlName,"LSWLocationFit")) |
---|
1750 | //set LSWLocation limits... |
---|
1751 | NVAR LSWLocation=$("root:Packages:IR2L_NLSQF:LSWLocation_pop"+num2str(whichDataSet)) |
---|
1752 | NVAR LSWLocationMin=$("root:Packages:IR2L_NLSQF:LSWLocationMin_pop"+num2str(whichDataSet)) |
---|
1753 | NVAR LSWLocationMax=$("root:Packages:IR2L_NLSQF:LSWLocationMax_pop"+num2str(whichDataSet)) |
---|
1754 | LSWLocationMin= LSWLocation*0.1 |
---|
1755 | LSWLocationMax=LSWLocation*10 |
---|
1756 | Execute("SetVariable LSWLocation,win=LSQF2_MainPanel,limits={0,Inf,"+num2str(LSWLocation*0.05)+"}") |
---|
1757 | endif |
---|
1758 | |
---|
1759 | ///////////////////////////// |
---|
1760 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
1761 | IR2L_Model_TabPanelControl("",V_Value) |
---|
1762 | DoWindow/F LSQF2_MainPanel |
---|
1763 | if(!stringMatch(ctrlName,"*Fit*")) //skip recalculations when user select what to fit... No real change was done... |
---|
1764 | IR2L_RecalculateIfSelected() |
---|
1765 | endif |
---|
1766 | setDataFolder OldDf |
---|
1767 | end |
---|
1768 | |
---|
1769 | //***************************************************************************************************************** |
---|
1770 | //***************************************************************************************************************** |
---|
1771 | //***************************************************************************************************************** |
---|
1772 | //***************************************************************************************************************** |
---|
1773 | //***************************************************************************************************************** |
---|
1774 | |
---|
1775 | Function IR2L_RecalculateErrors(WhichDataSet) |
---|
1776 | variable WhichDataSet |
---|
1777 | string oldDf=GetDataFolder(1) |
---|
1778 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1779 | |
---|
1780 | |
---|
1781 | NVAR UseUserErrors = $("UseUserErrors_set"+num2str(WhichDataSet)) |
---|
1782 | NVAR UseSQRTErrors = $("UseSQRTErrors_set"+num2str(WhichDataSet)) |
---|
1783 | NVAR UsePercentErrors = $("UsePercentErrors_set"+num2str(WhichDataSet)) |
---|
1784 | NVAR ErrorScalingFactor = $("ErrorScalingFactor_set"+num2str(WhichDataSet)) |
---|
1785 | SVAR NewFldrName=$("root:Packages:IR2L_NLSQF:FolderName_set"+num2str(whichDataSet)) |
---|
1786 | SVAR NewIntName = $("root:Packages:IR2L_NLSQF:IntensityDataName_set"+num2str(whichDataSet)) |
---|
1787 | SVAR NewQName=$("root:Packages:IR2L_NLSQF:QvecDataName_set"+num2str(whichDataSet)) |
---|
1788 | SVAR NewErrorName=$("root:Packages:IR2L_NLSQF:ErrorDataName_set"+num2str(whichDataSet)) |
---|
1789 | NVAR SlitSmeared_set=$("root:Packages:IR2L_NLSQF:SlitSmeared_set"+num2str(whichDataSet)) |
---|
1790 | |
---|
1791 | setDataFolder NewFldrName |
---|
1792 | wave/Z inputI=$(NewIntName) |
---|
1793 | wave/Z inputQ=$(NewQName) |
---|
1794 | wave/Z inputE=$(NewErrorName) |
---|
1795 | if(!WaveExists(inputE)) |
---|
1796 | UseUserErrors=0 |
---|
1797 | if(UseSQRTErrors+UsePercentErrors!=1) |
---|
1798 | UseSQRTErrors=1 |
---|
1799 | UsePercentErrors=0 |
---|
1800 | endif |
---|
1801 | endif |
---|
1802 | setDataFolder root:Packages:IR2L_NLSQF |
---|
1803 | if(UseUserErrors) //handle special cases of errors not loaded in Igor |
---|
1804 | Duplicate/O inputE, $("Error_set"+num2str(whichDataSet)) |
---|
1805 | elseif(UseSQRTErrors) |
---|
1806 | Duplicate/O inputI, $("Error_set"+num2str(whichDataSet)) |
---|
1807 | Wave ErrorWv=$("Error_set"+num2str(whichDataSet)) |
---|
1808 | Wave IntWv= $("Intensity_set"+num2str(whichDataSet)) |
---|
1809 | ErrorWv=sqrt(IntWv) |
---|
1810 | else |
---|
1811 | Duplicate/O inputI, $("Error_set"+num2str(whichDataSet)) |
---|
1812 | Wave ErrorWv=$("Error_set"+num2str(whichDataSet)) |
---|
1813 | Wave IntWv= $("Intensity_set"+num2str(whichDataSet)) |
---|
1814 | ErrorWv=0.01*(IntWv) |
---|
1815 | endif |
---|
1816 | Wave ErrorWv=$("Error_set"+num2str(whichDataSet)) |
---|
1817 | ErrorWv = ErrorWv * ErrorScalingFactor |
---|
1818 | variable i |
---|
1819 | wavestats/Q ErrorWv |
---|
1820 | ErrorWv = (numtype(ErrorWv[p])==0) ? ErrorWv[p] : V_min |
---|
1821 | |
---|
1822 | setDataFolder OldDf |
---|
1823 | |
---|
1824 | end |
---|
1825 | //***************************************************************************************************************** |
---|
1826 | //***************************************************************************************************************** |
---|
1827 | //***************************************************************************************************************** |
---|
1828 | //***************************************************************************************************************** |
---|
1829 | //***************************************************************************************************************** |
---|
1830 | |
---|
1831 | Function IR2L_Initialize() |
---|
1832 | |
---|
1833 | string OldDf=GetDataFolder(1) |
---|
1834 | setdatafolder root: |
---|
1835 | NewDataFolder/O/S root:Packages |
---|
1836 | NewDataFolder/O/S IR2L_NLSQF |
---|
1837 | |
---|
1838 | string/g ListOfVariables, ListOfDataVariables, ListOfPopulationVariables, ListOfPopulationVariablesSD, ListOfPopulationVariablesDP, ListOfPopulationVariablesUF |
---|
1839 | string/g ListOfStrings, ListOfDataStrings, ListOfPopulationsStrings |
---|
1840 | variable i, j |
---|
1841 | |
---|
1842 | ListOfPopulationsStrings="" |
---|
1843 | ListOfDataStrings="" |
---|
1844 | |
---|
1845 | //here define the lists of variables and strings needed, separate names by ;... |
---|
1846 | |
---|
1847 | //Main parameters |
---|
1848 | ListOfVariables="UseIndra2Data;UseQRSdata;UseSMRData;MultipleInputData;UseNumberDistributions;RecalculateAutomatically;DisplaySinglePopInt;" |
---|
1849 | ListOfVariables+="SameContrastForDataSets;VaryContrastForDataSets;DisplayInputDataControls;DisplayModelControls;UseGeneticOptimization;UseLSQF;" |
---|
1850 | ListOfStrings="DataFolderName;IntensityWaveName;QWavename;ErrorWaveName;ListOfKnownPeakShapes;" |
---|
1851 | ListOfStrings+="ConfEvListOfParameters;ConEvSelParameter;ConEvMethod;" |
---|
1852 | |
---|
1853 | ListOfVariables+="GraphXMin;GraphXMax;GraphYMin;GraphYMax;SizeDistDisplayNumDist;SizeDistDisplayVolDist;" |
---|
1854 | ListOfVariables+="SizeDistLogVolDist;SizeDistLogNumDist;SizeDistLogX;" |
---|
1855 | ListOfVariables+="ConfEvMinVal;ConfEvMaxVal;ConfEvNumSteps;ConfEvVaryParam;ConfEvChiSq;ConfEvAutoOverwrite;ConfEvFixRanges;" |
---|
1856 | ListOfVariables+="ConfEvTargetChiSqRange;ConfEvAutoCalcTarget;" |
---|
1857 | |
---|
1858 | //Input Data parameters... Will have _setX attached, in this method background needs to be here... |
---|
1859 | ListOfDataVariables="UseTheData;SlitSmeared;SlitLength;Qmin;Qmax;" |
---|
1860 | ListOfDataVariables+="Background;BackgroundFit;BackgroundMin;BackgroundMax;BackgErr;BackgStep;" |
---|
1861 | ListOfDataVariables+="DataScalingFactor;ErrorScalingFactor;UseUserErrors;UseSQRTErrors;UsePercentErrors;" |
---|
1862 | |
---|
1863 | |
---|
1864 | ListOfDataStrings ="FolderName;IntensityDataName;QvecDataName;ErrorDataName;UserDataSetName;" |
---|
1865 | |
---|
1866 | |
---|
1867 | //Common Size distribution Model parameters, these need to have _popX attached at the end of name |
---|
1868 | ListOfPopulationVariables="UseThePop;" |
---|
1869 | ListOfPopulationVariables+="Contrast;Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
1870 | //Form factor parameters |
---|
1871 | ListOfPopulationsStrings+="Model;FormFactor;FFUserFFformula;FFUserVolumeFormula;StructureFactor;PopSizeDistShape;SFUserSQFormula;" |
---|
1872 | |
---|
1873 | //R distribution parameters |
---|
1874 | ListOfPopulationVariablesSD="RdistAuto;RdistrSemiAuto;RdistMan;RdistManMin;RdistManMax;RdistLog;RdistNumPnts;RdistNeglectTails;" |
---|
1875 | ListOfPopulationVariablesSD+="FormFactor_Param1;FormFactor_Param1Fit;FormFactor_Param1Min;FormFactor_Param1Max;" |
---|
1876 | ListOfPopulationVariablesSD+="FormFactor_Param2;FormFactor_Param2Fit;FormFactor_Param2Min;FormFactor_Param2Max;" |
---|
1877 | ListOfPopulationVariablesSD+="FormFactor_Param3;FormFactor_Param3Fit;FormFactor_Param3Min;FormFactor_Param3Max;" |
---|
1878 | ListOfPopulationVariablesSD+="FormFactor_Param4;FormFactor_Param4Fit;FormFactor_Param4Min;FormFactor_Param4Max;" |
---|
1879 | ListOfPopulationVariablesSD+="FormFactor_Param5;FormFactor_Param5Fit;FormFactor_Param5Min;FormFactor_Param5Max;" |
---|
1880 | ListOfPopulationVariablesSD+="FormFactor_Param6;FormFactor_Param6Fit;FormFactor_Param6Min;FormFactor_Param6Max;" |
---|
1881 | ListOfPopulationVariablesSD+="FormFactor_Param7;FormFactor_Param7Fit;FormFactor_Param7Min;FormFactor_Param7Max;" |
---|
1882 | ListOfPopulationVariablesSD+="FormFactor_Param8;FormFactor_Param8Fit;FormFactor_Param8Min;FormFactor_Param8Max;" |
---|
1883 | ListOfPopulationVariablesSD+="FormFactor_Param9;FormFactor_Param9Fit;FormFactor_Param9Min;FormFactor_Param9Max;" |
---|
1884 | //Distribution parameters |
---|
1885 | ListOfPopulationVariablesSD+="Volume;VolumeFit;VolumeMin;VolumeMax;Mean;Mode;Median;FWHM;" |
---|
1886 | ListOfPopulationVariablesSD+="LNMinSize;LNMinSizeFit;LNMinSizeMin;LNMinSizeMax;LNMeanSize;LNMeanSizeFit;LNMeanSizeMin;LNMeanSizeMax;LNSdeviation;LNSdeviationFit;LNSdeviationMin;LNSdeviationMax;" |
---|
1887 | ListOfPopulationVariablesSD+="GMeanSize;GMeanSizeFit;GMeanSizeMin;GMeanSizeMax;GWidth;GWidthFit;GWidthMin;GWidthMax;LSWLocation;LSWLocationFit;LSWLocationMin;LSWLocationMax;" |
---|
1888 | ListOfPopulationVariablesSD+="SZMeanSize;SZMeanSizeFit;SZMeanSizeMin;SZMeanSizeMax;SZWidth;SZWidthFit;SZWidthMin;SZWidthMax;" |
---|
1889 | |
---|
1890 | ListOfPopulationVariablesSD+="StructureParam1;StructureParam1Fit;StructureParam1Min;StructureParam1Max;StructureParam2;StructureParam2Fit;StructureParam2Min;StructureParam2Max;" |
---|
1891 | ListOfPopulationVariablesSD+="StructureParam3;StructureParam3Fit;StructureParam3Min;StructureParam3Max;StructureParam4;StructureParam4Fit;StructureParam4Min;StructureParam4Max;" |
---|
1892 | ListOfPopulationVariablesSD+="StructureParam5;StructureParam5Fit;StructureParam5Min;StructureParam5Max;StructureParam6;StructureParam6Fit;StructureParam6Min;StructureParam6Max;" |
---|
1893 | |
---|
1894 | |
---|
1895 | //Unified level parameters |
---|
1896 | ListOfPopulationVariablesUF="UF_G;UF_GFit;UF_GMin;UF_GMax;UF_Rg;UF_RgFit;UF_RgMin;UF_RgMax;UF_B;UF_BFit;UF_BMin;UF_BMax;UF_P;UF_PFit;UF_PMin;UF_PMax;UF_K;UF_LinkRGCO;UF_LinkRGCOLevel;"//SZWidthMin;SZWidthMax;" |
---|
1897 | ListOfPopulationVariablesUF+="UF_RGCO;UF_RGCOFit;UF_RGCOMin;UF_RGCOMax;" |
---|
1898 | |
---|
1899 | //Diffraction peak parameters |
---|
1900 | ListOfPopulationsStrings+="DiffPeakProfile;" |
---|
1901 | ListOfPopulationVariablesDP="DiffPeakDPos;DiffPeakQPos;DiffPeakDFWHM;DiffPeakQFWHM;DiffPeakIntgInt;" |
---|
1902 | ListOfPopulationVariablesDP+="DiffPeakPar1;DiffPeakPar1Fit;DiffPeakPar1Min;DiffPeakPar1Max;" |
---|
1903 | ListOfPopulationVariablesDP+="DiffPeakPar2;DiffPeakPar2Fit;DiffPeakPar2Min;DiffPeakPar2Max;" |
---|
1904 | ListOfPopulationVariablesDP+="DiffPeakPar3;DiffPeakPar3Fit;DiffPeakPar3Min;DiffPeakPar3Max;" |
---|
1905 | ListOfPopulationVariablesDP+="DiffPeakPar4;DiffPeakPar4Fit;DiffPeakPar4Min;DiffPeakPar4Max;" |
---|
1906 | ListOfPopulationVariablesDP+="DiffPeakPar5;DiffPeakPar5Fit;DiffPeakPar5Min;DiffPeakPar5Max;" |
---|
1907 | |
---|
1908 | |
---|
1909 | |
---|
1910 | |
---|
1911 | |
---|
1912 | |
---|
1913 | //and here we create them |
---|
1914 | for(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
1915 | IN2G_CreateItem("variable",StringFromList(i,ListOfVariables)) |
---|
1916 | endfor |
---|
1917 | //following needs to run 10 times to create 10 sets for 10 data sets... |
---|
1918 | for(j=1;j<=10;j+=1) |
---|
1919 | for(i=0;i<itemsInList(ListOfDataVariables);i+=1) |
---|
1920 | IN2G_CreateItem("variable",StringFromList(i,ListOfDataVariables)+"_set"+num2str(j)) |
---|
1921 | endfor |
---|
1922 | endfor |
---|
1923 | //following needs to run 10 times to create 10 different populations sets of variables and strings |
---|
1924 | for(j=1;j<=10;j+=1) |
---|
1925 | for(i=0;i<itemsInList(ListOfPopulationVariables);i+=1) |
---|
1926 | IN2G_CreateItem("variable",StringFromList(i,ListOfPopulationVariables)+"_pop"+num2str(j)) |
---|
1927 | endfor |
---|
1928 | endfor |
---|
1929 | for(j=1;j<=10;j+=1) |
---|
1930 | for(i=0;i<itemsInList(ListOfPopulationVariablesSD);i+=1) |
---|
1931 | IN2G_CreateItem("variable",StringFromList(i,ListOfPopulationVariablesSD)+"_pop"+num2str(j)) |
---|
1932 | endfor |
---|
1933 | endfor |
---|
1934 | for(j=1;j<=10;j+=1) |
---|
1935 | for(i=0;i<itemsInList(ListOfPopulationVariablesDP);i+=1) |
---|
1936 | IN2G_CreateItem("variable",StringFromList(i,ListOfPopulationVariablesDP)+"_pop"+num2str(j)) |
---|
1937 | endfor |
---|
1938 | endfor |
---|
1939 | for(j=1;j<=10;j+=1) |
---|
1940 | for(i=0;i<itemsInList(ListOfPopulationVariablesUF);i+=1) |
---|
1941 | IN2G_CreateItem("variable",StringFromList(i,ListOfPopulationVariablesUF)+"_pop"+num2str(j)) |
---|
1942 | endfor |
---|
1943 | endfor |
---|
1944 | //following 10 times as these are data sets |
---|
1945 | for(j=1;j<=10;j+=1) |
---|
1946 | for(i=0;i<itemsInList(ListOfDataStrings);i+=1) |
---|
1947 | IN2G_CreateItem("string",StringFromList(i,ListOfDataStrings)+"_set"+num2str(j)) |
---|
1948 | endfor |
---|
1949 | endfor |
---|
1950 | for(j=1;j<=10;j+=1) |
---|
1951 | for(i=0;i<itemsInList(ListOfPopulationsStrings);i+=1) |
---|
1952 | IN2G_CreateItem("string",StringFromList(i,ListOfPopulationsStrings)+"_pop"+num2str(j)) |
---|
1953 | endfor |
---|
1954 | endfor |
---|
1955 | |
---|
1956 | for(i=0;i<itemsInList(ListOfStrings);i+=1) |
---|
1957 | IN2G_CreateItem("string",StringFromList(i,ListOfStrings)) |
---|
1958 | endfor |
---|
1959 | |
---|
1960 | NVAR UseGeneticOptimization |
---|
1961 | NVAR UseLSQF |
---|
1962 | UseLSQF = !UseGeneticOptimization |
---|
1963 | |
---|
1964 | String/g rgbIntensity_set1="(52224,0,0)" |
---|
1965 | String/g rgbIntensity_set2="(0,39168,0)" |
---|
1966 | String/g rgbIntensity_set3="(0,9472,39168)" |
---|
1967 | String/g rgbIntensity_set4="(39168,0,31232)" |
---|
1968 | String/g rgbIntensity_set5="(65280,16384,16384)" |
---|
1969 | String/g rgbIntensity_set6="(16384,65280,16384)" |
---|
1970 | String/g rgbIntensity_set7="(16384,28160,65280)" |
---|
1971 | String/g rgbIntensity_set8="(65280,16384,55552)" |
---|
1972 | String/g rgbIntensity_set9="(0,0,0)" |
---|
1973 | String/g rgbIntensity_set10="(34816,34816,34816)" |
---|
1974 | |
---|
1975 | String/g rgbIntensityLine_set10="(52224,0,0)" |
---|
1976 | String/g rgbIntensityLine_set9="(0,39168,0)" |
---|
1977 | String/g rgbIntensityLine_set8="(0,9472,39168)" |
---|
1978 | String/g rgbIntensityLine_set7="(39168,0,31232)" |
---|
1979 | String/g rgbIntensityLine_set6="(65280,16384,16384)" |
---|
1980 | String/g rgbIntensityLine_set5="(16384,65280,16384)" |
---|
1981 | String/g rgbIntensityLine_set4="(16384,28160,65280)" |
---|
1982 | String/g rgbIntensityLine_set3="(65280,16384,55552)" |
---|
1983 | String/g rgbIntensityLine_set2="(0,0,0)" |
---|
1984 | String/g rgbIntensityLine_set1="(34816,34816,34816)" |
---|
1985 | |
---|
1986 | for(j=1;j<=6;j+=1) |
---|
1987 | for(i=0;i<itemsInList(ListOfPopulationsStrings);i+=1) |
---|
1988 | SVAR testStr = $( "StructureFactor_pop"+num2str(j)) |
---|
1989 | if(strlen(testStr)==0) |
---|
1990 | testStr="Dilute system" |
---|
1991 | endif |
---|
1992 | endfor |
---|
1993 | endfor |
---|
1994 | |
---|
1995 | setDataFolder OldDf |
---|
1996 | |
---|
1997 | end |
---|
1998 | |
---|
1999 | |
---|
2000 | //***************************************************************************************************************** |
---|
2001 | //***************************************************************************************************************** |
---|
2002 | //***************************************************************************************************************** |
---|
2003 | //***************************************************************************************************************** |
---|
2004 | //***************************************************************************************************************** |
---|
2005 | |
---|
2006 | Function IR2L_SetInitialValues(enforce) |
---|
2007 | variable enforce |
---|
2008 | //and here set default values... |
---|
2009 | |
---|
2010 | string OldDf=getDataFolder(1) |
---|
2011 | setDataFolder root:Packages:IR2L_NLSQF |
---|
2012 | |
---|
2013 | // abort "finish me - IE2L_SetInitialValues" |
---|
2014 | string ListOfVariables |
---|
2015 | variable i, j |
---|
2016 | //here we set what needs to be 0 |
---|
2017 | //Main parameters |
---|
2018 | // ListOfVariables="UseIndra2Data;UseQRSdata;UseSMRData;MultipleInputData;" |
---|
2019 | // ListOfVariables+="SameContrastForDataSets;VaryContrastForDataSets;DisplayInputDataControls;DisplayModelControls;" |
---|
2020 | // ListOfStrings="DataFolderName;IntensityWaveName;QWavename;ErrorWaveName;" |
---|
2021 | // |
---|
2022 | // ListOfVariables+="GraphXMin;GraphXMax;GraphYMin;GraphYMax;" |
---|
2023 | // |
---|
2024 | // |
---|
2025 | // //Input Data parameters... Will have _setX attached, in this method background needs to be here... |
---|
2026 | // ListOfDataVariables="UseTheData;SlitSmeared;SlitLength;Qmin;Qmax;" |
---|
2027 | // ListOfDataVariables+="Background;BackgroundFit;BackgroundMin;BackgroundMax;BackgErr;BackgStep;" |
---|
2028 | // ListOfDataVariables+="DataScalingFactor;ErrorScalingFactor;UseUserErrors;UseSQRTErrors;UsePercentErrors;" |
---|
2029 | // ListOfDataStrings ="FolderName;IntensityDataName;QvecDataName;ErrorDataName;UserDataSetName;" |
---|
2030 | // |
---|
2031 | // |
---|
2032 | // //Model parameters, these need to have _popX attached at the end of name |
---|
2033 | // ListOfPopulationVariables="UseThePop;" |
---|
2034 | // //R distribution parameters |
---|
2035 | // ListOfPopulationVariables+="RdistAuto;RdistrSemiAuto;RdistMan;RdistManMin;RdistManMax;RdistLog;RdistNumPnts;RdistNeglectTails;" |
---|
2036 | // ListOfPopulationVariables+="Contrast;Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2037 | // //Form factor parameters |
---|
2038 | // ListOfPopulationsStrings+="FormFactor;FFUserFFformula;FFUserVolumeFormula;" |
---|
2039 | // ListOfPopulationVariables+="FormFactor_Param1;FormFactor_Param1Fit;FormFactor_Param1Min;FormFactor_Param1Max;" |
---|
2040 | // ListOfPopulationVariables+="FormFactor_Param2;FormFactor_Param2Fit;FormFactor_Param2Min;FormFactor_Param2Max;" |
---|
2041 | // ListOfPopulationVariables+="FormFactor_Param3;FormFactor_Param3Fit;FormFactor_Param3Min;FormFactor_Param3Max;" |
---|
2042 | // ListOfPopulationVariables+="FormFactor_Param4;FormFactor_Param4Fit;FormFactor_Param4Min;FormFactor_Param4Max;" |
---|
2043 | // ListOfPopulationVariables+="FormFactor_Param5;FormFactor_Param5Fit;FormFactor_Param5Min;FormFactor_Param5Max;" |
---|
2044 | // //Distribution parameters |
---|
2045 | // ListOfPopulationVariables+="Volume;VolumeFit;VolumeMin;VolumeMax;" |
---|
2046 | // ListOfPopulationVariables+="LNMinSize;LNMinSizeFit;LNMinSizeMin;LNMinSizeMax;LNMeanSize;LNMeanSizeFit;LNMeanSizeMin;LNMeanSizeMax;LNSdeviation;LNSdeviationFit;LNSdeviationMin;LNSdeviationMax;" |
---|
2047 | // ListOfPopulationVariables+="GMeanSize;GMeanSizeFit;GMeanSizeMin;GMeanSizeMax;GWidth;GWidthFit;GWidthMin;GWidthMax;LSWLocation;LSWLocationFit;LSWLocationMin;LSWLocationMax;" |
---|
2048 | // |
---|
2049 | // ListOfPopulationsStrings+="PopSizeDistShape;" |
---|
2050 | |
---|
2051 | //not done in any way, seems impossible to match meaningful numbers to various SFs. |
---|
2052 | // ListOfPopulationVariables+="StructureParam1;StructureParam1Fit;StructureParam1Min;StructureParam1Max;StructureParam2;StructureParam2Fit;StructureParam2Min;StructureParam2Max;" |
---|
2053 | // ListOfPopulationVariables+="StructureParam3;StructureParam3Fit;StructureParam3Min;StructureParam3Max;StructureParam4;StructureParam4Fit;StructureParam4Min;StructureParam4Max;" |
---|
2054 | // ListOfPopulationVariables+="StructureParam5;StructureParam5Fit;StructureParam5Min;StructureParam5Max;StructureParam6;StructureParam6Fit;StructureParam6Min;StructureParam6Max;" |
---|
2055 | |
---|
2056 | |
---|
2057 | //set initial values.... |
---|
2058 | //set starting conditions here.... |
---|
2059 | //SameContrastForDataSets;VaryContrastForDataSets;DisplayInputDataControls;DisplayModelControls |
---|
2060 | NVAR SameContrastForDataSets |
---|
2061 | NVAR VaryContrastForDataSets |
---|
2062 | if((VaryContrastForDataSets + SameContrastForDataSets)!=1) |
---|
2063 | VaryContrastForDataSets=0 |
---|
2064 | SameContrastForDataSets =1 |
---|
2065 | endif |
---|
2066 | NVAR DisplayInputDataControls |
---|
2067 | NVAR DisplayModelControls |
---|
2068 | if((DisplayInputDataControls+DisplayModelControls)!=1) |
---|
2069 | DisplayInputDataControls = 1 |
---|
2070 | DisplayModelControls = 0 |
---|
2071 | endif |
---|
2072 | SVAR ListOfKnownPeakShapes |
---|
2073 | ListOfKnownPeakShapes="Gauss;Lorenz;LorenzSquared;Pseudo-Voigt;Gumbel;Pearson_VII;Modif_Gauss;SkewedNormal;" |
---|
2074 | NVAR SizeDistDisplayNumDist |
---|
2075 | NVAR SizeDistDisplayVolDist |
---|
2076 | if(SizeDistDisplayNumDist + SizeDistDisplayVolDist <1) |
---|
2077 | SizeDistDisplayVolDist=1 |
---|
2078 | endif |
---|
2079 | |
---|
2080 | for(i=1;i<=10;i+=1) |
---|
2081 | NVAR UseUserErrors=$("UseUserErrors_set"+num2str(i)) |
---|
2082 | NVAR UseSQRTErrors=$("UseSQRTErrors_set"+num2str(i)) |
---|
2083 | NVAR UsePercentErrors=$("UsePercentErrors_set"+num2str(i)) |
---|
2084 | if(UseUserErrors+UseSQRTErrors+UsePercentErrors!=0) |
---|
2085 | UseUserErrors=1 |
---|
2086 | UseSQRTErrors=0 |
---|
2087 | UsePercentErrors=0 |
---|
2088 | endif |
---|
2089 | endfor |
---|
2090 | |
---|
2091 | for(i=1;i<=10;i+=1) |
---|
2092 | SVAR Model=$("Model_pop"+num2str(i)) |
---|
2093 | if(strlen(Model)<3) |
---|
2094 | Model="Size dist." |
---|
2095 | endif |
---|
2096 | endfor |
---|
2097 | for(i=1;i<=10;i+=1) |
---|
2098 | SVAR Model=$("DiffPeakProfile_pop"+num2str(i)) |
---|
2099 | if(strlen(Model)<3) |
---|
2100 | Model="Gauss" |
---|
2101 | endif |
---|
2102 | endfor |
---|
2103 | |
---|
2104 | for(i=1;i<=10;i+=1) |
---|
2105 | SVAR FormFactor=$("FormFactor_pop"+num2str(i)) |
---|
2106 | if(strlen(FormFactor)<3) |
---|
2107 | FormFactor="Spheroid" |
---|
2108 | endif |
---|
2109 | endfor |
---|
2110 | for(i=1;i<=10;i+=1) //RdistAuto;RdistrSemiAuto;RdistMan |
---|
2111 | NVAR RdistAuto=$("RdistAuto_pop"+num2str(i)) |
---|
2112 | NVAR RdistrSemiAuto=$("RdistrSemiAuto_pop"+num2str(i)) |
---|
2113 | NVAR RdistMan=$("RdistMan_pop"+num2str(i)) |
---|
2114 | if(RdistMan+RdistrSemiAuto+RdistAuto !=1) |
---|
2115 | RdistAuto=1 |
---|
2116 | RdistMan=0 |
---|
2117 | RdistrSemiAuto=0 |
---|
2118 | //RdistManMin;RdistManMax;RdistLog;RdistNumPnts;RdistNeglectTails |
---|
2119 | NVAR RdistManMin=$("RdistManMin_pop"+num2str(i)) |
---|
2120 | NVAR RdistManMax=$("RdistManMax_pop"+num2str(i)) |
---|
2121 | NVAR RdistLog=$("RdistLog_pop"+num2str(i)) |
---|
2122 | NVAR RdistNumPnts=$("RdistNumPnts_pop"+num2str(i)) |
---|
2123 | NVAR RdistNeglectTails=$("RdistNeglectTails_pop"+num2str(i)) |
---|
2124 | RdistNeglectTails=0.01 |
---|
2125 | RdistNumPnts=50 |
---|
2126 | RdistLog=1 |
---|
2127 | RdistManMin=10 |
---|
2128 | RdistManMax=10000 |
---|
2129 | SVAR PopSizeDistShape=$("PopSizeDistShape_pop"+num2str(i)) |
---|
2130 | PopSizeDistShape="LogNormal" |
---|
2131 | SVAR FormFactor=$("FormFactor_pop"+num2str(i)) |
---|
2132 | FormFactor="Spheroid" |
---|
2133 | NVAR Par1=$("FormFactor_Param1_pop"+num2str(i)) |
---|
2134 | NVAR Par2=$("FormFactor_Param2_pop"+num2str(i)) |
---|
2135 | NVAR Par3=$("FormFactor_Param3_pop"+num2str(i)) |
---|
2136 | NVAR Par4=$("FormFactor_Param4_pop"+num2str(i)) |
---|
2137 | NVAR Par5=$("FormFactor_Param5_pop"+num2str(i)) |
---|
2138 | NVAR Par6=$("FormFactor_Param6_pop"+num2str(i)) |
---|
2139 | NVAR Par7=$("FormFactor_Param7_pop"+num2str(i)) |
---|
2140 | NVAR Par8=$("FormFactor_Param8_pop"+num2str(i)) |
---|
2141 | NVAR Par9=$("FormFactor_Param9_pop"+num2str(i)) |
---|
2142 | Par1=1 |
---|
2143 | Par2=1 |
---|
2144 | Par3=1 |
---|
2145 | Par4=1 |
---|
2146 | Par5=1 |
---|
2147 | Par6=1 |
---|
2148 | Par7=1 |
---|
2149 | Par8=1 |
---|
2150 | Par9=1 |
---|
2151 | endif |
---|
2152 | endfor |
---|
2153 | |
---|
2154 | for(j=1;j<=10;j+=1) //"Contrast;Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2155 | ListOfVariables = "Contrast;Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2156 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2157 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2158 | if(testVar==0) |
---|
2159 | testVar=100 |
---|
2160 | endif |
---|
2161 | endfor |
---|
2162 | endfor |
---|
2163 | |
---|
2164 | for(j=1;j<=10;j+=1) //"Contrast;Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2165 | ListOfVariables = "UF_G;" |
---|
2166 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2167 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2168 | if(testVar==0) |
---|
2169 | testVar=100 |
---|
2170 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2171 | testVar=10 |
---|
2172 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2173 | testVar=1000 |
---|
2174 | endif |
---|
2175 | endfor |
---|
2176 | ListOfVariables = "UF_Rg;" |
---|
2177 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2178 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2179 | if(testVar==0) |
---|
2180 | testVar=100 |
---|
2181 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2182 | testVar=10 |
---|
2183 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2184 | testVar=1000 |
---|
2185 | endif |
---|
2186 | endfor |
---|
2187 | ListOfVariables = "UF_B;" |
---|
2188 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2189 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2190 | if(testVar==0) |
---|
2191 | testVar=1 |
---|
2192 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2193 | testVar=0.001 |
---|
2194 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2195 | testVar=1000 |
---|
2196 | endif |
---|
2197 | endfor |
---|
2198 | ListOfVariables = "UF_P;" |
---|
2199 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2200 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2201 | if(testVar==0) |
---|
2202 | testVar=4 |
---|
2203 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2204 | testVar=1 |
---|
2205 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2206 | testVar=4.2 |
---|
2207 | endif |
---|
2208 | endfor |
---|
2209 | ListOfVariables = "UF_K;" |
---|
2210 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2211 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2212 | if(testVar==0) |
---|
2213 | testVar=1 |
---|
2214 | endif |
---|
2215 | endfor |
---|
2216 | //diffraction |
---|
2217 | ListOfVariables = "DiffPeakPar1;" //prefactor |
---|
2218 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2219 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2220 | if(testVar==0) |
---|
2221 | testVar=1 |
---|
2222 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2223 | testVar=0.1 |
---|
2224 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2225 | testVar=10 |
---|
2226 | endif |
---|
2227 | endfor |
---|
2228 | ListOfVariables = "DiffPeakPar2;" //Q position |
---|
2229 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2230 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2231 | if(testVar==0) |
---|
2232 | testVar=0.07 |
---|
2233 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2234 | testVar=0.03 |
---|
2235 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2236 | testVar=0.12 |
---|
2237 | endif |
---|
2238 | endfor |
---|
2239 | ListOfVariables = "DiffPeakPar3;" //Q width |
---|
2240 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2241 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2242 | if(testVar==0) |
---|
2243 | testVar=0.01 |
---|
2244 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2245 | testVar=0.002 |
---|
2246 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2247 | testVar=0.02 |
---|
2248 | endif |
---|
2249 | endfor |
---|
2250 | ListOfVariables = "DiffPeakPar4;" //other parameter |
---|
2251 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2252 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2253 | if(testVar==0) |
---|
2254 | testVar=1 |
---|
2255 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Min_pop"+num2str(j)) |
---|
2256 | testVar=0.001 |
---|
2257 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"Max_pop"+num2str(j)) |
---|
2258 | testVar=2 |
---|
2259 | endif |
---|
2260 | endfor |
---|
2261 | |
---|
2262 | |
---|
2263 | |
---|
2264 | endfor |
---|
2265 | |
---|
2266 | for(i=1;i<=10;i+=1) |
---|
2267 | NVAR DataScalingFactor=$("DataScalingFactor_set"+num2str(i)) |
---|
2268 | NVAR ErrorScalingFactor=$("ErrorScalingFactor_set"+num2str(i)) |
---|
2269 | if(DataScalingFactor==0) |
---|
2270 | DataScalingFactor=1 |
---|
2271 | endif |
---|
2272 | if(ErrorScalingFactor==0) |
---|
2273 | ErrorScalingFactor=1 |
---|
2274 | endif |
---|
2275 | endfor |
---|
2276 | |
---|
2277 | // //Model parameters, these need to have _popX attached at the end of name |
---|
2278 | // ListOfPopulationVariables+="Volume;VolumeFit;VolumeMin;VolumeMax;" |
---|
2279 | // ListOfPopulationVariables+="LNMinSize;LNMinSizeFit;LNMinSizeMin;LNMinSizeMax;LNMeanSize;LNMeanSizeFit;LNMeanSizeMin;LNMeanSizeMax;LNSdeviation;LNSdeviationFit;LNSdeviationMin;LNSdeviationMax;" |
---|
2280 | // ListOfPopulationVariables+="GMeanSize;GMeanSizeFit;GMeanSizeMin;GMeanSizeMax;GWidth;GWidthFit;GWidthMin;GWidthMax;LSWLocation;LSWLocationFit;LSWLocationMin;LSWLocationMax;" |
---|
2281 | |
---|
2282 | for(j=1;j<=10;j+=1) //RdistAuto;RdistrSemiAuto;RdistMan |
---|
2283 | ListOfVariables = "Volume" |
---|
2284 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2285 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2286 | if(testVar==0) |
---|
2287 | testVar=0.05 |
---|
2288 | endif |
---|
2289 | endfor |
---|
2290 | ListOfVariables = "LNSdeviation" |
---|
2291 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2292 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2293 | if(testVar==0) |
---|
2294 | testVar=0.5 |
---|
2295 | endif |
---|
2296 | endfor |
---|
2297 | ListOfVariables = "GWidth;SZWidth;" |
---|
2298 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2299 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2300 | if(testVar==0) |
---|
2301 | testVar=50*j |
---|
2302 | endif |
---|
2303 | endfor |
---|
2304 | |
---|
2305 | ListOfVariables = "LNMeanSize;GMeanSize;SZMeanSize;LSWLocation;" |
---|
2306 | For(i=0;i<itemsInList(ListOfVariables);i+=1) |
---|
2307 | NVAR/Z testVar=$(StringFromList(i,ListOfVariables)+"_pop"+num2str(j)) |
---|
2308 | if(testVar==0) |
---|
2309 | testVar=j*150 |
---|
2310 | endif |
---|
2311 | endfor |
---|
2312 | |
---|
2313 | |
---|
2314 | endfor |
---|
2315 | end |
---|
2316 | |
---|
2317 | Function IR2L_DataTabCheckboxProc(ctrlName,checked) : CheckBoxControl |
---|
2318 | String ctrlName |
---|
2319 | Variable checked |
---|
2320 | |
---|
2321 | string oldDf=GetDataFolder(1) |
---|
2322 | setDataFolder root:Packages:IR2L_NLSQF |
---|
2323 | |
---|
2324 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
2325 | variable WhichDataSet= V_Value+1 |
---|
2326 | if(V_disable)//disabled, so the model tab is visible |
---|
2327 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
2328 | endif |
---|
2329 | |
---|
2330 | if (stringMatch(ctrlName,"BackgroundFit_set")) |
---|
2331 | // IR2L_Data_TabPanelControl("",V_Value) |
---|
2332 | endif |
---|
2333 | if (stringMatch(ctrlName,"UseTheData_set")) |
---|
2334 | if(checked) |
---|
2335 | IR2L_AppendDataIntoGraph(WhichDataSet) |
---|
2336 | else |
---|
2337 | IR2L_RemoveDataFromGraph(WhichDataSet) |
---|
2338 | endif |
---|
2339 | IR2L_AppendOrRemoveLocalPopInts() |
---|
2340 | IR2L_FormatInputGraph() |
---|
2341 | //IR2L_FormatLegend() //part of IR2L_AppendOrRemoveLocalPopInts |
---|
2342 | IR2L_RecalculateIfSelected() |
---|
2343 | endif |
---|
2344 | if (stringMatch(ctrlName,"MultipleInputData")) |
---|
2345 | if(checked) |
---|
2346 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(0)="1.",tabLabel(1)="2." |
---|
2347 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(2)="3.",tabLabel(3)="4." |
---|
2348 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(4)="5.",tabLabel(5)="6." |
---|
2349 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(6)="7.",tabLabel(7)="8." |
---|
2350 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(8)="9.",tabLabel(9)="10.", value=0 |
---|
2351 | CheckBox SameContrastForDataSets,win=LSQF2_MainPanel,disable=0 |
---|
2352 | Button ScriptingTool,win=LSQF2_MainPanel,disable=1 |
---|
2353 | IR2L_InputPanelButtonProc("Regraph") |
---|
2354 | IR2L_Model_TabPanelControl("",V_Value) |
---|
2355 | else |
---|
2356 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(0)="Input Data",tabLabel(1)="" |
---|
2357 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(2)="",tabLabel(3)="" |
---|
2358 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(4)="",tabLabel(5)="" |
---|
2359 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(6)="",tabLabel(7)="" |
---|
2360 | TabControl DataTabs,win=LSQF2_MainPanel,tabLabel(8)="",tabLabel(9)="", value=0 |
---|
2361 | CheckBox SameContrastForDataSets,win=LSQF2_MainPanel,disable=1 |
---|
2362 | Button ScriptingTool,win=LSQF2_MainPanel,disable=0 |
---|
2363 | IR2L_InputPanelButtonProc("Regraph") |
---|
2364 | IR2L_Model_TabPanelControl("",V_Value) |
---|
2365 | endif |
---|
2366 | IR2L_RecalculateIfSelected() |
---|
2367 | endif |
---|
2368 | |
---|
2369 | |
---|
2370 | if (stringMatch(ctrlName,"SameContrastForDataSets")) |
---|
2371 | NVAR SameContrastForDataSets |
---|
2372 | NVAR VaryContrastForDataSets |
---|
2373 | VaryContrastForDataSets = !SameContrastForDataSets |
---|
2374 | IR2L_Model_TabPanelControl("",V_Value) |
---|
2375 | IR2L_RecalculateIfSelected() |
---|
2376 | endif |
---|
2377 | |
---|
2378 | NVAR DisplayInputDataControls |
---|
2379 | NVAR DisplayModelControls |
---|
2380 | if (stringMatch(ctrlName,"DisplayInputDataControls")) |
---|
2381 | DisplayModelControls=!DisplayInputDataControls |
---|
2382 | TabControl DataTabs, win=LSQF2_MainPanel, disable=!DisplayInputDataControls |
---|
2383 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
2384 | IR2L_Model_TabPanelControl("",V_Value) |
---|
2385 | TabControl DistTabs, win=LSQF2_MainPanel, disable=!DisplayModelControls |
---|
2386 | endif |
---|
2387 | if (stringMatch(ctrlName,"DisplayModelControls")) |
---|
2388 | DisplayInputDataControls=!DisplayModelControls |
---|
2389 | TabControl DataTabs, win=LSQF2_MainPanel, disable=!DisplayInputDataControls |
---|
2390 | ControlInfo/W=LSQF2_MainPanel DistTabs |
---|
2391 | IR2L_Model_TabPanelControl("",V_Value) |
---|
2392 | TabControl DistTabs, win=LSQF2_MainPanel, disable=!DisplayModelControls |
---|
2393 | endif |
---|
2394 | |
---|
2395 | NVAR UseUserErrors_set = $("UseUserErrors_set"+num2str(WhichDataSet)) |
---|
2396 | NVAR UseSQRTErrors_set = $("UseSQRTErrors_set"+num2str(WhichDataSet)) |
---|
2397 | NVAR UsePercentErrors_set = $("UsePercentErrors_set"+num2str(WhichDataSet)) |
---|
2398 | if (stringMatch(ctrlName,"UseUserErrors_set")) |
---|
2399 | if(UseUserErrors_set) |
---|
2400 | UseSQRTErrors_set=0 |
---|
2401 | UsePercentErrors_set=0 |
---|
2402 | else |
---|
2403 | UseSQRTErrors_set=1 |
---|
2404 | UsePercentErrors_set=0 |
---|
2405 | endif |
---|
2406 | IR2L_RecalculateErrors(WhichDataSet) |
---|
2407 | endif |
---|
2408 | if (stringMatch(ctrlName,"UseSQRTErrors_set")) |
---|
2409 | if(UseSQRTErrors_set) |
---|
2410 | UseUserErrors_set=0 |
---|
2411 | UsePercentErrors_set=0 |
---|
2412 | else |
---|
2413 | UseUserErrors_set=0 |
---|
2414 | UsePercentErrors_set=1 |
---|
2415 | endif |
---|
2416 | IR2L_RecalculateErrors(WhichDataSet) |
---|
2417 | endif |
---|
2418 | if (stringMatch(ctrlName,"UsePercentErrors_set")) |
---|
2419 | if(UsePercentErrors_set) |
---|
2420 | UseUserErrors_set=0 |
---|
2421 | UseSQRTErrors_set=0 |
---|
2422 | else |
---|
2423 | UseUserErrors_set=0 |
---|
2424 | UseSQRTErrors_set=1 |
---|
2425 | endif |
---|
2426 | IR2L_RecalculateErrors(WhichDataSet) |
---|
2427 | endif |
---|
2428 | if (stringMatch(ctrlName,"RecalculateAutomatically")) |
---|
2429 | IR2L_RecalculateIfSelected() |
---|
2430 | endif |
---|
2431 | if (stringMatch(ctrlName,"UseNumberDistributions")) |
---|
2432 | NVAR SizeDistDisplayNumDist = root:Packages:IR2L_NLSQF:SizeDistDisplayNumDist |
---|
2433 | NVAR SizeDistDisplayVolDist = root:Packages:IR2L_NLSQF:SizeDistDisplayVolDist |
---|
2434 | if(Checked) |
---|
2435 | SizeDistDisplayNumDist =1 |
---|
2436 | // SizeDistDisplayVolDist = 0 |
---|
2437 | else |
---|
2438 | // SizeDistDisplayNumDist =0 |
---|
2439 | SizeDistDisplayVolDist = 1 |
---|
2440 | endif |
---|
2441 | IR2L_RecalculateIfSelected() |
---|
2442 | endif |
---|
2443 | |
---|
2444 | NVAR UseGeneticOptimization=root:Packages:IR2L_NLSQF:UseGeneticOptimization |
---|
2445 | NVAR UseLSQF=root:Packages:IR2L_NLSQF:UseLSQF |
---|
2446 | if (stringMatch(ctrlName,"UseGeneticOptimization")) |
---|
2447 | UseLSQF=!UseGeneticOptimization |
---|
2448 | endif |
---|
2449 | if (stringMatch(ctrlName,"UseLSQF")) |
---|
2450 | UseGeneticOptimization=!UseLSQF |
---|
2451 | endif |
---|
2452 | |
---|
2453 | |
---|
2454 | ControlInfo/W=LSQF2_MainPanel DataTabs |
---|
2455 | IR2L_Data_TabPanelControl("",V_Value) |
---|
2456 | DoWindow/F LSQF2_MainPanel |
---|
2457 | setDataFolder OldDf |
---|
2458 | end |
---|
2459 | |
---|
2460 | //***************************************************************************************************************** |
---|
2461 | //***************************************************************************************************************** |
---|
2462 | //***************************************************************************************************************** |
---|
2463 | //***************************************************************************************************************** |
---|
2464 | //***************************************************************************************************************** |
---|
2465 | |
---|
2466 | Function IR2L_SaveResultsInNotebook() |
---|
2467 | |
---|
2468 | IR2L_SvNbk_CreateNbk() //create notebook |
---|
2469 | |
---|
2470 | IR2L_SvNbk_SampleInf() //store data information |
---|
2471 | |
---|
2472 | IR2L_SvNbk_Graphs(1) //insert graphs |
---|
2473 | |
---|
2474 | IR2L_SvNbk_ModelInf() //store model information |
---|
2475 | |
---|
2476 | //summary? |
---|
2477 | IR2L_SvNbk_PgBreak() //page break at the end |
---|
2478 | end |
---|
2479 | //***************************************************************************************************************** |
---|
2480 | //***************************************************************************************************************** |
---|
2481 | //***************************************************************************************************************** |
---|
2482 | //***************************************************************************************************************** |
---|
2483 | //***************************************************************************************************************** |
---|
2484 | //***************************************************************************************************************** |
---|
2485 | //***************************************************************************************************************** |
---|
2486 | |
---|
2487 | Function IR2L_AddRemoveTagsToGraph(AddAlso) |
---|
2488 | variable AddAlso //set to 1 if you want to add new tags not only removce old ones |
---|
2489 | |
---|
2490 | string oldDf=GetDataFolder(1) |
---|
2491 | setDataFolder root:Packages:IR2L_NLSQF |
---|
2492 | variable k, i |
---|
2493 | string ListOfPopulationVariables |
---|
2494 | string TagName |
---|
2495 | variable LocationPnt |
---|
2496 | string TagText |
---|
2497 | NVAR MultipleInputData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
2498 | variable LastDataSet |
---|
2499 | LastDataSet = (MultipleInputData) ? 10 : 1 |
---|
2500 | //remove old tags |
---|
2501 | For(k=1;k<11;k+=1) |
---|
2502 | For(i=1;i<11;i+=1) |
---|
2503 | TagName = "ModelingIITag"+num2str(i)+"set"+num2str(k) |
---|
2504 | Tag/K/W=LSQF_MainGraph /N=$(TagName) |
---|
2505 | endfor |
---|
2506 | endfor |
---|
2507 | if(!AddAlso) |
---|
2508 | return 0 |
---|
2509 | endif |
---|
2510 | For(k=1;k<=LastDataSet;k+=1) |
---|
2511 | NVAR UseTheSet=$("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(k)) |
---|
2512 | if(UseTheSet||(LastDataSet==1)) |
---|
2513 | Wave/Z Qvec=$("root:Packages:IR2L_NLSQF:Q_set"+num2str(k)) |
---|
2514 | Wave/Z Intensity=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(k)) |
---|
2515 | |
---|
2516 | //And now the populations |
---|
2517 | For(i=1;i<11;i+=1) |
---|
2518 | NVAR UseThePop = $("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(i)) |
---|
2519 | SVAR FormFactor=$("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(i)) |
---|
2520 | SVAR Model=$("root:Packages:IR2L_NLSQF:Model_pop"+num2str(i)) |
---|
2521 | if(UseThePop) |
---|
2522 | if(stringmatch(Model,"Size dist.")) |
---|
2523 | //here append tag for Size distribution model |
---|
2524 | |
---|
2525 | SVAR PopSizeDistShape = $("root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(i)) |
---|
2526 | NVAR GMeanSize = $("root:Packages:IR2L_NLSQF:GMeanSize_pop"+num2str(i)) |
---|
2527 | NVAR GWidth = $("root:Packages:IR2L_NLSQF:GWidth_pop"+num2str(i)) |
---|
2528 | NVAR LNMinSize = $("root:Packages:IR2L_NLSQF:LNMinSize_pop"+num2str(i)) |
---|
2529 | NVAR LNMeanSize = $("root:Packages:IR2L_NLSQF:LNMeanSize_pop"+num2str(i)) |
---|
2530 | NVAR LNSdeviation = $("root:Packages:IR2L_NLSQF:LNSdeviation_pop"+num2str(i)) |
---|
2531 | NVAR LSWLocation = $("root:Packages:IR2L_NLSQF:LSWLocation_pop"+num2str(i)) |
---|
2532 | NVAR MeanVal = $("root:Packages:IR2L_NLSQF:Mean_pop"+num2str(i)) |
---|
2533 | NVAR ModeVal = $("root:Packages:IR2L_NLSQF:Mode_pop"+num2str(i)) |
---|
2534 | NVAR MedianVal = $("root:Packages:IR2L_NLSQF:Median_pop"+num2str(i)) |
---|
2535 | NVAR FWHMVal = $("root:Packages:IR2L_NLSQF:FWHM_pop"+num2str(i)) |
---|
2536 | SVAR StrFac=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(i)) |
---|
2537 | NVAR SFParam1= $("root:Packages:IR2L_NLSQF:StructureParam1_pop"+num2str(i)) |
---|
2538 | NVAR SFParam2= $("root:Packages:IR2L_NLSQF:StructureParam2_pop"+num2str(i)) |
---|
2539 | NVAR SFParam3= $("root:Packages:IR2L_NLSQF:StructureParam3_pop"+num2str(i)) |
---|
2540 | NVAR SFParam4= $("root:Packages:IR2L_NLSQF:StructureParam4_pop"+num2str(i)) |
---|
2541 | NVAR SFParam5= $("root:Packages:IR2L_NLSQF:StructureParam5_pop"+num2str(i)) |
---|
2542 | NVAR SFParam6= $("root:Packages:IR2L_NLSQF:StructureParam6_pop"+num2str(i)) |
---|
2543 | SVAR FormFac=$("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(i)) |
---|
2544 | SVAR U1FormFac=$("root:Packages:IR2L_NLSQF:FFUserFFformula_pop"+num2str(i)) |
---|
2545 | SVAR U2FormFac=$("root:Packages:IR2L_NLSQF:FFUserVolumeFormula_pop"+num2str(i)) |
---|
2546 | NVAR FFParam1= $("root:Packages:IR2L_NLSQF:FormFactor_Param1_pop"+num2str(i)) |
---|
2547 | NVAR FFParam2= $("root:Packages:IR2L_NLSQF:FormFactor_Param2_pop"+num2str(i)) |
---|
2548 | NVAR FFParam3= $("root:Packages:IR2L_NLSQF:FormFactor_Param3_pop"+num2str(i)) |
---|
2549 | NVAR FFParam4= $("root:Packages:IR2L_NLSQF:FormFactor_Param4_pop"+num2str(i)) |
---|
2550 | NVAR FFParam5= $("root:Packages:IR2L_NLSQF:FormFactor_Param5_pop"+num2str(i)) |
---|
2551 | |
---|
2552 | TagName = "ModelingIITag"+num2str(i)+"set"+num2str(k) |
---|
2553 | LocationPnt = BinarySearch(Qvec, 1.7/ModeVal ) |
---|
2554 | TagText="\\Z"+IR2C_LkUpDfltVar("TagSize")+"Size distribution "+num2str(i)+"P\r" |
---|
2555 | TagText+="Distribution : "+PopSizeDistShape+" \r" |
---|
2556 | TagText+="Mean / Mode / Median / FWHM \r" |
---|
2557 | TagText+=num2str(MeanVal)+" / "+num2str(ModeVal)+" / "+num2str(MedianVal)+" / "+num2str(FWHMVal)+" \r" |
---|
2558 | //TagText+="Median= "+num2str(MedianVal)+" \r" |
---|
2559 | //TagText+="FWHM = "+num2str(FWHMVal)+" \r" |
---|
2560 | // if(stringMatch(PopSizeDistShape, "Gauss") ) |
---|
2561 | // LocationPnt = BinarySearch(Qvec, 1.8/GMeanSize ) |
---|
2562 | // TagText+="Mean = "+num2str(GMeanSize)+" \r" |
---|
2563 | // TagText+="Width = "+num2str(GWidth)+" \r" |
---|
2564 | // elseif(stringMatch(PopSizeDistShape, "LogNormal" )) |
---|
2565 | // LocationPnt = BinarySearch(Qvec, 1.8/LNMeanSize ) |
---|
2566 | // TagText+="Mean = "+num2str(LNMeanSize)+" \r" |
---|
2567 | // TagText+="Min = "+num2str(LNMinSize)+" \r" |
---|
2568 | // TagText+="Deviation = "+num2str(LNSdeviation)+" \r" |
---|
2569 | // else //LSW |
---|
2570 | // IR2L_AppendAnyText("DistributionShape"+"\t=\tLSW",0) |
---|
2571 | // IR2L_AppendAnyText("LSWLocation"+"\t=\t"+num2str(LSWLocation),0) |
---|
2572 | // LocationPnt = BinarySearch(Qvec, 1.8/LSWLocation ) |
---|
2573 | // TagText+="Location = "+num2str(LSWLocation)+" \r" |
---|
2574 | // endif |
---|
2575 | |
---|
2576 | TagText+="Form Factor : "+FormFac+" \r" |
---|
2577 | if(stringmatch(FormFac, "*User*")) |
---|
2578 | TagText+="FFUserFFformula = "+U1FormFac+" \r" |
---|
2579 | TagText+="FFUserVolumeformula = "+U2FormFac+" \r" |
---|
2580 | endif |
---|
2581 | if(strlen(IR1T_IdentifyFFParamName(FormFac,1))>0) |
---|
2582 | TagText+=IR1T_IdentifyFFParamName(FormFac,1)+" = "+num2str(FFParam1)+" \r" |
---|
2583 | endif |
---|
2584 | if(strlen(IR1T_IdentifyFFParamName(FormFac,2))>0) |
---|
2585 | TagText+=IR1T_IdentifyFFParamName(FormFac,2)+" = "+num2str(FFParam2)+" \r" |
---|
2586 | endif |
---|
2587 | if(strlen(IR1T_IdentifyFFParamName(FormFac,3))>0) |
---|
2588 | TagText+=IR1T_IdentifyFFParamName(FormFac,3)+" = "+num2str(FFParam3)+" \r" |
---|
2589 | endif |
---|
2590 | if(strlen(IR1T_IdentifyFFParamName(FormFac,4))>0) |
---|
2591 | TagText+=IR1T_IdentifyFFParamName(FormFac,4)+" = "+num2str(FFParam4)+" \r" |
---|
2592 | endif |
---|
2593 | if(strlen(IR1T_IdentifyFFParamName(FormFac,5))>0) |
---|
2594 | TagText+=IR1T_IdentifyFFParamName(FormFac,5)+" = "+num2str(FFParam5)+" \r" |
---|
2595 | endif |
---|
2596 | if(!stringmatch(StrFac, "*Dilute system*")) |
---|
2597 | TagText+="Structure Factor : "+StrFac+" \r" |
---|
2598 | TagText+=IR1T_IdentifySFParamName(StrFac,1)+" = "+num2str(SFParam1)+" \r" |
---|
2599 | if(strlen(IR1T_IdentifySFParamName(StrFac,2))>0) |
---|
2600 | TagText+=IR1T_IdentifySFParamName(StrFac,2)+" = "+num2str(SFParam2)+" \r" |
---|
2601 | endif |
---|
2602 | if(strlen(IR1T_IdentifySFParamName(StrFac,3))>0) |
---|
2603 | TagText+=IR1T_IdentifySFParamName(StrFac,3)+" = "+num2str(SFParam3)+" \r" |
---|
2604 | endif |
---|
2605 | if(strlen(IR1T_IdentifySFParamName(StrFac,4))>0) |
---|
2606 | TagText+=IR1T_IdentifySFParamName(StrFac,4)+" = "+num2str(SFParam4)+" \r" |
---|
2607 | endif |
---|
2608 | if(strlen(IR1T_IdentifySFParamName(StrFac,5))>0) |
---|
2609 | TagText+=IR1T_IdentifySFParamName(StrFac,5)+" = "+num2str(SFParam5)+" \r" |
---|
2610 | endif |
---|
2611 | if(strlen(IR1T_IdentifySFParamName(StrFac,6))>0) |
---|
2612 | TagText+=IR1T_IdentifySFParamName(StrFac,6)+" = "+num2str(SFParam6)+" \r" |
---|
2613 | endif |
---|
2614 | else |
---|
2615 | //TagText+="Dilute system assumed \r" |
---|
2616 | endif |
---|
2617 | TagText = RemoveEnding(TagText, "\r" )+"set"+num2str(k) |
---|
2618 | Tag/C/W=LSQF_MainGraph /N=$(TagName)/F=0/L=2/TL=0 $("IntensityModel_set"+num2str(k)), LocationPnt, TagText |
---|
2619 | |
---|
2620 | elseif(stringmatch(Model,"Unified level")) //Unified level results |
---|
2621 | //here appedn tag for Unified level model |
---|
2622 | |
---|
2623 | NVAR Rg=$("root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(i)) |
---|
2624 | NVAR G=$("root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(i)) |
---|
2625 | NVAR P=$("root:Packages:IR2L_NLSQF:UF_P_pop"+num2str(i)) |
---|
2626 | NVAR B=$("root:Packages:IR2L_NLSQF:UF_B_pop"+num2str(i)) |
---|
2627 | NVAR RgCO=$("root:Packages:IR2L_NLSQF:UF_RgCO_pop"+num2str(i)) |
---|
2628 | NVAR Kval=$("root:Packages:IR2L_NLSQF:UF_K_pop"+num2str(i)) |
---|
2629 | SVAR StrFac=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(i)) |
---|
2630 | NVAR SFParam1= $("root:Packages:IR2L_NLSQF:StructureParam1_pop"+num2str(i)) |
---|
2631 | NVAR SFParam2= $("root:Packages:IR2L_NLSQF:StructureParam2_pop"+num2str(i)) |
---|
2632 | NVAR SFParam3= $("root:Packages:IR2L_NLSQF:StructureParam3_pop"+num2str(i)) |
---|
2633 | NVAR SFParam4= $("root:Packages:IR2L_NLSQF:StructureParam4_pop"+num2str(i)) |
---|
2634 | NVAR SFParam5= $("root:Packages:IR2L_NLSQF:StructureParam5_pop"+num2str(i)) |
---|
2635 | NVAR SFParam6= $("root:Packages:IR2L_NLSQF:StructureParam6_pop"+num2str(i)) |
---|
2636 | TagName = "ModelingIITag"+num2str(i)+"set"+num2str(k) |
---|
2637 | LocationPnt = BinarySearch(Qvec, 1.8/Rg ) |
---|
2638 | TagText="\\Z"+IR2C_LkUpDfltVar("TagSize")+"Unified level "+num2str(i)+"P\r" |
---|
2639 | TagText+="G = "+num2str(G)+" \r" |
---|
2640 | TagText+="Rg = "+num2str(Rg)+" [A]\r" |
---|
2641 | TagText+="B = "+num2str(B)+"\r" |
---|
2642 | TagText+="P = "+num2str(P)+" \r" |
---|
2643 | if(!stringmatch(StrFac, "*Dilute system*")) |
---|
2644 | TagText+="Structure Factor : "+StrFac+" \r" |
---|
2645 | TagText+=IR1T_IdentifySFParamName(StrFac,1)+" = "+num2str(SFParam1)+" \r" |
---|
2646 | if(strlen(IR1T_IdentifySFParamName(StrFac,2))>0) |
---|
2647 | TagText+=IR1T_IdentifySFParamName(StrFac,2)+" = "+num2str(SFParam2)+" \r" |
---|
2648 | endif |
---|
2649 | if(strlen(IR1T_IdentifySFParamName(StrFac,3))>0) |
---|
2650 | TagText+=IR1T_IdentifySFParamName(StrFac,3)+" = "+num2str(SFParam3)+" \r" |
---|
2651 | endif |
---|
2652 | if(strlen(IR1T_IdentifySFParamName(StrFac,4))>0) |
---|
2653 | TagText+=IR1T_IdentifySFParamName(StrFac,4)+" = "+num2str(SFParam4)+" \r" |
---|
2654 | endif |
---|
2655 | if(strlen(IR1T_IdentifySFParamName(StrFac,5))>0) |
---|
2656 | TagText+=IR1T_IdentifySFParamName(StrFac,5)+" = "+num2str(SFParam5)+" \r" |
---|
2657 | endif |
---|
2658 | if(strlen(IR1T_IdentifySFParamName(StrFac,6))>0) |
---|
2659 | TagText+=IR1T_IdentifySFParamName(StrFac,6)+" = "+num2str(SFParam6)+" \r" |
---|
2660 | endif |
---|
2661 | else |
---|
2662 | //TagText+="Dilute system assumed \r" |
---|
2663 | endif |
---|
2664 | TagText = RemoveEnding(TagText, "\r" ) |
---|
2665 | Tag/C/W=LSQF_MainGraph /N=$(TagName)/F=0/L=2/TL=0 $("IntensityModel_set"+num2str(k)), LocationPnt, TagText |
---|
2666 | elseif(stringmatch(Model,"Diffraction Peak")) |
---|
2667 | //here append tag for Diffraction peak |
---|
2668 | SVAR PeakProfile = $("root:Packages:IR2L_NLSQF:DiffPeakProfile_pop"+num2str(i)) |
---|
2669 | NVAR DiffPeakDPos=$("root:Packages:IR2L_NLSQF:DiffPeakDPos_pop"+num2str(i)) |
---|
2670 | NVAR DiffPeakQPos=$("root:Packages:IR2L_NLSQF:DiffPeakQPos_pop"+num2str(i)) |
---|
2671 | NVAR DiffPeakQFWHM=$("root:Packages:IR2L_NLSQF:DiffPeakQFWHM_pop"+num2str(i)) |
---|
2672 | NVAR DiffPeakIntgInt=$("root:Packages:IR2L_NLSQF:DiffPeakIntgInt_pop"+num2str(i)) |
---|
2673 | NVAR DiffPeakPar1=$("root:Packages:IR2L_NLSQF:DiffPeakPar1_pop"+num2str(i)) |
---|
2674 | NVAR DiffPeakPar2=$("root:Packages:IR2L_NLSQF:DiffPeakPar2_pop"+num2str(i)) |
---|
2675 | NVAR DiffPeakPar3=$("root:Packages:IR2L_NLSQF:DiffPeakPar3_pop"+num2str(i)) |
---|
2676 | NVAR DiffPeakPar4=$("root:Packages:IR2L_NLSQF:DiffPeakPar4_pop"+num2str(i)) |
---|
2677 | NVAR DiffPeakPar5=$("root:Packages:IR2L_NLSQF:DiffPeakPar5_pop"+num2str(i)) |
---|
2678 | TagName = "ModelingIITag"+num2str(i)+"set"+num2str(k) |
---|
2679 | LocationPnt = BinarySearch(Qvec, DiffPeakPar2 ) |
---|
2680 | TagText="\\Z"+IR2C_LkUpDfltVar("TagSize")+"Diffraction Peak "+num2str(i)+"P\r" |
---|
2681 | TagText+="Shape : "+PeakProfile+"\r" |
---|
2682 | TagText+="Position (d) = "+num2str(DiffPeakDPos)+" [A]\r" |
---|
2683 | TagText+="Position (Q) = "+num2str(DiffPeakQPos)+" [A^-1]\r" |
---|
2684 | TagText+="Integral intensity = "+num2str(DiffPeakIntgInt)+"\r" |
---|
2685 | TagText+="FWHM (Q) = "+num2str(DiffPeakQFWHM)+" [A^-1]" |
---|
2686 | TagText = RemoveEnding(TagText, "\r" ) |
---|
2687 | Tag/C/W=LSQF_MainGraph /N=$(TagName)/F=0/L=2/TL=0 $("IntensityModel_set"+num2str(k)), LocationPnt, TagText |
---|
2688 | |
---|
2689 | endif |
---|
2690 | endif |
---|
2691 | endfor |
---|
2692 | endif |
---|
2693 | endfor |
---|
2694 | end |
---|
2695 | //***************************************************************************************************************** |
---|
2696 | //***************************************************************************************************************** |
---|
2697 | //***************************************************************************************************************** |
---|
2698 | //***************************************************************************************************************** |
---|
2699 | //***************************************************************************************************************** |
---|
2700 | //***************************************************************************************************************** |
---|
2701 | //***************************************************************************************************************** |
---|
2702 | |
---|
2703 | |
---|
2704 | Function IR2L_SvNbk_ModelInf() |
---|
2705 | //this function saves information about the samples |
---|
2706 | //and header |
---|
2707 | |
---|
2708 | SVAR/Z nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
2709 | if(!SVAR_Exists(nbl)) |
---|
2710 | abort |
---|
2711 | endif |
---|
2712 | string oldDf=GetDataFolder(1) |
---|
2713 | setDataFolder root:Packages:IR2L_NLSQF |
---|
2714 | variable k, i |
---|
2715 | string ListOfPopulationVariables |
---|
2716 | k=0 |
---|
2717 | For(i=1;i<11;i+=1) |
---|
2718 | NVAR UseThePop = $("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(i)) |
---|
2719 | k+=UseThePop |
---|
2720 | endfor |
---|
2721 | |
---|
2722 | // //write header here... separator and some heading to divide the record.... |
---|
2723 | IR2L_AppendAnyText(" ",2) //separate |
---|
2724 | IR2L_AppendAnyText("Model data for "+num2str(k)+" population(s) used to obtain above results"+"\r",1) |
---|
2725 | //IR2L_AppendAnyText(" ",0) |
---|
2726 | |
---|
2727 | //And now the populations |
---|
2728 | For(i=1;i<11;i+=1) |
---|
2729 | NVAR UseThePop = $("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(i)) |
---|
2730 | SVAR FormFactor=$("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(i)) |
---|
2731 | SVAR Model=$("root:Packages:IR2L_NLSQF:Model_pop"+num2str(i)) |
---|
2732 | if(UseThePop) |
---|
2733 | if(stringmatch(Model,"Size dist.")) |
---|
2734 | IR2L_AppendAnyText("Summary results for population "+num2str(i),1) |
---|
2735 | IR2L_AppendAnyText(" ",0) |
---|
2736 | IR2L_AppendAnyText(" This population was Size Distribution ",0) |
---|
2737 | ListOfPopulationVariables="Volume;Mean;Mode;Median;FWHM;" |
---|
2738 | for(k=0;k<itemsInList(ListOfPopulationVariables);k+=1) |
---|
2739 | NVAR testVar = $(StringFromList(k,ListOfPopulationVariables)+"_pop"+num2str(i)) |
---|
2740 | IR2L_AppendAnyText(StringFromList(k,ListOfPopulationVariables)+"\t=\t"+num2str(testVar),0) |
---|
2741 | endfor |
---|
2742 | |
---|
2743 | IR2L_AppendAnyText(" ",0) |
---|
2744 | //IR2L_AppendAnyText("Distribution type for "+num2str(i)+" population",1) |
---|
2745 | SVAR PopSizeDistShape = $("root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(i)) |
---|
2746 | if(stringMatch(PopSizeDistShape, "Gauss") ) |
---|
2747 | IR2L_AppendAnyText("Distribution Type"+"\t=\t Gauss",0) |
---|
2748 | NVAR GMeanSize = $("root:Packages:IR2L_NLSQF:GMeanSize_pop"+num2str(i)) |
---|
2749 | IR2L_AppendAnyText("GaussMean"+"\t=\t"+num2str(GMeanSize),0) |
---|
2750 | NVAR GWidth = $("root:Packages:IR2L_NLSQF:GWidth_pop"+num2str(i)) |
---|
2751 | IR2L_AppendAnyText("GaussWidth"+"\t=\t"+num2str(GWidth),0) |
---|
2752 | elseif(stringMatch(PopSizeDistShape, "LogNormal" )) |
---|
2753 | IR2L_AppendAnyText("DistributionShape"+"\t=\tLogNormal",0) |
---|
2754 | NVAR LNMinSize = $("root:Packages:IR2L_NLSQF:LNMinSize_pop"+num2str(i)) |
---|
2755 | IR2L_AppendAnyText("LogNormalMin"+"\t=\t"+num2str(LNMinSize),0) |
---|
2756 | NVAR LNMeanSize = $("root:Packages:IR2L_NLSQF:LNMeanSize_pop"+num2str(i)) |
---|
2757 | IR2L_AppendAnyText("LogNormalMean"+"\t=\t"+num2str(LNMeanSize),0) |
---|
2758 | NVAR LNSdeviation = $("root:Packages:IR2L_NLSQF:LNSdeviation_pop"+num2str(i)) |
---|
2759 | IR2L_AppendAnyText("LogNormalSdeviation"+"\t=\t"+num2str(LNSdeviation),0) |
---|
2760 | else //LSW |
---|
2761 | IR2L_AppendAnyText("DistributionShape"+"\t=\tLSW",0) |
---|
2762 | NVAR LSWLocation = $("root:Packages:IR2L_NLSQF:LSWLocation_pop"+num2str(i)) |
---|
2763 | IR2L_AppendAnyText("LSWLocation"+"\t=\t"+num2str(LSWLocation),0) |
---|
2764 | endif |
---|
2765 | |
---|
2766 | NVAR VaryContrast=root:Packages:IR2L_NLSQF:SameContrastForDataSets |
---|
2767 | NVAR UseMultipleData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
2768 | IR2L_AppendAnyText(" ",0) |
---|
2769 | if(VaryContrast && UseMultipleData ) |
---|
2770 | IR2L_AppendAnyText("Contrasts for different data sets : ",1) |
---|
2771 | ListOfPopulationVariables="Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2772 | for(k=0;k<itemsInList(ListOfPopulationVariables);k+=1) |
---|
2773 | NVAR testVar = $(StringFromList(k,ListOfPopulationVariables)+"_pop"+num2str(i)) |
---|
2774 | IR2L_AppendAnyText(StringFromList(k,ListOfPopulationVariables)+"="+num2str(testVar),0) |
---|
2775 | endfor |
---|
2776 | IR2L_AppendAnyText(" ",0) |
---|
2777 | else //same contrast for all sets... |
---|
2778 | NVAR Contrast = $("root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(i)) |
---|
2779 | IR2L_AppendAnyText("Contrast "+"\t=\t"+num2str(Contrast),0) |
---|
2780 | endif |
---|
2781 | // // Form factor parameters.... messy... |
---|
2782 | SVAR FormFac=$("root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(i)) |
---|
2783 | IR2L_AppendAnyText(" ",0) |
---|
2784 | //IR2L_AppendAnyText("Form factor description and parameters ",1) |
---|
2785 | IR2L_AppendAnyText("FormFactor"+"\t=\t"+FormFac,0) |
---|
2786 | if(stringmatch(FormFac, "*User*")) |
---|
2787 | SVAR U1FormFac=$("root:Packages:IR2L_NLSQF:FFUserFFformula_pop"+num2str(i)) |
---|
2788 | IR2L_AppendAnyText("FFUserFFformula_pop"+num2str(i)+"\t=\t"+U1FormFac,0) |
---|
2789 | SVAR U2FormFac=$("root:Packages:IR2L_NLSQF:FFUserVolumeFormula_pop"+num2str(i)) |
---|
2790 | IR2L_AppendAnyText("FFUserVolumeFormula_pop"+num2str(i)+"\t=\t"+U2FormFac,0) |
---|
2791 | endif |
---|
2792 | NVAR FFParam1= $("root:Packages:IR2L_NLSQF:FormFactor_Param1_pop"+num2str(i)) |
---|
2793 | if(strlen(IR1T_IdentifyFFParamName(FormFac,1))>0) |
---|
2794 | IR2L_AppendAnyText(IR1T_IdentifyFFParamName(FormFac,1)+" ("+"FormFactor_Param1)"+"\t=\t"+num2str(FFParam1),0) |
---|
2795 | endif |
---|
2796 | NVAR FFParam2= $("root:Packages:IR2L_NLSQF:FormFactor_Param2_pop"+num2str(i)) |
---|
2797 | if(strlen(IR1T_IdentifyFFParamName(FormFac,2))>0) |
---|
2798 | IR2L_AppendAnyText(IR1T_IdentifyFFParamName(FormFac,2)+" ("+"FormFactor_Param2)"+"\t=\t"+num2str(FFParam2),0) |
---|
2799 | endif |
---|
2800 | NVAR FFParam3= $("root:Packages:IR2L_NLSQF:FormFactor_Param3_pop"+num2str(i)) |
---|
2801 | if(strlen(IR1T_IdentifyFFParamName(FormFac,3))>0) |
---|
2802 | IR2L_AppendAnyText(IR1T_IdentifyFFParamName(FormFac,3)+" ("+"FormFactor_Param3)"+"\t=\t"+num2str(FFParam3),0) |
---|
2803 | endif |
---|
2804 | NVAR FFParam4= $("root:Packages:IR2L_NLSQF:FormFactor_Param4_pop"+num2str(i)) |
---|
2805 | if(strlen(IR1T_IdentifyFFParamName(FormFac,4))>0) |
---|
2806 | IR2L_AppendAnyText(IR1T_IdentifyFFParamName(FormFac,4)+" ("+"FormFactor_Param4)"+"\t=\t"+num2str(FFParam4),0) |
---|
2807 | endif |
---|
2808 | NVAR FFParam5= $("root:Packages:IR2L_NLSQF:FormFactor_Param5_pop"+num2str(i)) |
---|
2809 | if(strlen(IR1T_IdentifyFFParamName(FormFac,5))>0) |
---|
2810 | IR2L_AppendAnyText(IR1T_IdentifyFFParamName(FormFac,5)+" ("+"FormFactor_Param5)"+"="+num2str(FFParam5),0) |
---|
2811 | endif |
---|
2812 | |
---|
2813 | SVAR StrFac=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(i)) |
---|
2814 | IR2L_AppendAnyText(" ",0) |
---|
2815 | //IR2L_AppendAnyText("Structure factor description and parameters ",0) |
---|
2816 | IR2L_AppendAnyText("StructureFactor"+"\t=\t"+StrFac,0) |
---|
2817 | if(!stringmatch(StrFac, "*Dilute system*")) |
---|
2818 | NVAR SFParam1= $("root:Packages:IR2L_NLSQF:StructureParam1_pop"+num2str(i)) |
---|
2819 | if(strlen(IR1T_IdentifySFParamName(StrFac,1))>0) |
---|
2820 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,1)+"\t"+"StructureParam1"+"\t=\t"+num2str(SFParam1),0) |
---|
2821 | endif |
---|
2822 | NVAR SFParam2= $("root:Packages:IR2L_NLSQF:StructureParam2_pop"+num2str(i)) |
---|
2823 | if(strlen(IR1T_IdentifySFParamName(StrFac,2))>0) |
---|
2824 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,2)+"\t"+"StructureParam2"+"\t=\t"+num2str(SFParam2),0) |
---|
2825 | endif |
---|
2826 | NVAR SFParam3= $("root:Packages:IR2L_NLSQF:StructureParam3_pop"+num2str(i)) |
---|
2827 | if(strlen(IR1T_IdentifySFParamName(StrFac,3))>0) |
---|
2828 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,3)+"\t"+"StructureParam3"+"\t=\t"+num2str(SFParam3),0) |
---|
2829 | endif |
---|
2830 | NVAR SFParam4= $("root:Packages:IR2L_NLSQF:StructureParam4_pop"+num2str(i)) |
---|
2831 | if(strlen(IR1T_IdentifySFParamName(StrFac,4))>0) |
---|
2832 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,4)+"\t"+"StructureParam4"+"\t=\t"+num2str(SFParam4),0) |
---|
2833 | endif |
---|
2834 | NVAR SFParam5= $("root:Packages:IR2L_NLSQF:StructureParam5_pop"+num2str(i)) |
---|
2835 | if(strlen(IR1T_IdentifySFParamName(StrFac,5))>0) |
---|
2836 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,5)+"\t"+"StructureParam5"+"\t=\t"+num2str(SFParam5),0) |
---|
2837 | endif |
---|
2838 | NVAR SFParam6= $("root:Packages:IR2L_NLSQF:StructureParam6_pop"+num2str(i)) |
---|
2839 | if(strlen(IR1T_IdentifySFParamName(StrFac,6))>0) |
---|
2840 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,6)+"\t"+"StructureParam6"+"\t=\t"+num2str(SFParam6),0) |
---|
2841 | endif |
---|
2842 | endif |
---|
2843 | |
---|
2844 | elseif(stringmatch(Model,"Unified level")) //Unified level results |
---|
2845 | |
---|
2846 | IR2L_AppendAnyText("Summary results for population "+num2str(i),1) |
---|
2847 | IR2L_AppendAnyText(" ",0) |
---|
2848 | IR2L_AppendAnyText(" This population was Unified level ",0) |
---|
2849 | IR2L_AppendAnyText(" ",0) |
---|
2850 | NVAR VaryContrast=root:Packages:IR2L_NLSQF:SameContrastForDataSets |
---|
2851 | NVAR UseMultipleData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
2852 | if(VaryContrast && UseMultipleData ) |
---|
2853 | IR2L_AppendAnyText("Contrasts for different data sets : ",1) |
---|
2854 | ListOfPopulationVariables="Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2855 | for(k=0;k<itemsInList(ListOfPopulationVariables);k+=1) |
---|
2856 | NVAR testVar = $(StringFromList(k,ListOfPopulationVariables)+"_pop"+num2str(i)) |
---|
2857 | IR2L_AppendAnyText(StringFromList(k,ListOfPopulationVariables)+"="+num2str(testVar),0) |
---|
2858 | endfor |
---|
2859 | IR2L_AppendAnyText(" ",0) |
---|
2860 | else //same contrast for all sets... |
---|
2861 | NVAR Contrast = $("root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(i)) |
---|
2862 | IR2L_AppendAnyText("Contrast "+"\t=\t"+num2str(Contrast),0) |
---|
2863 | endif |
---|
2864 | NVAR Rg=$("root:Packages:IR2L_NLSQF:UF_Rg_pop"+num2str(i)) |
---|
2865 | NVAR G=$("root:Packages:IR2L_NLSQF:UF_G_pop"+num2str(i)) |
---|
2866 | NVAR P=$("root:Packages:IR2L_NLSQF:UF_P_pop"+num2str(i)) |
---|
2867 | NVAR B=$("root:Packages:IR2L_NLSQF:UF_B_pop"+num2str(i)) |
---|
2868 | NVAR RgCO=$("root:Packages:IR2L_NLSQF:UF_RgCO_pop"+num2str(i)) |
---|
2869 | NVAR Kval=$("root:Packages:IR2L_NLSQF:UF_K_pop"+num2str(i)) |
---|
2870 | IR2L_AppendAnyText("Unified level Rg "+"\t=\t"+num2str(Rg),0) |
---|
2871 | IR2L_AppendAnyText("Unified level G "+"\t=\t"+num2str(G),0) |
---|
2872 | IR2L_AppendAnyText("Unified level B "+"\t=\t"+num2str(B),0) |
---|
2873 | IR2L_AppendAnyText("Unified level P "+"\t=\t"+num2str(P),0) |
---|
2874 | IR2L_AppendAnyText("Unified level RGCo "+"\t=\t"+num2str(RGCO),0) |
---|
2875 | IR2L_AppendAnyText("Unified level K "+"\t=\t"+num2str(Kval),0) |
---|
2876 | |
---|
2877 | SVAR StrFac=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(i)) |
---|
2878 | IR2L_AppendAnyText(" ",0) |
---|
2879 | IR2L_AppendAnyText("Structure factor description and parameters ",0) |
---|
2880 | IR2L_AppendAnyText("StructureFactor"+"\t=\t"+StrFac,0) |
---|
2881 | if(!stringmatch(StrFac, "*Dilute system*")) |
---|
2882 | NVAR SFParam1= $("root:Packages:IR2L_NLSQF:StructureParam1_pop"+num2str(i)) |
---|
2883 | if(strlen(IR1T_IdentifySFParamName(StrFac,1))>0) |
---|
2884 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,1)+"\t"+"StructureParam1"+"\t=\t"+num2str(SFParam1),0) |
---|
2885 | endif |
---|
2886 | NVAR SFParam2= $("root:Packages:IR2L_NLSQF:StructureParam2_pop"+num2str(i)) |
---|
2887 | if(strlen(IR1T_IdentifySFParamName(StrFac,2))>0) |
---|
2888 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,2)+"\t"+"StructureParam2"+"\t=\t"+num2str(SFParam2),0) |
---|
2889 | endif |
---|
2890 | NVAR SFParam3= $("root:Packages:IR2L_NLSQF:StructureParam3_pop"+num2str(i)) |
---|
2891 | if(strlen(IR1T_IdentifySFParamName(StrFac,3))>0) |
---|
2892 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,3)+"\t"+"StructureParam3"+"\t=\t"+num2str(SFParam3),0) |
---|
2893 | endif |
---|
2894 | NVAR SFParam4= $("root:Packages:IR2L_NLSQF:StructureParam4_pop"+num2str(i)) |
---|
2895 | if(strlen(IR1T_IdentifySFParamName(StrFac,4))>0) |
---|
2896 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,4)+"\t"+"StructureParam4"+"\t=\t"+num2str(SFParam4),0) |
---|
2897 | endif |
---|
2898 | NVAR SFParam5= $("root:Packages:IR2L_NLSQF:StructureParam5_pop"+num2str(i)) |
---|
2899 | if(strlen(IR1T_IdentifySFParamName(StrFac,5))>0) |
---|
2900 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,5)+"\t"+"StructureParam5"+"\t=\t"+num2str(SFParam5),0) |
---|
2901 | endif |
---|
2902 | NVAR SFParam6= $("root:Packages:IR2L_NLSQF:StructureParam6_pop"+num2str(i)) |
---|
2903 | if(strlen(IR1T_IdentifySFParamName(StrFac,6))>0) |
---|
2904 | IR2L_AppendAnyText(IR1T_IdentifySFParamName(StrFac,6)+"\t"+"StructureParam6"+"\t=\t"+num2str(SFParam6),0) |
---|
2905 | endif |
---|
2906 | endif |
---|
2907 | |
---|
2908 | elseif(stringmatch(Model,"Diffraction Peak")) |
---|
2909 | IR2L_AppendAnyText("Summary results for population "+num2str(i),1) |
---|
2910 | IR2L_AppendAnyText(" ",0) |
---|
2911 | IR2L_AppendAnyText(" This population was Diffraction Peak ",0) |
---|
2912 | IR2L_AppendAnyText(" ",0) |
---|
2913 | NVAR VaryContrast=root:Packages:IR2L_NLSQF:SameContrastForDataSets |
---|
2914 | NVAR UseMultipleData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
2915 | if(VaryContrast && UseMultipleData ) |
---|
2916 | IR2L_AppendAnyText("Contrasts for different data sets : ",1) |
---|
2917 | ListOfPopulationVariables="Contrast_set1;Contrast_set2;Contrast_set3;Contrast_set4;Contrast_set5;Contrast_set6;Contrast_set7;Contrast_set8;Contrast_set9;Contrast_set10;" |
---|
2918 | for(k=0;k<itemsInList(ListOfPopulationVariables);k+=1) |
---|
2919 | NVAR testVar = $(StringFromList(k,ListOfPopulationVariables)+"_pop"+num2str(i)) |
---|
2920 | IR2L_AppendAnyText(StringFromList(k,ListOfPopulationVariables)+"="+num2str(testVar),0) |
---|
2921 | endfor |
---|
2922 | IR2L_AppendAnyText(" ",0) |
---|
2923 | else //same contrast for all sets... |
---|
2924 | NVAR Contrast = $("root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(i)) |
---|
2925 | IR2L_AppendAnyText("Contrast "+"\t=\t"+num2str(Contrast),0) |
---|
2926 | endif |
---|
2927 | SVAR PeakProfile = $("root:Packages:IR2L_NLSQF:DiffPeakProfile_pop"+num2str(i)) |
---|
2928 | NVAR DiffPeakDPos=$("root:Packages:IR2L_NLSQF:DiffPeakDPos_pop"+num2str(i)) |
---|
2929 | NVAR DiffPeakQPos=$("root:Packages:IR2L_NLSQF:DiffPeakQPos_pop"+num2str(i)) |
---|
2930 | NVAR DiffPeakQFWHM=$("root:Packages:IR2L_NLSQF:DiffPeakQFWHM_pop"+num2str(i)) |
---|
2931 | NVAR DiffPeakIntgInt=$("root:Packages:IR2L_NLSQF:DiffPeakIntgInt_pop"+num2str(i)) |
---|
2932 | NVAR DiffPeakPar1=$("root:Packages:IR2L_NLSQF:DiffPeakPar1_pop"+num2str(i)) |
---|
2933 | NVAR DiffPeakPar2=$("root:Packages:IR2L_NLSQF:DiffPeakPar2_pop"+num2str(i)) |
---|
2934 | NVAR DiffPeakPar3=$("root:Packages:IR2L_NLSQF:DiffPeakPar3_pop"+num2str(i)) |
---|
2935 | NVAR DiffPeakPar4=$("root:Packages:IR2L_NLSQF:DiffPeakPar4_pop"+num2str(i)) |
---|
2936 | NVAR DiffPeakPar5=$("root:Packages:IR2L_NLSQF:DiffPeakPar5_pop"+num2str(i)) |
---|
2937 | |
---|
2938 | IR2L_AppendAnyText("Peak profile shape "+"\t=\t"+PeakProfile,0) |
---|
2939 | IR2L_AppendAnyText("Peak D position [A] "+"\t=\t"+num2str(DiffPeakDPos),0) |
---|
2940 | IR2L_AppendAnyText("Peak Q position [A^-1] "+"\t=\t"+num2str(DiffPeakQPos),0) |
---|
2941 | IR2L_AppendAnyText("Peak FWHM (Q) "+"\t=\t"+num2str(DiffPeakQFWHM),0) |
---|
2942 | IR2L_AppendAnyText("Peak Integral Intensity "+"\t=\t"+num2str(DiffPeakIntgInt),0) |
---|
2943 | IR2L_AppendAnyText("Prefactor "+"\t=\t"+num2str(DiffPeakPar1),0) |
---|
2944 | IR2L_AppendAnyText("Position "+"\t=\t"+num2str(DiffPeakPar2),0) |
---|
2945 | IR2L_AppendAnyText("Width "+"\t=\t"+num2str(DiffPeakPar3),0) |
---|
2946 | string Par4name="" |
---|
2947 | if(stringmatch(PeakProfile,"Pseudo-Voigt")) |
---|
2948 | Par4name="Eta" |
---|
2949 | elseif(stringmatch(PeakProfile,"Pearson_VII") || stringmatch(PeakProfile,"Modifif_Gauss")||stringmatch(PeakProfile,"SkewedNormal")) |
---|
2950 | Par4name="Tail Param" |
---|
2951 | endif |
---|
2952 | if(strlen(Par4name)<0) |
---|
2953 | IR2L_AppendAnyText("Eta "+"\t=\t"+num2str(DiffPeakPar4),0) |
---|
2954 | endif |
---|
2955 | |
---|
2956 | endif |
---|
2957 | IR2L_AppendAnyText(" ",0) |
---|
2958 | IR2L_AppendAnyText(" ",0) |
---|
2959 | endif |
---|
2960 | endfor |
---|
2961 | |
---|
2962 | end |
---|
2963 | //***************************************************************************************************************** |
---|
2964 | //***************************************************************************************************************** |
---|
2965 | //***************************************************************************************************************** |
---|
2966 | //***************************************************************************************************************** |
---|
2967 | //***************************************************************************************************************** |
---|
2968 | //***************************************************************************************************************** |
---|
2969 | //***************************************************************************************************************** |
---|
2970 | //***************************************************************************************************************** |
---|
2971 | |
---|
2972 | Function IR2L_SvNbk_Graphs(color) |
---|
2973 | variable color |
---|
2974 | Silent 1 |
---|
2975 | SVAR nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
2976 | DoWIndow LSQF_MainGraph |
---|
2977 | if(V_Flag) |
---|
2978 | Notebook $nbl text="\r" |
---|
2979 | Notebook $nbl selection={endOfFile, endOfFile} |
---|
2980 | Notebook $nbl scaling={80,80}, frame=1, picture={LSQF_MainGraph,1,color} |
---|
2981 | Notebook $nbl text="\r" |
---|
2982 | Notebook $nbl text=IN2G_WindowTitle("LSQF_MainGraph") |
---|
2983 | Notebook $nbl text="\r" |
---|
2984 | endif |
---|
2985 | |
---|
2986 | DoWIndow LSQF_ResidualsGraph |
---|
2987 | if(V_Flag) |
---|
2988 | Notebook $nbl text="\r" |
---|
2989 | Notebook $nbl selection={endOfFile, endOfFile} |
---|
2990 | Notebook $nbl scaling={80,80}, frame=1, picture={LSQF_ResidualsGraph,1,color} |
---|
2991 | Notebook $nbl text="\r" |
---|
2992 | Notebook $nbl text=IN2G_WindowTitle("LSQF_ResidualsGraph") |
---|
2993 | Notebook $nbl text="\r" |
---|
2994 | endif |
---|
2995 | DoWIndow GraphSizeDistributions |
---|
2996 | if(V_Flag) |
---|
2997 | Notebook $nbl text="\r" |
---|
2998 | Notebook $nbl selection={endOfFile, endOfFile} |
---|
2999 | Notebook $nbl scaling={80,80}, frame=1, picture={GraphSizeDistributions,1,color} |
---|
3000 | Notebook $nbl text="\r" |
---|
3001 | Notebook $nbl text=IN2G_WindowTitle("GraphSizeDistributions") |
---|
3002 | Notebook $nbl text="\r" |
---|
3003 | endif |
---|
3004 | End |
---|
3005 | |
---|
3006 | end |
---|
3007 | //***************************************************************************************************************** |
---|
3008 | //***************************************************************************************************************** |
---|
3009 | //***************************************************************************************************************** |
---|
3010 | //***************************************************************************************************************** |
---|
3011 | //***************************************************************************************************************** |
---|
3012 | //***************************************************************************************************************** |
---|
3013 | //***************************************************************************************************************** |
---|
3014 | |
---|
3015 | Function IR2L_SvNbk_PgBreak() |
---|
3016 | |
---|
3017 | Silent 1 |
---|
3018 | SVAR nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
3019 | Notebook $nbl selection={endOfFile, endOfFile} |
---|
3020 | Notebook $nbl SpecialChar={1,0,""} |
---|
3021 | end |
---|
3022 | //***************************************************************************************************************** |
---|
3023 | //***************************************************************************************************************** |
---|
3024 | //***************************************************************************************************************** |
---|
3025 | //***************************************************************************************************************** |
---|
3026 | //***************************************************************************************************************** |
---|
3027 | //***************************************************************************************************************** |
---|
3028 | //***************************************************************************************************************** |
---|
3029 | //***************************************************************************************************************** |
---|
3030 | |
---|
3031 | Function IR2L_SvNbk_SampleInf() |
---|
3032 | //this function saves information about the samples |
---|
3033 | //and header |
---|
3034 | |
---|
3035 | SVAR/Z nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
3036 | if(!SVAR_Exists(nbl)) |
---|
3037 | abort |
---|
3038 | endif |
---|
3039 | string oldDf=GetDataFolder(1) |
---|
3040 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3041 | |
---|
3042 | //write header here... separator and some heading to divide the record.... |
---|
3043 | IR2L_AppendAnyText("************************************************\r",2) |
---|
3044 | IR2L_AppendAnyText("Results saved on " + date() +" "+time()+"\r",1) |
---|
3045 | IR2L_AppendAnyText(" ",0) |
---|
3046 | |
---|
3047 | |
---|
3048 | NVAR MultipleInputData=root:Packages:IR2L_NLSQF:MultipleInputData |
---|
3049 | variable i |
---|
3050 | if(MultipleInputData) |
---|
3051 | //multiple data selected, need to return to multiple places.... |
---|
3052 | IR2L_AppendAnyText("Multiple data sets used, listing of data sets and associated parameters\r",2) |
---|
3053 | for(i=1;i<11;i+=1) |
---|
3054 | NVAR UseSet=$("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(i)) |
---|
3055 | if(UseSet) |
---|
3056 | IR2L_SvNbk_DataSetSave(i) |
---|
3057 | IR2L_AppendAnyText("",0) |
---|
3058 | endif |
---|
3059 | endfor |
---|
3060 | else |
---|
3061 | IR2L_AppendAnyText("Single data set used:",2) |
---|
3062 | //only one data set to be returned... the first one |
---|
3063 | IR2L_SvNbk_DataSetSave(1) |
---|
3064 | endif |
---|
3065 | |
---|
3066 | setDataFolder OldDf |
---|
3067 | |
---|
3068 | end |
---|
3069 | |
---|
3070 | |
---|
3071 | //***************************************************************************************************************** |
---|
3072 | //***************************************************************************************************************** |
---|
3073 | //***************************************************************************************************************** |
---|
3074 | //***************************************************************************************************************** |
---|
3075 | //***************************************************************************************************************** |
---|
3076 | |
---|
3077 | |
---|
3078 | |
---|
3079 | Function IR2L_SvNbk_DataSetSave(WdtSt) |
---|
3080 | variable WdtSt |
---|
3081 | |
---|
3082 | |
---|
3083 | string oldDf=GetDataFolder(1) |
---|
3084 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3085 | |
---|
3086 | string ListOfVariables, ListOfDataVariables, ListOfPopulationVariables |
---|
3087 | string ListOfStrings, ListOfDataStrings, ListOfPopulationsStrings |
---|
3088 | string ListOfParameters, ListOfParametersStr |
---|
3089 | ListOfParametersStr = "" |
---|
3090 | ListOfParameters="" |
---|
3091 | variable i, j |
---|
3092 | |
---|
3093 | j = WdtSt |
---|
3094 | |
---|
3095 | //First deal with data itself... Name, background etc. |
---|
3096 | ListOfDataStrings ="FolderName;IntensityDataName;QvecDataName;ErrorDataName;UserDataSetName;" |
---|
3097 | for(i=0;i<itemsInList(ListOfDataStrings);i+=1) |
---|
3098 | SVAR testStr = $(StringFromList(i,ListOfDataStrings)+"_set"+num2str(j)) |
---|
3099 | if(stringmatch(StringFromList(i,ListOfDataStrings),"FolderName")) |
---|
3100 | IR2L_AppendAnyText(StringFromList(i,ListOfDataStrings)+"_set"+num2str(j)+"\t=\t"+testStr,2) |
---|
3101 | else |
---|
3102 | IR2L_AppendAnyText(StringFromList(i,ListOfDataStrings)+"_set"+num2str(j)+"\t=\t"+testStr,0) |
---|
3103 | endif |
---|
3104 | endfor |
---|
3105 | |
---|
3106 | ListOfDataVariables="DataScalingFactor;ErrorScalingFactor;Qmin;Qmax;Background;" |
---|
3107 | for(i=0;i<itemsInList(ListOfDataVariables);i+=1) |
---|
3108 | NVAR testVar = $(StringFromList(i,ListOfDataVariables)+"_set"+num2str(j)) |
---|
3109 | IR2L_AppendAnyText(StringFromList(i,ListOfDataVariables)+"_set"+num2str(j)+"\t=\t"+num2str(testVar),0) |
---|
3110 | endfor |
---|
3111 | |
---|
3112 | //Slit smeared data? |
---|
3113 | NVAR SlitSmeared = $("root:Packages:IR2L_NLSQF:SlitSmeared_set"+num2str(j)) |
---|
3114 | if(SlitSmeared) |
---|
3115 | NVAR SlitLength = $("root:Packages:IR2L_NLSQF:SlitLength_set"+num2str(j)) |
---|
3116 | IR2L_AppendAnyText("Slit smeared data used...",1) |
---|
3117 | IR2L_AppendAnyText("SlitLength"+"_set"+num2str(j)+"\t=\t"+num2str(SlitLength),0) |
---|
3118 | else |
---|
3119 | // ListOfParameters+="SlitLength"+"_set"+num2str(j)+"=0;" |
---|
3120 | endif |
---|
3121 | |
---|
3122 | |
---|
3123 | end |
---|
3124 | //***************************************************************************************************************** |
---|
3125 | //***************************************************************************************************************** |
---|
3126 | //***************************************************************************************************************** |
---|
3127 | //***************************************************************************************************************** |
---|
3128 | //***************************************************************************************************************** |
---|
3129 | Function IR2L_AppendAnyText(TextToBeInserted, level) //this function checks for existance of notebook |
---|
3130 | string TextToBeInserted //and appends text to the end of the notebook |
---|
3131 | variable level //formating level... 0 for base, 1 and higher define my own |
---|
3132 | Silent 1 |
---|
3133 | TextToBeInserted=TextToBeInserted+"\r" |
---|
3134 | SVAR/Z nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
3135 | if(SVAR_exists(nbl)) |
---|
3136 | if (strsearch(WinList("*",";","WIN:16"),nbl,0)!=-1) //Logs data in Logbook |
---|
3137 | Notebook $nbl selection={endOfFile, endOfFile} |
---|
3138 | Switch(level) |
---|
3139 | case 0: |
---|
3140 | Notebook $nbl font="Arial", fsize=10, fStyle=-1, text=TextToBeInserted |
---|
3141 | break |
---|
3142 | case 1: |
---|
3143 | Notebook $nbl font="Arial", fsize=10, fStyle=4, text=TextToBeInserted |
---|
3144 | break |
---|
3145 | case 2: |
---|
3146 | Notebook $nbl font="Arial", fsize=12, fStyle=3, text=TextToBeInserted |
---|
3147 | break |
---|
3148 | |
---|
3149 | default: |
---|
3150 | Notebook $nbl text=TextToBeInserted |
---|
3151 | endswitch |
---|
3152 | endif |
---|
3153 | endif |
---|
3154 | end |
---|
3155 | |
---|
3156 | //***************************************************************************************************************** |
---|
3157 | //***************************************************************************************************************** |
---|
3158 | //***************************************************************************************************************** |
---|
3159 | //***************************************************************************************************************** |
---|
3160 | //***************************************************************************************************************** |
---|
3161 | |
---|
3162 | Function IR2L_SvNbk_CreateNbk() |
---|
3163 | |
---|
3164 | SVAR/Z nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
3165 | if(!SVAR_Exists(nbl)) |
---|
3166 | NewDataFolder/O root:Packages |
---|
3167 | NewDataFolder/O root:Packages:IR2L_NLSQF |
---|
3168 | String/G root:Packages:IR2L_NLSQF:NotebookName="" |
---|
3169 | SVAR nbl=root:Packages:IR2L_NLSQF:NotebookName |
---|
3170 | nbL="ModelingII_Results" |
---|
3171 | endif |
---|
3172 | |
---|
3173 | string nbLL=nbl |
---|
3174 | |
---|
3175 | Silent 1 |
---|
3176 | if (strsearch(WinList("*",";","WIN:16"),nbL,0)!=-1) ///Logbook exists |
---|
3177 | DoWindow/F $nbl |
---|
3178 | else |
---|
3179 | NewNotebook/K=3/N=$nbl/F=1/V=1/W=(235.5,44.75,817.5,592.25) as nbl +": Modeling II Output" |
---|
3180 | Notebook $nbl defaultTab=144, statusWidth=238, pageMargins={72,72,72,72} |
---|
3181 | Notebook $nbl showRuler=1, rulerUnits=1, updating={1, 60} |
---|
3182 | Notebook $nbl newRuler=Normal, justification=0, margins={0,0,468}, spacing={0,0,0}, tabs={2.5*72, 3.5*72 + 8192, 5*72 + 3*8192}, rulerDefaults={"Arial",10,0,(0,0,0)} |
---|
3183 | Notebook $nbl ruler=Normal |
---|
3184 | Notebook $nbl justification=1, rulerDefaults={"Arial",14,1,(0,0,0)} |
---|
3185 | Notebook $nbl text="This is output of results from Modeling II of Irena package.\r" |
---|
3186 | Notebook $nbl text="\r" |
---|
3187 | Notebook $nbl ruler=Normal |
---|
3188 | IR1_InsertDateAndTime(nbl) |
---|
3189 | endif |
---|
3190 | |
---|
3191 | end |
---|
3192 | |
---|
3193 | //***************************************************************************************************************** |
---|
3194 | //***************************************************************************************************************** |
---|
3195 | //***************************************************************************************************************** |
---|
3196 | //***************************************************************************************************************** |
---|
3197 | //***************************************************************************************************************** |
---|
3198 | |
---|
3199 | Function IR2L_FixLimits(scale) |
---|
3200 | variable scale |
---|
3201 | |
---|
3202 | variable i, j |
---|
3203 | //Input Data parameters... Will have _setX attached, in this method background needs to be here... |
---|
3204 | //0.1 - 10x |
---|
3205 | string ListOfDataVariables="UseTheData;" |
---|
3206 | ListOfDataVariables+="Background;BackgroundFit;BackgroundMin;BackgroundMax;BackgErr;BackgStep;" |
---|
3207 | |
---|
3208 | for (i=1;i<=10;i+=1) |
---|
3209 | NVAR UseData=$("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(i)) |
---|
3210 | if(UseData) |
---|
3211 | NVAR Bckg = $("root:Packages:IR2L_NLSQF:Background_set"+num2str(i)) |
---|
3212 | NVAR BckgFit = $("root:Packages:IR2L_NLSQF:BackgroundFit_set"+num2str(i)) |
---|
3213 | NVAR BckgMin = $("root:Packages:IR2L_NLSQF:BackgroundMin_set"+num2str(i)) |
---|
3214 | NVAR BckgMax = $("root:Packages:IR2L_NLSQF:BackgroundMax_set"+num2str(i)) |
---|
3215 | if(BckgFit) |
---|
3216 | BckgMin = scale*0.1 * Bckg |
---|
3217 | BckgMax = scale*10 * Bckg |
---|
3218 | endif |
---|
3219 | endif |
---|
3220 | endfor |
---|
3221 | string ListOfPopulationVariables="" |
---|
3222 | ListOfPopulationVariables+="FormFactor_Param1;FormFactor_Param2;FormFactor_Param3;FormFactor_Param4;" |
---|
3223 | ListOfPopulationVariables+="FormFactor_Param5;FormFactor_Param6;FormFactor_Param7;FormFactor_Param8;FormFactor_Param9;" |
---|
3224 | |
---|
3225 | ListOfPopulationVariables+="Volume;" |
---|
3226 | ListOfPopulationVariables+="LNMinSize;LNMeanSize;LNSdeviation;" |
---|
3227 | ListOfPopulationVariables+="GMeanSize;GWidth;LSWLocation;" |
---|
3228 | ListOfPopulationVariables+="SZMeanSize;SZWidth;" |
---|
3229 | |
---|
3230 | ListOfPopulationVariables+="StructureParam1;StructureParam2;" |
---|
3231 | ListOfPopulationVariables+="StructureParam3;StructureParam4;" |
---|
3232 | ListOfPopulationVariables+="StructureParam5;StructureParam6;" |
---|
3233 | //Unified level parameters |
---|
3234 | ListOfPopulationVariables+="UF_G;UF_Rg;UF_B;UF_P;UF_RGCO;" |
---|
3235 | //Diffraction peak parameters |
---|
3236 | ListOfPopulationVariables+="DiffPeakPar1;DiffPeakPar2;DiffPeakPar3;DiffPeakPar4;DiffPeakPar5;" |
---|
3237 | |
---|
3238 | //G, Rg, RgCO, B 0.1 - 10 |
---|
3239 | //P 0.2 (min 1) - 2 (max 4) |
---|
3240 | //diff peaks, volume, LN, Gauss, SZ, Struct params... - 0.5 - 2 |
---|
3241 | // |
---|
3242 | //Common Size distribution Model parameters, these need to have _popX attached at the end of name |
---|
3243 | string tempStr |
---|
3244 | For(j=1;j<=10;j+=1) |
---|
3245 | NVAR UseThePop=$("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(j)) |
---|
3246 | if(UseThePop) |
---|
3247 | for (i=0;i<itemsInList(ListOfPopulationVariables);i+=1) |
---|
3248 | tempStr = stringFromList(i,ListOfPopulationVariables) |
---|
3249 | NVAR VarVal=$("root:Packages:IR2L_NLSQF:"+tempStr+"_pop"+num2str(j)) |
---|
3250 | NVAR FitVarVal=$("root:Packages:IR2L_NLSQF:"+tempStr+"Fit_pop"+num2str(j)) |
---|
3251 | NVAR MinVarVal=$("root:Packages:IR2L_NLSQF:"+tempStr+"Min_pop"+num2str(j)) |
---|
3252 | NVAR MaxVarVal=$("root:Packages:IR2L_NLSQF:"+tempStr+"Max_pop"+num2str(j)) |
---|
3253 | if(FitVarVal) |
---|
3254 | if(StringMatch(tempStr, "UF_*")) |
---|
3255 | MinVarVal= 0.1 * VarVal/scale |
---|
3256 | MaxVarVal=scale*10 * VarVal |
---|
3257 | elseif(StringMatch(tempStr, "UF_P")) |
---|
3258 | MinVarVal= (VarVal/scale*0.2)>1 ? VarVal/scale*0.2 : 1 |
---|
3259 | MaxVarVal=(VarVal*scale*2)<4.5 ? (VarVal*scale*2) : 4.5 |
---|
3260 | elseif(StringMatch(tempStr, "DiffPeak*") || StringMatch(tempStr, "Volume")|| StringMatch(tempStr, "LN*")|| StringMatch(tempStr, "G*")|| StringMatch(tempStr, "SZ*")|| StringMatch(tempStr, "Structure*")|| StringMatch(tempStr, "LSW*")) |
---|
3261 | MinVarVal= 0.5 * VarVal/scale |
---|
3262 | MaxVarVal=scale*2 * VarVal |
---|
3263 | elseif(StringMatch(tempStr, "FormF*")) |
---|
3264 | MinVarVal= 0.8 * VarVal/scale |
---|
3265 | MaxVarVal=scale*1.2 * VarVal |
---|
3266 | else |
---|
3267 | MinVarVal= 0.5 * VarVal/scale |
---|
3268 | MaxVarVal=scale*2 * VarVal |
---|
3269 | endif |
---|
3270 | endif |
---|
3271 | endfor |
---|
3272 | endif |
---|
3273 | endfor |
---|
3274 | end |
---|
3275 | |
---|
3276 | //***************************************************************************************************************** |
---|
3277 | //***************************************************************************************************************** |
---|
3278 | //***************************************************************************************************************** |
---|
3279 | //***************************************************************************************************************** |
---|
3280 | //***************************************************************************************************************** |
---|
3281 | |
---|
3282 | Function IR2L_AnalyzeUncertainities() |
---|
3283 | |
---|
3284 | string OldDf=getDataFOlder(1) |
---|
3285 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3286 | //follow IR1A_ConfidenceEvaluation() |
---|
3287 | IR2L_ConfEvResetList() |
---|
3288 | DoWindow IR2L_ConfEvaluationPanel |
---|
3289 | if(!V_Flag) |
---|
3290 | IR2L_ConfEvaluationPanelF() |
---|
3291 | else |
---|
3292 | DoWindow/F IR2L_ConfEvaluationPanel |
---|
3293 | endif |
---|
3294 | IR1_CreateResultsNbk() |
---|
3295 | setDataFolder OldDf |
---|
3296 | end |
---|
3297 | |
---|
3298 | |
---|
3299 | //****************************************************************************************************************** |
---|
3300 | //****************************************************************************************************************** |
---|
3301 | //****************************************************************************************************************** |
---|
3302 | Function IR2L_ConfEvResetList() |
---|
3303 | |
---|
3304 | string OldDf=getDataFolder(1) |
---|
3305 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3306 | DoWIndow IR2L_ConfEvaluationPanel |
---|
3307 | if(V_Flag) |
---|
3308 | ControlInfo /W=IR2L_ConfEvaluationPanel ListOfParamsToProcess |
---|
3309 | if(V_Flag==11) |
---|
3310 | KillControl /W=IR2L_ConfEvaluationPanel ListOfParamsToProcess |
---|
3311 | endif |
---|
3312 | endif |
---|
3313 | Wave/Z ConEvParamNameWv |
---|
3314 | Wave/Z ConEvMethodWv |
---|
3315 | Wave/Z ConEvMinValueWv |
---|
3316 | Wave/Z ConEvMaxValueWv |
---|
3317 | Wave/Z ConEvNumStepsWv |
---|
3318 | Wave/Z ConEvListboxWv |
---|
3319 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3320 | Method = "Sequential, fix param" |
---|
3321 | |
---|
3322 | Killwaves/Z ConEvParamNameWv, ConEvMethodWv, ConEvMinValueWv, ConEvMaxValueWv, ConEvNumStepsWv, ConEvListboxWv |
---|
3323 | setDataFolder oldDf |
---|
3324 | end |
---|
3325 | |
---|
3326 | |
---|
3327 | //****************************************************************************************************************** |
---|
3328 | //****************************************************************************************************************** |
---|
3329 | //****************************************************************************************************************** |
---|
3330 | |
---|
3331 | Function IR2L_ConfEvaluationPanelF() |
---|
3332 | PauseUpdate; Silent 1 // building window... |
---|
3333 | NewPanel /K=1/W=(405,136,793,600) as "Modeling II uncertainitiy evaluation" |
---|
3334 | DoWIndow/C IR2L_ConfEvaluationPanel |
---|
3335 | //ShowTools/A |
---|
3336 | SetDrawLayer UserBack |
---|
3337 | SetDrawEnv fsize= 16,fstyle= 3,textrgb= (1,4,52428) |
---|
3338 | DrawText 60,29,"Parameter Uncertainity Evaluation " |
---|
3339 | SVAR ConEvSelParameter=root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
3340 | PopupMenu SelectParameter,pos={8,59},size={163,20},proc=IR2L_ConfEvPopMenuProc,title="Select parameter " |
---|
3341 | PopupMenu SelectParameter,help={"Select parameter to evaluate, it had to be fitted"} |
---|
3342 | PopupMenu SelectParameter,popvalue=ConEvSelParameter,value= #"IR2L_ConfEvalBuildListOfParams(1)" |
---|
3343 | SetVariable ParameterMin,pos={15,94},size={149,14},bodyWidth=100,title="Min value" |
---|
3344 | SetVariable ParameterMin,value= root:Packages:IR2L_NLSQF:ConfEvMinVal |
---|
3345 | SetVariable ParameterMax,pos={13,117},size={151,14},bodyWidth=100,title="Max value" |
---|
3346 | SetVariable ParameterMax,value= root:Packages:IR2L_NLSQF:ConfEvMaxVal |
---|
3347 | SetVariable ParameterNumSteps,pos={192,103},size={153,14},bodyWidth=100,title="Num Steps" |
---|
3348 | SetVariable ParameterNumSteps,value= root:Packages:IR2L_NLSQF:ConfEvNumSteps |
---|
3349 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3350 | PopupMenu Method,pos={70,150},size={212,20},proc=IR2L_ConfEvPopMenuProc,title="Method " |
---|
3351 | PopupMenu Method,help={"Select method to be used for analysis"} |
---|
3352 | PopupMenu Method,mode=1,popvalue=Method,value= #"\"Sequential, fix param;Sequential, reset, fix param;Centered, fix param;Random, fix param;Random, fit param;Vary data, fit params;\"" |
---|
3353 | checkbox AutoOverwrite pos={20,180}, title="Automatically overwrite prior results?", variable=root:Packages:IR2L_NLSQF:ConfEvAutoOverwrite |
---|
3354 | Checkbox AutoOverwrite help={"Check to avoid being asked if you want to overwrite prior results"} |
---|
3355 | checkbox ConfEvAutoCalcTarget pos={20,200},title="Calculate ChiSq range?", variable=root:Packages:IR2L_NLSQF:ConfEvAutoCalcTarget |
---|
3356 | Checkbox ConfEvAutoCalcTarget help={"Check to calculate the ChiSquae range"}, proc=IR2L_ConfEvalCheckProc |
---|
3357 | checkbox ConfEvFixRanges pos={260,180}, title="Fix fit limits?", variable=root:Packages:IR2L_NLSQF:ConfEvFixRanges |
---|
3358 | Checkbox ConfEvFixRanges help={"Check to avoid being asked if you want to fix ranges during analysis"} |
---|
3359 | NVAR tmpVal=root:Packages:IR2L_NLSQF:ConfEvAutoCalcTarget |
---|
3360 | SetVariable ConfEvTargetChiSqRange,pos={200,200}, limits={1,inf,0.003}, format="%1.4g", size={173,14},bodyWidth=80,title="ChiSq range target" |
---|
3361 | SetVariable ConfEvTargetChiSqRange,value= root:Packages:IR2L_NLSQF:ConfEvTargetChiSqRange, disable=2*tmpVal |
---|
3362 | Button GetHelp,pos={284,37},size={90,20},proc=IR2L_ConfEvButtonProc,title="Get Help" |
---|
3363 | Button AnalyzeSelParam,pos={18,225},size={150,20},proc=IR2L_ConfEvButtonProc,title="Analyze selected Parameter" |
---|
3364 | Button AddSetToList,pos={187,225},size={150,20},proc=IR2L_ConfEvButtonProc,title="Add Parameter to List" |
---|
3365 | Button AnalyzeListOfParameters,pos={18,250},size={150,20},proc=IR2L_ConfEvButtonProc,title="Analyze list of Parameters" |
---|
3366 | Button ResetList,pos={187,250},size={150,20},proc=IR2L_ConfEvButtonProc,title="Reset List" |
---|
3367 | Button RecoverFromAbort,pos={18,430},size={150,20},proc=IR2L_ConfEvButtonProc,title="Recover from abort" |
---|
3368 | EndMacro |
---|
3369 | |
---|
3370 | //****************************************************************************************************************** |
---|
3371 | //****************************************************************************************************************** |
---|
3372 | //****************************************************************************************************************** |
---|
3373 | //****************************************************************************************************************** |
---|
3374 | //****************************************************************************************************************** |
---|
3375 | //****************************************************************************************************************** |
---|
3376 | |
---|
3377 | Function IR2L_ConfEvButtonProc(ba) : ButtonControl |
---|
3378 | STRUCT WMButtonAction &ba |
---|
3379 | |
---|
3380 | SVAR SampleFullName=root:Packages:IR2L_NLSQF:FolderName_set1 //cannot analyze more than first data set here, makes little sense to me how to do it... |
---|
3381 | variable j |
---|
3382 | switch( ba.eventCode ) |
---|
3383 | case 2: // mouse up |
---|
3384 | // click code here |
---|
3385 | if(stringMatch(ba.ctrlName,"GetHelp")) |
---|
3386 | //Generate help |
---|
3387 | IR1A_ConfEvHelp() |
---|
3388 | endif |
---|
3389 | if(stringMatch(ba.ctrlName,"AnalyzeSelParam")) |
---|
3390 | //analyze this parameter |
---|
3391 | SVAR ParamName = root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
3392 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3393 | NVAR MinValue =root:Packages:IR2L_NLSQF:ConfEvMinVal |
---|
3394 | NVAR MaxValue =root:Packages:IR2L_NLSQF:ConfEvMaxVal |
---|
3395 | NVAR NumSteps =root:Packages:IR2L_NLSQF:ConfEvNumSteps |
---|
3396 | IR1_AppendAnyText("Evaluated sample :"+StringFromList(ItemsInList(SampleFullName,":")-1,SampleFullName,":"), 1) |
---|
3397 | IR2L_ConEvEvaluateParameter(ParamName,MinValue,MaxValue,NumSteps,Method) |
---|
3398 | endif |
---|
3399 | if(stringMatch(ba.ctrlName,"AddSetToList")) |
---|
3400 | //add this parameter to list |
---|
3401 | IR2L_ConfEvAddToList() |
---|
3402 | endif |
---|
3403 | if(stringMatch(ba.ctrlName,"ResetList")) |
---|
3404 | //add this parameter to list |
---|
3405 | IR2L_ConfEvResetList() |
---|
3406 | endif |
---|
3407 | if(stringMatch(ba.ctrlName,"AnalyzeListOfParameters")) |
---|
3408 | //analyze list of parameters |
---|
3409 | IR1_AppendAnyText("Evaluated sample :"+StringFromList(ItemsInList(SampleFullName,":")-1,SampleFullName,":"), 1) |
---|
3410 | IR2L_ConfEvAnalyzeList() |
---|
3411 | endif |
---|
3412 | if(stringMatch(ba.ctrlName,"RecoverFromAbort")) |
---|
3413 | //Recover from abort |
---|
3414 | SVAR ParamName=root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
3415 | SVAR Method=root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3416 | IR2L_ConEvRestoreBackupSettings("root:ConfidenceEvaluation:"+possiblyquoteName(StringFromList(ItemsInList(SampleFullName,":")-1,SampleFullName,":"))) |
---|
3417 | if(stringMatch(ParamName,"UncertainityEffect")) |
---|
3418 | if(stringMatch(Method,"Vary data, fit params")) |
---|
3419 | For(j=1;j<=10;j+=1) |
---|
3420 | NVAR UseTheSet = $("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(j)) |
---|
3421 | if(UseTheSet) |
---|
3422 | Wave/Z InWave=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(j)) |
---|
3423 | Wave/Z InWaveBckp = $("root:Packages:IR2L_NLSQF:InWaveBckp_set"+num2str(j)) |
---|
3424 | if(WaveExists(InWave)&&WaveExists(InWaveBckp)) |
---|
3425 | InWave = InWaveBckp |
---|
3426 | endif |
---|
3427 | endif |
---|
3428 | endfor |
---|
3429 | endif |
---|
3430 | endif |
---|
3431 | endif |
---|
3432 | |
---|
3433 | |
---|
3434 | break |
---|
3435 | case -1: // control being killed |
---|
3436 | break |
---|
3437 | endswitch |
---|
3438 | |
---|
3439 | return 0 |
---|
3440 | End |
---|
3441 | //****************************************************************************************************************** |
---|
3442 | //****************************************************************************************************************** |
---|
3443 | //****************************************************************************************************************** |
---|
3444 | |
---|
3445 | static Function IR2L_ConEvBackupCurrentSettings(BackupLocation) |
---|
3446 | string BackupLocation |
---|
3447 | //creates backup waves (names/values) for all parameters used in current folder |
---|
3448 | string OldDf=GetDataFOlder(1) |
---|
3449 | //create folder where we dump this thing... |
---|
3450 | setDataFolder $(BackupLocation) |
---|
3451 | string ParamNames=IR2L_ConfEvalBuildListOfParams(0) |
---|
3452 | ParamNames = RemoveListItem(ItemsInList(ParamNames)-1, ParamNames) |
---|
3453 | make/O/N=1/T BackupParamNames |
---|
3454 | make/O/N=1 BackupParamValues |
---|
3455 | variable i, j |
---|
3456 | string tempName |
---|
3457 | For(j=0;j<ItemsInList(ParamNames);j+=1) |
---|
3458 | tempName=stringFromList(j,ParamNames) |
---|
3459 | NVAR CurPar = $("root:Packages:IR2L_NLSQF:"+tempName) |
---|
3460 | redimension/N=(numpnts(BackupParamValues)+1) BackupParamValues, BackupParamNames |
---|
3461 | BackupParamNames[numpnts(BackupParamNames)-1]=tempName |
---|
3462 | BackupParamValues[numpnts(BackupParamNames)-1]=CurPar |
---|
3463 | endfor |
---|
3464 | setDataFolder oldDf |
---|
3465 | |
---|
3466 | end |
---|
3467 | //****************************************************************************************************************** |
---|
3468 | //****************************************************************************************************************** |
---|
3469 | //****************************************************************************************************************** |
---|
3470 | //****************************************************************************************************************** |
---|
3471 | //****************************************************************************************************************** |
---|
3472 | |
---|
3473 | static Function IR2L_ConEvRestoreBackupSettings(BackupLocation) |
---|
3474 | string BackupLocation |
---|
3475 | //restores backup waves (names/values) for all parameters used in current folder |
---|
3476 | string OldDf=GetDataFOlder(1) |
---|
3477 | setDataFolder $(BackupLocation) |
---|
3478 | Wave/T BackupParamNames |
---|
3479 | Wave BackupParamValues |
---|
3480 | variable i, j |
---|
3481 | string tempName |
---|
3482 | For(i=0;i<numpnts(BackupParamValues);i+=1) |
---|
3483 | tempName=BackupParamNames[i] |
---|
3484 | if(strlen(tempName)>1) |
---|
3485 | NVAR CurPar = $("root:Packages:IR2L_NLSQF:"+tempName) |
---|
3486 | CurPar = BackupParamValues[i] |
---|
3487 | endif |
---|
3488 | endfor |
---|
3489 | setDataFolder oldDf |
---|
3490 | |
---|
3491 | end |
---|
3492 | //****************************************************************************************************************** |
---|
3493 | //****************************************************************************************************************** |
---|
3494 | //****************************************************************************************************************** |
---|
3495 | //****************************************************************************************************************** |
---|
3496 | static Function IR2L_ConfEvAnalyzeList() |
---|
3497 | |
---|
3498 | string OldDf=getDataFolder(1) |
---|
3499 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3500 | DoWIndow IR2L_ConfEvaluationPanel |
---|
3501 | if(!V_Flag) |
---|
3502 | abort |
---|
3503 | endif |
---|
3504 | Wave/T/Z ConEvParamNameWv |
---|
3505 | if(!WaveExists(ConEvParamNameWv)) |
---|
3506 | abort "List of parameters to process does not exist" |
---|
3507 | endif |
---|
3508 | Wave/T ConEvMethodWv |
---|
3509 | Wave ConEvMinValueWv |
---|
3510 | Wave ConEvMaxValueWv |
---|
3511 | Wave ConEvNumStepsWv |
---|
3512 | Wave ConEvListboxWv |
---|
3513 | variable i |
---|
3514 | |
---|
3515 | SVAR ParamName = root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
3516 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3517 | NVAR MinValue =root:Packages:IR2L_NLSQF:ConfEvMinVal |
---|
3518 | NVAR MaxValue =root:Packages:IR2L_NLSQF:ConfEvMaxVal |
---|
3519 | NVAR NumSteps =root:Packages:IR2L_NLSQF:ConfEvNumSteps |
---|
3520 | |
---|
3521 | For(i=0;i<numpnts(ConEvParamNameWv);i+=1) |
---|
3522 | ParamName=ConEvParamNameWv[i] |
---|
3523 | PopupMenu SelectParameter,win=IR2L_ConfEvaluationPanel , popvalue=ParamName |
---|
3524 | Method=ConEvMethodWv[i] |
---|
3525 | PopupMenu Method,win=IR2L_ConfEvaluationPanel , popvalue=Method |
---|
3526 | MinValue=ConEvMinValueWv[i] |
---|
3527 | MaxValue=ConEvMaxValueWv[i] |
---|
3528 | NumSteps=ConEvNumStepsWv[i] |
---|
3529 | print "Evaluating stability of "+ParamName |
---|
3530 | IR2L_ConEvEvaluateParameter(ParamName,MinValue,MaxValue,NumSteps,Method) |
---|
3531 | endfor |
---|
3532 | |
---|
3533 | DoWIndow IR2L_ConfEvaluationPanel |
---|
3534 | if(V_Flag) |
---|
3535 | DoWIndow/F IR2L_ConfEvaluationPanel |
---|
3536 | endif |
---|
3537 | |
---|
3538 | setDataFolder oldDf |
---|
3539 | end |
---|
3540 | |
---|
3541 | |
---|
3542 | //****************************************************************************************************************** |
---|
3543 | //****************************************************************************************************************** |
---|
3544 | //****************************************************************************************************************** |
---|
3545 | //****************************************************************************************************************** |
---|
3546 | //****************************************************************************************************************** |
---|
3547 | static Function IR2L_ConfEvAddToList() |
---|
3548 | |
---|
3549 | string OldDf=getDataFolder(1) |
---|
3550 | setDataFolder root:Packages:IR2L_NLSQF |
---|
3551 | SVAR ParamName = root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
3552 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3553 | NVAR MinValue =root:Packages:IR2L_NLSQF:ConfEvMinVal |
---|
3554 | NVAR MaxValue =root:Packages:IR2L_NLSQF:ConfEvMaxVal |
---|
3555 | NVAR NumSteps =root:Packages:IR2L_NLSQF:ConfEvNumSteps |
---|
3556 | |
---|
3557 | Wave/Z/T ConEvParamNameWv=root:Packages:IR2L_NLSQF:ConEvParamNameWv |
---|
3558 | if(!WaveExists(ConEvParamNameWv)) |
---|
3559 | make/O/N=1/T ConEvParamNameWv, ConEvMethodWv, ConEvListboxWv |
---|
3560 | make/O/N=1 ConEvMinValueWv, ConEvMaxValueWv, ConEvNumStepsWv |
---|
3561 | else |
---|
3562 | redimension/N=(numpnts(ConEvParamNameWv)+1) ConEvParamNameWv, ConEvMethodWv, ConEvListboxWv |
---|
3563 | redimension/N=(numpnts(ConEvParamNameWv)+1) ConEvMinValueWv, ConEvMaxValueWv, ConEvNumStepsWv |
---|
3564 | endif |
---|
3565 | ConEvParamNameWv[numpnts(ConEvParamNameWv)-1]=ParamName |
---|
3566 | ConEvMethodWv[numpnts(ConEvParamNameWv)-1]=Method |
---|
3567 | ConEvMinValueWv[numpnts(ConEvParamNameWv)-1]=MinValue |
---|
3568 | ConEvMaxValueWv[numpnts(ConEvParamNameWv)-1]=MaxValue |
---|
3569 | ConEvNumStepsWv[numpnts(ConEvParamNameWv)-1]=NumSteps |
---|
3570 | ConEvListboxWv[numpnts(ConEvParamNameWv)-1]=ParamName+": "+Method+";Min="+num2str(MinValue)+";Max="+num2str(MaxValue)+"Steps="+num2str(NumSteps) |
---|
3571 | |
---|
3572 | ControlInfo /W=IR2L_ConfEvaluationPanel ListOfParamsToProcess |
---|
3573 | if(V_Flag!=11) |
---|
3574 | ListBox ListOfParamsToProcess win=IR2L_ConfEvaluationPanel, pos={10,280}, size={370,140}, mode=0 |
---|
3575 | ListBox ListOfParamsToProcess listWave=root:Packages:IR2L_NLSQF:ConEvListboxWv |
---|
3576 | ListBox ListOfParamsToProcess help={"This is list of parameters selected to be processed"} |
---|
3577 | endif |
---|
3578 | setDataFolder oldDf |
---|
3579 | end |
---|
3580 | |
---|
3581 | |
---|
3582 | //****************************************************************************************************************** |
---|
3583 | //****************************************************************************************************************** |
---|
3584 | //****************************************************************************************************************** |
---|
3585 | static function IR2L_ConEvFixParamsIfNeeded() |
---|
3586 | |
---|
3587 | NVAR ConfEvFixRanges = root:Packages:IR2L_NLSQF:ConfEvFixRanges |
---|
3588 | if(ConfEvFixRanges) |
---|
3589 | IR2L_FixLimits(5) |
---|
3590 | endif |
---|
3591 | end |
---|
3592 | |
---|
3593 | //****************************************************************************************************************** |
---|
3594 | //****************************************************************************************************************** |
---|
3595 | //****************************************************************************************************************** |
---|
3596 | //****************************************************************************************************************** |
---|
3597 | //****************************************************************************************************************** |
---|
3598 | //****************************************************************************************************************** |
---|
3599 | |
---|
3600 | static Function IR2L_ConEvAnalyzeEvalResults2(ParamName) |
---|
3601 | string ParamName |
---|
3602 | print GetDataFOlder(1) |
---|
3603 | SVAR SampleFullName=root:Packages:IR2L_NLSQF:DataFolderName |
---|
3604 | NVAR ConfEVNumSteps=root:Packages:IR2L_NLSQF:ConfEVNumSteps |
---|
3605 | Wave ConfEvStartValues=$("ConfEvStartValues") |
---|
3606 | Wave ConfEvEndValues=$("ConfEvEndValues") |
---|
3607 | Wave/T ConfEvCoefNames=$("ConfEvCoefNames") |
---|
3608 | Wave ChiSquareValues=$(ParamName+"ChiSquare") |
---|
3609 | |
---|
3610 | variable i |
---|
3611 | for(i=0;i<numpnts(ChiSquareValues);i+=1) |
---|
3612 | if(ChiSquareValues[i]==0) |
---|
3613 | ChiSquareValues[i]=NaN |
---|
3614 | endif |
---|
3615 | endfor |
---|
3616 | |
---|
3617 | DoWindow ChisquaredAnalysis |
---|
3618 | if(V_Flag) |
---|
3619 | DoWindow/K ChisquaredAnalysis |
---|
3620 | endif |
---|
3621 | DoWindow ChisquaredAnalysis2 |
---|
3622 | if(V_Flag) |
---|
3623 | DoWindow/K ChisquaredAnalysis2 |
---|
3624 | endif |
---|
3625 | variable levellow, levelhigh |
---|
3626 | |
---|
3627 | IR1_CreateResultsNbk() |
---|
3628 | //IR1_AppendAnyText("Analyzed sample "+SampleFullName, 1) |
---|
3629 | IR1_AppendAnyText("Effect of data uncertainities on variability of parameters", 2) |
---|
3630 | IR1_AppendAnyText(SampleFullName, 2) |
---|
3631 | IR1_AppendAnyText(" ", 0) |
---|
3632 | IR1_AppendAnyText("Run "+num2str(ConfEVNumSteps)+" fittings using data modified by random Gauss noise within \"Errors\" ", 0) |
---|
3633 | IR1_AppendAnyText("To get following statistical results ", 0) |
---|
3634 | |
---|
3635 | |
---|
3636 | wavestats/Q ChiSquareValues |
---|
3637 | variable MeanChiSquare=V_avg |
---|
3638 | variable StdDevChiSquare=V_sdev |
---|
3639 | //IR1_AppendAnyText("Chi-square values : \taverage = "+num2str(MeanChiSquare)+"\tst. dev. = "+num2str(StdDevChiSquare), 0) |
---|
3640 | IR1_AppendAnyText("Chi-square values : \taverage +/- st. dev. = \t"+IN2G_roundToUncertainity(MeanChiSquare,StdDevChiSquare,2), 0) |
---|
3641 | |
---|
3642 | variable j |
---|
3643 | string tempStrName |
---|
3644 | For(j=0;j<numpnts(ConfEvCoefNames);j+=1) |
---|
3645 | tempStrName=ConfEvCoefNames[j] |
---|
3646 | Duplicate/Free/O/R=[j][] ConfEvEndValues, tempWv |
---|
3647 | wavestats/Q tempWv |
---|
3648 | //IR1_AppendAnyText(tempStrName+" : \taverage = "+num2str(V_avg)+"\tst. dev. = "+num2str(V_sdev), 0) |
---|
3649 | IR1_AppendAnyText(tempStrName+" : \taverage +/- st. dev. = \t"+IN2G_roundToUncertainity(V_avg, V_sdev,2), 0) |
---|
3650 | |
---|
3651 | endfor |
---|
3652 | |
---|
3653 | |
---|
3654 | end |
---|
3655 | //****************************************************************************************************************** |
---|
3656 | //****************************************************************************************************************** |
---|
3657 | static Function IR2L_ConEvEvaluateParameter(ParamName,MinValue,MaxValue,NumSteps,Method) |
---|
3658 | Variable MinValue,MaxValue,NumSteps |
---|
3659 | String ParamName,Method |
---|
3660 | |
---|
3661 | DoWindow ChisquaredAnalysis |
---|
3662 | if(V_Flag) |
---|
3663 | DoWindow/K ChisquaredAnalysis |
---|
3664 | endif |
---|
3665 | DoWindow ChisquaredAnalysis2 |
---|
3666 | if(V_Flag) |
---|
3667 | DoWindow/K ChisquaredAnalysis2 |
---|
3668 | endif |
---|
3669 | //create folder where we dump this thing... |
---|
3670 | NewDataFolder/O/S root:ConfidenceEvaluation |
---|
3671 | SVAR SampleFullName=root:Packages:IR2L_NLSQF:FolderName_set1 |
---|
3672 | NVAR ConfEvAutoOverwrite = root:Packages:IR2L_NLSQF:ConfEvAutoOverwrite |
---|
3673 | string Samplename=StringFromList(ItemsInList(SampleFullName,":")-1,SampleFullName,":") |
---|
3674 | SampleName=IN2G_RemoveExtraQuote(Samplename,1,1) |
---|
3675 | NewDataFolder /S/O $(Samplename) |
---|
3676 | Wave/Z/T BackupParamNames |
---|
3677 | if(checkName(ParamName,11)!=0 && !ConfEvAutoOverwrite) |
---|
3678 | DoALert /T="Folder Name Conflict" 1, "Folder with name "+ParamName+" found, do you want to overwrite prior Confidence Evaluation results?" |
---|
3679 | if(!V_Flag) |
---|
3680 | abort |
---|
3681 | endif |
---|
3682 | endif |
---|
3683 | if(!WaveExists(BackupParamNames)) |
---|
3684 | IR2L_ConEvBackupCurrentSettings(GetDataFolder(1)) |
---|
3685 | print "Stored setting in case of abort, this can be reset by button Reset from abort" |
---|
3686 | endif |
---|
3687 | NewDataFolder /S/O $(ParamName) |
---|
3688 | string BackupFilesLocation=GetDataFolder(1) |
---|
3689 | IR2L_ConEvBackupCurrentSettings(BackupFilesLocation) |
---|
3690 | //calculate chiSquare target if users asks for it.. |
---|
3691 | IR2L_ConfEvalCalcChiSqTarget() |
---|
3692 | NVAR ConfEvAutoCalcTarget=root:Packages:IR2L_NLSQF:ConfEvAutoCalcTarget |
---|
3693 | NVAR ConfEvTargetChiSqRange = root:Packages:IR2L_NLSQF:ConfEvTargetChiSqRange |
---|
3694 | variable i, currentParValue, tempi |
---|
3695 | make/O/N=0 $(ParamName+"ChiSquare") |
---|
3696 | Wave ChiSquareValues=$(ParamName+"ChiSquare") |
---|
3697 | NVAR AchievedChisq = root:Packages:IR2L_NLSQF:AchievedChisq |
---|
3698 | variable SortForAnalysis=0 |
---|
3699 | variable FittedParameter=0 |
---|
3700 | |
---|
3701 | variable j |
---|
3702 | if(stringMatch(ParamName,"UncertainityEffect")) |
---|
3703 | if(stringMatch(Method,"Vary data, fit params")) |
---|
3704 | For(j=1;j<=10;j+=1) |
---|
3705 | NVAR UseTheSet = $("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(j)) |
---|
3706 | if(UseTheSet) |
---|
3707 | Wave InWave=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(j)) |
---|
3708 | Wave Ewave=$("root:Packages:IR2L_NLSQF:Error_set"+num2str(j)) |
---|
3709 | Duplicate/O InWave, $("root:Packages:IR2L_NLSQF:InWaveBckp_set"+num2str(j)) |
---|
3710 | endif |
---|
3711 | endfor |
---|
3712 | For(i=0;i<NumSteps+1;i+=1) |
---|
3713 | For(j=1;j<=10;j+=1) |
---|
3714 | NVAR UseTheSet = $("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(j)) |
---|
3715 | if(UseTheSet) |
---|
3716 | Wave InWave=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(j)) |
---|
3717 | Wave Ewave=$("root:Packages:IR2L_NLSQF:Error_set"+num2str(j)) |
---|
3718 | Wave InWaveBckp = $("root:Packages:IR2L_NLSQF:InWaveBckp_set"+num2str(j)) |
---|
3719 | InWave = InWaveBckp + gnoise(Ewave[p]) |
---|
3720 | endif |
---|
3721 | endfor |
---|
3722 | IR2L_ConEvFixParamsIfNeeded() |
---|
3723 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3724 | Wave/T CoefNames=root:Packages:IR2L_NLSQF:CoefNames |
---|
3725 | Wave ValuesAfterFit=root:Packages:IR2L_NLSQF:W_coef |
---|
3726 | Wave ValuesBeforeFit = root:Packages:IR2L_NLSQF:CoefficientInput |
---|
3727 | Duplicate/O CoefNames, ConfEvCoefNames |
---|
3728 | Wave/Z ConfEvStartValues |
---|
3729 | if(i==0 || !WaveExists(ConfEvStartValues)) |
---|
3730 | Duplicate/O ValuesAfterFit, ConfEvEndValues |
---|
3731 | Duplicate/O ValuesBeforeFit, ConfEvStartValues |
---|
3732 | else |
---|
3733 | Wave ConfEvStartValues |
---|
3734 | Wave ConfEvEndValues |
---|
3735 | redimension/N=(-1,i+1) ConfEvEndValues, ConfEvStartValues |
---|
3736 | ConfEvStartValues[][i] = ValuesBeforeFit[p] |
---|
3737 | ConfEvEndValues[][i] = ValuesAfterFit[p] |
---|
3738 | endif |
---|
3739 | redimension/N=(i+1) ChiSquareValues |
---|
3740 | ChiSquareValues[i]=AchievedChisq |
---|
3741 | DoUpdate |
---|
3742 | sleep/s 1 |
---|
3743 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3744 | endfor |
---|
3745 | For(j=1;j<=10;j+=1) |
---|
3746 | NVAR UseTheSet = $("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(j)) |
---|
3747 | if(UseTheSet) |
---|
3748 | Wave InWave=$("root:Packages:IR2L_NLSQF:Intensity_set"+num2str(j)) |
---|
3749 | Wave InWaveBckp = $("root:Packages:IR2L_NLSQF:InWaveBckp_set"+num2str(j)) |
---|
3750 | InWave = InWaveBckp |
---|
3751 | endif |
---|
3752 | endfor |
---|
3753 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3754 | IR2L_ConEvAnalyzeEvalResults2(ParamName) |
---|
3755 | endif |
---|
3756 | else //parameter methods |
---|
3757 | //Metod = "Sequential, fix param;Sequential, reset, fix param;Random, fix param;Random, fit param;" |
---|
3758 | NVAR Param=$("root:Packages:IR2L_NLSQF:"+ParamName) |
---|
3759 | if(stringMatch(ParamName,"*_pop*")) |
---|
3760 | NVAR ParamFit=$("root:Packages:IR2L_NLSQF:"+ReplaceString("_pop", ParamName, "Fit_pop")) |
---|
3761 | else //set |
---|
3762 | NVAR ParamFit=$("root:Packages:IR2L_NLSQF:"+ReplaceString("_set", ParamName, "Fit_set")) |
---|
3763 | endif |
---|
3764 | make/O/N=0 $(ParamName+"StartValue"), $(ParamName+"EndValue"), $(ParamName+"ChiSquare") |
---|
3765 | Wave StartValues=$(ParamName+"StartValue") |
---|
3766 | Wave EndValues=$(ParamName+"EndValue") |
---|
3767 | variable StartHere=Param |
---|
3768 | variable step=(MaxValue-MinValue)/(NumSteps) |
---|
3769 | if(stringMatch(Method,"Sequential, fix param")) |
---|
3770 | ParamFit=0 |
---|
3771 | For(i=0;i<NumSteps+1;i+=1) |
---|
3772 | redimension/N=(i+1) StartValues, EndValues, ChiSquareValues |
---|
3773 | currentParValue = MinValue+ i* step |
---|
3774 | StartValues[i]=currentParValue |
---|
3775 | Param = currentParValue |
---|
3776 | IR2L_ConEvFixParamsIfNeeded() |
---|
3777 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3778 | EndValues[i]=Param |
---|
3779 | ChiSquareValues[i]=AchievedChisq |
---|
3780 | DoUpdate |
---|
3781 | sleep/s 1 |
---|
3782 | endfor |
---|
3783 | SortForAnalysis=0 |
---|
3784 | FittedParameter=0 |
---|
3785 | elseif(stringMatch(Method,"Sequential, reset, fix param")) |
---|
3786 | ParamFit=0 |
---|
3787 | For(i=0;i<NumSteps+1;i+=1) |
---|
3788 | redimension/N=(i+1) StartValues, EndValues, ChiSquareValues |
---|
3789 | currentParValue = MinValue+ i* step |
---|
3790 | StartValues[i]=currentParValue |
---|
3791 | Param = currentParValue |
---|
3792 | IR2L_ConEvFixParamsIfNeeded() |
---|
3793 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3794 | EndValues[i]=Param |
---|
3795 | ChiSquareValues[i]=AchievedChisq |
---|
3796 | DoUpdate |
---|
3797 | sleep/s 1 |
---|
3798 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3799 | endfor |
---|
3800 | SortForAnalysis=0 |
---|
3801 | FittedParameter=0 |
---|
3802 | elseif(stringMatch(Method,"Centered, fix param")) |
---|
3803 | ParamFit=0 |
---|
3804 | tempi=0 |
---|
3805 | variable NumSteps2=Ceil(NumSteps/2) |
---|
3806 | For(i=0;i<NumSteps2;i+=1) |
---|
3807 | tempi+=1 |
---|
3808 | redimension/N=(tempi) StartValues, EndValues, ChiSquareValues |
---|
3809 | currentParValue = StartHere - i* step |
---|
3810 | StartValues[tempi-1]=currentParValue |
---|
3811 | Param = currentParValue |
---|
3812 | IR2L_ConEvFixParamsIfNeeded() |
---|
3813 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3814 | EndValues[tempi-1]=Param |
---|
3815 | ChiSquareValues[tempi-1]=AchievedChisq |
---|
3816 | DoUpdate |
---|
3817 | sleep/s 1 |
---|
3818 | endfor |
---|
3819 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3820 | For(i=0;i<NumSteps2;i+=1) //and now |
---|
3821 | tempi+=1 |
---|
3822 | redimension/N=(tempi) StartValues, EndValues, ChiSquareValues |
---|
3823 | currentParValue = StartHere + i* step |
---|
3824 | StartValues[tempi-1]=currentParValue |
---|
3825 | Param = currentParValue |
---|
3826 | IR2L_ConEvFixParamsIfNeeded() |
---|
3827 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3828 | EndValues[tempi-1]=Param |
---|
3829 | ChiSquareValues[tempi-1]=AchievedChisq |
---|
3830 | DoUpdate |
---|
3831 | sleep/s 1 |
---|
3832 | endfor |
---|
3833 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3834 | SortForAnalysis=1 |
---|
3835 | FittedParameter=0 |
---|
3836 | elseif(stringMatch(Method,"Random, fix param")) |
---|
3837 | ParamFit=0 |
---|
3838 | For(i=0;i<NumSteps+1;i+=1) |
---|
3839 | redimension/N=(i+1) StartValues, EndValues, ChiSquareValues |
---|
3840 | currentParValue = MinValue + (0.5+enoise(0.5))*(MaxValue-MinValue) |
---|
3841 | StartValues[i]=currentParValue |
---|
3842 | Param = currentParValue |
---|
3843 | IR2L_ConEvFixParamsIfNeeded() |
---|
3844 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3845 | EndValues[i]=Param |
---|
3846 | ChiSquareValues[i]=AchievedChisq |
---|
3847 | DoUpdate |
---|
3848 | sleep/s 1 |
---|
3849 | //IR1A_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3850 | endfor |
---|
3851 | SortForAnalysis=1 |
---|
3852 | FittedParameter=0 |
---|
3853 | elseif(stringMatch(Method,"Random, fit param")) |
---|
3854 | ParamFit=1 |
---|
3855 | For(i=0;i<NumSteps+1;i+=1) |
---|
3856 | redimension/N=(i+1) StartValues, EndValues, ChiSquareValues |
---|
3857 | currentParValue = MinValue + (0.5+enoise(0.5))*(MaxValue-MinValue) |
---|
3858 | StartValues[i]=currentParValue |
---|
3859 | Param = currentParValue |
---|
3860 | IR2L_ConEvFixParamsIfNeeded() |
---|
3861 | IR2L_InputPanelButtonProc("FitModelSkipDialogs") |
---|
3862 | EndValues[i]=Param |
---|
3863 | ChiSquareValues[i]=AchievedChisq |
---|
3864 | DoUpdate |
---|
3865 | sleep/s 1 |
---|
3866 | //IR1A_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3867 | endfor |
---|
3868 | SortForAnalysis=1 |
---|
3869 | FittedParameter=1 |
---|
3870 | endif |
---|
3871 | ParamFit=1 |
---|
3872 | IR2L_ConEvRestoreBackupSettings(BackupFilesLocation) |
---|
3873 | IR2L_InputPanelButtonProc("Recalculate") |
---|
3874 | |
---|
3875 | IR2L_ConEvAnalyzeEvalResults(ParamName, SortForAnalysis,FittedParameter) |
---|
3876 | endif //end of parameters analysis |
---|
3877 | DoWIndow IR1A_ConfEvaluationPanel |
---|
3878 | if(V_Flag) |
---|
3879 | DoWIndow/F IR1A_ConfEvaluationPanel |
---|
3880 | endif |
---|
3881 | |
---|
3882 | end |
---|
3883 | //****************************************************************************************************************** |
---|
3884 | //****************************************************************************************************************** |
---|
3885 | //****************************************************************************************************************** |
---|
3886 | //****************************************************************************************************************** |
---|
3887 | //****************************************************************************************************************** |
---|
3888 | //****************************************************************************************************************** |
---|
3889 | |
---|
3890 | static Function IR2L_ConEvAnalyzeEvalResults(ParamName,SortForAnalysis,FittedParameter) |
---|
3891 | string ParamName |
---|
3892 | variable SortForAnalysis,FittedParameter |
---|
3893 | |
---|
3894 | NVAR ConfEvTargetChiSqRange = root:Packages:IR2L_NLSQF:ConfEvTargetChiSqRange |
---|
3895 | SVAR SampleFullName=root:Packages:IR2L_NLSQF:FolderName_set1 |
---|
3896 | Wave StartValues=$(ParamName+"StartValue") |
---|
3897 | Wave EndValues=$(ParamName+"EndValue") |
---|
3898 | Wave ChiSquareValues=$(ParamName+"ChiSquare") |
---|
3899 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
3900 | if(SortForAnalysis) |
---|
3901 | Sort EndValues, EndValues, StartValues, ChiSquareValues |
---|
3902 | endif |
---|
3903 | |
---|
3904 | variable i |
---|
3905 | for(i=0;i<numpnts(ChiSquareValues);i+=1) |
---|
3906 | if(ChiSquareValues[i]==0) |
---|
3907 | ChiSquareValues[i]=NaN |
---|
3908 | endif |
---|
3909 | endfor |
---|
3910 | |
---|
3911 | DoWindow ChisquaredAnalysis |
---|
3912 | if(V_Flag) |
---|
3913 | DoWindow/K ChisquaredAnalysis |
---|
3914 | endif |
---|
3915 | DoWindow ChisquaredAnalysis2 |
---|
3916 | if(V_Flag) |
---|
3917 | DoWindow/K ChisquaredAnalysis2 |
---|
3918 | endif |
---|
3919 | variable levellow, levelhigh |
---|
3920 | |
---|
3921 | if(FittedParameter) //fitted parameter, chi-square analysis needs a bit different... |
---|
3922 | wavestats/Q ChiSquareValues |
---|
3923 | variable MeanChiSquare=V_avg |
---|
3924 | variable StdDevChiSquare=V_sdev |
---|
3925 | |
---|
3926 | Display/W=(35,44,555,335)/K=1 ChiSquareValues vs EndValues |
---|
3927 | DoWindow/C/T ChisquaredAnalysis,ParamName+"Chi-squared analysis of "+SampleFullName |
---|
3928 | Label left "Achieved Chi-squared" |
---|
3929 | Label bottom "End "+ParamName+" value" |
---|
3930 | ModifyGraph mirror=1 |
---|
3931 | ModifyGraph mode=3,marker=19 |
---|
3932 | SetAxis left (V_avg-1.5*(V_avg-V_min)),(V_avg+1.5*(V_max-V_avg)) |
---|
3933 | |
---|
3934 | wavestats/Q EndValues |
---|
3935 | variable MeanEndValue=V_avg |
---|
3936 | variable StdDevEndValue=V_sdev |
---|
3937 | Display/W=(35,44,555,335)/K=1 EndValues vs StartValues |
---|
3938 | DoWindow/C/T ChisquaredAnalysis2,ParamName+" reproducibility analysis of "+SampleFullName |
---|
3939 | Label left "End "+ParamName+" value" |
---|
3940 | Label bottom "Start "+ParamName+" value" |
---|
3941 | ModifyGraph mirror=1 |
---|
3942 | ModifyGraph mode=3,marker=19 |
---|
3943 | variable TempDisplayRange=max(V_avg-V_min, V_max-V_avg) |
---|
3944 | SetAxis left (V_avg-1.5*(TempDisplayRange)),(V_avg+1.5*(TempDisplayRange)) |
---|
3945 | duplicate/O ChiSquareValues, EndValuesGraphAvg, EndValuesGraphMin, EndValuesGraphMax |
---|
3946 | EndValuesGraphAvg = V_avg |
---|
3947 | EndValuesGraphMin = V_avg-V_sdev |
---|
3948 | EndValuesGraphMax = V_avg+V_sdev |
---|
3949 | AppendToGraph EndValuesGraphMax,EndValuesGraphMin,EndValuesGraphAvg vs Level1RgStartValue |
---|
3950 | ModifyGraph lstyle(EndValuesGraphMax)=1,rgb(EndValuesGraphMax)=(0,0,0) |
---|
3951 | ModifyGraph lstyle(EndValuesGraphMin)=1,rgb(EndValuesGraphMin)=(0,0,0) |
---|
3952 | ModifyGraph lstyle(EndValuesGraphAvg)=7,lsize(EndValuesGraphAvg)=2 |
---|
3953 | ModifyGraph rgb(EndValuesGraphAvg)=(0,0,0) |
---|
3954 | TextBox/C/N=text0/F=0/A=LT "Average = "+num2str(V_avg)+"\rStandard deviation = "+num2str(V_sdev)+"\rMinimum = "+num2str(V_min)+", maximum = "+num2str(V_min) |
---|
3955 | |
---|
3956 | AutoPositionWindow/M=0/R=IR1A_ConfEvaluationPanel ChisquaredAnalysis |
---|
3957 | AutoPositionWindow/M=0/R=ChisquaredAnalysis ChisquaredAnalysis2 |
---|
3958 | |
---|
3959 | IR1_CreateResultsNbk() |
---|
3960 | // IR1_AppendAnyText("Analyzed sample "+SampleFullName, 1) |
---|
3961 | IR1_AppendAnyText("Modeling II uncertainity of parameter "+ParamName, 2) |
---|
3962 | IR1_AppendAnyText(" ", 0) |
---|
3963 | IR1_AppendAnyText("Method used to evaluate parameter reproducibility: "+Method, 0) |
---|
3964 | IR1_AppendAnyGraph("ChisquaredAnalysis") |
---|
3965 | IR1_AppendAnyGraph("ChisquaredAnalysis2") |
---|
3966 | IR1_AppendAnyText(" ", 0) |
---|
3967 | IR1_CreateResultsNbk() |
---|
3968 | |
---|
3969 | else //parameter fixed.. |
---|
3970 | wavestats/q ChiSquareValues |
---|
3971 | |
---|
3972 | Display/W=(35,44,555,335)/K=1 ChiSquareValues vs EndValues |
---|
3973 | DoWindow/C/T ChisquaredAnalysis,ParamName+" Chi-squared analysis " |
---|
3974 | Label left "Achieved Chi-squared" |
---|
3975 | Label bottom ParamName+" value" |
---|
3976 | ModifyGraph mirror=1 |
---|
3977 | ModifyGraph mode=3,marker=19 |
---|
3978 | Findlevels/Q/N=2 ChiSquareValues, ConfEvTargetChiSqRange*V_min |
---|
3979 | if(V_Flag!=0) |
---|
3980 | print "The range of parameters analyzed for "+ParamName +" was not sufficiently large, code did not find large enough values for chi-squared" |
---|
3981 | IR1_CreateResultsNbk() |
---|
3982 | // IR1_AppendAnyText("Analyzed sample "+SampleFullName, 1) |
---|
3983 | IR1_AppendAnyText("Modeling II evaluation of parameter "+ParamName+" failed", 2) |
---|
3984 | IR1_AppendAnyText(" ", 0) |
---|
3985 | IR1_AppendAnyText("Method used to evaluate parameter stability: "+Method, 0) |
---|
3986 | IR1_AppendAnyText("Minimum chi-squared found = "+num2str(V_min)+" for "+ParamName+" = "+ num2str(EndValues[V_minLoc]), 0) |
---|
3987 | IR1_AppendAnyText("Range of "+ParamName+" in which the chi-squared < "+num2str(ConfEvTargetChiSqRange)+"*"+num2str(V_min)+" was not between "+num2str(EndValues[0])+" to "+ num2str(EndValues[inf]), 0) |
---|
3988 | IR1_CreateResultsNbk() |
---|
3989 | IR1_AppendAnyText(" ", 0) |
---|
3990 | else |
---|
3991 | Wave W_FindLevels |
---|
3992 | levellow=EndValues[W_FindLevels[0]] |
---|
3993 | levelhigh=EndValues[W_FindLevels[1]] |
---|
3994 | Tag/C/N=MinTagLL/F=0/L=2/TL=0/X=0.00/Y=30.00 $(nameofwave(ChiSquareValues)), W_FindLevels[0],"\\JCLow edge\r\\JC"+num2str(levellow) |
---|
3995 | Tag/C/N=MinTagHL/F=0/L=2/TL=0/X=0.00/Y=30.00 $(nameofwave(ChiSquareValues)), W_FindLevels[1],"\\JCHigh edge\r\\JC"+num2str(levelhigh) |
---|
3996 | //Tag/C/N=MinTag/F=0/L=2/TL=0/X=0.00/Y=50.00 $(nameofwave(ChiSquareValues)), V_minLoc,"Minimum chi-squared = "+num2str(V_min)+"\rat "+ParamName+" = "+num2str(EndValues[V_minLoc])+"\rRange : "+num2str(levellow)+" to "+num2str(levelhigh) |
---|
3997 | Tag/C/N=MinTag/F=0/L=2/TL=0/X=0.00/Y=50.00 $(nameofwave(ChiSquareValues)), V_minLoc,"Minimum chi-squared = "+num2str(V_min)+"\rat "+ParamName+" = "+num2str(EndValues[V_minLoc])//+"\rRange : "+num2str(levellow)+" to "+num2str(levelhigh) |
---|
3998 | AutoPositionWindow/M=0/R=LSQF2_MainPanel ChisquaredAnalysis |
---|
3999 | IR1_CreateResultsNbk() |
---|
4000 | IR1_AppendAnyText("Moldeling II Evaluation of parameter "+ParamName, 2) |
---|
4001 | IR1_AppendAnyText(" ", 0) |
---|
4002 | IR1_AppendAnyText("Method used to evaluate parameter stability: "+Method, 0) |
---|
4003 | IR1_AppendAnyText("Minimum chi-squared found = "+num2str(V_min)+" for "+ParamName+" = "+ num2str(EndValues[V_minLoc]), 0) |
---|
4004 | IR1_AppendAnyText("Range of "+ParamName+" in which the chi-squared < "+num2str(ConfEvTargetChiSqRange)+"*"+num2str(V_min)+" is from "+num2str(levellow)+" to "+ num2str(levelhigh), 0) |
---|
4005 | IR1_AppendAnyText(" ************************************************** ", 0) |
---|
4006 | IR1_AppendAnyText("\"Simplistic presentation\" for publications : >>>> "+ParamName+" = "+IN2G_roundToUncertainity(EndValues[V_minLoc], (levelhigh - levellow)/2,2),0) |
---|
4007 | //num2str(IN2G_roundSignificant(EndValues[V_minLoc],2))+" +/- "+num2str(IN2G_roundSignificant((levelhigh - levellow)/2,2)),0) |
---|
4008 | IR1_AppendAnyText(" ************************************************** ", 0) |
---|
4009 | IR1_AppendAnyGraph("ChisquaredAnalysis") |
---|
4010 | IR1_AppendAnyText(" ", 0) |
---|
4011 | IR1_CreateResultsNbk() |
---|
4012 | endif |
---|
4013 | endif |
---|
4014 | end |
---|
4015 | //****************************************************************************************************************** |
---|
4016 | //****************************************************************************************************************** |
---|
4017 | //****************************************************************************************************************** |
---|
4018 | //****************************************************************************************************************** |
---|
4019 | //****************************************************************************************************************** |
---|
4020 | //****************************************************************************************************************** |
---|
4021 | //****************************************************************************************************************** |
---|
4022 | //****************************************************************************************************************** |
---|
4023 | //****************************************************************************************************************** |
---|
4024 | //****************************************************************************************************************** |
---|
4025 | |
---|
4026 | Function IR2L_ConfEvPopMenuProc(pa) : PopupMenuControl |
---|
4027 | STRUCT WMPopupAction &pa |
---|
4028 | |
---|
4029 | switch( pa.eventCode ) |
---|
4030 | case 2: // mouse up |
---|
4031 | Variable popNum = pa.popNum |
---|
4032 | String popStr = pa.popStr |
---|
4033 | if(stringMatch(pa.ctrlName,"SelectParameter")) |
---|
4034 | if(stringmatch(popStr,"UncertainityEffect")) |
---|
4035 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
4036 | Method = "Vary data, fit params" |
---|
4037 | SetVariable ParameterMin, win=IR2L_ConfEvaluationPanel, disable=1 |
---|
4038 | SetVariable ParameterMax, win=IR2L_ConfEvaluationPanel, disable=1 |
---|
4039 | PopupMenu Method, win=IR2L_ConfEvaluationPanel, mode=6 |
---|
4040 | IR2L_ConEvSetValues(popStr) |
---|
4041 | else |
---|
4042 | SetVariable ParameterMin, win=IR2L_ConfEvaluationPanel, disable=0 |
---|
4043 | SetVariable ParameterMax, win=IR2L_ConfEvaluationPanel, disable=0 |
---|
4044 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
4045 | PopupMenu Method, win=IR2L_ConfEvaluationPanel, mode=1 |
---|
4046 | Method = "Sequential, fix param" |
---|
4047 | IR2L_ConEvSetValues(popStr) |
---|
4048 | endif |
---|
4049 | endif |
---|
4050 | if(stringMatch(pa.ctrlname,"Method")) |
---|
4051 | //here we do what is needed |
---|
4052 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
4053 | Method = popStr |
---|
4054 | endif |
---|
4055 | break |
---|
4056 | case -1: // control being killed |
---|
4057 | break |
---|
4058 | endswitch |
---|
4059 | |
---|
4060 | return 0 |
---|
4061 | End |
---|
4062 | //****************************************************************************************************************** |
---|
4063 | //****************************************************************************************************************** |
---|
4064 | //****************************************************************************************************************** |
---|
4065 | Function IR2L_ConfEvalCheckProc(cba) : CheckBoxControl |
---|
4066 | STRUCT WMCheckboxAction &cba |
---|
4067 | |
---|
4068 | switch( cba.eventCode ) |
---|
4069 | case 2: // mouse up |
---|
4070 | Variable checked = cba.checked |
---|
4071 | SetVariable ConfEvTargetChiSqRange,win= IR2L_ConfEvaluationPanel, disable=2*checked |
---|
4072 | if(checked) |
---|
4073 | IR2L_ConfEvalCalcChiSqTarget() |
---|
4074 | endif |
---|
4075 | break |
---|
4076 | case -1: // control being killed |
---|
4077 | break |
---|
4078 | endswitch |
---|
4079 | |
---|
4080 | return 0 |
---|
4081 | End |
---|
4082 | //****************************************************************************************************************** |
---|
4083 | //****************************************************************************************************************** |
---|
4084 | //****************************************************************************************************************** |
---|
4085 | Function IR2L_ConfEvalCalcChiSqTarget() |
---|
4086 | NVAR ConfEvAutoCalcTarget=root:Packages:IR2L_NLSQF:ConfEvAutoCalcTarget |
---|
4087 | NVAR ConfEvTargetChiSqRange = root:Packages:IR2L_NLSQF:ConfEvTargetChiSqRange |
---|
4088 | DoWIndow LSQF_MainGraph |
---|
4089 | variable i |
---|
4090 | if(V_Flag&&ConfEvAutoCalcTarget) |
---|
4091 | variable startRange, endRange, Allpoints |
---|
4092 | For(i=1;i<=10;i+=1) |
---|
4093 | CheckDisplayed /W=LSQF_MainGraph $("Q_set"+num2str(i)) |
---|
4094 | if(V_Flag) |
---|
4095 | NVAR Qmin_set= $("root:Packages:IR2L_NLSQF:Qmin_set"+num2str(i)) |
---|
4096 | NVAR Qmax_set = $("root:Packages:IR2L_NLSQF:Qmax_set"+num2str(i)) |
---|
4097 | Wave Qwv=$("Q_set"+num2str(i)) |
---|
4098 | findlevel/P/Q Qwv, Qmin_set |
---|
4099 | startRange = V_LevelX |
---|
4100 | findlevel/P/Q Qwv, Qmax_set |
---|
4101 | endRange = V_LevelX |
---|
4102 | Allpoints+= abs(endRange - startRange) |
---|
4103 | endif |
---|
4104 | endfor |
---|
4105 | string ListOfPrameters=IR2L_ConfEvalBuildListOfParams(0) |
---|
4106 | variable NumFItVals=ItemsInList(ListOfPrameters)-1 |
---|
4107 | //print "Found "+num2str(NumFItVals)+" fitted parameters" |
---|
4108 | //method I tried... |
---|
4109 | //ConfEvTargetChiSqRange = Allpoints/(Allpoints - NumFItVals) |
---|
4110 | //ConfEvTargetChiSqRange = (round(1000*ConfEvTargetChiSqRange))/1000 |
---|
4111 | //method from Mateus |
---|
4112 | variable DF = Allpoints - NumFItVals - 1 //DegreesOfFreedom |
---|
4113 | variable parY0 = 1.01431 |
---|
4114 | variable parA1=0.05621 |
---|
4115 | variable parT1=117.48129 |
---|
4116 | variable parA2=0.0336 |
---|
4117 | variable parT2=737.73587 |
---|
4118 | variable parA3=0.10412 |
---|
4119 | variable parT3=23.25466 |
---|
4120 | ConfEvTargetChiSqRange = parY0 + parA1*exp(-DF/parT1) + parA2*exp(-DF/parT2) + parA3*exp(-DF/parT3) |
---|
4121 | ConfEvTargetChiSqRange = (round(10000*ConfEvTargetChiSqRange))/10000 |
---|
4122 | |
---|
4123 | endif |
---|
4124 | return ConfEvTargetChiSqRange |
---|
4125 | end |
---|
4126 | //****************************************************************************************************************** |
---|
4127 | //****************************************************************************************************************** |
---|
4128 | //****************************************************************************************************************** |
---|
4129 | |
---|
4130 | |
---|
4131 | Function/S IR2L_ConfEvalBuildListOfParams(SetLimits) |
---|
4132 | variable SetLimits |
---|
4133 | |
---|
4134 | string OldDf=getDataFolder(1) |
---|
4135 | setDataFolder root:Packages:IR2L_NLSQF |
---|
4136 | variable i,j |
---|
4137 | SVAR ConfEvListOfParameters=root:Packages:IR2L_NLSQF:ConfEvListOfParameters |
---|
4138 | //Build list of paramters which user was fitting, and therefore we can analyze stability for them |
---|
4139 | //Input Data parameters... Will have _setX attached, in this method background needs to be here... |
---|
4140 | string ListOfPopulationVariables="" |
---|
4141 | string ListOfDataVariables="UseTheData;" |
---|
4142 | string ListOfPopulationsStrings="Model;FormFactor;StructureFactor;PopSizeDistShape;" |
---|
4143 | ListOfPopulationVariables+="FormFactor_Param1;FormFactor_Param2;FormFactor_Param3;FormFactor_Param4;" |
---|
4144 | ListOfPopulationVariables+="FormFactor_Param5;FormFactor_Param6;FormFactor_Param7;FormFactor_Param8;FormFactor_Param9;" |
---|
4145 | |
---|
4146 | ListOfPopulationVariables+="Volume;" |
---|
4147 | |
---|
4148 | ListOfPopulationVariables+="StructureParam1;StructureParam2;" |
---|
4149 | ListOfPopulationVariables+="StructureParam3;StructureParam4;" |
---|
4150 | ListOfPopulationVariables+="StructureParam5;StructureParam6;" |
---|
4151 | //Unified level parameters |
---|
4152 | ListOfPopulationVariables+="UF_G;UF_Rg;UF_B;UF_P;UF_RGCO;" |
---|
4153 | //Diffraction peak parameters |
---|
4154 | ListOfPopulationVariables+="DiffPeakPar1;DiffPeakPar2;DiffPeakPar3;DiffPeakPar4;DiffPeakPar5;" |
---|
4155 | ConfEvListOfParameters="" |
---|
4156 | string tempName |
---|
4157 | |
---|
4158 | //Common Size distribution Model parameters, these need to have _popX attached at the end of name |
---|
4159 | string tempStr |
---|
4160 | For(j=1;j<=10;j+=1) |
---|
4161 | NVAR UseThePop=$("root:Packages:IR2L_NLSQF:UseThePop_pop"+num2str(j)) |
---|
4162 | if(UseThePop) |
---|
4163 | //these are common variables |
---|
4164 | ListOfPopulationVariables="" |
---|
4165 | SVAR Model=$("root:Packages:IR2L_NLSQF:Model_pop"+num2str(j)) //Size dist, Unified level, Diffraction peak |
---|
4166 | SVAR PopSizeDistShape=$("root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(j)) |
---|
4167 | if(stringMatch(Model,"Size dist.")) |
---|
4168 | ListOfPopulationVariables+="Volume;" |
---|
4169 | if(stringMatch(PopSizeDistShape,"Gauss")) |
---|
4170 | ListOfPopulationVariables+="GMeanSize;GWidth;" |
---|
4171 | elseif(stringMatch(PopSizeDistShape,"LogNormal")) |
---|
4172 | ListOfPopulationVariables+="LNMinSize;LNMeanSize;LNSdeviation;" |
---|
4173 | elseif(stringMatch(PopSizeDistShape,"LSW")) |
---|
4174 | ListOfPopulationVariables+="LSWLocation;" |
---|
4175 | else |
---|
4176 | ListOfPopulationVariables+="SZMeanSize;SZWidth;" |
---|
4177 | endif |
---|
4178 | ListOfPopulationVariables+="FormFactor_Param1;FormFactor_Param2;FormFactor_Param3;FormFactor_Param4;" |
---|
4179 | ListOfPopulationVariables+="FormFactor_Param5;FormFactor_Param6;FormFactor_Param7;FormFactor_Param8;FormFactor_Param9;" |
---|
4180 | elseif(stringMatch(Model,"Unified level")) |
---|
4181 | ListOfPopulationVariables+="Volume;" |
---|
4182 | ListOfPopulationVariables+="UF_G;UF_Rg;UF_B;UF_P;UF_RGCO;" |
---|
4183 | else //diffraction peak |
---|
4184 | ListOfPopulationVariables+="DiffPeakPar1;DiffPeakPar2;DiffPeakPar3;DiffPeakPar4;DiffPeakPar5;" |
---|
4185 | endif |
---|
4186 | SVAR StructureFactor=$("root:Packages:IR2L_NLSQF:StructureFactor_pop"+num2str(j)) |
---|
4187 | if(!stringMatch(StructureFactor,"Dilute system")&&(stringMatch(Model,"Size dist.")||stringMatch(Model,"Unified level"))) |
---|
4188 | ListOfPopulationVariables+="StructureParam1;StructureParam2;" |
---|
4189 | ListOfPopulationVariables+="StructureParam3;StructureParam4;" |
---|
4190 | ListOfPopulationVariables+="StructureParam5;StructureParam6;" |
---|
4191 | else |
---|
4192 | |
---|
4193 | endif |
---|
4194 | for (i=0;i<itemsInList(ListOfPopulationVariables);i+=1) |
---|
4195 | //these are common variables - for form factor |
---|
4196 | tempStr = stringFromList(i,ListOfPopulationVariables) |
---|
4197 | NVAR FitVarVal=$("root:Packages:IR2L_NLSQF:"+tempStr+"Fit_pop"+num2str(j)) |
---|
4198 | if(FitVarVal) |
---|
4199 | ConfEvListOfParameters+=tempStr+"_pop"+num2str(j)+";" |
---|
4200 | endif |
---|
4201 | endfor |
---|
4202 | |
---|
4203 | endif |
---|
4204 | endfor |
---|
4205 | |
---|
4206 | |
---|
4207 | for (i=1;i<=10;i+=1) |
---|
4208 | NVAR UseData=$("root:Packages:IR2L_NLSQF:UseTheData_set"+num2str(i)) |
---|
4209 | NVAR BckgFit = $("root:Packages:IR2L_NLSQF:BackgroundFit_set"+num2str(i)) |
---|
4210 | if(UseData && BckgFit) |
---|
4211 | ConfEvListOfParameters+="Background_set"+num2str(i)+";" |
---|
4212 | endif |
---|
4213 | endfor |
---|
4214 | |
---|
4215 | //print ConfEvListOfParameters |
---|
4216 | SVAR Method = root:Packages:IR2L_NLSQF:ConEvMethod |
---|
4217 | SVAR ConEvSelParameter=root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
4218 | if(strlen(Method)<5) |
---|
4219 | Method = "Sequential, fix param" |
---|
4220 | endif |
---|
4221 | if(SetLimits) |
---|
4222 | ConEvSelParameter = stringFromList(0,ConfEvListOfParameters) |
---|
4223 | IR2L_ConEvSetValues(ConEvSelParameter) |
---|
4224 | endif |
---|
4225 | setDataFolder OldDf |
---|
4226 | return ConfEvListOfParameters+"UncertainityEffect;" |
---|
4227 | end |
---|
4228 | |
---|
4229 | //****************************************************************************************************************** |
---|
4230 | //****************************************************************************************************************** |
---|
4231 | //****************************************************************************************************************** |
---|
4232 | Function IR2L_ConEvSetValues(popStr) |
---|
4233 | string popStr |
---|
4234 | SVAR ConEvSelParameter=root:Packages:IR2L_NLSQF:ConEvSelParameter |
---|
4235 | ConEvSelParameter = popStr |
---|
4236 | NVAR/Z CurPar = $("root:Packages:IR2L_NLSQF:"+ConEvSelParameter) |
---|
4237 | if(!NVAR_Exists(CurPar)) |
---|
4238 | //something wrong here, bail out |
---|
4239 | return 0 |
---|
4240 | endif |
---|
4241 | if(StringMatch(popStr, "Backg*") ) |
---|
4242 | NVAR CurparLL = $("root:Packages:IR2L_NLSQF:"+ReplaceString("_set", ConEvSelParameter, "Min_set" ) ) |
---|
4243 | NVAR CurparHL = $("root:Packages:IR2L_NLSQF:"+ReplaceString("_set", ConEvSelParameter, "Max_set" )) |
---|
4244 | else |
---|
4245 | NVAR CurparLL = $("root:Packages:IR2L_NLSQF:"+ReplaceString("_pop", ConEvSelParameter, "Min_pop" ) ) |
---|
4246 | NVAR CurparHL = $("root:Packages:IR2L_NLSQF:"+ReplaceString("_pop", ConEvSelParameter, "Max_pop" )) |
---|
4247 | endif |
---|
4248 | NVAR ConfEvMinVal = root:Packages:IR2L_NLSQF:ConfEvMinVal |
---|
4249 | NVAR ConfEvMaxVal = root:Packages:IR2L_NLSQF:ConfEvMaxVal |
---|
4250 | NVAR ConfEvNumSteps = root:Packages:IR2L_NLSQF:ConfEvNumSteps |
---|
4251 | if(ConfEvNumSteps<3) |
---|
4252 | ConfEvNumSteps=20 |
---|
4253 | endif |
---|
4254 | if(stringMatch(ConEvSelParameter,"Volume*")) |
---|
4255 | ConfEvMinVal = 0.8*CurPar |
---|
4256 | ConfEvMaxVal = 1.2 * Curpar |
---|
4257 | elseif(stringMatch(ConEvSelParameter,"UF_P*")) |
---|
4258 | ConfEvMinVal = 0.95*CurPar |
---|
4259 | ConfEvMaxVal = 1.05 * Curpar |
---|
4260 | elseif(stringMatch(ConEvSelParameter,"UF_G*")) |
---|
4261 | ConfEvMinVal = 0.5*CurPar |
---|
4262 | ConfEvMaxVal = 2* Curpar |
---|
4263 | elseif(stringMatch(ConEvSelParameter,"UF_B*")) |
---|
4264 | ConfEvMinVal = 0.5*CurPar |
---|
4265 | ConfEvMaxVal = 2* Curpar |
---|
4266 | elseif(stringMatch(ConEvSelParameter,"UF_Rg*")) |
---|
4267 | ConfEvMinVal = 0.8*CurPar |
---|
4268 | ConfEvMaxVal = 1.2* Curpar |
---|
4269 | elseif(stringMatch(ConEvSelParameter,"*Structure*")) |
---|
4270 | ConfEvMinVal = 0.9*CurPar |
---|
4271 | ConfEvMaxVal = 1.1* Curpar |
---|
4272 | elseif(stringMatch(ConEvSelParameter,"Background*")) |
---|
4273 | ConfEvMinVal = 0.2*CurPar |
---|
4274 | ConfEvMaxVal = 5* Curpar |
---|
4275 | else |
---|
4276 | ConfEvMinVal = 0.8*CurPar |
---|
4277 | ConfEvMaxVal = 1.2* Curpar |
---|
4278 | endif |
---|
4279 | //check limits... |
---|
4280 | if(CurparLL>ConfEvMinVal) |
---|
4281 | ConfEvMinVal = 1.01*CurparLL |
---|
4282 | endif |
---|
4283 | if(CurparHL<ConfEvMaxVal) |
---|
4284 | ConfEvMaxVal = 0.99 * CurparHL |
---|
4285 | endif |
---|
4286 | DoWIndow IR2L_ConfEvaluationPanel |
---|
4287 | if(V_Flag) |
---|
4288 | Execute("SetVariable ParameterMin,win=IR2L_ConfEvaluationPanel, limits={0, "+num2str(Curpar)+", "+num2str(0.05*Curpar)+"}") |
---|
4289 | Execute("SetVariable ParameterMax,win=IR2L_ConfEvaluationPanel, limits={"+num2str(Curpar)+", inf, "+num2str(0.05*Curpar)+"}") |
---|
4290 | endif |
---|
4291 | |
---|
4292 | end |
---|
4293 | |
---|
4294 | //****************************************************************************************************************** |
---|
4295 | //****************************************************************************************************************** |
---|
4296 | //****************************************************************************************************************** |
---|
4297 | |
---|