Ignore:
Timestamp:
Nov 8, 2012 11:45:21 AM (10 years ago)
Author:
srkline
Message:

Changes to the EventModeProcessing? to put some of the functions on the panel as buttons, rather than on the Macros menu.

Added a menu item in the package loader to invoke the event panel. The reduction procedures must be loaded first.

Added Matt's fixes to the rescaling panel so that it will remove the "_RA" suffix when the scaling is reset to I vs q. A benefit of this is that the dependency works again (automatically) - so users could toggle between scalings and adjust coefficients if they desired.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf

    r871 r874  
    88// 
    99// -- fix the log/lin display - it's not working correctly 
    10 // -- add controls to show the bar graph 
     10// X- add controls to show the bar graph 
    1111// x- add popup for selecting the binning type 
    1212// x- add ability to save the slices to RAW VAX files 
    13 // -- add control to show the bin counts and bin end times 
     13// X- add control to show the bin counts and bin end times 
    1414// x- ADD buttons, switches, etc for the oscillatory mode - so that this can be accessed 
    1515// 
     
    3737 
    3838 
    39 Macro Show_Event_Panel() 
     39Proc Show_Event_Panel() 
    4040        DoWindow/F EventModePanel 
    4141        if(V_flag ==0) 
     
    4848Function Init_Event() 
    4949        String/G        root:Packages:NIST:gEvent_logfile 
     50        String/G        root:Packages:NIST:gEventDisplayString="Details of the file load" 
     51         
    5052        Variable/G      root:Packages:NIST:AIMTYPE_XY=0 // XY Event 
    5153        Variable/G      root:Packages:NIST:AIMTYPE_XYM=2 // XY Minor event 
     
    8082Proc EventModePanel() 
    8183        PauseUpdate; Silent 1           // building window... 
    82         NewPanel/K=2 /W=(100,50,600,680)/N=EventModePanel 
     84        NewPanel /W=(100,50,600,840)/N=EventModePanel/K=2 
    8385        DoWindow/C EventModePanel 
    8486        ModifyPanel fixedSize=1,noEdit =1 
    8587        //ShowTools/A 
    8688        SetDrawLayer UserBack 
    87         Button button0,pos = {10,10}, size={150,20},title="Load Event Log File",fSize=12 
     89        Button button0,pos={10,10}, size={150,20},title="Load Event Log File",fSize=12 
    8890        Button button0,proc=LoadEventLog_Button 
    89         SetVariable setvar3,pos= {20,590},size={460,20},title=" ",fSize=12 
    90         SetVariable setvar3,disable=2,variable=root:Packages:NIST:gEvent_logfile 
     91         
     92        TitleBox tb1,pos={20,650},size={460,80},fSize=12 
     93        TitleBox tb1,variable=root:Packages:NIST:gEventDisplayString 
     94         
    9195        CheckBox chkbox1,pos={170,15},title="Oscillatory Mode?" 
    9296        CheckBox chkbox1,variable = root:Packages:NIST:gEvent_mode 
    93         Button doneButton,pos={400,10}, size={50,20},title="Done",fSize=12 
     97        Button doneButton,pos={435,12}, size={50,20},title="Done",fSize=12 
    9498        Button doneButton,proc=EventDone_Proc 
     99 
     100        Button button2,pos={20,122},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 
     101        Button button3,pos={20,147},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 
     102        Button button4,pos={175,122},size={140,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 
     103        Button button5,pos={175,147},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 
     104        Button button6,pos={378,13},size={40,20},proc=EventModeHelpButtonProc,title="?" 
    95105         
    96106        //DrawLine 10,35,490,35 
     
    111121        SetVariable setvar0,value= root:Packages:NIST:gEvent_tsdisp 
    112122        SetVariable setvar0,proc=sliceSelectEvent_Proc 
    113         Display/W=(20,120,480,580)/HOST=EventModePanel/N=Event_slicegraph 
     123        Display/W=(20,180,480,640)/HOST=EventModePanel/N=Event_slicegraph 
    114124        AppendImage/W=EventModePanel#Event_slicegraph/T root:Packages:NIST:Event:dispsliceData 
    115125        ModifyImage/W=EventModePanel#Event_slicegraph  ''#0 ctab= {*,*,Grays,0} 
     
    128138EndMacro 
    129139 
     140Function ShowEventDataButtonProc(ba) : ButtonControl 
     141        STRUCT WMButtonAction &ba 
     142 
     143        switch( ba.eventCode ) 
     144                case 2: // mouse up 
     145                        // click code here 
     146                        Execute "ShowRescaledTimeGraph()" 
     147                        break 
     148                case -1: // control being killed 
     149                        break 
     150        endswitch 
     151 
     152        return 0 
     153End 
     154 
     155Function ShowBinDetailsButtonProc(ba) : ButtonControl 
     156        STRUCT WMButtonAction &ba 
     157 
     158        switch( ba.eventCode ) 
     159                case 2: // mouse up 
     160                        // click code here 
     161                        Execute "ShowBinTable()" 
     162                        Execute "BinEventBarGraph()" 
     163                        break 
     164                case -1: // control being killed 
     165                        break 
     166        endswitch 
     167 
     168        return 0 
     169End 
     170 
     171Function UndoTimeSortButtonProc(ba) : ButtonControl 
     172        STRUCT WMButtonAction &ba 
     173 
     174        switch( ba.eventCode ) 
     175                case 2: // mouse up 
     176                        // click code here 
     177                        Execute "UndoTheSorting()" 
     178                        break 
     179                case -1: // control being killed 
     180                        break 
     181        endswitch 
     182 
     183        return 0 
     184End 
     185 
     186Function ExportSlicesButtonProc(ba) : ButtonControl 
     187        STRUCT WMButtonAction &ba 
     188 
     189        switch( ba.eventCode ) 
     190                case 2: // mouse up 
     191                        // click code here 
     192                        Execute "ExportSlicesAsVAX()"           //will invoke the dialog 
     193                        break 
     194                case -1: // control being killed 
     195                        break 
     196        endswitch 
     197 
     198        return 0 
     199End 
     200 
     201Function EventModeHelpButtonProc(ba) : ButtonControl 
     202        STRUCT WMButtonAction &ba 
     203 
     204        switch( ba.eventCode ) 
     205                case 2: // mouse up 
     206                        // click code here 
     207                        DoAlert 0,"The help file has not been written yet" 
     208                        break 
     209                case -1: // control being killed 
     210                        break 
     211        endswitch 
     212 
     213        return 0 
     214End 
     215 
     216 
    130217Function EventDone_Proc(ba) : ButtonControl 
    131218        STRUCT WMButtonAction &ba 
     
    222309 
    223310 
    224 Macro   UndoTheSorting() 
     311Proc    UndoTheSorting() 
    225312        Osc_UndoSort() 
    226313End 
     
    683770 
    684771// 
     772// for the bit shifts, see the decimal-binary conversion 
     773// http://www.binaryconvert.com/convert_unsigned_int.html 
     774// 
    685775Function LoadEvents() 
    686776         
     
    690780         
    691781        SVAR filepathstr = root:Packages:NIST:gEvent_logfile 
     782        SVAR dispStr = root:Packages:NIST:gEventDisplayString 
     783         
    692784        SetDataFolder root:Packages:NIST:Event 
    693785 
     
    773865// 
    774866//       
    775         Printf "numXYevents = %d\r",numXYevents 
    776         Printf "XY = num0 = %d\r",num0 
    777         Printf "XY time = num2 = %d\r",num2 
    778         Printf "time MSW = num1 = %d\r",num1 
    779         Printf "Rollover = num3 = %d\r",num3 
    780  
    781         Printf "num0 + num2 = %d\r",num0+num2 
     867//      Printf "numXYevents = %d\r",numXYevents 
     868//      Printf "XY = num0 = %d\r",num0 
     869//      Printf "XY time = num2 = %d\r",num2 
     870//      Printf "time MSW = num1 = %d\r",num1 
     871//      Printf "Rollover = num3 = %d\r",num3 
     872 
     873//      Printf "num0 + num2 = %d\r",num0+num2 
     874 
     875        String fileStr = ParseFilePath(0, filepathstr, ":", 1, 0),tmpStr 
     876         
     877        sprintf tmpStr, "%s: %d total bytes",fileStr,totBytes  
     878        dispStr = tmpStr 
     879        sPrintf tmpStr,"\rnumXYevents = %d\rXY = num0 = %d",numXYevents,num0 
     880        dispStr += tmpStr 
     881        sPrintf tmpStr,"\rXY time = num2 = %d\rtime MSW = num1 = %d",num2,num1 
     882        dispStr += tmpStr 
     883        sPrintf tmpStr,"\rRollover = num3 = %d",num3 
     884        dispStr += tmpStr 
     885 
     886         
    782887         
    783888        Make/O/U/N=(numXYevents) xLoc,yLoc 
     
    821926                type = (dataval & 0xC0000000)/1073741824                //right shift by 2^30 
    822927                 
     928                if(verbose > 0) 
     929                        verbose -= 1 
     930                endif 
    823931//               
    824932                switch(type) 
     
    845953                                if(verbose)              
    846954//                                      printf "%u : %u : %u : %u\r",dataval,time_lsw,time_msw,timeval 
    847                                         printf "%u : %u : %u : %u\r",dataval,timeval,xval,yval 
     955                                        printf "d=%u : t=%u : msw=%u : lsw=%u : %u : %u \r",dataval,timeval,time_msw,time_lsw,xval,yval 
    848956                                endif                            
    849957 
     
    8931001                                if(verbose) 
    8941002//                                      printf "%u : %u : %u : %u\r",dataval,time_lsw,time_msw,timeval 
    895                                         printf "%u : %u : %u : %u : %u\r",dataval,time_lsw,time_msw,timeval,t_longest 
     1003                                        printf "d=%u : t=%u : msw=%u : lsw=%u : tlong=%u\r",dataval,timeval,time_msw,time_lsw,t_longest 
    8961004                                endif 
    8971005                                 
     
    9081016                        case ATMAR: 
    9091017                                if(verbose3) 
    910 //                                      verbose = 1 
     1018//                                      verbose = 15 
     1019                                        verbose = 2 
    9111020                                        printf "MAR : " 
    9121021                                endif 
     
    9401049/// 
    9411050 
    942 Macro BinEventBarGraph() 
     1051Proc BinEventBarGraph() 
    9431052        PauseUpdate; Silent 1           // building window... 
    9441053        String fldrSav0= GetDataFolder(1) 
     
    9621071End 
    9631072 
    964 Macro ShowBinTable() : Table 
     1073Proc ShowBinTable() : Table 
    9651074        PauseUpdate; Silent 1           // building window... 
    9661075        String fldrSav0= GetDataFolder(1) 
     
    9741083// only show the first 1500 data points 
    9751084// 
    976 Macro ShowRescaledTimeGraph() : Graph 
     1085Proc ShowRescaledTimeGraph() : Graph 
    9771086        PauseUpdate; Silent 1           // building window... 
    9781087        String fldrSav0= GetDataFolder(1) 
     
    9921101 
    9931102 
    994 Macro ExportSlicesAsVAX(firstNum,prefix) 
     1103Proc ExportSlicesAsVAX(firstNum,prefix) 
    9951104        Variable firstNum=1 
    9961105        String prefix="SAMPL" 
Note: See TracChangeset for help on using the changeset viewer.