source: sans/Dev/trunk/NCNR_Igor_Procedures/NCNR_Package_Loader.ipf @ 969

Last change on this file since 969 was 950, checked in by srkline, 8 years ago

adding new procedures for testing -- that will enable:

(1) automation of SANS data reduction, at least in some of the more standard cases. The more consistently the data files are named, the better this works.
(2) Much simpler scripting of experiment simulation. now a simulated experiment can be set up is the same way that a real experiemtn can -- by setting up a list of "runs"

Help files are to follow for all of these. Prelimiary help for the automation has been added to the SANS Reduction Help file. Videos to follow. Loaders for these two items have been added to the Macros menu so that all of the dependencies are satisfied.

More testing is still necessary to make sure that nothing has been broken, and that sufficient error catching has been done so that meaningful testing can be done.

File size: 21.9 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion=6.2
3
4// load/unload courtesy of Jan Ilavsky
5// June 2008
6//
7// - SRK Oct 2008
8// rather than deleting the macros, it is preferable to simply hide the appropriate panels.
9// deleting the ipf files will break dependencies, leave panels hanging open without
10// their associated procedures, etc.
11//
12// names of everything have been changed so I won't clash with Jan's code
13// - make this an independent module in case of bad compilation...?
14//
15//
16// a "(" anywhere in the menuItemString will disable that menu item
17// <U underlines, <U bolds (?? maybe use these to show which is actually loaded)
18
19
20
21
22Menu "Macros"
23        "-"
24        StrVarOrDefault("root:Packages:NCNRItemStr1a","Load NCNR Analysis Macros"), NCNR_AnalysisLoader(StrVarOrDefault("root:Packages:NCNRItemStr1a","Load NCNR Analysis Macros"))
25//      StrVarOrDefault("root:Packages:NCNRItemStr1b","-"), NCNR_AnalysisLoader(StrVarOrDefault("root:Packages:NCNRItemStr1b","-"))
26
27        Submenu "Load SANS Reduction Macros"
28                StrVarOrDefault("root:Packages:NCNRItemStr2a","Load NCNR SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2a","Load NCNR SANS Reduction Macros"))
29                StrVarOrDefault("root:Packages:NCNRItemStr2b","Load QUOKKA SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2b","Load QUOKKA SANS Reduction Macros"))
30                StrVarOrDefault("root:Packages:NCNRItemStr2c","Load ILL SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2c","Load ILL SANS Reduction Macros"))
31                StrVarOrDefault("root:Packages:NCNRItemStr2d","Load HFIR SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2d","Load HFIR SANS Reduction Macros"))
32//              StrVarOrDefault("root:Packages:NCNRItemStr2e","Load HANARO SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2e","Load HANARO SANS Reduction Macros"))
33//              StrVarOrDefault("root:Packages:NCNRItemStr2b","-"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2b","-"))       
34        End
35       
36        Submenu "Load USANS Reduction Macros"
37                StrVarOrDefault("root:Packages:NCNRItemStr3a","Load NCNR USANS Reduction Macros"), NCNR_USANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr3a","Load NCNR USANS Reduction Macros"))
38                StrVarOrDefault("root:Packages:NCNRItemStr3b","Load HANARO USANS Reduction Macros"), NCNR_USANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr3b","Load HANARO USANS Reduction Macros"))
39//              StrVarOrDefault("root:Packages:NCNRItemStr3b","-"), NCNR_USANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr3b","-"))
40        End
41       
42        StrVarOrDefault("root:Packages:NCNRItemStr4a","Load NCNR SANS Live Data"), NCNR_SANSLiveLoader(StrVarOrDefault("root:Packages:NCNRItemStr4a","Load NCNR SANS Live Data"))
43//      StrVarOrDefault("root:Packages:NCNRItemStr4b","-"), NCNR_SANSLiveLoader(StrVarOrDefault("root:Packages:NCNRItemStr4b","-"))
44
45        // for testing ONLY
46        "-"
47        "Load Polarization Reduction",PolarizationLoader()
48        "Load Real Space Modeling",RealSpaceLoader()
49        "Event Mode Processing",EventModeLoader()
50        "Load Batch Fitting - Beta",BatchFitLoader()
51        "Load Simulation Run Builder",SimSANSRunListLoader()
52        "Automated SANS Reduction - Beta",AutomateSANSLoader()
53
54//      "-"
55
56end
57
58Function NCNR_AnalysisLoader(itemStr)
59        String itemStr
60               
61        if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.2)
62                Abort "Your version of Igor is lower than 6.2, these macros need version 6.2 or higher.... "
63        endif
64       
65        NewDataFolder/O root:Packages           //create the folder for string variable
66        String/G root:Packages:NCNRItemStr1a = itemStr
67        String/G root:Packages:NCNRItemStr1b = itemStr
68        SVAR gMenuStr1a = root:Packages:NCNRItemStr1a
69        SVAR gMenuStr1b = root:Packages:NCNRItemStr1b
70       
71        String SANSAna_WinList = "wrapperPanel;Procedure_List;Report;Plot_Manager;A_FitPanel;A_FitWindow;Sum_Model_Panel;"
72        SANSAna_WinList += "NewGlobalFitPanel;SimpGFPanel;Invariant_Panel;invariant_graph;"
73        strswitch(itemStr)      // string switch
74                case "Load NCNR Analysis Macros":       
75                        Execute/P "INSERTINCLUDE \"SA_Includes_v410\""
76                        Execute/P "COMPILEPROCEDURES "
77                        Execute/P ("Init_WrapperPanel()")
78                        Execute/P ("ModelPicker_Panel()")
79                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
80               
81                        gMenuStr1a = "Hide NCNR Analysis Macros"
82//                      gMenuStr1b = "Unload NCNR Analysis Macros"
83                        gMenuStr1b = "-"
84                        BuildMenu "Macros"
85                       
86                        break                                           
87                case "Unload NCNR Analysis Macros":     
88                // very dangerous - don't really want to implement this because it will surely crash
89                        Execute/P "DELETEINCLUDE \"SA_Includes_v410\""
90                        Execute/P "COMPILEPROCEDURES "
91                        DoWindow wrapperPanel
92                        if(V_Flag)
93                                DoWindow/K wrapperPanel
94                        endif
95                        DoWindow Procedure_List
96                        If(V_Flag)
97                                DoWindow/K Procedure_List
98                        endif
99
100                        gMenuStr1a = "Load NCNR Analysis Macros"
101                        gMenuStr1b = "-"
102                       
103                        BuildMenu "Macros"
104                       
105                        break
106                case "Hide NCNR Analysis Macros":       
107                        HideShowWindowsInList(SANSAna_WinList,1)       
108               
109                        gMenuStr1a = "Show NCNR Analysis Macros"
110//                      gMenuStr1b = "Unload NCNR Analysis Macros"
111                        gMenuStr1b = "-"
112                        BuildMenu "Macros"
113                       
114                        break
115                case "Show NCNR Analysis Macros":
116                        HideShowWindowsInList(SANSAna_WinList,0)       
117               
118                        gMenuStr1a = "Hide NCNR Analysis Macros"
119//                      gMenuStr1b = "Unload NCNR Analysis Macros"
120                        gMenuStr1b = "-"
121                        BuildMenu "Macros"
122                       
123                        break
124                default:
125                        Abort "Invalid Menu Selection"
126        endswitch
127
128end
129
130
131// now add for the SANS Reduction
132// a = NCNR
133// b = QUOKKA
134// c = ILL
135// d = HFIR
136// e = HANARO
137//
138Function NCNR_SANSReductionLoader(itemStr)
139        String itemStr
140       
141        if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.2)
142                Abort "Your version of Igor is lower than 6.2, these macros need version 6.2 or higher.... "
143        endif
144       
145        NewDataFolder/O root:Packages           //create the folder for string variable
146
147        String/G root:Packages:NCNRItemStr2a = "Load NCNR SANS Reduction Macros"
148        String/G root:Packages:NCNRItemStr2b = "Load QUOKKA SANS Reduction Macros"
149        String/G root:Packages:NCNRItemStr2c = "Load ILL SANS Reduction Macros"
150        String/G root:Packages:NCNRItemStr2d = "Load HFIR SANS Reduction Macros"
151        String/G root:Packages:NCNRItemStr2e = "Load HANARO SANS Reduction Macros"
152        SVAR gMenuStr2a = root:Packages:NCNRItemStr2a
153        SVAR gMenuStr2b = root:Packages:NCNRItemStr2b
154        SVAR gMenuStr2c = root:Packages:NCNRItemStr2c
155        SVAR gMenuStr2d = root:Packages:NCNRItemStr2d
156        SVAR gMenuStr2e = root:Packages:NCNRItemStr2e
157       
158        String SANSRed_WinList = "Main_Panel;CatVSTable;SANS_Data;Plot_Manager;Average_Panel;Plot_1d;CatWin;Surface_3D;FitPanel;FitWindow;"
159        SANSRed_WinList += "FitRPAPanel;SANS_Histo;drawMaskWin;Multiple_Reduce_Panel;NSORT_Panel;NSORT_Graph;CombineTable;ToCombine;Patch_Panel;"
160        SANSRed_WinList += "ProtocolPanel;Schematic_Layout;Tile_2D;RAW_to_ASCII;Trans_Panel;TransFileTable;ScatterFileTable;Convert_to_Trans;"
161        SANSRed_WinList += "WorkFileMath;Pref_Panel;Subtract_1D_Panel;Plot_Sub1D;SASCALC;MC_SASCALC;Saved_Configurations;TISANE;Sim_1D_Panel;"
162        SANSRed_WinList += "Trial_Configuration;Saved_Configurations;DataArithmeticPanel;DAPlotPanel;"
163        strswitch(itemStr)      // string switch
164       
165                case "Load NCNR SANS Reduction Macros":
166                        Execute/P "INSERTINCLUDE \"Includes_v520\""
167                        Execute/P "COMPILEPROCEDURES "
168                        Execute/P ("Initialize()")
169                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
170
171                        // change the facility label, disable the others               
172                        gMenuStr2a = "Hide NCNR SANS Reduction Macros"
173                        gMenuStr2b += "("
174                        gMenuStr2c += "("
175                        gMenuStr2d += "("
176                        gMenuStr2e += "("
177
178                        BuildMenu "Macros"
179                        break           
180                       
181                case "Load QUOKKA SANS Reduction Macros":
182//                      DoAlert 0, "QUOKKA macros not in SVN yet - NCNR macros loaded instead"
183//                      Execute/P "INSERTINCLUDE \"Includes_v520\""
184                        Execute/P "INSERTINCLUDE \"QKK_Includes_ANSTO\""
185                        Execute/P "COMPILEPROCEDURES "
186                        Execute/P ("Initialize()")
187                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
188
189                        // change the facility label, disable the others               
190                        gMenuStr2a += "("
191                        gMenuStr2b = "Hide QUOKKA SANS Reduction Macros"
192                        gMenuStr2c += "("
193                        gMenuStr2d += "("
194                        gMenuStr2e += "("
195
196                        BuildMenu "Macros"
197                        break
198                       
199                case "Load ILL SANS Reduction Macros":
200                        Execute/P "INSERTINCLUDE \"ILL_Includes_v520\""
201                        Execute/P "COMPILEPROCEDURES "
202                        Execute/P ("Initialize()")
203                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
204
205                        // change the facility label, disable the others               
206                        gMenuStr2a += "("
207                        gMenuStr2b += "("
208                        gMenuStr2c = "Hide ILL SANS Reduction Macros"
209                        gMenuStr2d += "("
210                        gMenuStr2e += "("
211
212                        BuildMenu "Macros"     
213                        break
214                       
215                case "Load HFIR SANS Reduction Macros":
216                        Execute/P "INSERTINCLUDE \"HFIR_Includes_v520\""
217                        Execute/P "COMPILEPROCEDURES "
218                        Execute/P ("Initialize()")
219                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
220
221                        // change the facility label, disable the others               
222                        gMenuStr2a += "("
223                        gMenuStr2b += "("
224                        gMenuStr2c += "("
225                        gMenuStr2d = "Hide HFIR SANS Reduction Macros"
226                        gMenuStr2e += "("
227
228                        BuildMenu "Macros"
229                        break
230                       
231                case "Load HANARO SANS Reduction Macros":       
232                Print "HANARO not loaded into SVN yet. NCNR is loaded"
233                        Execute/P "INSERTINCLUDE \"Includes_v520\""
234                        Execute/P "COMPILEPROCEDURES "
235                        Execute/P ("Initialize()")
236                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
237
238                        // change the facility label, disable the others               
239                        gMenuStr2a += "("
240                        gMenuStr2b += "("
241                        gMenuStr2c += "("
242                        gMenuStr2d += "("
243                        gMenuStr2e += "Hide HANARO SANS Reduction Macros"
244
245                        BuildMenu "Macros"
246                        break
247                                               
248////////////
249                case "Hide NCNR SANS Reduction Macros":
250                        HideShowWindowsInList(SANSRed_WinList,1)
251
252                        // change the facility label, disable the others               
253                        gMenuStr2a = "Show NCNR SANS Reduction Macros"                 
254                        gMenuStr2b += "("
255                        gMenuStr2c += "("
256                        gMenuStr2d += "("
257                        gMenuStr2e += "("                       
258                       
259                        BuildMenu "Macros"
260                        break
261                       
262                case "Hide QUOKKA SANS Reduction Macros":
263                        HideShowWindowsInList(SANSRed_WinList,1)
264
265                        // change the facility label, disable the others               
266                        gMenuStr2a += "("                       
267                        gMenuStr2b = "Show QUOKKA SANS Reduction Macros"
268                        gMenuStr2c += "("
269                        gMenuStr2d += "("
270                        gMenuStr2e += "("                       
271                       
272                        BuildMenu "Macros"
273                        break                   
274
275                case "Hide ILL SANS Reduction Macros":
276                        HideShowWindowsInList(SANSRed_WinList,1)
277
278                        // change the facility label, disable the others               
279                        gMenuStr2a += "("                       
280                        gMenuStr2b += "("
281                        gMenuStr2c = "Show ILL SANS Reduction Macros"
282                        gMenuStr2d += "("
283                        gMenuStr2e += "("                       
284                       
285                        BuildMenu "Macros"
286                        break
287
288                case "Hide HFIR SANS Reduction Macros":
289                        HideShowWindowsInList(SANSRed_WinList,1)
290
291                        // change the facility label, disable the others               
292                        gMenuStr2a += "("                       
293                        gMenuStr2b += "("
294                        gMenuStr2c += "("
295                        gMenuStr2d = "Show HFIR SANS Reduction Macros"
296                        gMenuStr2e += "("                       
297                       
298                        BuildMenu "Macros"
299                        break
300
301                case "Hide HANARO SANS Reduction Macros":
302                        HideShowWindowsInList(SANSRed_WinList,1)
303
304                        // change the facility label, disable the others               
305                        gMenuStr2a += "("                       
306                        gMenuStr2b += "("
307                        gMenuStr2c += "("
308                        gMenuStr2d += "("
309                        gMenuStr2e = "Show HANARO SANS Reduction Macros"                       
310                       
311                        BuildMenu "Macros"
312                        break
313
314///////////////                 
315                case "Show NCNR SANS Reduction Macros":
316                        HideShowWindowsInList(SANSRed_WinList,0)
317
318                        // change the facility label, disable the others               
319                        gMenuStr2a = "Hide NCNR SANS Reduction Macros"
320                        gMenuStr2b += "("
321                        gMenuStr2c += "("
322                        gMenuStr2d += "("
323                        gMenuStr2e += "("
324
325                        BuildMenu "Macros"
326                        break
327                       
328                case "Show QUOKKA SANS Reduction Macros":       
329                        HideShowWindowsInList(SANSRed_WinList,0)
330
331                        // change the facility label, disable the others               
332                        gMenuStr2a += "("
333                        gMenuStr2b = "Hide QUOKKA SANS Reduction Macros"
334                        gMenuStr2c += "("
335                        gMenuStr2d += "("
336                        gMenuStr2e += "("
337
338                        BuildMenu "Macros"
339                        break
340                       
341                case "Show ILL SANS Reduction Macros": 
342                        HideShowWindowsInList(SANSRed_WinList,0)
343
344                        // change the facility label, disable the others               
345                        gMenuStr2a += "("
346                        gMenuStr2b += "("
347                        gMenuStr2c = "Hide ILL SANS Reduction Macros"
348                        gMenuStr2d += "("
349                        gMenuStr2e += "("
350
351                        BuildMenu "Macros"
352                        break
353                       
354                case "Show HFIR SANS Reduction Macros":
355                        HideShowWindowsInList(SANSRed_WinList,0)
356
357                        // change the facility label, disable the others               
358                        gMenuStr2a += "("
359                        gMenuStr2b += "("
360                        gMenuStr2c += "("
361                        gMenuStr2d = "Hide HFIR SANS Reduction Macros"
362                        gMenuStr2e += "("
363
364                        BuildMenu "Macros"
365                        break
366                       
367                case "Show HANARO SANS Reduction Macros":       
368                        HideShowWindowsInList(SANSRed_WinList,0)
369
370                        // change the facility label, disable the others               
371                        gMenuStr2a += "("
372                        gMenuStr2b += "("
373                        gMenuStr2c += "("
374                        gMenuStr2d += "("
375                        gMenuStr2e = "Hide HANARO SANS Reduction Macros"
376
377                        BuildMenu "Macros"
378                        break
379                       
380                       
381//              case "Unload NCNR SANS Reduction Macros":       
382//              // very dangerous - don't really want to implement this because it will surely crash
383//                      Execute/P "DELETEINCLUDE \"Includes_v520\""
384//                      Execute/P "COMPILEPROCEDURES "
385//                      DoWindow Main_Panel
386//                      if(V_Flag)
387//                              DoWindow/K Main_Panel
388//                      endif
389//
390//                      gMenuStr2a = "Load NCNR SANS Reduction Macros"
391//                      gMenuStr2b = "-"
392//                     
393//                      BuildMenu "Macros"
394//                     
395//                      break                   
396                       
397                default:
398                        Abort "Invalid Menu Selection"
399        endswitch
400
401end
402
403// now add for the USANS Reduction
404// a = NCNR
405// b = HANARO
406Function NCNR_USANSReductionLoader(itemStr)
407        String itemStr
408       
409        if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.2)
410                Abort "Your version of Igor is lower than 6.2, these macros need version 6.2 or higher.... "
411        endif
412       
413        NewDataFolder/O root:Packages           //create the folder for string variable
414        String/G root:Packages:NCNRItemStr3a = "Load NCNR USANS Reduction Macros"
415        String/G root:Packages:NCNRItemStr3b = "Load HANARO USANS Reduction Macros"
416        SVAR gMenuStr3a = root:Packages:NCNRItemStr3a
417        SVAR gMenuStr3b = root:Packages:NCNRItemStr3b
418       
419        String USANS_WinList = "USANS_Panel;COR_Graph;RawDataWin;Desmear_Graph;USANS_Slope;UCALC;"
420       
421        strswitch(itemStr)      // string switch
422                case "Load NCNR USANS Reduction Macros":       
423                        Execute/P "INSERTINCLUDE \"NCNR_USANS_Includes_v230\""
424                        Execute/P "COMPILEPROCEDURES "
425                        Execute/P ("ShowUSANSPanel()")
426                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
427
428                        // change the facility label, disable the others               
429                        gMenuStr3a = "Hide NCNR USANS Reduction Macros"
430                        gMenuStr3b += "("
431                       
432                        BuildMenu "Macros"
433                        break   
434                       
435                case "Load HANARO USANS Reduction Macros":     
436                        Execute/P "INSERTINCLUDE \"KIST_USANS_Includes_v230\""
437                        Execute/P "COMPILEPROCEDURES "
438                        Execute/P ("ShowUSANSPanel()")
439                        Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"")
440
441                        // change the facility label, disable the others
442                        gMenuStr3a += "("
443                        gMenuStr3b = "Hide HANARO USANS Reduction Macros"
444                       
445                        BuildMenu "Macros"
446                        break   
447                                                       
448///////////////////
449
450                case "Hide NCNR USANS Reduction Macros":       
451                        HideShowWindowsInList(USANS_WinList,1) 
452
453                        // change the facility label, disable the others               
454                        gMenuStr3a = "Show NCNR USANS Reduction Macros"
455                        gMenuStr3b += "("
456                                       
457                        BuildMenu "Macros"
458                        break
459                       
460                case "Hide HANARO USANS Reduction Macros":     
461                        HideShowWindowsInList(USANS_WinList,1) 
462
463                        // change the facility label, disable the others
464                        gMenuStr3a += "("
465                        gMenuStr3b = "Show HANARO USANS Reduction Macros"
466                                       
467                        BuildMenu "Macros"
468                        break
469
470///////////////////
471                case "Show NCNR USANS Reduction Macros":
472                        HideShowWindowsInList(USANS_WinList,0) 
473
474                        // change the facility label, disable the others               
475                        gMenuStr3a = "Hide NCNR USANS Reduction Macros"
476                        gMenuStr3b += "("
477                                               
478                        BuildMenu "Macros"
479                        break
480                       
481                case "Show HANARO USANS Reduction Macros":
482                        HideShowWindowsInList(USANS_WinList,0) 
483
484                        // change the facility label, disable the others       
485                        gMenuStr3a += "("
486                        gMenuStr3b = "Hide HANARO USANS Reduction Macros"
487                                               
488                        BuildMenu "Macros"
489                        break
490                       
491                       
492//              case "Unload NCNR USANS Reduction Macros":     
493//              // very dangerous - don't really want to implement this because it will surely crash
494//                      Execute/P "DELETEINCLUDE \"USANS_Includes_v230\""
495//                      Execute/P "COMPILEPROCEDURES "
496//                      DoWindow USANS_Panel
497//                      if(V_Flag)
498//                              DoWindow/K USANS_Panel
499//                      endif
500//
501//                      gMenuStr3a = "Load NCNR USANS Reduction Macros"
502//                      gMenuStr3b = "-"
503//                     
504//                      BuildMenu "Macros"
505//                     
506//                      break                   
507                default:
508                        Abort "Invalid Menu Selection"
509        endswitch
510       
511end
512
513// 1 = hide, 0 = show
514Function HideShowWindowsInList(list,hide)
515        String list
516        Variable hide
517       
518        String item
519        Variable ii,num=ItemsinList(list)
520        for(ii=0;ii<num;ii+=1)
521                item = StringFromList(ii, list , ";")
522                DoWindow $item
523                if(V_Flag)
524                        DoWindow/HIDE=(hide) $item
525                endif
526        endfor
527        return(0)
528End
529
530// now add for the SANS Live
531Function NCNR_SANSLiveLoader(itemStr)
532        String itemStr
533       
534        if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.2)
535                Abort "Your version of Igor is lower than 6.2, these macros need version 6.2 or higher.... "
536        endif
537       
538        NewDataFolder/O root:Packages           //create the folder for string variable
539        String/G root:Packages:NCNRItemStr4a = itemStr
540        String/G root:Packages:NCNRItemStr4b = itemStr
541        SVAR gMenuStr4a = root:Packages:NCNRItemStr4a
542        SVAR gMenuStr4b = root:Packages:NCNRItemStr4b
543       
544        String SANSLive_WinList = "RT_Panel;SANS_Data;"
545        //SANSLive_WinList += "FitRPAPanel;SANS_Histo;drawMaskWin;Multiple_Reduce_Panel;NSORT_Panel;NSORT_Graph;CombineTable;ToCombine;Patch_Panel;"
546        //SANSLive_WinList += "ProtocolPanel;Schematic_Layout;Tile_2D;RAW_to_ASCII;Trans_Panel;TransFileTable;ScatterFileTable;Convert_to_Trans;"
547        //SANSLive_WinList += "WorkFileMath;Pref_Panel;Subtract_1D_Panel;Plot_Sub1D;SASCALC;MC_SASCALC;Saved_Configurations;TISANE;"
548        strswitch(itemStr)      // string switch
549                case "Load NCNR SANS Live Data":       
550                        Execute/P "INSERTINCLUDE \"Includes_v520\""
551                        Execute/P "COMPILEPROCEDURES "
552                        Execute/P ("Init_for_RealTime()")
553               
554                        gMenuStr4a = "Hide NCNR SANS Live Data"
555//                      gMenuStr2b = "Unload NCNR SANS Reduction Macros"
556                        gMenuStr4b = "-"
557                        BuildMenu "Macros"
558                       
559                        break                                           
560                case "Unload NCNR SANS Live Data":     
561                // very dangerous - don't really want to implement this because it will surely crash
562                        Execute/P "DELETEINCLUDE \"Includes_v520\""
563                        Execute/P "COMPILEPROCEDURES "
564                        DoWindow Main_Panel
565                        if(V_Flag)
566                                DoWindow/K Main_Panel
567                        endif
568
569                        gMenuStr4a = "Load NCNR SANS Live Data"
570                        gMenuStr4b = "-"
571                       
572                        BuildMenu "Macros"
573                       
574                        break
575                case "Hide NCNR SANS Live Data":
576                        HideShowWindowsInList(SANSLive_WinList,1)
577               
578                        gMenuStr4a = "Show NCNR SANS Reduction Macros"
579//                      gMenuStr2b = "Unload NCNR SANS Reduction Macros"
580                        gMenuStr4b = "-"
581                        BuildMenu "Macros"
582                       
583                        break
584                case "Show NCNR SANS Reduction Macros":
585                        HideShowWindowsInList(SANSLive_WinList,0)
586               
587                        gMenuStr4a = "Hide NCNR SANS Reduction Macros"
588//                      gMenuStr2b = "Unload NCNR SANS Reduction Macros"
589                        gMenuStr4b = "-"
590                        BuildMenu "Macros"
591                       
592                        break
593                default:
594                        Abort "Invalid Menu Selection"
595        endswitch
596
597end
598
599Function WhatSymbolsAreDefined()
600
601#if (exists("QUOKKA")==6)
602                print "function QUOKKA defined"
603#else
604                print "function QUOKKA NOT defined"
605#endif
606       
607#if(exists("HFIR")==6)
608                print "function HFIR defined"
609#else
610                print "function HFIR NOT defined"
611#endif
612       
613#if(exists("ILL_D22")==6)
614                print "function ILL_D22 defined"
615#else
616                print "function ILL_D22 NOT defined"
617#endif
618
619
620
621// for a lot of reasons, defined symbols do not work
622// mostly, the procedures are compiled before the symbols are
623// defined (or re-defined)
624// another issues is that they are persistent, and  don't disappear
625// until Igor is quit.
626       
627//      SetIgorOption poundDefine=QUOKKA?
628//      if(V_flag)
629//              print "QUOKKA defined"
630//      else
631//              print "QUOKKA NOT defined"
632//      endif
633//     
634//      SetIgorOption poundDefine=HFIR?
635//      if(V_flag)
636//              print "HFIR defined"
637//      else
638//              print "HFIR NOT defined"
639//      endif
640//     
641//      SetIgorOption poundDefine=ILL_D22?
642//      if(V_flag)
643//              print "ILL_D22 defined"
644//      else
645//              print "ILL_D22 NOT defined"
646//      endif
647
648        return(0)
649End
650
651Proc ClearDefinedSymbols()
652        SetIgorOption poundUnDefine=QUOKKA
653        SetIgorOption poundUnDefine=HFIR
654        SetIgorOption poundUnDefine=ILL_D22
655End
656
657Function PolarizationLoader()
658
659        // be sure that the SANS reduction is loaded and compiles
660        NCNR_SANSReductionLoader("Load NCNR SANS Reduction Macros")
661       
662        // then the polarization
663        Execute/P "INSERTINCLUDE \"Include_Polarization\"";Execute/P "COMPILEPROCEDURES "
664        BuildMenu "Macros"
665
666        return(0)
667End
668
669// loads all of the FFT procedures and the fit functions too
670Function RealSpaceLoader()
671
672        // be sure that the SANS Analysis is loaded and compiles
673        NCNR_AnalysisLoader("Load NCNR Analysis Macros")
674       
675        // then the FFT files
676        Execute/P "INSERTINCLUDE \"FFT_Cubes_Includes\""
677        Execute/P "INSERTINCLUDE \"FFT_Fit_Includes\""
678        Execute/P "COMPILEPROCEDURES "
679        Execute/P "Init_FFT()"
680       
681        BuildMenu "Macros"
682
683        return(0)
684End
685
686Function EventModeLoader()
687
688        // be sure that the SANS reduction is loaded and compiles
689        NCNR_SANSReductionLoader("Load NCNR SANS Reduction Macros")
690       
691        // then bring up the Event Mode panel
692        Execute/P "Show_Event_Panel()"
693//      BuildMenu "Macros"
694
695        return(0)
696End
697
698
699// loads the Analysis package, then the AutoFit procedure
700Function BatchFitLoader()
701
702        // be sure that the SANS Analysis is loaded and compiles
703        NCNR_AnalysisLoader("Load NCNR Analysis Macros")
704       
705        // then the AutoFit files
706        Execute/P "INSERTINCLUDE \"Auto_Fit\""
707        Execute/P "COMPILEPROCEDURES "
708        Execute/P "InitializeAutoFitPanel()"
709       
710        BuildMenu "Macros"
711
712        return(0)
713End
714
715// loads the Reduction package, then the Auto_Reduction panel
716Function AutomateSANSLoader()
717
718        // be sure that the SANS reduction is loaded and compiles
719        NCNR_SANSReductionLoader("Load NCNR SANS Reduction Macros")
720       
721        // then bring up the Auto_reduction panel
722        Execute/P "Auto_Reduce_Panel()"
723       
724        return(0)
725End
726
727
728
729// for SANS simulation scripting, need to load the reduction, analysis,
730// then the two scripting procedures
731//
732// -- this is to avoid the entanglement betwen analysis models and SASCALC (in reduction)
733//
734Function SimSANSRunListLoader()
735
736        // be sure that the SANS reduction is loaded and compiles
737        NCNR_SANSReductionLoader("Load NCNR SANS Reduction Macros")
738       
739        // be sure that the SANS Analysis is loaded and compiles
740        NCNR_AnalysisLoader("Load NCNR Analysis Macros")
741       
742        // then the Scripting files
743        Execute/P "INSERTINCLUDE \"MC_SimulationScripting\""
744        Execute/P "INSERTINCLUDE \"MC_Script_Panels\""
745        Execute/P "COMPILEPROCEDURES "
746//      Execute/P "InitializeAutoFitPanel()"
747       
748        BuildMenu "Macros"
749        return(0)
750End
Note: See TracBrowser for help on using the repository browser.