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

Last change on this file since 1002 was 1002, checked in by srkline, 6 years ago

main changes here are the addition of a first pass at the file catalog, and patch panel. each of these is based on the old SANS file (for now) and has been updated to at least compile.

Much more work needs to be done to get the functionality to be what VSANS needs, both in what is important to report in the file catalog, and how to best present the patch GUI for different situations

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