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

Last change on this file since 1037 was 1033, checked in by srkline, 6 years ago

Adding utilities to calculate transmission. Added V_Transmission.ipf file. Getting the functionality to work, user interface or incorporation into the data reduction protocol is still to be decided.

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