source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MainPanel.ipf @ 683

Last change on this file since 683 was 648, checked in by srkline, 13 years ago

Changes to move the "Do Combine Files" to a separate panel that is accessible from the MainPanel?->1D Ops tab.

Updated the help files.

Disabled the SANSBeta menu.

File size: 19.6 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma version=5.0
3#pragma IgorVersion=6.1
4
5//*********************
6// Vers 1.2 091901
7//
8//draws main panel of buttons for all data reduction operations
9//panel can't be killed (without really trying)
10// initialize() from the SANS menu will redraw the panel
11//panel simply dispatches to previously written procedures (not functions)
12//
13// **function names are really self-explanatory...see the called function for the real details
14//
15//**********************
16
17Proc PickPath_MainButtonProc(ctrlName) : ButtonControl
18        String ctrlName
19       
20        PickPath()
21End
22
23Proc DrawMask_MainButtonProc(ctrlName) : ButtonControl
24        String ctrlName
25       
26        DrawMask()
27End
28
29Proc DisplayMainButtonProc(ctrlName) : ButtonControl
30        String ctrlName
31
32        Variable err=   LoadRawSANSData("Select a Raw SANS data file")
33        if(!err)
34                UpdateDisplayInformation("RAW")
35        endif
36End
37
38Proc PatchMainButtonProc(ctrlName) : ButtonControl
39        String ctrlName
40
41        PatchFiles()
42End
43
44Proc TransMainButtonProc(ctrlName) : ButtonControl
45        String ctrlName
46
47         CalcTrans()
48End
49
50Proc BuildProtocol_MainButtonProc(ctrlName) : ButtonControl
51        String ctrlName
52
53        ReductionProtocolPanel()
54End
55
56Proc ReduceAFile_MainButtonProc(ctrlName) : ButtonControl
57        String ctrlName
58
59        ReduceAFile()
60End
61
62Proc ReduceMultiple_MainButtonProc(ctrlName) : ButtonControl
63        String ctrlName
64
65        ReduceMultipleFiles()
66End
67
68Proc Plot1D_MainButtonProc(ctrlName) : ButtonControl
69        String ctrlName
70
71        //LoadOneDData()
72        Show_Plot_Manager()
73End
74
75Proc Sort1D_MainButtonProc(ctrlName) : ButtonControl
76        String ctrlName
77
78        ShowNSORTPanel()
79End
80
81Proc Combine1D_MainButtonProc(ctrlName) : ButtonControl
82        String ctrlName
83
84        ShowCombinePanel()
85End
86
87
88Proc Fit1D_MainButtonProc(ctrlName) : ButtonControl
89        String ctrlName
90
91        OpenFITPanel()
92End
93
94Proc FitRPA_MainButtonProc(ctrlName) : ButtonControl
95        String ctrlName
96
97        OpenFITRPAPanel()
98End
99
100Proc Subtract1D_MainButtonProc(ctrlName) : ButtonControl
101        String ctrlName
102
103        OpenSubtract1DPanel()
104End
105
106Proc Arithmetic1D_MainButtonProc(ctrlName) : ButtonControl
107        String ctrlName
108
109        MakeDAPanel()
110End
111
112Proc DisplayInterm_MainButtonProc(ctrlName) : ButtonControl
113        String ctrlName
114
115        ChangeDisplay()
116End
117
118Proc ReadMask_MainButtonProc(ctrlName) : ButtonControl
119        String ctrlName
120
121        ReadMask()
122End
123
124Proc Draw3D_MainButtonProc(ctrlName) : ButtonControl
125        String ctrlName
126
127        Plot3DSurface()
128End
129
130//on Misc Ops tab, generates a notebook
131Proc CatShort_MainButtonProc(ctrlName) : ButtonControl
132        String ctrlName
133
134        BuildCatShortNotebook()
135End
136
137//button is labeled "File Catalog"
138Proc CatVShort_MainButtonProc(ctrlName) : ButtonControl
139        String ctrlName
140
141        //BuildCatVeryShortNotebook()
142        BuildCatVeryShortTable()
143End
144
145Proc ShowCatShort_MainButtonProc(ctrlName) : ButtonControl
146        String ctrlName
147
148        ShowCATWindow()
149End
150
151Proc ShowSchematic_MainButtonProc(ctrlName) : ButtonControl
152        String ctrlName
153       
154        if(root:myGlobals:isDemoVersion == 1)
155                //      comment out in DEMO_MODIFIED version, and show the alert
156                DoAlert 0,"This operation is not available in the Demo version of IGOR"
157        else
158                ShowSchematic()
159        endif
160End
161
162Proc ShowAvePanel_MainButtonProc(ctrlName) : ButtonControl
163        String ctrlName
164
165        ShowAveragePanel()
166End
167
168Proc HelpMainButtonProc(ctrlName) : ButtonControl
169        String ctrlName
170        DisplayHelpTopic/Z/K=1 "SANS Data Reduction Tutorial"
171        if(V_flag !=0)
172                DoAlert 0,"The SANS Data Reduction Tutorial Help file could not be found"
173        endif
174End
175
176Proc ShowTilePanel_MainButtonProc(ctrlName) : ButtonControl
177        String ctrlName
178       
179        if(root:myGlobals:isDemoVersion == 1)
180                //      comment out in DEMO_MODIFIED version, and show the alert
181                DoAlert 0,"This operation is not available in the Demo version of IGOR"
182        else
183                Show_Tile_2D_Panel()
184        endif
185End
186
187Proc NG1TransConv_MainButtonProc(ctrlName) : ButtonControl
188        String ctrlName
189
190        TransformToTransFile()
191End
192
193Proc CopyWork_MainButtonProc(ctrlName) : ButtonControl
194        String ctrlName
195
196        CopyWorkFolder()                //will put up missing param dialog
197End
198
199Proc PRODIV_MainButtonProc(ctrlName) : ButtonControl
200        String ctrlName
201
202        //new, May 2009. show a full panel for input
203        BuildDIVPanel()
204//      MakeDIVFile("","")                     
205End
206
207
208Proc WorkMath_MainButtonProc(ctrlName) : ButtonControl
209        String ctrlName
210
211        Show_WorkMath_Panel()
212End
213
214Proc TISANE_MainButtonProc(ctrlName) : ButtonControl
215        String ctrlName
216       
217        if(exists("Show_TISANE_Panel")==0)
218                // procedure file was not loaded
219                DoAlert 0,"This operation is not available in this set of macros"
220        else
221                Show_TISANE_Panel()
222        endif
223       
224End
225
226Proc Raw2ASCII_MainButtonProc(ctrlName) : ButtonControl
227        String ctrlName
228
229        Export_RAW_Ascii_Panel()
230End
231
232Proc RealTime_MainButtonProc(ctrlName) : ButtonControl
233        String ctrlName
234
235        if(exists("Init_for_RealTime")==0)
236                // procedure file was not loaded
237                DoAlert 0,"This operation is not available in this set of macros"
238        else
239                Show_RealTime_Panel()
240        endif
241End
242
243Proc Preferences_MainButtonProc(ctrlName) : ButtonControl
244        String ctrlName
245
246        Show_Preferences_Panel()
247End
248
249////////////////////////////////////////////////
250//************* NEW version of Main control Panel *****************
251//
252// button management for the different tabs is handled by consistent
253// naming of each button with its tab number as documented below
254// then MainTabProc() can enable/disable the appropriate buttons for the
255// tab that is displayed
256//
257// panel must be killed and redrawn for new buttons to appear
258//
259Window Main_Panel()
260        PauseUpdate; Silent 1           // building window...
261        NewPanel /W=(500,60,924,320) /K=2 as "SANS Reduction Controls"
262        ModifyPanel cbRGB=(65535,58981,27524)
263        ModifyPanel fixedSize=1
264//////
265//on main portion of panel
266        Button MainButtonA,pos={8,8},size={80,20},title="Pick Path",proc=PickPath_MainButtonProc
267        Button MainButtonA,help={"Pick the local data folder that contains the SANS data"}
268        Button MainButtonB,pos={100,8},size={90,20},proc=CatVShort_MainButtonProc,title="File Catalog"
269        Button MainButtonB,help={"This will generate a condensed CATalog table of all files in a specified local folder"}
270        Button MainButtonC,pos={250,8},size={50,20},proc=HelpMainButtonProc,title="Help"
271        Button MainButtonC,help={"Display the help file"}
272        Button MainButtonD,pos={320,8},size={80,20},proc=SR_OpenTracTicketPage,title="Feedback"
273        Button MainButtonD,help={"Submit bug reports or feature requests"}
274       
275        TabControl MainTab,pos={7,49},size={410,202},tabLabel(0)="Raw Data",proc=MainTabProc
276        TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops"
277        TabControl MainTab,value=0
278        //
279        TabControl MainTab labelBack=(65535,58981,27524)
280       
281//on tab(0) - Raw Data - initially visible
282        Button MainButton_0a,pos={15,90},size={130,20},proc=DisplayMainButtonProc,title="Display Raw Data"
283        Button MainButton_0a,help={"Display will load and plot a single 2-D raw data file"}
284        Button MainButton_0b,pos={15,120},size={70,20},proc=PatchMainButtonProc,title="Patch"
285        Button MainButton_0b,help={"Patch will update incorrect information in raw data headers"}
286        Button MainButton_0c,pos={15,150},size={110,20},proc=TransMainButtonProc,title="Transmission"
287        Button MainButton_0c,help={"Shows the \"Patch\" panel which allows calculation of sample transmissions and entering these values into raw data headers"}
288        Button MainButton_0d,pos={15,180},size={130,20},proc=RealTime_MainButtonProc,title="RealTime Display"
289        Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"}
290
291//on tab(1) - Reduction
292        Button MainButton_1a,pos={15,90},size={110,20},proc=BuildProtocol_MainButtonProc,title="Build Protocol"
293        Button MainButton_1a,help={"Shows a panel where the CATalog window is used as input for creating a protocol. Can also be used for standard reductions"}
294        Button MainButton_1b,pos={15,120},size={110,20},proc=ReduceAFile_MainButtonProc,title="Reduce a File"
295        Button MainButton_1b,help={"Presents a questionnare for creating a reduction protocol, then reduces a single file"}
296        Button MainButton_1c,pos={15,150},size={160,20},proc=ReduceMultiple_MainButtonProc,title="Reduce Multiple Files"
297        Button MainButton_1c,help={"Use for reducing multiple raw datasets after protocol(s) have been created"}
298        Button MainButton_1d,pos={15,180},size={110,20},proc=ShowCatShort_MainButtonProc,title="Show CAT Table"
299        Button MainButton_1d,help={"This button will bring the CATalog window to the front, if it exists"}
300        Button MainButton_1a,disable=1
301        Button MainButton_1b,disable=1
302        Button MainButton_1c,disable=1
303        Button MainButton_1d,disable=1
304
305//on tab(2) - 1-D operations
306        Button MainButton_2a,pos={15,90},size={60,20},proc=Plot1D_MainButtonProc,title="Plot"
307        Button MainButton_2a,help={"Loads and plots a 1-D dataset in the format expected by \"FIT\""}
308        Button MainButton_2b,pos={15,120},size={60,20},proc=Sort1D_MainButtonProc,title="Sort"
309        Button MainButton_2b,help={"Sorts and combines 2 or 3 separate 1-D datasets into a single file. Use \"Plot\" button to import 1-D data files"}
310        Button MainButton_2c,pos={15,150},size={60,20},proc=Fit1D_MainButtonProc,title="FIT"
311        Button MainButton_2c,help={"Shows panel for performing a variety of linearized fits to 1-D data files. Use \"Plot\" button to import 1-D data files"}
312        Button MainButton_2d,pos={15,180},size={60,20},proc=FITRPA_MainButtonProc,title="FIT/RPA"
313        Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."}
314//      Button MainButton_2e,pos={120,90},size={90,20},proc=Subtract1D_MainButtonProc,title="Subtract 1D"
315//      Button MainButton_2e,help={"Shows panel for subtracting two 1-D data sets"}
316        Button MainButton_2e,pos={120,90},size={110,20},proc=Arithmetic1D_MainButtonProc,title="1D Arithmetic"
317        Button MainButton_2e,help={"Shows panel for doing arithmetic on 1D data sets"}
318        Button MainButton_2f,pos={120,120},size={130,20},proc=Combine1D_MainButtonProc,title="Combine 1D Files"
319        Button MainButton_2f,help={"Shows panel for batch combination of 1D data files. Use after you're comfortable with NSORT"}
320        Button MainButton_2a,disable=1
321        Button MainButton_2b,disable=1
322        Button MainButton_2c,disable=1
323        Button MainButton_2d,disable=1
324        Button MainButton_2e,disable=1
325        Button MainButton_2f,disable=1
326
327
328
329//on tab(3) - 2-D Operations
330        Button MainButton_3a,pos={15,90},size={90,20},proc=DisplayInterm_MainButtonProc,title="Display 2D"
331        Button MainButton_3a,help={"Display will plot a 2-D work data file that has previously been created during data reduction"}
332        Button MainButton_3b,pos={15,120},size={90,20},title="Draw Mask",proc=DrawMask_MainButtonProc
333        Button MainButton_3b,help={"Draw a mask file and save it."}
334        Button MainButton_3c,pos={15,150},size={90,20},proc=ReadMask_MainButtonProc,title="Read Mask"
335        Button MainButton_3c,help={"Reads a mask file into the proper work folder, and displays a small image of the mask. Yellow areas will be excluded from the data"}
336        Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=ShowTilePanel_MainButtonProc
337        Button MainButton_3d,help={"Adds selected RAW data files to a layout."}
338        Button MainButton_3e,pos={150,90},size={100,20},title="Copy Work",proc=CopyWork_MainButtonProc
339        Button MainButton_3e,help={"Copies WORK data from specified folder to destination folder."}
340        Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=WorkMath_MainButtonProc
341        Button MainButton_3f,help={"Perfom simple math operations on workfile data"}
342        Button MainButton_3g,pos={150,180},size={100,20},title="TISANE",proc=TISANE_MainButtonProc
343        Button MainButton_3g,help={"Manipulate TISANE Timeslice data"}
344       
345        Button MainButton_3a,disable=1
346        Button MainButton_3b,disable=1
347        Button MainButton_3c,disable=1
348        Button MainButton_3d,disable=1
349        Button MainButton_3e,disable=1
350        Button MainButton_3f,disable=1
351        Button MainButton_3g,disable=1
352
353//on tab(4) - Miscellaneous operations
354        Button MainButton_4a,pos={15,90},size={80,20},proc=Draw3D_MainButtonProc,title="3D Display"
355        Button MainButton_4a,help={"Plots a 3-D surface of the selected file type"}
356        Button MainButton_4b,pos={15,120},size={120,20},proc=ShowSchematic_MainButtonProc,title="Show Schematic"
357        Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"}
358        Button MainButton_4c,pos={15,150},size={80,20},proc=ShowAvePanel_MainButtonProc,title="Average"
359        Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"}
360        Button MainButton_4d,pos={15,180},size={110,20},proc=CatShort_MainButtonProc,title="CAT/Notebook"
361        Button MainButton_4d,help={"This will generate a CATalog notebook of all files in a specified local folder"}
362        Button MainButton_4e,pos={180,90},size={130,20},proc=NG1TransConv_MainButtonProc,title="NG1 Files to Trans"
363        Button MainButton_4e,help={"Converts NG1 transmission data files to be interpreted as such"}
364        Button MainButton_4f,pos={180,120},size={130,20},proc=PRODIV_MainButtonProc,title="Make DIV file"
365        Button MainButton_4f,help={"Merges two stored workfiles (CORrected) into a DIV file, and saves the result"}
366        Button MainButton_4g,pos={180,150},size={130,20},proc=Raw2ASCII_MainButtonProc,title="RAW ASCII Export"
367        Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"}
368        Button MainButton_4h,pos={180,180},size={130,20},proc=Preferences_MainButtonProc,title="Preferences"
369        Button MainButton_4h,help={"Sets user preferences for selected parameters"}
370       
371        Button MainButton_4a,disable=1
372        Button MainButton_4b,disable=1
373        Button MainButton_4c,disable=1
374        Button MainButton_4d,disable=1
375        Button MainButton_4e,disable=1
376        Button MainButton_4f,disable=1
377        Button MainButton_4g,disable=1
378        Button MainButton_4h,disable=1
379//     
380EndMacro
381
382// function to control the drawing of buttons in the TabControl on the main panel
383// Naming scheme for the buttons MUST be strictly adhered to... else buttons will
384// appear in odd places...
385// all buttons are named MainButton_NA where N is the tab number and A is the letter denoting
386// the button's position on that particular tab.
387// in this way, buttons will always be drawn correctly..
388//
389Function MainTabProc(name,tab)
390        String name
391        Variable tab
392       
393//      Print "name,number",name,tab
394        String ctrlList = ControlNameList("",";"),item="",nameStr=""
395        Variable num = ItemsinList(ctrlList,";"),ii,onTab
396        for(ii=0;ii<num;ii+=1)
397                //items all start w/"MainButton_"
398                item=StringFromList(ii, ctrlList ,";")
399                nameStr=item[0,10]
400                if(cmpstr(nameStr,"MainButton_")==0)
401                        onTab = str2num(item[11])
402                        Button $item,disable=(tab!=onTab)
403                endif
404        endfor
405End
406
407//
408Function SR_OpenTracTicketPage(ctrlName)
409        String ctrlName
410        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
411        if(V_flag==1)
412                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
413        endif
414End
415
416//********************************
417//************* OLD version of Main Panel *************
418//Window Main_Panel()
419Window OLD_Main_Panel()
420        PauseUpdate; Silent 1           // building window...
421        NewPanel /K=2 /W=(630,75,938,408) as "SANS Reduction Controls"
422        ModifyPanel cbRGB=(52428,52425,1)
423        ModifyPanel fixedSize=1
424        SetDrawLayer UserBack
425        SetDrawEnv fillfgc= (24672,51914,36494)
426        DrawRect 2,250,303,325
427        SetDrawEnv fillfgc= (24672,51914,36494)
428        DrawRect 2,243,186,194
429        SetDrawEnv fillfgc= (24672,51914,36494)
430        DrawRect 2,140,303,189
431        SetDrawEnv fillfgc= (24672,51914,36494)
432        DrawRect 2,59,303,133
433        SetDrawEnv fillfgc= (24672,51914,36494)
434        DrawRect 2,2,303,53
435        SetDrawEnv fstyle= 5
436        DrawText 6,20,"Raw Data Operations"
437        SetDrawEnv fstyle= 5
438        DrawText 6,79,"Data Reduction Operations"
439        SetDrawEnv fstyle= 5
440        DrawText 6,158,"1-D Data Operations"
441        SetDrawEnv fstyle= 5
442        DrawText 6,212,"Intermediate 2-D Files"
443        SetDrawEnv fstyle= 5
444        DrawText 6,268,"Miscellaneous"
445        SetDrawEnv fillfgc= (24672,51914,36494)
446        DrawRect 190,194,303,242
447        SetDrawEnv fstyle= 5
448        DrawText 200,211,"Data Folder"
449        Button MainButton_0,pos={6,25},size={70,20},proc=DisplayMainButtonProc,title="Display"
450        Button MainButton_0,help={"Display will load and plot a single 2-D raw data file"}
451        Button MainButton_1,pos={86,25},size={70,20},proc=PatchMainButtonProc,title="Patch"
452        Button MainButton_1,help={"Patch will update incorrect information in raw data headers"}
453        Button MainButton_2,pos={166,25},size={110,20},proc=TransMainButtonProc,title="Transmission"
454        Button MainButton_2,help={"Shows the \"Patch\" panel which allows calculation of sample transmissions and entering these values into raw data headers"}
455        Button MainButton_3,pos={6,82},size={110,20},proc=BuildProtocol_MainButtonProc,title="Build Protocol"
456        Button MainButton_3,help={"Shows a panel where the CATalog window is used as input for creating a protocol. Can also be used for standard reductions"}
457        Button MainButton_4,pos={147,82},size={110,20},proc=ReduceAFile_MainButtonProc,title="Reduce a File"
458        Button MainButton_4,help={"Presents a questionnare for creating a reduction protocol, then reduces a single file"}
459        Button MainButton_5,pos={6,107},size={160,20},proc=ReduceMultiple_MainButtonProc,title="Reduce Multiple Files"
460        Button MainButton_5,help={"Use for reducing multiple raw datasets after protocol(s) have been created"}
461
462        Button MainButton_19,pos={175,107},size={80,20},title="Draw Mask",proc=DrawMask_MainButtonProc
463        Button MainButton_19,help={"Draw a mask file and save it."}
464       
465        Button MainButton_6,pos={6,162},size={60,20},proc=Plot1D_MainButtonProc,title="Plot"
466        Button MainButton_6,help={"Loads and plots a 1-D dataset in the format expected by \"Sort\" and \"FIT\""}
467        Button MainButton_7,pos={77,162},size={60,20},proc=Sort1D_MainButtonProc,title="Sort"
468        Button MainButton_7,help={"Sorts and combines 2 or 3 separate 1-D datasets into a single file. Use \"Plot\" button to import 1-D data files"}
469        Button MainButton_8,pos={147,162},size={60,20},proc=Fit1D_MainButtonProc,title="FIT"
470        Button MainButton_8,help={"Shows panel for performing a variety of linearized fits to 1-D data files. Use \"Plot\" button to import 1-D data files"}
471
472        Button MainButton_17,pos={217,162},size={60,20},proc=FITRPA_MainButtonProc,title="FIT/RPA"
473        Button MainButton_17,help={"Shows panel for performing a fit to a polymer standard."}
474
475        Button MainButton_9,pos={6,216},size={70,20},proc=DisplayInterm_MainButtonProc,title="Display"
476        Button MainButton_9,help={"Display will plot a 2-D work data file that has previously been created during data reduction"}
477        Button MainButton_10,pos={89,216},size={90,20},proc=ReadMask_MainButtonProc,title="Read Mask"
478        Button MainButton_10,help={"Reads a mask file into the proper work folder, and displays a small image of the mask. Yellow areas will be excluded from the data"}
479        Button MainButton_11,pos={6,298},size={80,20},proc=Draw3D_MainButtonProc,title="3D Display"
480        Button MainButton_11,help={"Plots a 3-D surface of the selected file type"}
481        Button MainButton_12,pos={6,273},size={90,20},proc=CatShort_MainButtonProc,title="CAT/SHORT"
482        Button MainButton_12,help={"This will generate a CATalog window of all files in a specified local folder"}
483
484        Button MainButton_18,pos={106,273},size={90,20},proc=CatVShort_MainButtonProc,title="CAT/VShort"
485        Button MainButton_18,help={"This will generate a condensed CATalog table of all files in a specified local folder"}
486
487        Button MainButton_13,pos={206,273},size={90,20},proc=ShowCatShort_MainButtonProc,title="Show CAT"
488        Button MainButton_13,help={"This button will bring the CATalog window to the front, if it exists"}
489        Button MainButton_14,pos={96,298},size={110,20},proc=ShowSchematic_MainButtonProc,title="Show Schematic"
490        Button MainButton_14,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"}
491        Button MainButton_15,pos={216,298},size={80,20},proc=ShowAvePanel_MainButtonProc,title="Average"
492        Button MainButton_15,help={"Shows a panel for interactive selection of the 1-D averaging step"}
493        Button MainButton_16,pos={200,214},size={80,20},title="Pick Path",proc=PickPath_MainButtonProc
494        Button MainButton_16,help={"Pick the local data folder that contains the SANS data"}
495       
496EndMacro
497//****************above is OLD********************
Note: See TracBrowser for help on using the repository browser.