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

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

lots of changes to plotting of q-values, generating fake data with non-linear corrections, masking of data, etc.

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