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

Last change on this file since 1246 was 1222, checked in by srkline, 3 years ago

Updated help file for VSANS. Graphics were not PNG.

Removed HFIR SANS package since if requires XML XOP - no longer supported.

Improved quality of graphics export for Analysis reports.

Added more support for super_white_beam mode on VSANS

Corrected printf bug (Igor 8) when printing out % sign

Added utilities for patching wavelength and monochromator type on VSANS since the type is still not written out correctly by NICE, and super_white_beam is not yet defined in NICE

Adjusted panel dimensions for the temperature sensor display on VSANS (needed onWindows)

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