source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf @ 971

Last change on this file since 971 was 971, checked in by srkline, 7 years ago

Filling in missing "dummy" functions when XML xop is not present.

Added new V_ procedures for the beginning of the reduction steps - initialization, main panel, preferences, and a menu. These are lifted directly from the SANS routines and much still needs to be modified.

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