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

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

Added two model functions for white beam smearing.

Many other small changes for processing of the back detector, shuffling of VSANS menu items, and consistent naming of V_ procedures.

  • Property svn:executable set to *
File size: 18.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//
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_Raw2ASCII_MainButtonProc(ctrlName) : ButtonControl
321        String ctrlName
322
323        Export_RAW_Ascii_Panel()
324End
325
326Proc V_RealTime_MainButtonProc(ctrlName) : ButtonControl
327        String ctrlName
328
329        if(exists("V_Init_RT")==0)
330                // procedure file was not loaded
331                DoAlert 0,"This operation is not available in this set of macros"
332        else
333                V_Show_RealTime_Panel()
334        endif
335End
336
337Proc V_RTReduce_MainButtonProc(ctrlName) : ButtonControl
338        String ctrlName
339
340        V_ShowOnlineReductionPanel()
341End
342
343Proc V_Preferences_MainButtonProc(ctrlName) : ButtonControl
344        String ctrlName
345
346        Show_VSANSPreferences_Panel()
347End
348
349
350Proc V_DataTree_MainButtonProc(ctrlName) : ButtonControl
351        String ctrlName
352
353        V_ShowDataFolderTree()
354End
355
356////////////////////////////////////////////////
357//************* NEW version of Main control Panel *****************
358//
359// button management for the different tabs is handled by consistent
360// naming of each button with its tab number as documented below
361// then MainTabProc() can enable/disable the appropriate buttons for the
362// tab that is displayed
363//
364// panel must be killed and redrawn for new buttons to appear
365//
366Window Main_VSANS_Panel()
367        PauseUpdate; Silent 1           // building window...
368        NewPanel /W=(500,60,924,320) /K=2 as "VSANS Reduction Controls"
369        ModifyPanel cbRGB=(49694,61514,27679)
370        ModifyPanel fixedSize=1
371//////
372//on main portion of panel
373        Button MainButtonA,pos={8,8},size={80,20},title="Pick Path",proc=V_PickPath_MainButtonProc
374        Button MainButtonA,help={"Pick the local data folder that contains the VSANS data"}
375        Button MainButtonB,pos={100,8},size={90,20},proc=V_CatVShort_MainButtonProc,title="File Catalog"
376        Button MainButtonB,help={"This will generate a condensed CATalog table of all files in a specified local folder"}
377        Button MainButtonC,pos={250,8},size={50,20},proc=V_HelpMainButtonProc,title="Help"
378        Button MainButtonC,help={"Display the help file"}
379        Button MainButtonD,pos={320,8},size={80,20},proc=V_SR_OpenTracTicketPage,title="Feedback"
380        Button MainButtonD,help={"Submit bug reports or feature requests"}
381       
382        TabControl MainTab,pos={7,49},size={410,202},tabLabel(0)="Raw Data",proc=V_MainTabProc
383        TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops"
384        TabControl MainTab,value=0
385        //
386        TabControl MainTab labelBack=(47748,57192,54093)
387       
388//on tab(0) - Raw Data - initially visible
389        Button MainButton_0a,pos={15,90},size={130,20},proc=V_DisplayMainButtonProc,title="Display Raw Data"
390        Button MainButton_0a,help={"Display will load and plot a single 2-D raw data file"}
391        Button MainButton_0b,pos={15,120},size={70,20},proc=V_PatchMainButtonProc,title="Patch"
392        Button MainButton_0b,help={"Patch will update incorrect information in raw data headers"}
393        Button MainButton_0c,pos={15,150},size={110,20},proc=V_TransMainButtonProc,title="Transmission"
394        Button MainButton_0c,help={"Shows the panel which allows calculation of sample transmissions and patching values into raw data headers"}
395        Button MainButton_0d,pos={15,180},size={130,20},proc=V_RealTime_MainButtonProc,title="RealTime Display"
396        Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"}
397        Button MainButton_0e,pos={15,210},size={130,20},proc=V_CatSort_MainButtonProc,title="Sort Catalog"
398        Button MainButton_0e,help={"Sort the Data Catalog, courtesy of ANSTO"}
399        Button MainButton_0f,pos={300,90},size={90,20},proc=V_DataTree_MainButtonProc,title="Data Tree"
400        Button MainButton_0f,help={"Show the header and data tree"}
401        Button MainButton_0g,pos={170,180},size={110,20},proc=V_RTReduce_MainButtonProc,title="RT Reduction"
402        Button MainButton_0g,help={"Reduce live (incomplete) data files during acquisition"}
403        Button MainButton_0h,pos={170,90},size={90,20},proc=V_Patch_XY_MainButtonProc,title="Patch XY"
404        Button MainButton_0h,help={"Easy patching of XY beam center to multiple files"}
405        Button MainButton_0i,pos={170,120},size={110,20},proc=V_Patch_DeadTime_MainButtonProc,title="Patch DeadTime"
406        Button MainButton_0i,help={"Easy patching of dead time tables to multiple files"}
407        Button MainButton_0j,pos={170,150},size={90,20},proc=V_Patch_Calib_MainButtonProc,title="Patch Calib"
408        Button MainButton_0j,help={"Easy patching of nonlinear calibration tables to multiple files"}
409
410//on tab(1) - Reduction
411        Button MainButton_1a,pos={15,90},size={110,20},proc=V_BuildProtocol_MainButtonProc,title="Build Protocol"
412        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"}
413//      Button MainButton_1b,pos={15,120},size={110,20},proc=V_ReduceAFile_MainButtonProc,title="Reduce a File"
414//      Button MainButton_1b,help={"Presents a questionnare for creating a reduction protocol, then reduces a single file"}
415        Button MainButton_1c,pos={15,150},size={160,20},proc=V_ReduceMultiple_MainButtonProc,title="Reduce Multiple Files"
416        Button MainButton_1c,help={"Use for reducing multiple raw datasets after protocol(s) have been created"}
417//      Button MainButton_1d,pos={15,180},size={110,20},proc=V_ShowCatShort_MainButtonProc,title="Show CAT Table"
418//      Button MainButton_1d,help={"This button will bring the CATalog window to the front, if it exists"}
419        Button MainButton_1a,disable=1
420//      Button MainButton_1b,disable=1
421        Button MainButton_1c,disable=1
422//      Button MainButton_1d,disable=1
423
424//on tab(2) - 1-D operations
425        Button MainButton_2a,pos={15,90},size={60,20},proc=V_Plot1D_MainButtonProc,title="Plot"
426        Button MainButton_2a,help={"Loads and plots a 1-D dataset in the format expected by \"FIT\""}
427//      Button MainButton_2b,pos={15,120},size={60,20},proc=V_Sort1D_MainButtonProc,title="Sort"
428//      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"}
429        Button MainButton_2c,pos={15,150},size={60,20},proc=V_Fit1D_MainButtonProc,title="FIT"
430        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"}
431//      Button MainButton_2d,pos={15,180},size={60,20},proc=V_FITRPA_MainButtonProc,title="FIT/RPA"
432//      Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."}
433//      Button MainButton_2e,pos={120,90},size={90,20},proc=V_Subtract1D_MainButtonProc,title="Subtract 1D"
434//      Button MainButton_2e,help={"Shows panel for subtracting two 1-D data sets"}
435        Button MainButton_2e,pos={120,90},size={110,20},proc=V_Arithmetic1D_MainButtonProc,title="1D Arithmetic"
436        Button MainButton_2e,help={"Shows panel for doing arithmetic on 1D data sets"}
437        Button MainButton_2f,pos={120,120},size={130,20},proc=V_Combine1D_MainButtonProc,title="Combine 1D Files"
438        Button MainButton_2f,help={"Shows panel for selecting points to trim before combining files"}
439        Button MainButton_2a,disable=1
440//      Button MainButton_2b,disable=1
441        Button MainButton_2c,disable=1
442//      Button MainButton_2d,disable=1
443        Button MainButton_2e,disable=1
444        Button MainButton_2f,disable=1
445
446
447
448//on tab(3) - 2-D Operations
449        Button MainButton_3a,pos={15,90},size={90,20},proc=V_DisplayInterm_MainButtonProc,title="Display 2D"
450        Button MainButton_3a,help={"Display will plot a 2-D work data file that has previously been created during data reduction"}
451        Button MainButton_3b,pos={15,120},size={90,20},title="Draw Mask",proc=V_DrawMask_MainButtonProc
452        Button MainButton_3b,help={"Draw a mask file and save it."}
453        Button MainButton_3c,pos={15,150},size={90,20},proc=V_ReadMask_MainButtonProc,title="Read Mask"
454        Button MainButton_3c,help={"Reads a mask file into the proper work folder"}
455//      Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=V_ShowTilePanel_MainButtonProc
456//      Button MainButton_3d,help={"Adds selected RAW data files to a layout."}
457        Button MainButton_3e,pos={150,90},size={100,20},title="Copy Work",proc=V_CopyWork_MainButtonProc
458        Button MainButton_3e,help={"Copies WORK data from specified folder to destination folder."}
459//      Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=V_WorkMath_MainButtonProc
460//      Button MainButton_3f,help={"Perfom simple math operations on workfile data"}
461        Button MainButton_3g,pos={150,180},size={100,20},title="Event Data",proc=V_Event_MainButtonProc
462        Button MainButton_3g,help={"Manipulate VSANS Event Mode data"}
463       
464        Button MainButton_3a,disable=1
465        Button MainButton_3b,disable=1
466        Button MainButton_3c,disable=1
467//      Button MainButton_3d,disable=1
468        Button MainButton_3e,disable=1
469//      Button MainButton_3f,disable=1
470        Button MainButton_3g,disable=1
471
472//on tab(4) - Miscellaneous operations
473        Button MainButton_4a,pos={15,90},size={80,20},proc=V_Draw3D_MainButtonProc,title="3D Display"
474        Button MainButton_4a,help={"Plots a 3-D surface of the selected file type"}
475//      Button MainButton_4b,pos={15,120},size={120,20},proc=V_ShowSchematic_MainButtonProc,title="Show Schematic"
476//      Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"}
477//      Button MainButton_4c,pos={15,150},size={80,20},proc=V_ShowAvePanel_MainButtonProc,title="Average"
478//      Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"}
479//      Button MainButton_4d,pos={15,180},size={110,20},proc=V_CatShort_MainButtonProc,title="CAT/Notebook"
480//      Button MainButton_4d,help={"This will generate a CATalog notebook of all files in a specified local folder"}
481        Button MainButton_4e,pos={180,90},size={130,20},proc=V_NonLinTubes_MainButtonProc,title="Fit NonLinear Tubes"
482        Button MainButton_4e,help={""}
483        Button MainButton_4f,pos={180,120},size={130,20},proc=V_PRODIV_MainButtonProc,title="Make DIV file"
484        Button MainButton_4f,help={"Displays panels and outlines the steps for generating a detector sensitivity file"}
485//      Button MainButton_4g,pos={180,150},size={130,20},proc=V_Raw2ASCII_MainButtonProc,title="RAW ASCII Export"
486//      Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"}
487        Button MainButton_4h,pos={180,180},size={130,20},proc=V_Preferences_MainButtonProc,title="Preferences"
488        Button MainButton_4h,help={"Sets user preferences for selected parameters"}
489       
490        Button MainButton_4a,disable=1
491//      Button MainButton_4b,disable=1
492//      Button MainButton_4c,disable=1
493//      Button MainButton_4d,disable=1
494        Button MainButton_4e,disable=1
495        Button MainButton_4f,disable=1
496//      Button MainButton_4g,disable=1
497        Button MainButton_4h,disable=1
498//     
499EndMacro
500
501// function to control the drawing of buttons in the TabControl on the main panel
502// Naming scheme for the buttons MUST be strictly adhered to... else buttons will
503// appear in odd places...
504// all buttons are named MainButton_NA where N is the tab number and A is the letter denoting
505// the button's position on that particular tab.
506// in this way, buttons will always be drawn correctly..
507//
508Function V_MainTabProc(name,tab)
509        String name
510        Variable tab
511       
512//      Print "name,number",name,tab
513        String ctrlList = ControlNameList("",";"),item="",nameStr=""
514        Variable num = ItemsinList(ctrlList,";"),ii,onTab
515        for(ii=0;ii<num;ii+=1)
516                //items all start w/"MainButton_"
517                item=StringFromList(ii, ctrlList ,";")
518                nameStr=item[0,10]
519                if(cmpstr(nameStr,"MainButton_")==0)
520                        onTab = str2num(item[11])
521                        Button $item,disable=(tab!=onTab)
522                endif
523        endfor
524End
525
526//
527Function V_SR_OpenTracTicketPage(ctrlName)
528        String ctrlName
529        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
530        if(V_flag==1)
531                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
532        endif
533End
534
Note: See TracBrowser for help on using the repository browser.