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

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

a number of changes, mostly to allow everything to compile.

added conditional compile to ensure that XML code would not be compiled if VSANS was present, since it's not XML-aware.

modified V_MainPanel to avoid conflicts with the SANS version. There still may be some functions hidden in procedures that do not have the V_ prefix yet, but these are either for functions that should point to a common file, or procedures that have been hidden from the VSANS panel

modified saving of VSANS mask files so that they can still be saved from teh deom version where home path is not defined.

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