source: sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/MainPanel.ipf @ 224

Last change on this file since 224 was 224, checked in by srkline, 15 years ago

Updated files for an "improved" way of assigning transmission files. works with a shift-click on the transmission file and a table hook to do the search. User gets to say y/n to the match. no cutting or pasting needed.

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