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

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

cleaning up a lot of the TODO items from the code.

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