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

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

lots of changes here:
many little fixes to clean up TODO items and marke them DONE

changed the handling of the panel "gap" to split the gap evenly. Q-calculations have been re-verified with this change.

re-named the list of "bin Type" values, and added a few more choices. Streamlined how the averaging and plotting works with this list so that it can be more easily modified as different combinations of binning are envisioned. This resulted in a lot of excess code being cut out and replaced with cleaner logic. This change has also been verified to work as intended.

Attenuation is now always calculated from the table. The table also by (NEW) definition has values for the white beam (one waelength) and graphite (multiple possible wavelengths) where the wavelengths are artificially scaled (*1000) or *1e6) so that the interpolations can be done internally without the need for multiple attenuator tables.

  • 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        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        //new, May 2009. show a full panel for input
271        BuildDIVPanel()
272//      MakeDIVFile("","")                     
273End
274
275
276Proc WorkMath_MainButtonProc(ctrlName) : ButtonControl
277        String ctrlName
278
279        Show_WorkMath_Panel()
280End
281
282//Proc TISANE_MainButtonProc(ctrlName) : ButtonControl
283//      String ctrlName
284//     
285//      if(exists("Show_TISANE_Panel")==0)
286//              // procedure file was not loaded
287//              DoAlert 0,"This operation is not available in this set of macros"
288//      else
289//              Show_TISANE_Panel()
290//      endif
291//     
292//End
293
294Proc Event_MainButtonProc(ctrlName) : ButtonControl
295        String ctrlName
296       
297        if(exists("V_Show_Event_Panel")==0)
298                // procedure file was not loaded
299                DoAlert 0,"Only test procedures exist. See V_VSANS_Event_Testing.ipf"
300        else
301                V_Show_Event_Panel()
302        endif
303       
304End
305
306Proc Raw2ASCII_MainButtonProc(ctrlName) : ButtonControl
307        String ctrlName
308
309        Export_RAW_Ascii_Panel()
310End
311
312Proc RealTime_MainButtonProc(ctrlName) : ButtonControl
313        String ctrlName
314
315        if(exists("V_Init_RT")==0)
316                // procedure file was not loaded
317                DoAlert 0,"This operation is not available in this set of macros"
318        else
319                Show_RealTime_Panel()
320        endif
321End
322
323Proc RTReduce_MainButtonProc(ctrlName) : ButtonControl
324        String ctrlName
325
326        V_ShowOnlineReductionPanel()
327End
328
329Proc Preferences_MainButtonProc(ctrlName) : ButtonControl
330        String ctrlName
331
332        Show_VSANSPreferences_Panel()
333End
334
335
336Proc DataTree_MainButtonProc(ctrlName) : ButtonControl
337        String ctrlName
338
339        V_ShowDataFolderTree()
340End
341
342////////////////////////////////////////////////
343//************* NEW version of Main control Panel *****************
344//
345// button management for the different tabs is handled by consistent
346// naming of each button with its tab number as documented below
347// then MainTabProc() can enable/disable the appropriate buttons for the
348// tab that is displayed
349//
350// panel must be killed and redrawn for new buttons to appear
351//
352Window Main_VSANS_Panel()
353        PauseUpdate; Silent 1           // building window...
354        NewPanel /W=(500,60,924,320) /K=2 as "VSANS Reduction Controls"
355        ModifyPanel cbRGB=(49694,61514,27679)
356        ModifyPanel fixedSize=1
357//////
358//on main portion of panel
359        Button MainButtonA,pos={8,8},size={80,20},title="Pick Path",proc=PickPath_MainButtonProc
360        Button MainButtonA,help={"Pick the local data folder that contains the SANS data"}
361        Button MainButtonB,pos={100,8},size={90,20},proc=CatVShort_MainButtonProc,title="File Catalog"
362        Button MainButtonB,help={"This will generate a condensed CATalog table of all files in a specified local folder"}
363        Button MainButtonC,pos={250,8},size={50,20},proc=HelpMainButtonProc,title="Help"
364        Button MainButtonC,help={"Display the help file"}
365        Button MainButtonD,pos={320,8},size={80,20},proc=SR_OpenTracTicketPage,title="Feedback"
366        Button MainButtonD,help={"Submit bug reports or feature requests"}
367       
368        TabControl MainTab,pos={7,49},size={410,202},tabLabel(0)="Raw Data",proc=MainTabProc
369        TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops"
370        TabControl MainTab,value=0
371        //
372        TabControl MainTab labelBack=(47748,57192,54093)
373       
374//on tab(0) - Raw Data - initially visible
375        Button MainButton_0a,pos={15,90},size={130,20},proc=DisplayMainButtonProc,title="Display Raw Data"
376        Button MainButton_0a,help={"Display will load and plot a single 2-D raw data file"}
377        Button MainButton_0b,pos={15,120},size={70,20},proc=PatchMainButtonProc,title="Patch"
378        Button MainButton_0b,help={"Patch will update incorrect information in raw data headers"}
379        Button MainButton_0c,pos={15,150},size={110,20},proc=TransMainButtonProc,title="Transmission"
380        Button MainButton_0c,help={"Shows the panel which allows calculation of sample transmissions and entering these values into raw data headers"}
381        Button MainButton_0d,pos={15,180},size={130,20},proc=RealTime_MainButtonProc,title="RealTime Display"
382        Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"}
383        Button MainButton_0e,pos={15,210},size={130,20},proc=CatSort_MainButtonProc,title="Sort Catalog"
384        Button MainButton_0e,help={"Sort the Data Catalog, courtesy of ANSTO"}
385        Button MainButton_0f,pos={300,90},size={90,20},proc=DataTree_MainButtonProc,title="Data Tree"
386        Button MainButton_0f,help={"Show the header and data tree"}
387        Button MainButton_0g,pos={170,180},size={110,20},proc=RTReduce_MainButtonProc,title="RT Reduction"
388        Button MainButton_0g,help={"Reduce live (incomplete) data files during acquisition"}
389        Button MainButton_0h,pos={170,90},size={90,20},proc=Patch_XY_MainButtonProc,title="Patch XY"
390        Button MainButton_0h,help={"Patch will update incorrect information in raw data headers"}
391        Button MainButton_0i,pos={170,120},size={110,20},proc=Patch_DeadTime_MainButtonProc,title="Patch DeadTime"
392        Button MainButton_0i,help={"Patch will update incorrect information in raw data headers"}
393        Button MainButton_0j,pos={170,150},size={90,20},proc=Patch_Calib_MainButtonProc,title="Patch Calib"
394        Button MainButton_0j,help={"Patch will update incorrect information in raw data headers"}
395
396//on tab(1) - Reduction
397        Button MainButton_1a,pos={15,90},size={110,20},proc=BuildProtocol_MainButtonProc,title="Build Protocol"
398        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"}
399        Button MainButton_1b,pos={15,120},size={110,20},proc=ReduceAFile_MainButtonProc,title="Reduce a File"
400        Button MainButton_1b,help={"Presents a questionnare for creating a reduction protocol, then reduces a single file"}
401        Button MainButton_1c,pos={15,150},size={160,20},proc=ReduceMultiple_MainButtonProc,title="Reduce Multiple Files"
402        Button MainButton_1c,help={"Use for reducing multiple raw datasets after protocol(s) have been created"}
403//      Button MainButton_1d,pos={15,180},size={110,20},proc=ShowCatShort_MainButtonProc,title="Show CAT Table"
404//      Button MainButton_1d,help={"This button will bring the CATalog window to the front, if it exists"}
405        Button MainButton_1a,disable=1
406        Button MainButton_1b,disable=1
407        Button MainButton_1c,disable=1
408//      Button MainButton_1d,disable=1
409
410//on tab(2) - 1-D operations
411        Button MainButton_2a,pos={15,90},size={60,20},proc=Plot1D_MainButtonProc,title="Plot"
412        Button MainButton_2a,help={"Loads and plots a 1-D dataset in the format expected by \"FIT\""}
413//      Button MainButton_2b,pos={15,120},size={60,20},proc=Sort1D_MainButtonProc,title="Sort"
414//      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"}
415        Button MainButton_2c,pos={15,150},size={60,20},proc=Fit1D_MainButtonProc,title="FIT"
416        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"}
417//      Button MainButton_2d,pos={15,180},size={60,20},proc=FITRPA_MainButtonProc,title="FIT/RPA"
418//      Button MainButton_2d,help={"Shows panel for performing a fit to a polymer standard."}
419//      Button MainButton_2e,pos={120,90},size={90,20},proc=Subtract1D_MainButtonProc,title="Subtract 1D"
420//      Button MainButton_2e,help={"Shows panel for subtracting two 1-D data sets"}
421        Button MainButton_2e,pos={120,90},size={110,20},proc=Arithmetic1D_MainButtonProc,title="1D Arithmetic"
422        Button MainButton_2e,help={"Shows panel for doing arithmetic on 1D data sets"}
423        Button MainButton_2f,pos={120,120},size={130,20},proc=Combine1D_MainButtonProc,title="Combine 1D Files"
424        Button MainButton_2f,help={"Shows panel for batch combination of 1D data files. Use after you're comfortable with NSORT"}
425        Button MainButton_2a,disable=1
426//      Button MainButton_2b,disable=1
427        Button MainButton_2c,disable=1
428//      Button MainButton_2d,disable=1
429        Button MainButton_2e,disable=1
430        Button MainButton_2f,disable=1
431
432
433
434//on tab(3) - 2-D Operations
435        Button MainButton_3a,pos={15,90},size={90,20},proc=DisplayInterm_MainButtonProc,title="Display 2D"
436        Button MainButton_3a,help={"Display will plot a 2-D work data file that has previously been created during data reduction"}
437        Button MainButton_3b,pos={15,120},size={90,20},title="Draw Mask",proc=DrawMask_MainButtonProc
438        Button MainButton_3b,help={"Draw a mask file and save it."}
439        Button MainButton_3c,pos={15,150},size={90,20},proc=ReadMask_MainButtonProc,title="Read Mask"
440        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"}
441//      Button MainButton_3d,pos={15,180},size={100,20},title="Tile RAW 2D",proc=ShowTilePanel_MainButtonProc
442//      Button MainButton_3d,help={"Adds selected RAW data files to a layout."}
443        Button MainButton_3e,pos={150,90},size={100,20},title="Copy Work",proc=CopyWork_MainButtonProc
444        Button MainButton_3e,help={"Copies WORK data from specified folder to destination folder."}
445//      Button MainButton_3f,pos={150,120},size={110,20},title="WorkFile Math",proc=WorkMath_MainButtonProc
446//      Button MainButton_3f,help={"Perfom simple math operations on workfile data"}
447        Button MainButton_3g,pos={150,180},size={100,20},title="Event Data",proc=Event_MainButtonProc
448        Button MainButton_3g,help={"Manipulate TISANE Timeslice data"}
449       
450        Button MainButton_3a,disable=1
451        Button MainButton_3b,disable=1
452        Button MainButton_3c,disable=1
453//      Button MainButton_3d,disable=1
454        Button MainButton_3e,disable=1
455//      Button MainButton_3f,disable=1
456        Button MainButton_3g,disable=1
457
458//on tab(4) - Miscellaneous operations
459        Button MainButton_4a,pos={15,90},size={80,20},proc=Draw3D_MainButtonProc,title="3D Display"
460        Button MainButton_4a,help={"Plots a 3-D surface of the selected file type"}
461//      Button MainButton_4b,pos={15,120},size={120,20},proc=ShowSchematic_MainButtonProc,title="Show Schematic"
462//      Button MainButton_4b,help={"Use this to show a schematic of the data reduction process for a selected sample file and reduction protocol"}
463//      Button MainButton_4c,pos={15,150},size={80,20},proc=ShowAvePanel_MainButtonProc,title="Average"
464//      Button MainButton_4c,help={"Shows a panel for interactive selection of the 1-D averaging step"}
465//      Button MainButton_4d,pos={15,180},size={110,20},proc=CatShort_MainButtonProc,title="CAT/Notebook"
466//      Button MainButton_4d,help={"This will generate a CATalog notebook of all files in a specified local folder"}
467        Button MainButton_4e,pos={180,90},size={130,20},proc=NonLinTubes_MainButtonProc,title="Fit NonLinear Tubes"
468        Button MainButton_4e,help={""}
469        Button MainButton_4f,pos={180,120},size={130,20},proc=PRODIV_MainButtonProc,title="Make DIV file"
470        Button MainButton_4f,help={"Merges two stored workfiles (CORrected) into a DIV file, and saves the result"}
471//      Button MainButton_4g,pos={180,150},size={130,20},proc=Raw2ASCII_MainButtonProc,title="RAW ASCII Export"
472//      Button MainButton_4g,help={"Exports selected RAW (2D) data file(s) as ASCII, either as pixel values or I(Qx,Qy)"}
473        Button MainButton_4h,pos={180,180},size={130,20},proc=Preferences_MainButtonProc,title="Preferences"
474        Button MainButton_4h,help={"Sets user preferences for selected parameters"}
475       
476        Button MainButton_4a,disable=1
477//      Button MainButton_4b,disable=1
478//      Button MainButton_4c,disable=1
479//      Button MainButton_4d,disable=1
480        Button MainButton_4e,disable=1
481        Button MainButton_4f,disable=1
482//      Button MainButton_4g,disable=1
483        Button MainButton_4h,disable=1
484//     
485EndMacro
486
487// function to control the drawing of buttons in the TabControl on the main panel
488// Naming scheme for the buttons MUST be strictly adhered to... else buttons will
489// appear in odd places...
490// all buttons are named MainButton_NA where N is the tab number and A is the letter denoting
491// the button's position on that particular tab.
492// in this way, buttons will always be drawn correctly..
493//
494Function MainTabProc(name,tab)
495        String name
496        Variable tab
497       
498//      Print "name,number",name,tab
499        String ctrlList = ControlNameList("",";"),item="",nameStr=""
500        Variable num = ItemsinList(ctrlList,";"),ii,onTab
501        for(ii=0;ii<num;ii+=1)
502                //items all start w/"MainButton_"
503                item=StringFromList(ii, ctrlList ,";")
504                nameStr=item[0,10]
505                if(cmpstr(nameStr,"MainButton_")==0)
506                        onTab = str2num(item[11])
507                        Button $item,disable=(tab!=onTab)
508                endif
509        endfor
510End
511
512//
513Function SR_OpenTracTicketPage(ctrlName)
514        String ctrlName
515        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
516        if(V_flag==1)
517                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
518        endif
519End
520
Note: See TracBrowser for help on using the repository browser.