source: sans/Dev/branches/nxcansas_writer/NCNR_Igor_Procedures/NCNR_Package_Loader.ipf @ 1160

Last change on this file since 1160 was 1124, checked in by srkline, 4 years ago

changes to read in new USANS Raw data structure, based on the file creation date.

Some additional changes to sector averaging and viewing the "avg" masks on the detector panels. still not quite complete.

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