1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion=6.1 |
---|
3 | #pragma version=4.00 |
---|
4 | |
---|
5 | //************************ |
---|
6 | // |
---|
7 | // Utility procedure to allow the user to select exactly which fitting |
---|
8 | // functions they wish to include in their experiment. Smearing and plotting |
---|
9 | // procedures are automatically included |
---|
10 | // |
---|
11 | // Functions are now in "SANS Models" Menu, with submenus for |
---|
12 | // smeared/unsmeared functions |
---|
13 | // |
---|
14 | // this change was prompted due to the 31 item limitation of Windows submenus |
---|
15 | // resulting in functions being unavailable in the curve fitting dialog |
---|
16 | // |
---|
17 | // A built-in list of procedure files is included, and should match the current |
---|
18 | // distribution package -- see the procedure asdf() for instructions on how |
---|
19 | // to update the built-in list of procedures |
---|
20 | // |
---|
21 | // SRK 091801 |
---|
22 | // |
---|
23 | // Updated for easier use 02 JUL 04 SRK |
---|
24 | // |
---|
25 | // SRK 16DEC05 added utility function to get the list of all functions |
---|
26 | // first - select and include all of the models |
---|
27 | // -- Proc GetAllModelFunctions() |
---|
28 | // |
---|
29 | // SEE TypeNewModelList() for instructions on how to permanently add new model |
---|
30 | // functions to the list... (APR 06 SRK) |
---|
31 | // |
---|
32 | // added Freeze Model - to duplicate a model function/strip the dependency |
---|
33 | // and plot it on the top graph - so that parameters can be changed... |
---|
34 | // SRK 09 JUN 2006 |
---|
35 | // |
---|
36 | //*************************** |
---|
37 | |
---|
38 | // main procedure for invoking the Procedure list panel |
---|
39 | // initializes each time to make sure |
---|
40 | Proc ModelPicker_Panel() |
---|
41 | |
---|
42 | DoWindow/F Procedure_List |
---|
43 | if(V_Flag==0) |
---|
44 | Init_FileList() |
---|
45 | Procedure_List() |
---|
46 | AutoPositionWindow/M=1/R=WrapperPanel Procedure_List //keep it on-screen |
---|
47 | endif |
---|
48 | End |
---|
49 | |
---|
50 | // initialization procedure to create the necessary data folder and the waves for |
---|
51 | // the list box in the panel |
---|
52 | Proc Init_FileList() |
---|
53 | //create the data folders and globals |
---|
54 | NewDataFolder/O root:Packages |
---|
55 | NewDataFolder/O root:Packages:NIST |
---|
56 | |
---|
57 | if(!DataFolderExists("root:Packages:NIST:FileList")) |
---|
58 | NewDataFolder/O/S root:Packages:NIST:FileList |
---|
59 | //create the waves |
---|
60 | Make/O/T/N=0 fileWave,includedFileWave |
---|
61 | Make/O/N=0 selWave,selToDelWave |
---|
62 | // String/G allFiles="" |
---|
63 | String/G MenuItemStr1="" |
---|
64 | String/G MenuItemStr2="" |
---|
65 | //DON'T create MenuItemStr_def |
---|
66 | |
---|
67 | // a switch for me to turn off file checking |
---|
68 | Variable/G checkForFiles=1 //set to true initially |
---|
69 | |
---|
70 | // always turn off file checking for me |
---|
71 | checkForFiles = !(stringmatch(ParseFilePath(0,SpecialDirPath("Desktop",0,0,0),":",1,1),"s*ine")) //zero for me |
---|
72 | |
---|
73 | // turn off file checking if the proper alias to the NCNR procedures is there |
---|
74 | PathInfo igor |
---|
75 | NewPath/O/Q tmpUPPath S_Path + "User Procedures" |
---|
76 | String fileList = IndexedFile(tmpUPPath,-1,"????") |
---|
77 | if(strsearch(fileList, "NCNR_User_Procedures", 0 , 2) != -1) //ignore case |
---|
78 | checkforfiles = 0 |
---|
79 | Print "found the proper procedures" |
---|
80 | endif |
---|
81 | |
---|
82 | //fill the list of procedures |
---|
83 | // |
---|
84 | // first time, create wave from built-in list |
---|
85 | FileList_BuiltInList() //makes sure that the wave exists |
---|
86 | FileList_GetListButtonProc("") //converts it into a list for the panel |
---|
87 | |
---|
88 | // "include" nothing to force a load of the utility procedures |
---|
89 | FileList_InsertButtonProc("") |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | SetDataFolder root: |
---|
94 | Endif |
---|
95 | End |
---|
96 | |
---|
97 | |
---|
98 | // for my own testing to read in a new list of procedures |
---|
99 | // FileList_GetListButtonProc("") will only read in a new list |
---|
100 | // if the wave SANS_Model_List does not exist |
---|
101 | Proc ReadNewProcList() |
---|
102 | KillWaves/Z root:Packages:NIST:FileList:SANS_Model_List //kill the old list |
---|
103 | FileList_GetListButtonProc("") |
---|
104 | End |
---|
105 | |
---|
106 | // To create a new "Built-in" list of procedures, edit the |
---|
107 | // wave SANS_Model_List (a text wave), adding your new procedure names |
---|
108 | // (sort alphabetically if desired) |
---|
109 | // then use TypeNewModelList() to spit out the text format. |
---|
110 | // then paste this list into FileList_BuiltInList |
---|
111 | // |
---|
112 | // note that you won't have help for these new procedures until |
---|
113 | // you update the function documentation, making the name of the procedure |
---|
114 | // file a Subtopic |
---|
115 | // |
---|
116 | Proc TypeNewModelList() |
---|
117 | variable ii=0,num=numpnts(root:Packages:NIST:FileList:SANS_Model_List) |
---|
118 | printf "Make/O/T/N=%d SANS_Model_List\r\r",num |
---|
119 | do |
---|
120 | printf "SANS_Model_List[%d] = \"%s\"\r",ii,root:Packages:NIST:FileList:SANS_Model_List[ii] |
---|
121 | ii+=1 |
---|
122 | while(ii<num) |
---|
123 | End |
---|
124 | |
---|
125 | Proc FileList_BuiltInList() |
---|
126 | SetDataFolder root:Packages:NIST:FileList |
---|
127 | |
---|
128 | ////paste here... after deleting the old make statement and list |
---|
129 | |
---|
130 | Make/O/T/N=92 SANS_Model_List |
---|
131 | |
---|
132 | SANS_Model_List[0] = "BE_Polyelectrolyte.ipf" |
---|
133 | SANS_Model_List[1] = "CoreShellCylinder.ipf" |
---|
134 | SANS_Model_List[2] = "CoreShell_Sq.ipf" |
---|
135 | SANS_Model_List[3] = "CoreShell.ipf" |
---|
136 | SANS_Model_List[4] = "Cylinder_Sq.ipf" |
---|
137 | SANS_Model_List[5] = "Cylinder.ipf" |
---|
138 | SANS_Model_List[6] = "DAB_model.ipf" |
---|
139 | SANS_Model_List[7] = "HPMSA.ipf" |
---|
140 | SANS_Model_List[8] = "HardSphereStruct.ipf" |
---|
141 | SANS_Model_List[9] = "HollowCylinders.ipf" |
---|
142 | SANS_Model_List[10] = "Lorentz_model.ipf" |
---|
143 | SANS_Model_List[11] = "OblateCoreShell_Sq.ipf" |
---|
144 | SANS_Model_List[12] = "OblateCoreShell.ipf" |
---|
145 | SANS_Model_List[13] = "Peak_Gauss_model.ipf" |
---|
146 | SANS_Model_List[14] = "Peak_Lorentz_model.ipf" |
---|
147 | SANS_Model_List[15] = "PolyCoreShellRatio_Sq.ipf" |
---|
148 | SANS_Model_List[16] = "PolyCoreShellRatio.ipf" |
---|
149 | SANS_Model_List[17] = "PolyCore_Sq.ipf" |
---|
150 | SANS_Model_List[18] = "PolyCore.ipf" |
---|
151 | SANS_Model_List[19] = "PolyHardSphereInten.ipf" |
---|
152 | SANS_Model_List[20] = "PolyRectSphere_Sq.ipf" |
---|
153 | SANS_Model_List[21] = "PolyRectSphere.ipf" |
---|
154 | SANS_Model_List[22] = "Power_Law_model.ipf" |
---|
155 | SANS_Model_List[23] = "ProlateCoreShell_Sq.ipf" |
---|
156 | SANS_Model_List[24] = "ProlateCoreShell.ipf" |
---|
157 | SANS_Model_List[25] = "SmearedRPA.ipf" |
---|
158 | SANS_Model_List[26] = "Sphere_Sq.ipf" |
---|
159 | SANS_Model_List[27] = "Sphere.ipf" |
---|
160 | SANS_Model_List[28] = "SquareWellStruct.ipf" |
---|
161 | SANS_Model_List[29] = "StackedDiscs.ipf" |
---|
162 | SANS_Model_List[30] = "Teubner.ipf" |
---|
163 | SANS_Model_List[31] = "UniformEllipsoid_Sq.ipf" |
---|
164 | SANS_Model_List[32] = "UniformEllipsoid.ipf" |
---|
165 | SANS_Model_List[33] = "CoreShellCyl2D.ipf" |
---|
166 | SANS_Model_List[34] = "Cylinder_2D.ipf" |
---|
167 | SANS_Model_List[35] = "Ellipsoid2D.ipf" |
---|
168 | SANS_Model_List[36] = "EllipticalCylinder2D.ipf" |
---|
169 | SANS_Model_List[37] = "Beaucage.ipf" |
---|
170 | SANS_Model_List[38] = "BimodalSchulzSpheres.ipf" |
---|
171 | SANS_Model_List[39] = "BinaryHardSpheres.ipf" |
---|
172 | SANS_Model_List[40] = "Cylinder_PolyLength.ipf" |
---|
173 | SANS_Model_List[41] = "Cylinder_PolyRadius.ipf" |
---|
174 | SANS_Model_List[42] = "Debye.ipf" |
---|
175 | SANS_Model_List[43] = "EllipticalCylinder.ipf" |
---|
176 | SANS_Model_List[44] = "FlexCyl_EllipCross.ipf" |
---|
177 | SANS_Model_List[45] = "FlexCyl_PolyLen.ipf" |
---|
178 | SANS_Model_List[46] = "FlexCyl_PolyRadius.ipf" |
---|
179 | SANS_Model_List[47] = "FlexibleCylinder.ipf" |
---|
180 | SANS_Model_List[48] = "Fractal.ipf" |
---|
181 | SANS_Model_List[49] = "GaussSpheres_Sq.ipf" |
---|
182 | SANS_Model_List[50] = "GaussSpheres.ipf" |
---|
183 | SANS_Model_List[51] = "LamellarFF_HG.ipf" |
---|
184 | SANS_Model_List[52] = "LamellarFF.ipf" |
---|
185 | SANS_Model_List[53] = "LamellarPS_HG.ipf" |
---|
186 | SANS_Model_List[54] = "LamellarPS.ipf" |
---|
187 | SANS_Model_List[55] = "LogNormalSphere_Sq.ipf" |
---|
188 | SANS_Model_List[56] = "LogNormalSphere.ipf" |
---|
189 | SANS_Model_List[57] = "MultiShell.ipf" |
---|
190 | SANS_Model_List[58] = "Parallelepiped.ipf" |
---|
191 | SANS_Model_List[59] = "PolyCoreShellCylinder.ipf" |
---|
192 | SANS_Model_List[60] = "SchulzSpheres_Sq.ipf" |
---|
193 | SANS_Model_List[61] = "SchulzSpheres.ipf" |
---|
194 | SANS_Model_List[62] = "StickyHardSphereStruct.ipf" |
---|
195 | SANS_Model_List[63] = "TriaxialEllipsoid.ipf" |
---|
196 | SANS_Model_List[64] = "Vesicle_UL_and_Struct.ipf" |
---|
197 | SANS_Model_List[65] = "Vesicle_UL.ipf" |
---|
198 | //2008 Models |
---|
199 | SANS_Model_List[66] = "Core_and_NShells.ipf" |
---|
200 | SANS_Model_List[67] = "PolyCore_and_NShells.ipf" |
---|
201 | SANS_Model_List[68] = "Fractal_PolySphere.ipf" |
---|
202 | SANS_Model_List[69] = "GaussLorentzGel.ipf" |
---|
203 | SANS_Model_List[70] = "PolyGaussCoil.ipf" |
---|
204 | SANS_Model_List[71] = "Two_Power_Law.ipf" |
---|
205 | SANS_Model_List[72] = "BroadPeak.ipf" |
---|
206 | SANS_Model_List[73] = "CorrelationLengthModel.ipf" |
---|
207 | SANS_Model_List[74] = "TwoLorentzian.ipf" |
---|
208 | SANS_Model_List[75] = "PolyGaussShell.ipf" |
---|
209 | SANS_Model_List[76] = "LamellarParacrystal.ipf" |
---|
210 | SANS_Model_List[77] = "SC_ParaCrystal.ipf" |
---|
211 | SANS_Model_List[78] = "BCC_ParaCrystal.ipf" |
---|
212 | SANS_Model_List[79] = "FCC_ParaCrystal.ipf" |
---|
213 | SANS_Model_List[80] = "Spherocylinder.ipf" |
---|
214 | SANS_Model_List[81] = "Dumbbell.ipf" |
---|
215 | SANS_Model_List[82] = "ConvexLens.ipf" |
---|
216 | SANS_Model_List[83] = "CappedCylinder.ipf" |
---|
217 | SANS_Model_List[84] = "Barbell.ipf" |
---|
218 | //2009 Models |
---|
219 | SANS_Model_List[85] = "PolyCoreBicelle.ipf" |
---|
220 | SANS_Model_List[86] = "CSParallelepiped.ipf" |
---|
221 | SANS_Model_List[87] = "Fractal_PolyCore.ipf" |
---|
222 | SANS_Model_List[88] = "FuzzySpheres.ipf" |
---|
223 | SANS_Model_List[89] = "FuzzySpheres_Sq.ipf" |
---|
224 | //2010 models |
---|
225 | SANS_Model_List[90] = "Guinier_Porod.ipf" |
---|
226 | SANS_Model_List[91] = "PolymerExcludVol.ipf" |
---|
227 | |
---|
228 | ///end paste here |
---|
229 | End |
---|
230 | |
---|
231 | //another way to add a single procedure name to the list |
---|
232 | // (only in the current experiment!) |
---|
233 | // not a permanent add to the template, unless you re-save the |
---|
234 | // template |
---|
235 | Proc AddProcedureToList(ProcedureName) |
---|
236 | String ProcedureName |
---|
237 | |
---|
238 | SetDataFolder root:Packages:NIST:FileList |
---|
239 | Variable num |
---|
240 | num=numpnts(fileWave) |
---|
241 | Redimension/N=(num+1) fileWave |
---|
242 | fileWave[num] = ProcedureName |
---|
243 | num=numpnts(selWave) |
---|
244 | Redimension/N=(num+1) selWave |
---|
245 | selWave[num] = 0 |
---|
246 | |
---|
247 | SetDataFolder root: |
---|
248 | End |
---|
249 | ///////////////////////////////////////////////////////////// |
---|
250 | |
---|
251 | |
---|
252 | Proc doCheck(val) |
---|
253 | Variable val |
---|
254 | // a switch for me to turn off file checking |
---|
255 | root:Packages:NIST:FileList:checkForFiles=val //0==no check, 1=check |
---|
256 | End |
---|
257 | |
---|
258 | |
---|
259 | //Function MakeMenu_ButtonProc(ctrlName) : ButtonControl |
---|
260 | // String ctrlName |
---|
261 | |
---|
262 | // RefreshMenu() |
---|
263 | //End |
---|
264 | |
---|
265 | //procedure for drawing the simple panel to pick and compile selected models |
---|
266 | // |
---|
267 | Proc Procedure_List() |
---|
268 | PauseUpdate; Silent 1 // building window... |
---|
269 | NewPanel /W=(1115,44,1453,363) /K=2 |
---|
270 | DoWindow/C Procedure_List |
---|
271 | ModifyPanel fixedSize=1 |
---|
272 | |
---|
273 | ListBox fileList,pos={4,3},size={200,203},listWave=root:Packages:NIST:FileList:fileWave |
---|
274 | ListBox fileList,selWave=root:Packages:NIST:FileList:selWave,mode= 4 |
---|
275 | ListBox inclList,pos={4,212},size={200,100} |
---|
276 | ListBox inclList,listWave=root:Packages:NIST:FileList:includedFileWave |
---|
277 | ListBox inclList,selWave=root:Packages:NIST:FileList:selToDelWave,mode= 4 |
---|
278 | Button button0,pos={212,173},size={110,20},proc=FileList_InsertButtonProc,title="Include File(s)" |
---|
279 | Button button0,help={"Includes the selected procedures, functions appear under the SANS Models menu"} |
---|
280 | Button button5,pos={212,283},size={110,20},proc=FileList_RemoveButtonProc,title="Remove File(s)" |
---|
281 | Button button5,help={"Removes selected procedures from the experiment"} |
---|
282 | Button PickerButton,pos={212,14},size={90,20},proc=FileList_HelpButtonProc,title="Help" |
---|
283 | Button PickerButton,help={"If you need help understanding what a help button does, you really need help"} |
---|
284 | Button button1,pos={212,37},size={100,20},proc=FileList_HelpButtonProc,title="Function Help" |
---|
285 | Button button1,help={"If you need help understanding what a help button does, you really need help"} |
---|
286 | GroupBox group0,pos={203,128},size={46,11},title="Select model functions" |
---|
287 | GroupBox group0_1,pos={203,145},size={46,11},title="to include" |
---|
288 | EndMacro |
---|
289 | |
---|
290 | |
---|
291 | //button function to prompt user to select path where procedures are located |
---|
292 | Function FL_PickButtonProc(ctrlName) : ButtonControl |
---|
293 | String ctrlName |
---|
294 | |
---|
295 | PickProcPath() |
---|
296 | End |
---|
297 | |
---|
298 | //bring the help notebook to the front |
---|
299 | Function FileList_HelpButtonProc(ctrlName) : ButtonControl |
---|
300 | String ctrlName |
---|
301 | |
---|
302 | if(cmpstr(ctrlName,"PickerButton")==0) //PickerButton is the picker help |
---|
303 | DisplayHelpTopic/Z/K=1 "SANS Model Picker" |
---|
304 | if(V_flag !=0) |
---|
305 | DoAlert 0,"The SANS Model Picker Help file could not be found" |
---|
306 | endif |
---|
307 | return(0) |
---|
308 | endif |
---|
309 | |
---|
310 | //otherwise, show the help for the selected function |
---|
311 | //loop through the selected files in the list... |
---|
312 | // |
---|
313 | Wave/T fileWave=$"root:Packages:NIST:FileList:fileWave" |
---|
314 | Wave sel=$"root:Packages:NIST:FileList:selWave" |
---|
315 | |
---|
316 | Variable num=numpnts(sel),ii |
---|
317 | String fname="" |
---|
318 | |
---|
319 | // NVAR doCheck=root:Packages:NIST:FileList:checkForFiles |
---|
320 | ii=num-1 //work bottom-up to not lose the index |
---|
321 | do |
---|
322 | if(sel[ii] == 1) |
---|
323 | fname = fileWave[ii] //RemoveExten(fileWave[ii]) |
---|
324 | endif |
---|
325 | ii-=1 |
---|
326 | while(ii>=0) |
---|
327 | |
---|
328 | // nothing selected in the list to include, |
---|
329 | //try the list of already-included files |
---|
330 | if(cmpstr(fname,"")==0) |
---|
331 | Wave/T inclFileWave=$"root:Packages:NIST:FileList:includedFileWave" |
---|
332 | Wave seltoDel=$"root:Packages:NIST:FileList:selToDelWave" |
---|
333 | num=numpnts(seltoDel) |
---|
334 | ii=num-1 //work bottom-up to not lose the index |
---|
335 | do |
---|
336 | if(seltoDel[ii] == 1) |
---|
337 | fname = inclFileWave[ii] //RemoveExten(fileWave[ii]) |
---|
338 | endif |
---|
339 | ii-=1 |
---|
340 | while(ii>=0) |
---|
341 | endif |
---|
342 | |
---|
343 | if(cmpstr(fname,"")!=0) |
---|
344 | // Print "show help for ",RemoveExten(fname) |
---|
345 | // Print fname[strlen(fname)-11,strlen(fname)-1] |
---|
346 | // Print fname |
---|
347 | if(cmpstr(fname[strlen(fname)-7,strlen(fname)-1],"_Sq.ipf") ==0 ) |
---|
348 | DisplayHelpTopic/Z/K=1 "How Form Factors and Structure Factors are Combined" |
---|
349 | if(V_flag !=0) |
---|
350 | DoAlert 0,"The Help file could not be found" |
---|
351 | endif |
---|
352 | else |
---|
353 | DisplayHelpTopic/Z/K=1 fname |
---|
354 | if(V_flag !=0) |
---|
355 | DoAlert 0,"The Help file could not be found for " + fname |
---|
356 | endif |
---|
357 | endif |
---|
358 | else |
---|
359 | DoAlert 0,"Please select a function from the list to display its help file" |
---|
360 | endif |
---|
361 | |
---|
362 | return(0) |
---|
363 | End |
---|
364 | |
---|
365 | //closes the panel when done |
---|
366 | Function FileListDoneButtonProc(ctrlName) : ButtonControl |
---|
367 | String ctrlName |
---|
368 | |
---|
369 | //kill the panel |
---|
370 | DoWindow/K Procedure_List |
---|
371 | return(0) |
---|
372 | End |
---|
373 | |
---|
374 | //reads in the list of procedures |
---|
375 | // (in practice, the list will be part of the experiment) |
---|
376 | // but this can be used to easily update the list if |
---|
377 | // new models are added, or if a custom list is desired |
---|
378 | // - these lists could also be stored in the template |
---|
379 | // |
---|
380 | Function FileList_GetListButtonProc(ctrlName) : ButtonControl |
---|
381 | String ctrlName |
---|
382 | |
---|
383 | String list="" |
---|
384 | |
---|
385 | if(Exists("root:Packages:NIST:FileList:SANS_Model_List") != 1) |
---|
386 | SetDataFolder root:Packages:NIST:FileList |
---|
387 | LoadWave/A/T |
---|
388 | WAVE/T w=$(StringFromList(0,S_WaveNames,";")) |
---|
389 | SetDataFolder root: |
---|
390 | else |
---|
391 | WAVE/T w=$("root:Packages:NIST:FileList:SANS_Model_List") |
---|
392 | endif |
---|
393 | |
---|
394 | // // convert the input wave to a semi-list |
---|
395 | // SVAR allFiles=root:Packages:NIST:FileList:allFiles |
---|
396 | // allFiles=MP_TextWave2SemiList(w) |
---|
397 | list=MP_TextWave2SemiList(w) |
---|
398 | |
---|
399 | //get the list of available files from the specified path |
---|
400 | String newList="",item="" |
---|
401 | Variable num=ItemsInList(list,";"),ii |
---|
402 | |
---|
403 | // remove the items that have already been included |
---|
404 | Wave/T includedFileWave=$"root:Packages:NIST:FileList:includedFileWave" |
---|
405 | Variable numInc=numpnts(includedFileWave) |
---|
406 | for(ii=0;ii<numInc;ii+=1) |
---|
407 | list = RemoveFromList(includedFileWave[ii],list,";") |
---|
408 | endfor |
---|
409 | list = SortList(list,";",0) |
---|
410 | num=ItemsInList(list,";") |
---|
411 | WAVE/T fileWave=$"root:Packages:NIST:FileList:fileWave" |
---|
412 | WAVE selWave=$"root:Packages:NIST:FileList:selWave" |
---|
413 | Redimension/N=(num) fileWave //make the waves the proper length |
---|
414 | Redimension/N=(num) selWave |
---|
415 | fileWave = StringFromList(p,list,";") //converts the list to a wave |
---|
416 | Sort filewave,filewave |
---|
417 | |
---|
418 | return(0) |
---|
419 | End |
---|
420 | |
---|
421 | //*******OLD WAY******* |
---|
422 | //*******NOT USED******* |
---|
423 | //gets the list of files in the folder specified by procPathName |
---|
424 | //filters the list to remove some of the procedures that the user does not need to see |
---|
425 | // list is assigned to textbox wave |
---|
426 | Function OLD_FileList_GetListButtonProc(ctrlName) : ButtonControl |
---|
427 | String ctrlName |
---|
428 | |
---|
429 | //make sure that path exists |
---|
430 | PathInfo procPathName |
---|
431 | if (V_flag == 0) |
---|
432 | //Abort "Folder path does not exist - use Pick Path button to set path" |
---|
433 | //build the path to the User Procedures folder |
---|
434 | PathInfo Igor |
---|
435 | // Print S_Path |
---|
436 | String UserProcStr=S_path+"User Procedures:" |
---|
437 | NewPath/O/Q procPathName UserProcStr |
---|
438 | Endif |
---|
439 | |
---|
440 | String list="" |
---|
441 | // list=IndexedFile(procPathName,-1,"????") |
---|
442 | |
---|
443 | // new way, to catch all files in all subfolders |
---|
444 | SVAR allFiles=root:Packages:NIST:FileList:allFiles |
---|
445 | allFiles="" //clear the list |
---|
446 | |
---|
447 | ListAllFilesAndFolders("procPathName",1,1,0) //this sets allFiles |
---|
448 | list = allFiles |
---|
449 | |
---|
450 | //get the list of available files from the specified path |
---|
451 | |
---|
452 | String newList="",item="" |
---|
453 | Variable num=ItemsInList(list,";"),ii |
---|
454 | //remove procedures from the list the are unrelated, or may be loaded by default (Utils) |
---|
455 | list = RemoveFromList(".DS_Store",list,";") //occurs on OSX, not "hidden" to Igor |
---|
456 | list = RemoveFromList("GaussUtils.ipf",list,";" ) |
---|
457 | list = RemoveFromList("PlotUtils.ipf",list,";" ) |
---|
458 | list = RemoveFromList("PlotUtilsMacro.ipf",list,";" ) |
---|
459 | list = RemoveFromList("WriteModelData.ipf",list,";" ) |
---|
460 | list = RemoveFromList("WMMenus.ipf",list,";" ) |
---|
461 | list = RemoveFromList("DemoLoader.ipf",list,";" ) |
---|
462 | // remove the items that have already been included |
---|
463 | Wave/T includedFileWave=$"root:Packages:NIST:FileList:includedFileWave" |
---|
464 | Variable numInc=numpnts(includedFileWave) |
---|
465 | for(ii=0;ii<numInc;ii+=1) |
---|
466 | list = RemoveFromList(includedFileWave[ii],list,";") |
---|
467 | endfor |
---|
468 | list = SortList(list,";",0) |
---|
469 | num=ItemsInList(list,";") |
---|
470 | WAVE/T fileWave=$"root:Packages:NIST:FileList:fileWave" |
---|
471 | WAVE selWave=$"root:Packages:NIST:FileList:selWave" |
---|
472 | Redimension/N=(num) fileWave //make the waves the proper length |
---|
473 | Redimension/N=(num) selWave |
---|
474 | fileWave = StringFromList(p,list,";") //converts the list to a wave |
---|
475 | Sort filewave,filewave |
---|
476 | End |
---|
477 | |
---|
478 | // returns 1 if the file exists, 0 if the file is not there |
---|
479 | // fails miserably if there are aliases in the UP folder, although |
---|
480 | // the #include doesn't mind |
---|
481 | // |
---|
482 | // SRK -2010- I need to look in the special directory too (look there first) |
---|
483 | // |
---|
484 | Function CheckFileInUPFolder(fileStr) |
---|
485 | String fileStr |
---|
486 | |
---|
487 | Variable err=0 |
---|
488 | String/G root:Packages:NIST:FileList:allFiles="" |
---|
489 | SVAR allFiles = root:Packages:NIST:FileList:allFiles |
---|
490 | |
---|
491 | SVAR fileVerExt = root:Packages:NIST:SANS_ANA_EXTENSION |
---|
492 | |
---|
493 | fileStr = RemoveExten(fileStr)+fileVerExt |
---|
494 | |
---|
495 | // the Igor 6.1 User Procedure Path, same sub-folders as in Igor App Folder |
---|
496 | // the installer MOVES items here, so no troubles with aliases |
---|
497 | String userPathStr=RemoveEnding(SpecialDirPath("Igor Pro User Files",0,0,0),":")+":" |
---|
498 | String UPStr=userPathStr+"User Procedures:" |
---|
499 | NewPath /O/Q/Z UPPath ,UPStr |
---|
500 | ListAllFilesAndFolders("UPPath",1,1,0) //this sets the global string allFiles |
---|
501 | String list = allFiles |
---|
502 | err = strsearch(list, fileStr, 0,2) //this is not case-sensitive, but Igor 5! |
---|
503 | if(err != -1) |
---|
504 | return(1) //name was found somewhere |
---|
505 | endif |
---|
506 | |
---|
507 | // name not found, try looking in the Igor Pro/ folder |
---|
508 | // this will still fail if aliases are present here |
---|
509 | PathInfo Igor |
---|
510 | UPStr=S_path+"User Procedures:" |
---|
511 | NewPath /O/Q/Z UPPath ,UPStr |
---|
512 | ListAllFilesAndFolders("UPPath",1,1,0) //this sets the global string allFiles |
---|
513 | list = allFiles |
---|
514 | // err = FindListItem(fileStr, list ,";" ,0) |
---|
515 | err = strsearch(list, fileStr, 0,2) //this is not case-sensitive, but Igor 5! |
---|
516 | // err = strsearch(list, fileStr, 0) //this is Igor 4+ compatible |
---|
517 | // Print err |
---|
518 | if(err == -1) |
---|
519 | return(0) |
---|
520 | else |
---|
521 | return(1) //name was found somewhere |
---|
522 | endif |
---|
523 | End |
---|
524 | |
---|
525 | |
---|
526 | Function FileList_InsertButtonProc(ctrlName) : ButtonControl |
---|
527 | String ctrlName |
---|
528 | |
---|
529 | //loop through the selected files in the list... |
---|
530 | Wave/T fileWave=$"root:Packages:NIST:FileList:fileWave" |
---|
531 | Wave sel=$"root:Packages:NIST:FileList:selWave" |
---|
532 | //and adjust the included file lists |
---|
533 | Wave/T includedFileWave=$"root:Packages:NIST:FileList:includedFileWave" |
---|
534 | Wave selToDel=$"root:Packages:NIST:FileList:selToDelWave" |
---|
535 | |
---|
536 | SVAR fileVerExt=root:Packages:NIST:SANS_ANA_EXTENSION |
---|
537 | |
---|
538 | Variable numIncl=numpnts(includedFileWave) |
---|
539 | Variable num=numpnts(sel),ii,ok |
---|
540 | String fname="" |
---|
541 | |
---|
542 | //Necessary for every analysis experiment |
---|
543 | Execute/P "INSERTINCLUDE \"PlotUtilsMacro_v40\"" |
---|
544 | Execute/P "INSERTINCLUDE \"GaussUtils_v40\"" |
---|
545 | Execute/P "INSERTINCLUDE \"WriteModelData_v40\"" |
---|
546 | |
---|
547 | NVAR doCheck=root:Packages:NIST:FileList:checkForFiles |
---|
548 | |
---|
549 | ii=num-1 //work bottom-up to not lose the index |
---|
550 | do |
---|
551 | if(sel[ii] == 1) |
---|
552 | //can I make sure the file exists before trying to include it? |
---|
553 | if(doCheck) |
---|
554 | ok = CheckFileInUPFolder(fileWave[ii]) |
---|
555 | endif |
---|
556 | if(ok || !doCheck) |
---|
557 | fname = RemoveExten(fileWave[ii]) |
---|
558 | Execute/P "INSERTINCLUDE \""+fname+fileVerExt+"\"" |
---|
559 | // add to the already included list, and remove from the to-include list (and selWaves also) |
---|
560 | InsertPoints numpnts(includedFileWave), 1, includedFileWave,selToDel |
---|
561 | includedFileWave[numpnts(includedFileWave)-1]=fileWave[ii] |
---|
562 | |
---|
563 | DeletePoints ii, 1, fileWave,sel |
---|
564 | else |
---|
565 | DoAlert 0,"File "+fileWave[ii]+" was not found in the User Procedures folder, so it was not included" |
---|
566 | endif |
---|
567 | endif |
---|
568 | ii-=1 |
---|
569 | while(ii>=0) |
---|
570 | // Execute/P "COMPILEPROCEDURES ";Execute/P/Q/Z "RefreshMenu()" |
---|
571 | Execute/P "COMPILEPROCEDURES " |
---|
572 | |
---|
573 | sel=0 //clear the selections |
---|
574 | selToDel=0 |
---|
575 | |
---|
576 | return(0) |
---|
577 | End |
---|
578 | |
---|
579 | Function FileList_RemoveButtonProc(ctrlName) : ButtonControl |
---|
580 | String ctrlName |
---|
581 | |
---|
582 | //loop through the selected files in the list... |
---|
583 | Wave/T includedFileWave=$"root:Packages:NIST:FileList:includedFileWave" |
---|
584 | Wave selToDel=$"root:Packages:NIST:FileList:selToDelWave" |
---|
585 | // and put the unwanted procedures back in the to-add list |
---|
586 | Wave/T fileWave=$"root:Packages:NIST:FileList:fileWave" |
---|
587 | Wave sel=$"root:Packages:NIST:FileList:selWave" |
---|
588 | |
---|
589 | SVAR fileVerExt=root:Packages:NIST:SANS_ANA_EXTENSION |
---|
590 | |
---|
591 | Variable num=numpnts(selToDel),ii |
---|
592 | String fname="",funcToDelStr="" |
---|
593 | |
---|
594 | ii=num-1 //work backwards |
---|
595 | do |
---|
596 | if(selToDel[ii] == 1) |
---|
597 | fname = RemoveExten(includedFileWave[ii]) |
---|
598 | Execute/P "DELETEINCLUDE \""+fname+fileVerExt+"\"" |
---|
599 | //add to the to-include list |
---|
600 | InsertPoints numpnts(fileWave), 1, fileWave,sel |
---|
601 | fileWave[numpnts(fileWave)-1]=includedFileWave[ii] |
---|
602 | //delete the point |
---|
603 | DeletePoints ii, 1, includedFileWave,selToDel |
---|
604 | // |
---|
605 | // could kill dependencies connected to the procedure file, but really not necessary |
---|
606 | //funcToDelStr = FunctionList("*",";","WIN:"+fname+fileVerExt+".ipf") |
---|
607 | //KillAllDependentObjects("root:",funcToDelStr, 1, 1, 0) |
---|
608 | |
---|
609 | endif |
---|
610 | ii-=1 |
---|
611 | while(ii>=0) |
---|
612 | Execute/P "COMPILEPROCEDURES " |
---|
613 | |
---|
614 | sel=0 |
---|
615 | selToDel=0 |
---|
616 | |
---|
617 | Sort filewave,filewave |
---|
618 | return(0) |
---|
619 | End |
---|
620 | |
---|
621 | Function KillDependentVariables(folderStr,funcToDelStr) |
---|
622 | String folderStr,funcToDelStr |
---|
623 | |
---|
624 | String objName,formStr,funcStr,matchStr |
---|
625 | Variable index = 0,loc |
---|
626 | |
---|
627 | do |
---|
628 | objName = GetIndexedObjName(folderStr, 2, index) |
---|
629 | if (strlen(objName) == 0) |
---|
630 | break |
---|
631 | endif |
---|
632 | formStr = GetFormula($(folderStr+objName)) |
---|
633 | if(strlen(formStr) != 0) |
---|
634 | loc = strsearch(formStr,"(",0) |
---|
635 | funcStr = formStr[0,loc-1] |
---|
636 | // Print objName,funcStr |
---|
637 | matchStr = ListMatch(funcToDelStr, funcStr ,";") |
---|
638 | if(strlen(matchStr) != 0) |
---|
639 | SetFormula $(folderStr+objName),"" //kill the dependency |
---|
640 | Printf "killed the dependency of %s on the function %s\r",folderStr+objName,matchStr |
---|
641 | endif |
---|
642 | |
---|
643 | endif |
---|
644 | |
---|
645 | index += 1 |
---|
646 | while(1) |
---|
647 | End |
---|
648 | |
---|
649 | |
---|
650 | |
---|
651 | // doesn't really kill all objects... |
---|
652 | // kills the dependency formula for any variable that has a formula that contains a function name |
---|
653 | // that matches anything in the funcToDelStr, which are functions that are about to be removed |
---|
654 | // from the experiment by DELETEINCLUDE |
---|
655 | // |
---|
656 | // recursively looks through all data folders |
---|
657 | // |
---|
658 | // on the first call: |
---|
659 | // pass "root:" as the pathName |
---|
660 | // full = 1 |
---|
661 | // recurse = 1 |
---|
662 | // level = 0 |
---|
663 | // |
---|
664 | Function KillAllDependentObjects(pathName,funcToDelStr, full, recurse, level) |
---|
665 | String pathName // Name of symbolic path in which to look for folders. |
---|
666 | String funcToDelStr //list of functions to look for |
---|
667 | Variable full // True to print full paths instead of just folder name. |
---|
668 | Variable recurse // True to recurse (do it for subfolders too). |
---|
669 | Variable level // Recursion level. Pass 0 for the top level. |
---|
670 | |
---|
671 | Variable ii |
---|
672 | String prefix |
---|
673 | |
---|
674 | // SVAR allFiles=root:Packages:NIST:FileList:allFiles |
---|
675 | // Build a prefix (a number of tabs to indicate the folder level by indentation) |
---|
676 | prefix = "" |
---|
677 | ii = 0 |
---|
678 | do |
---|
679 | if (ii >= level) |
---|
680 | break |
---|
681 | endif |
---|
682 | prefix += "\t" // Indent one more tab |
---|
683 | ii += 1 |
---|
684 | while(1) |
---|
685 | |
---|
686 | // Printf "%s%s\r", prefix, pathName |
---|
687 | // Print IndexedFile($pathName,-1,"????") |
---|
688 | //allFiles += IndexedFile($pathName,-1,"????") |
---|
689 | |
---|
690 | KillDependentVariables(pathName,funcToDelStr) |
---|
691 | |
---|
692 | String path |
---|
693 | ii = 0 |
---|
694 | do |
---|
695 | path = GetIndexedObjName(pathName, 4, ii) |
---|
696 | if (strlen(path) == 0) |
---|
697 | break // No more folders |
---|
698 | endif |
---|
699 | path = pathName+path+":" //the full path |
---|
700 | // Print "ii, path = ",ii,path |
---|
701 | |
---|
702 | if (recurse) // Do we want to go into subfolder? |
---|
703 | KillAllDependentObjects(path, funcToDelStr, full, recurse, level+1) |
---|
704 | endif |
---|
705 | |
---|
706 | ii += 1 |
---|
707 | while(1) |
---|
708 | End |
---|
709 | |
---|
710 | |
---|
711 | //removes ANY ".ext" extension from the name |
---|
712 | // - wipes out all after the "dot" |
---|
713 | // - procedure files to be included (using quotes) must be in User Procedures folder |
---|
714 | // and end in .ipf? |
---|
715 | Function/S RemoveExten(str) |
---|
716 | String str |
---|
717 | |
---|
718 | Variable loc=0 |
---|
719 | String tempStr="" |
---|
720 | |
---|
721 | loc=strsearch(str,".",0) |
---|
722 | tempStr=str[0,loc-1] |
---|
723 | return(tempStr) |
---|
724 | End |
---|
725 | |
---|
726 | // function to have user select the path where the procedure files are |
---|
727 | // - the selected path is set as procPathName |
---|
728 | // |
---|
729 | // setting the path to "igor" does not seem to have the desired effect of |
---|
730 | // bringing up the Igor Pro folder in the NewPath Dialog |
---|
731 | // |
---|
732 | //may also be able to use folder lists on HD - for more sophisticated listings |
---|
733 | Function PickProcPath() |
---|
734 | |
---|
735 | //set the global string to the selected pathname |
---|
736 | PathInfo/S Igor |
---|
737 | |
---|
738 | NewPath/O/M="pick the SANS Procedure folder" procPathName |
---|
739 | return(0) //no error |
---|
740 | End |
---|
741 | |
---|
742 | |
---|
743 | //my menu, seemingly one item, but really a long string for each submenu |
---|
744 | // if root:MenuItemStr exists |
---|
745 | //Menu "SANS Models" |
---|
746 | // StrVarOrDefault("root:Packages:NIST:FileList:MenuItemStr_def","ModelPicker_Panel")//, RefreshMenu() |
---|
747 | // SubMenu "Unsmeared Models" |
---|
748 | // StrVarOrDefault("root:Packages:NIST:FileList:MenuItemStr1","ModelPicker_Panel") |
---|
749 | // End |
---|
750 | // SubMenu "Smeared Models" |
---|
751 | // StrVarOrDefault("root:Packages:NIST:FileList:MenuItemStr2","ModelPicker_Panel") |
---|
752 | // End |
---|
753 | // SubMenu "Models 3" |
---|
754 | // StrVarOrDefault("root:MenuItemStr3","ModelPicker_Panel") |
---|
755 | // End |
---|
756 | //End |
---|
757 | |
---|
758 | //wrapper to use the A_ prepended file loader from the dynamically defined menu |
---|
759 | //Proc LoadSANSorUSANSData() |
---|
760 | // A_LoadOneDData() |
---|
761 | //End |
---|
762 | |
---|
763 | //// tweaked to find RPA model which has an extra parameter in the declaration |
---|
764 | //Function RefreshMenu() |
---|
765 | // |
---|
766 | // String list="",sep=";" |
---|
767 | // |
---|
768 | // //list = "Refresh Menu"+sep+"ModelPicker_Panel"+sep+"-"+sep |
---|
769 | // list = "ModelPicker_Panel"+sep+"-"+sep |
---|
770 | //// list += MacroList("LoadO*",sep,"KIND:1,NPARAMS:0") //data loader |
---|
771 | // list += "Load SANS or USANS Data;" //use the wrapper above to get the right loader |
---|
772 | //// list += "Reset Resolution Waves;" // resets the resolution waves used for the calculations |
---|
773 | //// list += "Freeze Model;" // freeze a model to compare plots on the same graph |
---|
774 | // list += MacroList("WriteM*",sep,"KIND:1,NPARAMS:4") //data writer |
---|
775 | // list += "-"+sep |
---|
776 | // String/G root:Packages:NIST:FileList:MenuItemStr_def = TrimListTo255(list) |
---|
777 | // |
---|
778 | // list = "" |
---|
779 | // list += MacroList("*",sep,"KIND:1,NPARAMS:3") //unsmeared plot procedures |
---|
780 | // list += MacroList("Plot*",sep,"KIND:1,NPARAMS:4") //RPA has 4 parameters |
---|
781 | // list = RemoveFromList("FreezeModel", list ,";") // remove FreezeModel, it's not a model |
---|
782 | // // list += "-"+sep |
---|
783 | // String/G root:Packages:NIST:FileList:MenuItemStr1 = TrimListTo255(list) |
---|
784 | // |
---|
785 | // list="" |
---|
786 | // list += MacroList("PlotSmea*",sep,"KIND:1,NPARAMS:1") //smeared plot procedures |
---|
787 | // list += MacroList("PlotSmea*",sep,"KIND:1,NPARAMS:2") //smeared RPA has 2 parameters |
---|
788 | // String/G root:Packages:NIST:FileList:MenuItemStr2 = TrimListTo255(list) |
---|
789 | // |
---|
790 | // BuildMenu "SANS Models" |
---|
791 | // |
---|
792 | // return(0) |
---|
793 | //End |
---|
794 | |
---|
795 | //if the length of any of the strings is more than 255, the menu will disappear |
---|
796 | Function/S TrimListTo255(list) |
---|
797 | String list |
---|
798 | |
---|
799 | Variable len,num |
---|
800 | num = itemsinlist(list,";") |
---|
801 | len = strlen(list) |
---|
802 | if(len>255) |
---|
803 | DoAlert 0, "Not all menu items are shown - remove some of the models" |
---|
804 | do |
---|
805 | list = RemoveListItem(num-1, list ,";" ) |
---|
806 | len=strlen(list) |
---|
807 | num=itemsinlist(list,";") |
---|
808 | while(len>255) |
---|
809 | endif |
---|
810 | return(list) |
---|
811 | End |
---|
812 | |
---|
813 | Function/S MP_TextWave2SemiList(textW) |
---|
814 | Wave/T textW |
---|
815 | |
---|
816 | String list="" |
---|
817 | Variable num=numpnts(textW),ii=0 |
---|
818 | do |
---|
819 | list += textw[ii] + ";" |
---|
820 | ii+=1 |
---|
821 | while(ii<num) |
---|
822 | return(list) |
---|
823 | End |
---|
824 | |
---|
825 | Function MP_SemiList2TextWave(list,outWStr) |
---|
826 | String list,outWStr |
---|
827 | |
---|
828 | Variable num=itemsinList(list) |
---|
829 | Make/T/O/N=(num) $outWStr |
---|
830 | WAVE/T w=$outWStr |
---|
831 | w = StringFromList(p,list,";") |
---|
832 | return(0) |
---|
833 | End |
---|
834 | |
---|
835 | //modified to get a list of all files in folder and subfolders |
---|
836 | // passed back through a global variable |
---|
837 | Function ListAllFilesAndFolders(pathName, full, recurse, level) |
---|
838 | String pathName // Name of symbolic path in which to look for folders. |
---|
839 | Variable full // True to print full paths instead of just folder name. |
---|
840 | Variable recurse // True to recurse (do it for subfolders too). |
---|
841 | Variable level // Recursion level. Pass 0 for the top level. |
---|
842 | |
---|
843 | Variable ii |
---|
844 | String prefix |
---|
845 | |
---|
846 | SVAR allFiles=root:Packages:NIST:FileList:allFiles |
---|
847 | // Build a prefix (a number of tabs to indicate the folder level by indentation) |
---|
848 | prefix = "" |
---|
849 | ii = 0 |
---|
850 | do |
---|
851 | if (ii >= level) |
---|
852 | break |
---|
853 | endif |
---|
854 | prefix += "\t" // Indent one more tab |
---|
855 | ii += 1 |
---|
856 | while(1) |
---|
857 | |
---|
858 | // Printf "%s%s\r", prefix, pathName |
---|
859 | // Print IndexedFile($pathName,-1,"????") |
---|
860 | allFiles += IndexedFile($pathName,-1,"????") |
---|
861 | |
---|
862 | String path |
---|
863 | ii = 0 |
---|
864 | do |
---|
865 | path = IndexedDir($pathName, ii, full) |
---|
866 | if (strlen(path) == 0) |
---|
867 | break // No more folders |
---|
868 | endif |
---|
869 | // Printf "%s%s\r", prefix, path |
---|
870 | |
---|
871 | if (recurse) // Do we want to go into subfolder? |
---|
872 | String subFolderPathName = "tempPrintFoldersPath_" + num2istr(level+1) |
---|
873 | |
---|
874 | // Now we get the path to the new parent folder |
---|
875 | String subFolderPath |
---|
876 | if (full) |
---|
877 | subFolderPath = path // We already have the full path. |
---|
878 | else |
---|
879 | PathInfo $pathName // We have only the folder name. Need to get full path. |
---|
880 | subFolderPath = S_path + path |
---|
881 | endif |
---|
882 | |
---|
883 | NewPath/Q/O $subFolderPathName, subFolderPath |
---|
884 | ListAllFilesAndFolders(subFolderPathName, full, recurse, level+1) |
---|
885 | KillPath/Z $subFolderPathName |
---|
886 | endif |
---|
887 | |
---|
888 | ii += 1 |
---|
889 | while(1) |
---|
890 | End |
---|
891 | |
---|
892 | |
---|
893 | // utility function to get the list of all functions |
---|
894 | // first - select and include all of the models |
---|
895 | // |
---|
896 | Proc GetAllModelFunctions() |
---|
897 | String str = FunctionList("*",";","KIND:10,NINDVARS:1") |
---|
898 | Print itemsinList(str) |
---|
899 | |
---|
900 | MP_SemiList2TextWave(str,"UserFunctionList") |
---|
901 | edit UserFunctionList |
---|
902 | end |
---|
903 | |
---|
904 | // allows an easy way to "freeze" a model calculation |
---|
905 | // - duplicates X and Y waves (tags them _q and _i) |
---|
906 | // - kill the dependecy |
---|
907 | // - append it to the top graph |
---|
908 | // - it can later be exported with WriteModelData |
---|
909 | // |
---|
910 | // in Igor 5, you can restrict the WaveList to be just the top graph... |
---|
911 | // SRK 09 JUN 2006 |
---|
912 | // |
---|
913 | // made data folder-aware in a somewhat messy way, but wavelist works only on the |
---|
914 | // current data folder, and WaveSelectorWidget is waaaaaay too complex |
---|
915 | // |
---|
916 | Function FreezeModel() |
---|
917 | String modelType |
---|
918 | Prompt modelType,"What type of model to freeze? (smeared models use the current data set)",popup,"Unsmeared Model;Smeared Model;" |
---|
919 | DoPrompt "Type of Data",modelType |
---|
920 | |
---|
921 | if(V_Flag==1) //user canceled |
---|
922 | return(1) |
---|
923 | endif |
---|
924 | |
---|
925 | String xWave,yWave,newNameStr |
---|
926 | |
---|
927 | SetDataFolder root: |
---|
928 | if(cmpstr(modelType,"Smeared Model")==0) |
---|
929 | ControlInfo/W=WrapperPanel popup_0 |
---|
930 | String folderStr=S_Value |
---|
931 | SetDataFolder $("root:"+folderStr) |
---|
932 | |
---|
933 | Prompt xwave,"X data",popup,WaveList("s*",";","") |
---|
934 | Prompt ywave,"Y data",popup,WaveList("s*",";","") |
---|
935 | Prompt newNameStr,"new name for the waves, _q and _i will be appended" |
---|
936 | else |
---|
937 | Prompt xwave,"X data",popup,WaveList("x*",";","") |
---|
938 | Prompt ywave,"Y data",popup,WaveList("y*",";","") |
---|
939 | Prompt newNameStr,"new name for the waves, _q and _i will be appended" |
---|
940 | endif |
---|
941 | |
---|
942 | DoPrompt "Select the Waves to Freeze",xwave,ywave,newNameStr |
---|
943 | if(V_Flag==1) //user canceled |
---|
944 | SetDataFolder root: |
---|
945 | return(1) |
---|
946 | endif |
---|
947 | |
---|
948 | Duplicate/O $xwave,$(newNameStr+"_q") |
---|
949 | Duplicate/O $ywave,$(newNameStr+"_i") |
---|
950 | SetFormula $(newNameStr+"_i"), "" |
---|
951 | |
---|
952 | AppendToGraph $(newNameStr+"_i") vs $(newNameStr+"_q") |
---|
953 | |
---|
954 | SetDataFolder root: |
---|
955 | end |
---|