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

Last change on this file since 1085 was 1085, checked in by srkline, 5 years ago

corrections to how the DIV generation operates. Added to the documentation as well.

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