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

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

adding more functions for VSANS infrastructure

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