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

Last change on this file since 1154 was 1131, checked in by srkline, 4 years ago

verification of the updated beam centers based on fitted arcs of Silver Behenate

  • Property svn:executable set to *
File size: 18.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//
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 V_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 V_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 V_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 V_PatchMainButtonProc(ctrlName) : ButtonControl
77        String ctrlName
78
79        V_PatchFiles()
80End
81
82Proc V_Patch_XY_MainButtonProc(ctrlName) : ButtonControl
83        String ctrlName
84
85        V_PatchDet_xyCenters_Panel()
86End
87
88Proc V_Patch_DeadTime_MainButtonProc(ctrlName) : ButtonControl
89        String ctrlName
90
91        V_PatchDetectorDeadtimePanel()
92End
93
94Proc V_Patch_Calib_MainButtonProc(ctrlName) : ButtonControl
95        String ctrlName
96
97        V_PatchDetectorCalibrationPanel()
98End
99
100
101Proc V_TransMainButtonProc(ctrlName) : ButtonControl
102        String ctrlName
103
104         V_InitTransmissionPanel()
105End
106
107Proc V_BuildProtocol_MainButtonProc(ctrlName) : ButtonControl
108        String ctrlName
109
110        V_ReductionProtocolPanel()
111End
112
113Proc V_ReduceAFile_MainButtonProc(ctrlName) : ButtonControl
114        String ctrlName
115
116        V_ReductionProtocolPanel()
117//      ReduceAFile()
118End
119
120Proc V_ReduceMultiple_MainButtonProc(ctrlName) : ButtonControl
121        String ctrlName
122
123        V_ReduceMultipleFiles()
124End
125
126Proc V_Plot1D_MainButtonProc(ctrlName) : ButtonControl
127        String ctrlName
128
129        //LoadOneDData()
130        Show_Plot_Manager()
131End
132
133Proc V_Sort1D_MainButtonProc(ctrlName) : ButtonControl
134        String ctrlName
135
136//      ShowNSORTPanel()
137       
138End
139
140Proc V_Combine1D_MainButtonProc(ctrlName) : ButtonControl
141        String ctrlName
142
143//      ShowCombinePanel()
144        V_CombineDataGraph()
145End
146
147
148Proc V_Fit1D_MainButtonProc(ctrlName) : ButtonControl
149        String ctrlName
150
151        DoAlert 0, "This function has not been updated for VSANS yet..."
152
153//      OpenFITPanel()
154End
155
156//Proc V_FitRPA_MainButtonProc(ctrlName) : ButtonControl
157//      String ctrlName
158//
159//      OpenFITRPAPanel()
160//End
161
162Proc V_Subtract1D_MainButtonProc(ctrlName) : ButtonControl
163        String ctrlName
164
165        OpenSubtract1DPanel()
166End
167
168Proc V_Arithmetic1D_MainButtonProc(ctrlName) : ButtonControl
169        String ctrlName
170
171        DoAlert 0, "This function has not been updated for VSANS yet..."
172
173//      MakeDAPanel()
174End
175
176Proc V_DisplayInterm_MainButtonProc(ctrlName) : ButtonControl
177        String ctrlName
178
179        V_ChangeDisplay()
180End
181
182//
183// - fill in with a proper reader that will display the mask(s)
184Proc V_ReadMask_MainButtonProc(ctrlName) : ButtonControl
185        String ctrlName
186
187        DoAlert 0, "Loading MASK data"
188        V_LoadMASKData()
189End
190
191Proc V_Draw3D_MainButtonProc(ctrlName) : ButtonControl
192        String ctrlName
193
194//      DoAlert 0, "This function has not been updated for VSANS yet..."
195        DoAlert 0, "Right-click on the image and select '3D Surface from data'"
196
197//      Plot3DSurface()
198       
199End
200
201////on Misc Ops tab, generates a notebook
202//Proc V_CatShort_MainButtonProc(ctrlName) : ButtonControl
203//      String ctrlName
204//
205//      BuildCatShortNotebook()
206//End
207
208//button is labeled "File Catalog"
209Proc V_CatVShort_MainButtonProc(ctrlName) : ButtonControl
210        String ctrlName
211
212        V_BuildCatVeryShortTable()
213End
214
215Proc V_CatSort_MainButtonProc(ctrlName) : ButtonControl
216        String ctrlName
217       
218        V_Catalog_Sort()
219End
220
221Proc V_ShowCatShort_MainButtonProc(ctrlName) : ButtonControl
222        String ctrlName
223
224        ShowCATWindow()
225End
226
227Proc V_ShowSchematic_MainButtonProc(ctrlName) : ButtonControl
228        String ctrlName
229       
230        if(root:myGlobals:isDemoVersion == 1)
231                //      comment out in DEMO_MODIFIED version, and show the alert
232                DoAlert 0,"This operation is not available in the Demo version of IGOR"
233        else
234                ShowSchematic()
235        endif
236End
237
238Proc V_ShowAvePanel_MainButtonProc(ctrlName) : ButtonControl
239        String ctrlName
240
241        ShowAveragePanel()
242End
243
244Proc V_HelpMainButtonProc(ctrlName) : ButtonControl
245        String ctrlName
246        DisplayHelpTopic/Z/K=1 "VSANS Data Reduction Tutorial"
247        if(V_flag !=0)
248                DoAlert 0,"The VSANS Data Reduction Tutorial Help file could not be found"
249        endif
250End
251
252Proc V_ShowTilePanel_MainButtonProc(ctrlName) : ButtonControl
253        String ctrlName
254       
255        if(root:myGlobals:isDemoVersion == 1)
256                //      comment out in DEMO_MODIFIED version, and show the alert
257                DoAlert 0,"This operation is not available in the Demo version of IGOR"
258        else
259                Show_Tile_2D_Panel()
260        endif
261End
262
263Proc V_NonLinTubes_MainButtonProc(ctrlName) : ButtonControl
264        String ctrlName
265
266        V_TubeCoefPanel()
267End
268
269Proc V_CopyWork_MainButtonProc(ctrlName) : ButtonControl
270        String ctrlName
271
272        V_CopyWorkFolder()              //will put up missing param dialog
273End
274
275Proc V_PRODIV_MainButtonProc(ctrlName) : ButtonControl
276        String ctrlName
277
278        DoWindow/F DIV_Setup_Panel
279        if(V_flag == 0)
280                DIV_Setup_Panel()
281        endif
282       
283        DoWindow/F VSANS_DIVPanels
284        if(V_flag == 0)
285                V_Display_DIV_Panels() 
286        endif
287End
288
289
290Proc V_WorkMath_MainButtonProc(ctrlName) : ButtonControl
291        String ctrlName
292
293        Show_WorkMath_Panel()
294End
295
296//Proc V_TISANE_MainButtonProc(ctrlName) : ButtonControl
297//      String ctrlName
298//     
299//      if(exists("Show_TISANE_Panel")==0)
300//              // procedure file was not loaded
301//              DoAlert 0,"This operation is not available in this set of macros"
302//      else
303//              Show_TISANE_Panel()
304//      endif
305//     
306//End
307
308Proc V_Event_MainButtonProc(ctrlName) : ButtonControl
309        String ctrlName
310       
311        if(exists("V_Show_Event_Panel")==0)
312                // procedure file was not loaded
313                DoAlert 0,"Only test procedures exist. See V_VSANS_Event_Testing.ipf"
314        else
315                V_Show_Event_Panel()
316        endif
317       
318End
319
320Proc V_Event_MultReduceButtonProc(ctrlName) : ButtonControl
321        String ctrlName
322       
323                V_ReduceEventFilesPanel()
324       
325End
326
327Proc V_Raw2ASCII_MainButtonProc(ctrlName) : ButtonControl
328        String ctrlName
329
330        Export_RAW_Ascii_Panel()
331End
332
333Proc V_RealTime_MainButtonProc(ctrlName) : ButtonControl
334        String ctrlName
335
336        if(exists("V_Init_RT")==0)
337                // procedure file was not loaded
338                DoAlert 0,"This operation is not available in this set of macros"
339        else
340                V_Show_RealTime_Panel()
341        endif
342End
343
344Proc V_RTReduce_MainButtonProc(ctrlName) : ButtonControl
345        String ctrlName
346
347        V_ShowOnlineReductionPanel()
348End
349
350Proc V_Preferences_MainButtonProc(ctrlName) : ButtonControl
351        String ctrlName
352
353        Show_VSANSPreferences_Panel()
354End
355
356
357Proc V_DataTree_MainButtonProc(ctrlName) : ButtonControl
358        String ctrlName
359
360        V_ShowDataFolderTree()
361End
362
363////////////////////////////////////////////////
364//************* NEW version of Main control Panel *****************
365//
366// button management for the different tabs is handled by consistent
367// naming of each button with its tab number as documented below
368// then MainTabProc() can enable/disable the appropriate buttons for the
369// tab that is displayed
370//
371// panel must be killed and redrawn for new buttons to appear
372//
373Window Main_VSANS_Panel()
374        PauseUpdate; Silent 1           // building window...
375        NewPanel /W=(500,60,924,320) /K=2 as "VSANS Reduction Controls" + " " + num2str(kVSANSVersion)
376        ModifyPanel cbRGB=(49694,61514,27679)
377        ModifyPanel fixedSize=1
378//////
379//on main portion of panel
380        Button MainButtonA,pos={8,8},size={80,20},title="Pick Path",proc=V_PickPath_MainButtonProc
381        Button MainButtonA,help={"Pick the local data folder that contains the VSANS data"}
382        Button MainButtonB,pos={100,8},size={90,20},proc=V_CatVShort_MainButtonProc,title="File Catalog"
383        Button MainButtonB,help={"This will generate a condensed CATalog table of all files in a specified local folder"}
384        Button MainButtonC,pos={250,8},size={50,20},proc=V_HelpMainButtonProc,title="Help"
385        Button MainButtonC,help={"Display the help file"}
386        Button MainButtonD,pos={320,8},size={80,20},proc=V_SR_OpenTracTicketPage,title="Feedback"
387        Button MainButtonD,help={"Submit bug reports or feature requests"}
388       
389        TabControl MainTab,pos={7,49},size={410,202},tabLabel(0)="Raw Data",proc=V_MainTabProc
390        TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops"
391        TabControl MainTab,value=0
392        //
393        TabControl MainTab labelBack=(47748,57192,54093)
394       
395//on tab(0) - Raw Data - initially visible
396        Button MainButton_0a,pos={15,90},size={130,20},proc=V_DisplayMainButtonProc,title="Display Raw Data"
397        Button MainButton_0a,help={"Display will load and plot a single 2-D raw data file"}
398        Button MainButton_0b,pos={15,120},size={70,20},proc=V_PatchMainButtonProc,title="Patch"
399        Button MainButton_0b,help={"Patch will update incorrect information in raw data headers"}
400        Button MainButton_0c,pos={15,150},size={110,20},proc=V_TransMainButtonProc,title="Transmission"
401        Button MainButton_0c,help={"Shows the panel which allows calculation of sample transmissions and patching values into raw data headers"}
402        Button MainButton_0d,pos={15,180},size={130,20},proc=V_RealTime_MainButtonProc,title="RealTime Display"
403        Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"}
404        Button MainButton_0e,pos={15,210},size={130,20},proc=V_CatSort_MainButtonProc,title="Sort Catalog"
405        Button MainButton_0e,help={"Sort the Data Catalog, courtesy of ANSTO"}
406        Button MainButton_0f,pos={300,90},size={90,20},proc=V_DataTree_MainButtonProc,title="Data Tree"
407        Button MainButton_0f,help={"Show the header and data tree"}
408        Button MainButton_0g,pos={170,180},size={110,20},proc=V_RTReduce_MainButtonProc,title="RT Reduction"
409        Button MainButton_0g,help={"Reduce live (incomplete) data files during acquisition"}
410        Button MainButton_0h,pos={170,90},size={90,20},proc=V_Patch_XY_MainButtonProc,title="Patch XY"
411        Button MainButton_0h,help={"Easy patching of XY beam center to multiple files"}
412        Button MainButton_0i,pos={170,120},size={110,20},proc=V_Patch_DeadTime_MainButtonProc,title="Patch DeadTime"
413        Button MainButton_0i,help={"Easy patching of dead time tables to multiple files"}
414        Button MainButton_0j,pos={170,150},size={90,20},proc=V_Patch_Calib_MainButtonProc,title="Patch Calib"
415        Button MainButton_0j,help={"Easy patching of nonlinear calibration tables to multiple files"}
416
417//on tab(1) - Reduction
418        Button MainButton_1a,pos={15,90},size={110,20},proc=V_BuildProtocol_MainButtonProc,title="Build Protocol"
419        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"}
420//      Button MainButton_1b,pos={15,120},size={110,20},proc=V_ReduceAFile_MainButtonProc,title="Reduce a File"
421//      Button MainButton_1b,help={"Presents a questionnare for creating a reduction protocol, then reduces a single file"}
422        Button MainButton_1c,pos={15,150},size={160,20},proc=V_ReduceMultiple_MainButtonProc,title="Reduce Multiple Files"
423        Button MainButton_1c,help={"Use for reducing multiple raw datasets after protocol(s) have been created"}
424//      Button MainButton_1d,pos={15,180},size={110,20},proc=V_ShowCatShort_MainButtonProc,title="Show CAT Table"
425//      Button MainButton_1d,help={"This button will bring the CATalog window to the front, if it exists"}
426        Button MainButton_1a,disable=1
427//      Button MainButton_1b,disable=1
428        Button MainButton_1c,disable=1
429//      Button MainButton_1d,disable=1
430
431//on tab(2) - 1-D operations
432        Button MainButton_2a,pos={15,90},size={60,20},proc=V_Plot1D_MainButtonProc,title="Plot"
433        Button MainButton_2a,help={"Loads and plots a 1-D dataset in the format expected by \"FIT\""}
434//      Button MainButton_2b,pos={15,120},size={60,20},proc=V_Sort1D_MainButtonProc,title="Sort"
435//      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"}
436        Button MainButton_2c,pos={15,150},size={60,20},proc=V_Fit1D_MainButtonProc,title="FIT"
437        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"}
438//      Button MainButton_2d,pos={15,180},size={60,20},proc=V_FITRPA_MainButtonProc,title="FIT/RPA"
439//      Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."}
440//      Button MainButton_2e,pos={120,90},size={90,20},proc=V_Subtract1D_MainButtonProc,title="Subtract 1D"
441//      Button MainButton_2e,help={"Shows panel for subtracting two 1-D data sets"}
442        Button MainButton_2e,pos={120,90},size={110,20},proc=V_Arithmetic1D_MainButtonProc,title="1D Arithmetic"
443        Button MainButton_2e,help={"Shows panel for doing arithmetic on 1D data sets"}
444        Button MainButton_2f,pos={120,120},size={130,20},proc=V_Combine1D_MainButtonProc,title="Combine 1D Files"
445        Button MainButton_2f,help={"Shows panel for selecting points to trim before combining files"}
446        Button MainButton_2a,disable=1
447//      Button MainButton_2b,disable=1
448        Button MainButton_2c,disable=1
449//      Button MainButton_2d,disable=1
450        Button MainButton_2e,disable=1
451        Button MainButton_2f,disable=1
452
453
454
455//on tab(3) - 2-D Operations
456        Button MainButton_3a,pos={15,90},size={90,20},proc=V_DisplayInterm_MainButtonProc,title="Display 2D"
457        Button MainButton_3a,help={"Display will plot a 2-D work data file that has previously been created during data reduction"}
458        Button MainButton_3b,pos={15,120},size={90,20},title="Draw Mask",proc=V_DrawMask_MainButtonProc
459        Button MainButton_3b,help={"Draw a mask file and save it."}
460        Button MainButton_3c,pos={15,150},size={90,20},proc=V_ReadMask_MainButtonProc,title="Read Mask"
461        Button MainButton_3c,help={"Reads a mask file into the proper work folder"}
462//      Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=V_ShowTilePanel_MainButtonProc
463//      Button MainButton_3d,help={"Adds selected RAW data files to a layout."}
464        Button MainButton_3e,pos={150,90},size={100,20},title="Copy Work",proc=V_CopyWork_MainButtonProc
465        Button MainButton_3e,help={"Copies WORK data from specified folder to destination folder."}
466//      Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=V_WorkMath_MainButtonProc
467//      Button MainButton_3f,help={"Perfom simple math operations on workfile data"}
468        Button MainButton_3g,pos={150,150},size={100,20},title="Event Data",proc=V_Event_MainButtonProc
469        Button MainButton_3g,help={"Manipulate VSANS Event Mode data"}
470        Button MainButton_3h,pos={150,180},size={140,20},title="Event Reduction",proc=V_Event_MultReduceButtonProc
471        Button MainButton_3h,help={"Reduce VSANS Event Mode data"}
472               
473       
474        Button MainButton_3a,disable=1
475        Button MainButton_3b,disable=1
476        Button MainButton_3c,disable=1
477//      Button MainButton_3d,disable=1
478        Button MainButton_3e,disable=1
479//      Button MainButton_3f,disable=1
480        Button MainButton_3g,disable=1
481        Button MainButton_3h,disable=1
482
483//on tab(4) - Miscellaneous operations
484        Button MainButton_4a,pos={15,90},size={80,20},proc=V_Draw3D_MainButtonProc,title="3D Display"
485        Button MainButton_4a,help={"Plots a 3-D surface of the selected file type"}
486//      Button MainButton_4b,pos={15,120},size={120,20},proc=V_ShowSchematic_MainButtonProc,title="Show Schematic"
487//      Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"}
488//      Button MainButton_4c,pos={15,150},size={80,20},proc=V_ShowAvePanel_MainButtonProc,title="Average"
489//      Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"}
490//      Button MainButton_4d,pos={15,180},size={110,20},proc=V_CatShort_MainButtonProc,title="CAT/Notebook"
491//      Button MainButton_4d,help={"This will generate a CATalog notebook of all files in a specified local folder"}
492        Button MainButton_4e,pos={180,90},size={130,20},proc=V_NonLinTubes_MainButtonProc,title="Fit NonLinear Tubes"
493        Button MainButton_4e,help={""}
494        Button MainButton_4f,pos={180,120},size={130,20},proc=V_PRODIV_MainButtonProc,title="Make DIV file"
495        Button MainButton_4f,help={"Displays panels and outlines the steps for generating a detector sensitivity file"}
496//      Button MainButton_4g,pos={180,150},size={130,20},proc=V_Raw2ASCII_MainButtonProc,title="RAW ASCII Export"
497//      Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"}
498        Button MainButton_4h,pos={180,180},size={130,20},proc=V_Preferences_MainButtonProc,title="Preferences"
499        Button MainButton_4h,help={"Sets user preferences for selected parameters"}
500       
501        Button MainButton_4a,disable=1
502//      Button MainButton_4b,disable=1
503//      Button MainButton_4c,disable=1
504//      Button MainButton_4d,disable=1
505        Button MainButton_4e,disable=1
506        Button MainButton_4f,disable=1
507//      Button MainButton_4g,disable=1
508        Button MainButton_4h,disable=1
509//     
510EndMacro
511
512// function to control the drawing of buttons in the TabControl on the main panel
513// Naming scheme for the buttons MUST be strictly adhered to... else buttons will
514// appear in odd places...
515// all buttons are named MainButton_NA where N is the tab number and A is the letter denoting
516// the button's position on that particular tab.
517// in this way, buttons will always be drawn correctly..
518//
519Function V_MainTabProc(name,tab)
520        String name
521        Variable tab
522       
523//      Print "name,number",name,tab
524        String ctrlList = ControlNameList("",";"),item="",nameStr=""
525        Variable num = ItemsinList(ctrlList,";"),ii,onTab
526        for(ii=0;ii<num;ii+=1)
527                //items all start w/"MainButton_"
528                item=StringFromList(ii, ctrlList ,";")
529                nameStr=item[0,10]
530                if(cmpstr(nameStr,"MainButton_")==0)
531                        onTab = str2num(item[11])
532                        Button $item,disable=(tab!=onTab)
533                endif
534        endfor
535End
536
537//
538Function V_SR_OpenTracTicketPage(ctrlName)
539        String ctrlName
540        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
541        if(V_flag==1)
542                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
543        endif
544End
545
Note: See TracBrowser for help on using the repository browser.