Changeset 915 for sans/Dev


Ignore:
Timestamp:
Jun 24, 2013 4:29:54 PM (10 years ago)
Author:
srkline
Message:

Changes to panels so that they fit on a low-resolution laptop screen (Nx768).

  • Auto Fit
  • Event Mode
  • All polarization panels

In addition, Functionality was added to the event mode processing to (better) handle large files. Files can be split and either added as slices (if oscillatory) or decimated (if stream). The "tweaking" of the data stream is also a little bit more automated now, using some intelligent locating of the time steps and an overlay of the derivative.

Corrected a few bugs in file handling on the polarization panels in cases where the user canceled out of a file dialog.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Auto_Fit.ipf

    r912 r915  
    316316Window AutoFitPanel() 
    317317        PauseUpdate; Silent 1           // building window... 
    318         NewPanel /W=(685,44,1001,740) /K=1 
     318        NewPanel /W=(434,44,1063,422) /K=1 
    319319        DoWindow/C AutoFitPanel 
    320320        SetDrawLayer UserBack 
    321 //      DrawText 11,418,"Point Range" 
    322 //      DrawText 5,167,"Suffix" 
    323         DrawLine 8,362,287,362 
    324         PopupMenu popup0,pos={2,2},size={175,20},title="pick a function" 
     321///     DrawText 11,418,"Point Range" 
     322///     DrawText 5,167,"Suffix" 
     323//      DrawLine 8,362,287,362 
     324        PopupMenu popup0,pos={13,6},size={175,20},title="Pick a Function" 
    325325        PopupMenu popup0,mode=1,value= #"User_FunctionPopupList()",proc=AF_FuncPopupProc 
    326326                 
     
    330330        ListBox lb userColumnResize=1,widths={200,80} 
    331331         
    332 //      Button DelButton,pos={245,61},size={40,20},proc=DelButtonProc,title="Del",disable=2 
    333         Button PathButton,pos={6,61},size={50,20},proc=PDPButton,title="Path..." 
     332///     Button DelButton,pos={245,61},size={40,20},proc=DelButtonProc,title="Del",disable=2 
     333        Button PathButton,pos={13,61},size={50,20},proc=PDPButton,title="Path..." 
    334334        Button FileListButton,pos={82,61},size={50,20},proc=FileListButtonProc,title="List" 
    335         CheckBox AllFilesCheck,pos={182,64},size={32,14},proc=CheckAllFiles,title="Select All Files" 
     335        CheckBox AllFilesCheck,pos={196,64},size={32,14},proc=CheckAllFiles,title="Select All Files" 
    336336        CheckBox AllFilesCheck,value= 0 
    337         ListBox guessBox,pos={24,398},size={145,208},disable=1,proc=UpdateGuessMatrixProc 
     337        ListBox guessBox,pos={345,102},size={145,208},disable=1,proc=UpdateGuessMatrixProc 
    338338        ListBox guessBox,frame=2,listWave=root:AutoFit:guessList 
    339339        ListBox guessBox,selWave=root:AutoFit:guessSel,mode= 2,selRow= 0 
    340         Button FillAllGuessButton,pos={196,406},size={50,20},disable=1,proc=FillAllGuessButtonProc,title="Fill All" 
    341         Button FillAllHoldButton,pos={196,406},size={50,20},disable=1,proc=FillAllHoldButtonProc,title="Fill All" 
    342         Button FillAllConstrButton,pos={196,406},size={50,20},proc=FillAllConstrButtonProc,title="Fill All" 
    343         Button FillAllRangeB,pos={196,406},size={50,20},disable=1,proc=FillAllRangeButtonProc,title="Fill All" 
    344         SetVariable NumParams,pos={7,34},size={150,15},proc=SetNumParamProc,title="Number of Parameters" 
     340        Button FillAllGuessButton,pos={517,110},size={50,20},disable=1,proc=FillAllGuessButtonProc,title="Fill All" 
     341        Button FillAllHoldButton,pos={517,110},size={50,20},disable=1,proc=FillAllHoldButtonProc,title="Fill All" 
     342        Button FillAllConstrButton,pos={517,110},size={50,20},proc=FillAllConstrButtonProc,title="Fill All" 
     343        Button FillAllRangeB,pos={517,110},size={50,20},disable=1,proc=FillAllRangeButtonProc,title="Fill All" 
     344        SetVariable NumParams,pos={13,35},size={150,15},proc=SetNumParamProc,title="Number of Parameters" 
    345345        SetVariable NumParams,limits={2,Inf,0},value= root:AutoFit:numPar 
    346 //      CheckBox typeCheck,pos={207,31},size={32,14},title="NSE Data?",value=0 
    347 //      SetVariable fitTol,pos={80,208},size={80,15},title="Fit Tol" 
    348 //      SetVariable fitTol,limits={0.0001,0.1,0},value= root:AutoFit:fitTol 
    349         CheckBox epsilonCheck,pos={156,335},size={32,14},value=0,title="Use Epsilon Wave?" 
    350  
    351         TabControl tabC,pos={13,371},size={273,244},proc=tabProc,tabLabel(0)="Guess" 
     346///     CheckBox typeCheck,pos={207,31},size={32,14},title="NSE Data?",value=0 
     347///     SetVariable fitTol,pos={80,208},size={80,15},title="Fit Tol" 
     348///     SetVariable fitTol,limits={0.0001,0.1,0},value= root:AutoFit:fitTol 
     349        CheckBox epsilonCheck,pos={156,340},size={32,14},value=0,title="Use Epsilon Wave?" 
     350 
     351        TabControl tabC,pos={334,75},size={273,244},proc=tabProc,tabLabel(0)="Guess" 
    352352        TabControl tabC,tabLabel(1)="Hold",tabLabel(2)="Constraint",tabLabel(3)="Range",value= 0 
    353 //      CheckBox rangeCheck,pos={92,404},size={32,14},proc=RangeCheckProc,title="All" 
    354 //      CheckBox rangeCheck,value= 1,disable=2 
    355  
    356         SetVariable lowPt,pos={136,404},size={60,15},title="low" 
    357         SetVariable lowPt,limits={0,Inf,0},value= root:AutoFit:ptLow,noedit=1,disable=1 
    358         SetVariable highPt,pos={201,404},size={60,15},title=" to " 
    359         SetVariable highPt,limits={0,Inf,0},value= root:AutoFit:ptHigh,noedit=1,disable=1 
    360         ListBox holdBox,pos={24,398},size={145,208},disable=1,proc=UpdateHoldMatrixProc 
     353///     CheckBox rangeCheck,pos={92,404},size={32,14},proc=RangeCheckProc,title="All" 
     354///     CheckBox rangeCheck,value= 1,disable=2 
     355 
     356////    SetVariable lowPt,pos={136,404},size={60,15},title="low" 
     357////    SetVariable lowPt,limits={0,Inf,0},value= root:AutoFit:ptLow,noedit=1,disable=1 
     358////    SetVariable highPt,pos={201,404},size={60,15},title=" to " 
     359////    SetVariable highPt,limits={0,Inf,0},value= root:AutoFit:ptHigh,noedit=1,disable=1 
     360        ListBox holdBox,pos={345,102},size={145,208},disable=1,proc=UpdateHoldMatrixProc 
    361361        ListBox holdBox,frame=2,listWave=root:AutoFit:holdList 
    362362        ListBox holdBox,selWave=root:AutoFit:holdSel,mode= 2,selRow= 2 
    363         ListBox ConstrBox,pos={24,398},size={145,208},proc=UpdateConstrMatrixProc 
     363        ListBox ConstrBox,pos={345,102},size={145,208},proc=UpdateConstrMatrixProc 
    364364        ListBox ConstrBox,frame=2,listWave=root:AutoFit:ConstrList 
    365365        ListBox ConstrBox,selWave=root:AutoFit:ConstrSel,mode= 2,selRow= 2 
    366         ListBox RangeBox,pos={24,398},size={145,208},proc=UpdateRangeMatrixProc 
     366        ListBox RangeBox,pos={345,102},size={145,208},proc=UpdateRangeMatrixProc 
    367367        ListBox RangeBox,frame=2,listWave=root:AutoFit:rangeList 
    368368        ListBox RangeBox,selWave=root:AutoFit:RangeSel,mode= 2,selRow= 2 
    369 //      Button MatrixButton,pos={12,205},size={60,20},proc=ToMatrixButtonProc,title="Matrix",disable=2 
    370         Button DoItButton,pos={21,632},size={80,20},proc=DoTheFitsButtonProc,title="Do the fits" 
    371 //      Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..." 
    372         TitleBox tb1,pos={139,634},size={128,12},anchor=MC,variable=root:AutoFit:gStatus,frame=0 
    373         Button button0,pos={14,331},size={40,20},title="Plot",proc=LoadForGuessProc 
    374 //      SetVariable extStr,pos={4,170},size={40,15},title=" ",value= root:AutoFit:gExt 
    375          
    376         Button GuessCoefB,pos={198,440},size={50,20},title="Guess",proc=UseCoefAsGuess 
    377         Button GuessHoldB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseHoldAsGuess 
    378 //      Button GuessConstrB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseConstraintsAsGuess 
    379          
    380         TitleBox infoTitleBox pos={180,470},fixedSize=1,size={96,130},variable=root:AutoFit:guessStr 
    381          
    382         ValDisplay progressValdisp,pos={113,663},size={161,7},title="00:00" 
     369///     Button MatrixButton,pos={12,205},size={60,20},proc=ToMatrixButtonProc,title="Matrix",disable=2 
     370        Button DoItButton,pos={339,336},size={80,20},proc=DoTheFitsButtonProc,title="Do the fits" 
     371///     Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..." 
     372        TitleBox tb1,pos={479,330},size={128,12},anchor=MC,variable=root:AutoFit:gStatus,frame=0 
     373        Button button0,pos={14,336},size={60,20},title="Plot",proc=LoadForGuessProc 
     374///     SetVariable extStr,pos={4,170},size={40,15},title=" ",value= root:AutoFit:gExt 
     375         
     376        Button GuessCoefB,pos={519,144},size={50,20},title="Guess",proc=UseCoefAsGuess 
     377        Button GuessHoldB,pos={519,144},size={50,20},title="Guess",disable=1,proc=UseHoldAsGuess 
     378///     Button GuessConstrB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseConstraintsAsGuess 
     379         
     380        TitleBox infoTitleBox pos={501,174},fixedSize=1,size={96,130},variable=root:AutoFit:guessStr 
     381         
     382        ValDisplay progressValdisp,pos={446,349},size={161,7},title="00:00" 
    383383        ValDisplay progressValdisp,limits={0,root:AutoFit:endProgress,0},barmisc={0,0},value= root:AutoFit:curProgress 
    384384         
    385         Button AF_DoneButton,pos={174,30},size={70,20},proc=AF_DoneButtonProc,title="Done" 
    386         Button AF_HelpButton,pos={260,30},size={30,20},proc=AF_HelpButtonProc,title="?" 
     385        Button AF_DoneButton,pos={541,8},size={70,20},proc=AF_DoneButtonProc,title="Done" 
     386        Button AF_HelpButton,pos={496,8},size={30,20},proc=AF_HelpButtonProc,title="?" 
    387387 
    388388EndMacro 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf

    r867 r915  
    4040                DrawFlipperPanel() 
    4141        endif 
     42        // be sure that the panel is onscreen 
     43        DoIgorMenu "Control","Retrieve Window" 
    4244end 
    4345 
     
    6264         
    6365        PauseUpdate; Silent 1           // building window... 
    64         NewPanel /W=(1023,44,1832,526)/N=FlipperPanel/K=1 as "Flipper and Supermirror" 
     66        NewPanel /W=(250,44,1056,480)/N=FlipperPanel/K=1 as "Flipper and Supermirror" 
    6567        ModifyPanel cbRGB=(1,52428,26586) 
    6668         
    67         PopupMenu popup_0,pos={32,18},size={49,20},title="Field Condition",proc=FlipperPanelPopMenuProc 
     69        PopupMenu popup_0,pos={13,8},size={49,20},title="Field Condition",proc=FlipperPanelPopMenuProc 
    6870        PopupMenu popup_0,mode=1,value= #"D_ConditionNameList()" 
    6971         
    70         Button button_0,pos={42,310},size={100,20},proc=FlipperAverageButtonProc,title="Do Average" 
    71          
    72         GroupBox group_0,pos={39,350},size={335,103},title="AVERAGED RESULTS",fSize=10 
     72        Button button_0,pos={18,288},size={100,20},proc=FlipperAverageButtonProc,title="Do Average" 
     73         
     74        GroupBox group_0,pos={18,316},size={290,102},title="AVERAGED RESULTS",fSize=10 
    7375        GroupBox group_0,fStyle=1 
    74         SetVariable setvar_0,pos={49,385},size={250,15},title="Sam_depol*Psm*Pf" 
     76        SetVariable setvar_0,pos={33,351},size={250,15},title="Sam_depol*Psm*Pf" 
    7577        SetVariable setvar_0,fStyle=1 
    7678        SetVariable setvar_0,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsmPf 
    77         SetVariable setvar_1,pos={49,417},size={250,15},title="Sam_depol*Psm",fStyle=1 
     79        SetVariable setvar_1,pos={33,383},size={250,15},title="Sam_depol*Psm",fStyle=1 
    7880        SetVariable setvar_1,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsm 
    7981//      SetVariable setvar_2,pos={560,518},size={200,13},title="Gamma (h)",fStyle=1 
     
    8486         
    8587 
    86         Button button_1,pos={320,17},size={120,20},proc=AddFlipperConditionButton,title="Add Condition" 
    87         Button button_2,pos={403,295},size={110,20},proc=ClearAllFlipperWavesButton,title="Clear Table" 
    88         Button button_3,pos={183,310},size={120,20},proc=ShowFlipperCalcButton,title="Show Calc" 
    89         Button button_4,pos={540,295},size={110,20},proc=ClearFlipperRowButton,title="Clear Row" 
    90         Button button_5,pos={620,18},size={30,20},proc=FlipperHelpParButtonProc,title="?" 
    91         Button button_6,pos={488,418},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 
    92         Button button_7,pos={488,380},size={130,20},proc=ManualEnterPfPsmButton,title="Manual Entry" 
    93  
     88        Button button_1,pos={322,8},size={120,20},proc=AddFlipperConditionButton,title="Add Condition" 
     89        Button button_2,pos={482,323},size={110,20},proc=ClearAllFlipperWavesButton,title="Clear Table" 
     90        Button button_3,pos={330,288},size={110,20},proc=ShowFlipperCalcButton,title="Show Calc" 
     91        Button button_4,pos={482,288},size={110,20},proc=ClearFlipperRowButton,title="Clear Row" 
     92        Button button_5,pos={759,8},size={30,20},proc=FlipperHelpParButtonProc,title="?" 
     93        Button button_6,pos={328,358},size={110,20},proc=WindowSnapshotButton,title="Snapshot" 
     94        Button button_7,pos={331,323},size={110,20},proc=ManualEnterPfPsmButton,title="Manual Entry" 
     95 
     96        Button button_8,pos={615,288},size={110,20},proc=SaveFlipperPanelButton,title="Save State" 
     97        Button button_9,pos={615,323},size={110,20},proc=RestoreFlipperPanelButton,title="Restore State" 
     98         
    9499        // table 
    95         Edit/W=(14,55,794,275)/HOST=#  
     100        Edit/W=(14,40,794,275)/HOST=#  
    96101        ModifyTable format=1,width=0 
    97102        RenameWindow #,T0 
     
    101106        return(0) 
    102107End 
     108 
     109Function SaveFlipperPanelButton(ba) : ButtonControl 
     110        STRUCT WMButtonAction &ba 
     111 
     112        switch( ba.eventCode ) 
     113                case 2: // mouse up 
     114                        // click code here 
     115                        SaveFlipperTable() 
     116                        break 
     117                case -1: // control being killed 
     118                        break 
     119        endswitch 
     120 
     121        return 0 
     122End 
     123 
     124Function RestoreFlipperPanelButton(ba) : ButtonControl 
     125        STRUCT WMButtonAction &ba 
     126 
     127        switch( ba.eventCode ) 
     128                case 2: // mouse up 
     129                        // click code here 
     130                        RestoreFlipperTable() 
     131                        break 
     132                case -1: // control being killed 
     133                        break 
     134        endswitch 
     135 
     136        return 0 
     137End 
     138 
    103139 
    104140// now, this does not depend on the cell, just the condition 
     
    11171153         
    11181154        Variable refnum 
    1119         String fname="CellParamSaveState.itx" 
     1155        String fname="CellParamSaveState" 
    11201156//      WAVE w=root:testMat 
    11211157        WAVE/T cellName=root:Packages:NIST:Polarization:Cells:CellName 
     
    11261162        WAVE err_mu=root:Packages:NIST:Polarization:Cells:err_mu 
    11271163         
    1128         Open/P=home refnum      //as fname              // creates a new file, or overwrites the existing file   
     1164        // get the full path to the new file name before creating it 
     1165        fname = DoSaveFileDialog("Save the Cell Table",fname=fname,suffix=".itx") 
     1166        If(cmpstr(fname,"")==0) 
     1167                //user cancel, don't write out a file 
     1168                Close/A 
     1169                Abort "no data file was written" 
     1170        Endif 
     1171         
     1172        Open/P=home refnum      as fname                // creates a new file, or overwrites the existing file   
     1173         
    11291174        fprintf refNum,"IGOR\r" 
    11301175         
     
    11791224        Variable num,ii,refnum 
    11801225         
    1181         fname = "CellDecayPanelSaveState.itx" 
     1226        fname = "CellDecayPanelSaveState" 
    11821227         
    11831228        // get a list of the Decay waves 
     
    11861231//      print listStr 
    11871232 
    1188         Open/P=home refnum      // as fname             // creates a new file, or overwrites the existing file   
     1233        // get the full path to the new file name before creating it 
     1234        fname = DoSaveFileDialog("Save the Cell Decay Table",fname=fname,suffix=".itx") 
     1235        If(cmpstr(fname,"")==0) 
     1236                //user cancel, don't write out a file 
     1237                Close/A 
     1238                Abort "no data file was written" 
     1239        Endif 
     1240 
     1241        Open/P=home refnum as fname             // creates a new file, or overwrites the existing file   
    11891242        fprintf refNum,"IGOR\r" 
    11901243                         
     
    12841337        Variable num,ii,refnum 
    12851338         
    1286         fname = "FlipperPanelSaveState.itx" 
     1339        fname = "FlipperPanelSaveState" 
    12871340         
    12881341        // get a list of the "Condition" waves 
     
    12911344//      print listStr 
    12921345 
     1346        // get the full path to the new file name before creating it 
     1347        fname = DoSaveFileDialog("Save the Flipper State Table",fname=fname,suffix=".itx") 
     1348        If(cmpstr(fname,"")==0) 
     1349                //user cancel, don't write out a file 
     1350                Close/A 
     1351                Abort "no data file was written" 
     1352        Endif 
     1353         
    12931354        Open/P=home refnum      // as fname             // creates a new file, or overwrites the existing file   
    12941355        fprintf refNum,"IGOR\r" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf

    r867 r915  
    8282                restore=Initialize_PolCorPanel() 
    8383                PolCor_Panel() 
     84                 
     85                // be sure that the panel is onscreen 
     86                DoIgorMenu "Control","Retrieve Window" 
     87         
    8488                SetWindow PolCor_Panel hook(kill)=PolCorPanelHook               //to save the state when panel is killed 
    8589                //disable the controls on other tabs 
     
    131135        Variable num,ii,refnum 
    132136         
    133         fname = "PolCorPanelSaveState.itx" 
     137        fname = "PolCorPanelSaveState" 
    134138         
    135139        // get a list of the List waves 
     
    138142//      print listStr 
    139143 
     144 
     145        // get the full path to the new file name before creating it 
     146        fname = DoSaveFileDialog("Save the Pol_Cor Panel State",fname=fname,suffix=".itx") 
     147        If(cmpstr(fname,"")==0) 
     148                //user cancel, don't write out a file 
     149                Close/A 
     150                Abort "no data file was written" 
     151        Endif 
     152         
     153         
    140154        Open/P=home refnum// as fname           // creates a new file, or overwrites the existing file   
    141155        fprintf refNum,"IGOR\r" 
     
    327341Window PolCor_Panel() 
    328342        PauseUpdate; Silent 1           // building window... 
    329         NewPanel /W=(925,44,1662,800) /K=1 
     343        NewPanel /W=(300,44,1036,624) /K=1 as "Polarization Correction" 
    330344        ModifyPanel cbRGB=(64349,63913,44660) 
    331345//      ShowTools/A 
    332346        SetDrawEnv linethick= 2.00 
    333         DrawLine 10,510,600,510 
    334  
    335         TabControl PolCorTab,pos={15,27},size={708,401},proc=PolCorTabProc 
     347        DrawLine 11,427,696,427 
     348 
     349        TabControl PolCorTab,pos={15,20},size={515,360},proc=PolCorTabProc 
    336350        TabControl PolCorTab,tabLabel(0)="SAM",tabLabel(1)="EMP",tabLabel(2)="BGD" 
    337351        TabControl PolCorTab,value= 0 
    338352         
    339353        // always visible 
    340         Button button0,pos={26,445},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 
    341         Button button1,pos={26,473},size={130,20},proc=PolCorButton,title="Pol Correct Data" 
    342         Button button2,pos={222,445},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 
    343         Button button3,pos={222,473},size={160,20},proc=ChangeDisplayedPolData,title="Change Displayed Data" 
    344         Button button4,pos={620,18},size={30,20},proc=PolCorHelpParButtonProc,title="?" 
    345         Button button12,pos={440,473},size={120,20},proc=Display4XSButton,title="Display 4 XS" 
    346         Button button13,pos={440,446},size={120,20},proc=ClearPolCorEntries,title="Clear Entries" 
    347  
    348  
    349  
    350         TitleBox title0,pos={100,66},size={24,24},title="\\f01UU or + +",fSize=12 
    351         TitleBox title1,pos={430,66},size={24,24},title="\\f01DU or - +",fSize=12 
    352         TitleBox title2,pos={100,250},size={25,24},title="\\f01DD or - -",fSize=12 
    353         TitleBox title3,pos={430,250},size={24,24},title="\\f01UD or + -",fSize=12 
     354        Button button0,pos={23,396},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 
     355        Button button1,pos={136,397},size={130,20},proc=PolCorButton,title="Pol Correct Data" 
     356        Button button2,pos={546,92},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 
     357        Button button3,pos={546,151},size={160,20},proc=ChangeDisplayedPolData,title="Change Display Data" 
     358        Button button4,pos={503,9},size={30,20},proc=PolCorHelpParButtonProc,title="?" 
     359        Button button12,pos={546,121},size={120,20},proc=Display4XSButton,title="Display 4 XS" 
     360        Button button13,pos={360,9},size={110,20},proc=ClearPolCorEntries,title="Clear Entries" 
     361 
     362 
     363        TitleBox title0,pos={100,48},size={24,24},title="\\f01UU or + +",fSize=12 
     364        TitleBox title1,pos={380,48},size={24,24},title="\\f01DU or - +",fSize=12 
     365        TitleBox title2,pos={100,210},size={25,24},title="\\f01DD or - -",fSize=12 
     366        TitleBox title3,pos={380,210},size={24,24},title="\\f01UD or + -",fSize=12 
    354367         
    355368        // bits to set up reduction protocol 
    356         Button button5,pos={126,560},size={100,20},proc=PickDIVButton,title="set DIV file" 
     369        Button button5,pos={129,458},size={100,20},proc=PickDIVButton,title="set DIV file" 
    357370        Button button5,help={"This button will set the file selected in the File Catalog table to be the sensitivity file."} 
    358         Button button6,pos={126,590},size={100,20},proc=PickMASKButton,title="set MASK file" 
     371        Button button6,pos={129,482},size={100,20},proc=PickMASKButton,title="set MASK file" 
    359372        Button button6,help={"This button will set the file selected in the File Catalog table to be the mask file."} 
    360         Button button7,pos={126,620},size={110,20},proc=SetABSParamsButton,title="set ABS params" 
     373        Button button7,pos={129,506},size={110,20},proc=SetABSParamsButton,title="set ABS params" 
    361374        Button button7,help={"This button will prompt the user for absolute scaling parameters"} 
    362         Button button8,pos={126,650},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" 
     375        Button button8,pos={129,530},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" 
    363376        Button button8,help={"Prompts the user for the type of 1-D averaging to perform, as well as saving options"} 
    364         Button button9,pos={80,690},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data" 
     377        Button button9,pos={581,515},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data" 
    365378        Button button9,help={"Reduce PolCor data"} 
    366         Button button10,pos={226,690},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol" 
     379        Button button10,pos={581,460},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol" 
    367380        Button button10,help={"Save the PolCor protocol, within this experiment only"} 
    368         Button button11,pos={370,690},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol" 
    369         Button button11,help={"Recall a PolCor protocol from memory"}            
    370         Button button14,pos={226,720},size={120,20},proc=ExportPolCorProtocolButton,title="Export Protocol" 
     381        Button button11,pos={546,333},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol" 
     382        Button button11,help={"Recall a PolCor protocol from memory"} 
     383        Button button14,pos={546,303},size={120,20},proc=ExportPolCorProtocolButton,title="Export Protocol" 
    371384        Button button14,help={"Export the PolCor protocol, saving it on disk"} 
    372         Button button15,pos={370,720},size={120,20},proc=ImportPolCorProtocolButton,title="Import Protocol" 
     385        Button button15,pos={546,363},size={120,20},proc=ImportPolCorProtocolButton,title="Import Protocol" 
    373386        Button button15,help={"Import a PolCor protocol from a protocol previously saved to disk"} 
    374                  
    375         SetVariable setvar0,pos={322,560},size={250,15},title="file:" 
     387        Button button16,pos={546,216},size={110,20},proc=SavePolCorPanelButton,title="Save State" 
     388        Button button16,help={"Save the state of the panel for later recall"} 
     389        Button button17,pos={546,245},size={110,20},proc=RestorePolCorPanelButton,title="Restore State" 
     390        Button button17,help={"Recall a saved state of the Pol_Cor panel"} 
     391                         
     392        SetVariable setvar0,pos={303,458},size={250,15},title="file:" 
    376393        SetVariable setvar0,help={"Filename of the detector sensitivity file to be used in the data reduction"} 
    377         SetVariable setvar0,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gDIV 
    378         SetVariable setvar1,pos={322,590},size={250,15},title="file:" 
     394        SetVariable setvar0,limits={-inf,inf,0},value= root:myGlobals:Protocols:gDIV 
     395        SetVariable setvar1,pos={303,483},size={250,15},title="file:" 
    379396        SetVariable setvar1,help={"Filename of the mask file to be used in the data reduction"} 
    380         SetVariable setvar1,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gMASK 
    381         SetVariable setvar2,pos={322,620},size={250,15},title="parameters:" 
     397        SetVariable setvar1,limits={-inf,inf,0},value= root:myGlobals:Protocols:gMASK 
     398        SetVariable setvar2,pos={303,509},size={250,15},title="parameters:" 
    382399        SetVariable setvar2,help={"Keyword-string of values necessary for absolute scaling of data. Remaining parameters are taken from the sample file."} 
    383         SetVariable setvar2,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAbsStr  
    384         SetVariable setvar3,pos={322,650},size={250,15},title="parameters:" 
     400        SetVariable setvar2,limits={-inf,inf,0},value= root:myGlobals:Protocols:gAbsStr 
     401        SetVariable setvar3,pos={303,535},size={250,15},title="parameters:" 
    385402        SetVariable setvar3,help={"Keyword-string of choices used for averaging and saving the 1-D data files"} 
    386         SetVariable setvar3,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAVE     
    387          
    388         CheckBox check0,pos={10,560},size={72,14},title="Sensitivity" 
     403        SetVariable setvar3,limits={-inf,inf,0},value= root:myGlobals:Protocols:gAVE 
     404         
     405        CheckBox check0,pos={13,463},size={63,14},title="Sensitivity" 
    389406        CheckBox check0,help={"If checked, the specified detector sensitivity file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 
    390407        CheckBox check0,value= 1 
    391         CheckBox check1,pos={10,590},size={72,14},title="Mask" 
    392         CheckBox check1,help={""} 
    393         CheckBox check1,value= 1 
    394         CheckBox check2,pos={10,620},size={72,14},title="Absolute Scale" 
    395         CheckBox check2,help={""} 
    396         CheckBox check2,value= 1 
    397         CheckBox check3,pos={10,650},size={72,14},title="Average and Save" 
    398         CheckBox check3,help={""} 
    399         CheckBox check3,value= 1                 
    400         CheckBox check4,pos={10,530},size={72,14},title="Use EMP?" 
    401         CheckBox check4,help={""} 
    402         CheckBox check4,value= 1         
    403         CheckBox check5,pos={100,530},size={72,14},title="Use BGD?" 
    404         CheckBox check5,help={""} 
    405         CheckBox check5,value= 1         
    406  
     408        CheckBox check1,pos={13,486},size={39,14},title="Mask",value= 1 
     409        CheckBox check2,pos={13,509},size={82,14},title="Absolute Scale",value= 1 
     410        CheckBox check3,pos={13,532},size={96,14},title="Average and Save",value= 1 
     411        CheckBox check4,pos={13,436},size={59,14},title="Use EMP?",value= 1 
     412        CheckBox check5,pos={103,436},size={60,14},title="Use BGD?",value= 1 
    407413         
    408414 
    409415// SAM Tab       
    410         PopupMenu popup_0_1,pos={230,60},size={102,20},title="Condition" 
     416        PopupMenu popup_0_1,pos={190,45},size={102,20},title="Condition" 
    411417        PopupMenu popup_0_1, mode=1,popvalue="none",value= #"P_GetConditionNameList()" 
    412418        // UU 
    413         ListBox ListBox_0_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     419        ListBox ListBox_0_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    414420        ListBox ListBox_0_UU,listWave=root:Packages:NIST:Polarization:ListWave_0_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 
    415421        ListBox ListBox_0_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    436442 
    437443        // DU 
    438         ListBox ListBox_0_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     444        ListBox ListBox_0_DU,pos={310,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    439445        ListBox ListBox_0_DU,listWave=root:Packages:NIST:Polarization:ListWave_0_DU,titleWave=root:Packages:NIST:Polarization:lbTitles 
    440446        ListBox ListBox_0_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    461467 
    462468// DD 
    463         ListBox ListBox_0_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     469        ListBox ListBox_0_DD,pos={33,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    464470        ListBox ListBox_0_DD,listWave=root:Packages:NIST:Polarization:ListWave_0_DD,titleWave=root:Packages:NIST:Polarization:lbTitles 
    465471        ListBox ListBox_0_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    486492         
    487493// UD 
    488         ListBox ListBox_0_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     494        ListBox ListBox_0_UD,pos={310,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    489495        ListBox ListBox_0_UD,listWave=root:Packages:NIST:Polarization:ListWave_0_UD,titleWave=root:Packages:NIST:Polarization:lbTitles 
    490496        ListBox ListBox_0_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    512518 
    513519// EMP Tab 
    514         PopupMenu popup_1_1,pos={230,60},size={102,20},title="Condition" 
     520        PopupMenu popup_1_1,pos={190,45},size={102,20},title="Condition" 
    515521        PopupMenu popup_1_1, mode=1,popvalue="none",value= #"P_GetConditionNameList()"   
    516522        // UU 
    517         ListBox ListBox_1_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     523        ListBox ListBox_1_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    518524        ListBox ListBox_1_UU,listWave=root:Packages:NIST:Polarization:ListWave_1_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 
    519525        ListBox ListBox_1_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    540546 
    541547        // DU 
    542         ListBox ListBox_1_DU,pos={368,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     548        ListBox ListBox_1_DU,pos={310,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    543549        ListBox ListBox_1_DU,listWave=root:Packages:NIST:Polarization:ListWave_1_DU,titleWave=root:Packages:NIST:Polarization:lbTitles 
    544550        ListBox ListBox_1_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    565571 
    566572// DD 
    567         ListBox ListBox_1_DD,pos={33,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     573        ListBox ListBox_1_DD,pos={33,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    568574        ListBox ListBox_1_DD,listWave=root:Packages:NIST:Polarization:ListWave_1_DD,titleWave=root:Packages:NIST:Polarization:lbTitles 
    569575        ListBox ListBox_1_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    590596 
    591597// UD 
    592         ListBox ListBox_1_UD,pos={368,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     598        ListBox ListBox_1_UD,pos={310,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    593599        ListBox ListBox_1_UD,listWave=root:Packages:NIST:Polarization:ListWave_1_UD,titleWave=root:Packages:NIST:Polarization:lbTitles 
    594600        ListBox ListBox_1_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    618624// file is necessary - this is "incorrectly" labeled as UU. I'll get around to changing this in the future... 
    619625// 
    620         TitleBox title_2_UU,pos={350,100},size={400,48},title="\\f01BGD files are independent of polarization\rEnter all as UU",fSize=12 
     626        TitleBox title_2_UU,pos={250,100},size={400,48},title="\\f01BGD files are independent of polarization\rEnter all as UU",fSize=12 
    621627 
    622628 
    623629        // UU 
    624         ListBox ListBox_2_UU,pos={34,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2 
     630        ListBox ListBox_2_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 
    625631        ListBox ListBox_2_UU,listWave=root:Packages:NIST:Polarization:ListWave_2_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 
    626632        ListBox ListBox_2_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 
     
    722728 
    723729EndMacro 
     730 
     731Function SavePolCorPanelButton(ba) : ButtonControl 
     732        STRUCT WMButtonAction &ba 
     733 
     734        switch( ba.eventCode ) 
     735                case 2: // mouse up 
     736                        // click code here 
     737                        SavePolCorPanelState() 
     738                        break 
     739                case -1: // control being killed 
     740                        break 
     741        endswitch 
     742 
     743        return 0 
     744End 
     745 
     746Function RestorePolCorPanelButton(ba) : ButtonControl 
     747        STRUCT WMButtonAction &ba 
     748 
     749        switch( ba.eventCode ) 
     750                case 2: // mouse up 
     751                        // click code here 
     752                        RestorePolCorPanelState() 
     753                        break 
     754                case -1: // control being killed 
     755                        break 
     756        endswitch 
     757 
     758        return 0 
     759End 
     760 
     761 
    724762 
    725763// action procedure for the list box that allows the popup menu 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf

    r867 r915  
    144144                DrawCellParamPanel() 
    145145        endif 
    146  
     146        // be sure that the panel is onscreen 
     147        DoIgorMenu "Control","Retrieve Window" 
    147148end 
    148149 
     
    282283         
    283284        PauseUpdate; Silent 1           // building window... 
    284         NewPanel /W=(775,44,1375,377)/N=CellParamPanel/K=1 as "Fundamental Cell Parameters" 
     285        NewPanel /W=(150,44,750,377)/N=CellParamPanel/K=1 as "Fundamental Cell Parameters" 
    285286        ModifyPanel cbRGB=(65535,49151,55704) 
    286287        ModifyPanel fixedSize=1 
     
    289290        Button button_0,pos={10,10},size={90,20},proc=AddCellButtonProc,title="Add Cell" 
    290291        Button button_1,pos={118,10},size={160,20},proc=SaveCellParButtonProc,title="Update Parameters" 
    291         Button button_2,pos={300,10},size={130,20},proc=RevertCellParButtonProc,title="Revert Parameters" 
     292        Button button_2,pos={118,35},size={130,20},proc=RevertCellParButtonProc,title="Revert Parameters" 
    292293        Button button_3,pos={520,10},size={35,20},proc=CellHelpParButtonProc,title="?" 
    293294 
    294          
    295         Edit/W=(14,55,582,318)/HOST=# 
     295        Button button_4,pos={324,10},size={100,20},proc=SaveCellPanelButton,title="Save State" 
     296        Button button_5,pos={324,35},size={100,20},proc=RestoreCellPanelButton,title="Restore State" 
     297         
     298        Edit/W=(14,60,582,318)/HOST=# 
    296299        ModifyTable width(Point)=0 
    297300        RenameWindow #,T0 
     
    306309        return(0) 
    307310End 
     311 
     312 
     313Function SaveCellPanelButton(ba) : ButtonControl 
     314        STRUCT WMButtonAction &ba 
     315 
     316        switch( ba.eventCode ) 
     317                case 2: // mouse up 
     318                        // click code here 
     319                        SaveCellParameterTable() 
     320                        break 
     321                case -1: // control being killed 
     322                        break 
     323        endswitch 
     324 
     325        return 0 
     326End 
     327 
     328Function RestoreCellPanelButton(ba) : ButtonControl 
     329        STRUCT WMButtonAction &ba 
     330 
     331        switch( ba.eventCode ) 
     332                case 2: // mouse up 
     333                        // click code here 
     334                        RestoreCellParameterTable() 
     335                        break 
     336                case -1: // control being killed 
     337                        break 
     338        endswitch 
     339 
     340        return 0 
     341End 
     342 
     343 
     344 
    308345 
    309346Function CellHelpParButtonProc(ba) : ButtonControl 
     
    415452                DecayParamPanel() 
    416453        endif 
     454        // be sure that the panel is onscreen 
     455        DoIgorMenu "Control","Retrieve Window" 
    417456end 
    418457 
     
    441480         
    442481        PauseUpdate; Silent 1           // building window... 
    443         NewPanel /W=(759,44,1572,713)/N=DecayPanel/K=1 as "Cell Decay Parameters" 
     482        NewPanel /W=(200,44,1013,664)/N=DecayPanel/K=1 as "Cell Decay Parameters" 
    444483        ModifyPanel cbRGB=(32768,54615,65535) 
    445484//      Button button_3,pos={505,16},size={35,20},proc=DecayHelpParButtonProc,title="?" 
    446         PopupMenu popup_0,pos={32,18},size={49,20},title="Cell",proc=DecayPanelPopMenuProc 
     485        PopupMenu popup_0,pos={32,8},size={49,20},title="Cell",proc=DecayPanelPopMenuProc 
    447486        PopupMenu popup_0,mode=1,value= #"D_CellNameList()" 
    448487         
    449         Button button_0,pos={584,365},size={70,20},proc=DecayFitButtonProc,title="Do Fit" 
    450          
    451         GroupBox group_0,pos={550,399},size={230,149},title="FIT RESULTS",fSize=10 
     488        Button button_0,pos={560,294},size={70,20},proc=DecayFitButtonProc,title="Do Fit" 
     489         
     490        GroupBox group_0,pos={560,329},size={230,149},title="FIT RESULTS",fSize=10 
    452491        GroupBox group_0,fStyle=1 
    453         SetVariable setvar_0,pos={560,428},size={200,13},title="muPo of 3He" 
     492        SetVariable setvar_0,pos={570,358},size={200,13},title="muPo of 3He" 
    454493        SetVariable setvar_0,fStyle=1,limits={0,0,0},barmisc={0,1000} 
    455494        SetVariable setvar_0,value= root:Packages:NIST:Polarization:Cells:gMuPo 
    456         SetVariable setvar_1,pos={560,460},size={200,13},title="Po of 3He" 
     495        SetVariable setvar_1,pos={570,390},size={200,13},title="Po of 3He" 
    457496        SetVariable setvar_1,fStyle=1,limits={0,0,0},barmisc={0,1000} 
    458497        SetVariable setvar_1,value= root:Packages:NIST:Polarization:Cells:gPo 
    459         SetVariable setvar_2,pos={560,518},size={200,13},title="Gamma (h)",fStyle=1 
     498        SetVariable setvar_2,pos={570,448},size={200,13},title="Gamma (h)",fStyle=1 
    460499        SetVariable setvar_2,limits={0,0,0},barmisc={0,1000} 
    461500        SetVariable setvar_2,value= root:Packages:NIST:Polarization:Cells:gGamma 
    462         SetVariable setvar_3,pos={560,488},size={200,15},title="T0",fStyle=1 
     501        SetVariable setvar_3,pos={570,418},size={200,13},title="T0",fStyle=1 
    463502        SetVariable setvar_3,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gT0 
    464503         
    465504 
    466         Button button_1,pos={579,294},size={120,20},proc=CalcRowParamButton,title="Calculate Rows" 
    467         Button button_2,pos={307,18},size={110,20},proc=ClearDecayWavesButton,title="Clear Table" 
    468         Button button_3,pos={579,333},size={120,20},proc=ShowCalcRowButton,title="Show Calc" 
    469         Button button_4,pos={440,18},size={110,20},proc=ClearDecayWavesRowButton,title="Clear Row" 
    470         Button button_5,pos={620,18},size={40,20},proc=DecayHelpParButtonProc,title="?" 
    471         Button button_6,pos={620,620},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 
    472         Button button_7,pos={620,580},size={130,20},proc=ManualEnterDecayButton,title="Manual Entry" 
    473         CheckBox check0,mode=0,pos={600,550},title="Overrride T0?",value=0 
     505        Button button_1,pos={560,262},size={120,20},proc=CalcRowParamButton,title="Calculate Rows" 
     506        Button button_2,pos={307,8},size={110,20},proc=ClearDecayWavesButton,title="Clear Table" 
     507        Button button_3,pos={560,519},size={110,20},proc=ShowCalcRowButton,title="Show Calc" 
     508        Button button_4,pos={440,8},size={110,20},proc=ClearDecayWavesRowButton,title="Clear Row" 
     509        Button button_5,pos={620,8},size={40,20},proc=DecayHelpParButtonProc,title="?" 
     510        Button button_6,pos={560,574},size={110,20},proc=WindowSnapshotButton,title="Snapshot" 
     511        Button button_7,pos={560,547},size={110,20},proc=ManualEnterDecayButton,title="Manual Entry" 
     512        Button button_8,pos={690,547},size={110,20},proc=SaveDecayPanelButton,title="Save State" 
     513        Button button_9,pos={690,574},size={110,20},proc=RestoreDecayPanelButton,title="Restore State" 
     514        CheckBox check0,mode=0,pos={560,480},title="Overrride T0?",value=0 
    474515 
    475516 
    476517        // table 
    477         Edit/W=(14,55,794,275)/HOST=#  
     518        Edit/W=(14,35,794,240)/HOST=#  
    478519        ModifyTable format=1,width=0 
    479520        RenameWindow #,T0 
     
    481522         
    482523        // graph 
    483         Display/W=(15,291,540,652)/HOST=#  //root:yy vs root:xx 
     524        Display/W=(15,250,540,610)/HOST=#  //root:yy vs root:xx 
    484525        ModifyGraph frameStyle=2 
    485526        ModifyGraph mode=4 
     
    14221463End 
    14231464 
     1465Function SaveDecayPanelButton(ba) : ButtonControl 
     1466        STRUCT WMButtonAction &ba 
     1467 
     1468        switch( ba.eventCode ) 
     1469                case 2: // mouse up 
     1470                        // click code here 
     1471                        SaveCellDecayTable() 
     1472                        break 
     1473                case -1: // control being killed 
     1474                        break 
     1475        endswitch 
     1476 
     1477        return 0 
     1478End 
     1479 
     1480Function RestoreDecayPanelButton(ba) : ButtonControl 
     1481        STRUCT WMButtonAction &ba 
     1482 
     1483        switch( ba.eventCode ) 
     1484                case 2: // mouse up 
     1485                        // click code here 
     1486                        RestoreCellDecayTable() 
     1487                        break 
     1488                case -1: // control being killed 
     1489                        break 
     1490        endswitch 
     1491 
     1492        return 0 
     1493End 
     1494 
    14241495// null condition is not right. if the loop fails, then the  
    14251496// retStr will be ";;;;", not zero length. What's the proper test? 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf

    r912 r915  
    9696// 
    9797 
     98Static Constant MODE_STREAM = 0 
     99Static Constant MODE_OSCILL = 1 
     100Static Constant MODE_TISANE = 2 
     101Static Constant MODE_TOF = 3 
     102 
    98103//Menu "Macros" 
    99104//      "Split Large File",SplitBigFile() 
     
    132137        Variable/G root:Packages:NIST:gEvent_logint = 1 
    133138 
    134         Variable/G root:Packages:NIST:gEvent_Mode = 0                           // ==0 for "stream", ==1 for Oscillatory 
     139        Variable/G root:Packages:NIST:gEvent_Mode = MODE_OSCILL                         // ==0 for "stream", ==1 for Oscillatory 
    135140        Variable/G root:Packages:NIST:gRemoveBadEvents = 1              // ==1 to remove "bad" events, ==0 to read "as-is" 
    136141        Variable/G root:Packages:NIST:gSortStreamEvents = 0             // ==1 to sort the event stream, a last resort for a stream of data 
     
    146151        Duplicate/O slicedData logslicedData 
    147152        Duplicate/O slicedData dispsliceData 
     153 
     154 
     155// for decimation 
     156        Variable/G root:Packages:NIST:Event:gDecimation = 100 
     157        Variable/G root:Packages:NIST:gEvent_t_longest_decimated = 0 
     158 
     159// for large file splitting 
     160        String/G root:Packages:NIST:Event:gSplitFileList = ""           // a list of the file names as split 
    148161         
    149162        SetDataFolder root: 
    150163End 
    151164 
     165// 
     166// -- extra bits of buttons... not used 
     167// 
     168//      Button button9 title="Decimation",size={100,20},pos={490,400},proc=E_ShowDecimateButton 
     169// 
     170//      Button button11,pos={490,245},size={150,20},proc=LoadDecimateButtonProc,title="Load and Decimate" 
     171//      Button button12,pos={490,277},size={150,20},proc=ConcatenateButtonProc,title="Concatenate" 
     172//      Button button13,pos={490,305},size={150,20},proc=DisplayConcatenatedButtonProc,title="Display Concatenated" 
     173//       
     174//      GroupBox group0 title="Manual Controls",size={185,112},pos={490,220} 
     175// 
     176//      NewPanel /W=(82,44,854,664)/N=EventModePanel/K=2 
     177//      DoWindow/C EventModePanel 
     178//      ModifyPanel fixedSize=1,noEdit =1 
    152179Proc EventModePanel() 
    153180        PauseUpdate; Silent 1           // building window... 
    154         NewPanel /W=(100,50,600,840)/N=EventModePanel/K=2 
     181        NewPanel /W=(82,44,854,664)/N=EventModePanel/K=2 
    155182        DoWindow/C EventModePanel 
    156183        ModifyPanel fixedSize=1,noEdit =1 
    157         //ShowTools/A 
     184 
    158185        SetDrawLayer UserBack 
    159         Button button0,pos={10,10}, size={150,20},title="Load Event Log File",fSize=12 
    160         Button button0,proc=LoadEventLog_Button 
    161          
    162         TitleBox tb1,pos={20,650},size={460,80},fSize=12 
    163         TitleBox tb1,variable=root:Packages:NIST:gEventDisplayString 
    164          
    165         CheckBox chkbox1,pos={170,8},title="Oscillatory Mode?" 
    166         CheckBox chkbox1,variable = root:Packages:NIST:gEvent_mode 
    167         CheckBox chkbox3,pos={170,27},title="Remove Bad Events?" 
    168         CheckBox chkbox3,variable = root:Packages:NIST:gRemoveBadEvents 
    169          
    170         Button doneButton,pos={435,12}, size={50,20},title="Done",fSize=12 
    171         Button doneButton,proc=EventDone_Proc 
    172  
    173         Button button2,pos={20,122},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 
    174         Button button3,pos={20,147},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 
    175         Button button4,pos={175,122},size={140,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 
    176         Button button5,pos={175,147},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 
    177         Button button6,pos={378,13},size={40,20},proc=EventModeHelpButtonProc,title="?" 
    178  
    179         Button button7,pos={175+155,122},size={140,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 
    180         Button button8,pos={175+155,147},size={140,20},proc=CustomBinButtonProc,title="Custom Bins" 
    181          
    182         Button button1,pos = {10,50}, size={150,20},title="Process Data",fSize=12 
    183         Button button1,proc=ProcessEventLog_Button 
    184         SetVariable setvar1,pos={170,50},size={160,20},title="Number of slices",fSize=12,limits={1,1000,1} 
    185         SetVariable setvar1,value=root:Packages:NIST:gEvent_nslices 
    186         SetVariable setvar2,pos={330,50},size={160,20},title="Max Time (s)",fSize=12 
    187         SetVariable setvar2,value=root:Packages:NIST:gEvent_t_longest 
    188          
    189         PopupMenu popup0 title="Bin Spacing",pos={150,90},value="Equal;Fibonacci;Custom;" 
    190         PopupMenu popup0 proc=BinTypePopMenuProc 
    191          
    192         CheckBox chkbox2,pos={20,95},title="Log Intensity",value=1 
    193         CheckBox chkbox2,variable=root:Packages:NIST:gEvent_logint,proc=LogIntEvent_Proc 
    194         SetVariable setvar0,pos={320,90},size={160,20},title="Display Time Slice",fSize=12 
    195         SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:gEvent_tsdisp 
    196         SetVariable setvar0,proc=sliceSelectEvent_Proc 
    197         Display/W=(20,180,480,640)/HOST=EventModePanel/N=Event_slicegraph 
    198         AppendImage/W=EventModePanel#Event_slicegraph/T root:Packages:NIST:Event:dispsliceData 
    199         ModifyImage/W=EventModePanel#Event_slicegraph  ''#0 ctab= {*,*,ColdWarm,0} 
    200         ModifyImage/W=EventModePanel#Event_slicegraph ''#0 ctabAutoscale=3 
     186        DrawText 479,345,"Stream Data" 
     187        DrawLine 563,338,731,338 
     188        DrawText 479,419,"Oscillatory Data" 
     189        DrawLine 578,411,731,411 
     190 
     191//      ShowTools/A 
     192        Button button0,pos={14,87},size={150,20},proc=LoadEventLog_Button,title="Load Event Log File" 
     193        Button button0,fSize=12 
     194        TitleBox tb1,pos={475,500},size={135,24},fSize=10 
     195        TitleBox tb1,variable= root:Packages:NIST:gEventDisplayString 
     196 
     197        CheckBox chkbox2,pos={376,151},size={81,14},proc=LogIntEvent_Proc,title="Log Intensity" 
     198        CheckBox chkbox2,fSize=10,variable= root:Packages:NIST:gEvent_logint 
     199        CheckBox chkbox3,pos={14,125},size={119,14},title="Remove Bad Events?",fSize=10 
     200        CheckBox chkbox3,variable= root:Packages:NIST:gRemoveBadEvents 
     201         
     202        Button doneButton,pos={708,36},size={50,20},proc=EventDone_Proc,title="Done" 
     203        Button doneButton,fSize=12 
     204        Button button2,pos={419,28},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 
     205        Button button3,pos={419,56},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 
     206        Button button4,pos={487,227},size={120,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 
     207        Button button5,pos={419,85},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 
     208        Button button6,pos={718,9},size={40,20},proc=EventModeHelpButtonProc,title="?" 
     209        Button button7,pos={487,197},size={120,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 
     210        Button button8,pos={619,197},size={120,20},proc=CustomBinButtonProc,title="Custom Bins" 
     211        Button button1,pos={206,100},size={120,20},proc=ProcessEventLog_Button,title="Bin Event Data" 
     212        Button button1,fSize=12 
     213         
     214        SetVariable setvar0,pos={208,149},size={160,16},proc=sliceSelectEvent_Proc,title="Display Time Slice" 
     215        SetVariable setvar0,fSize=10 
     216        SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:gEvent_tsdisp    
     217        SetVariable setvar1,pos={206,26},size={160,16},title="Number of slices",fSize=10 
     218        SetVariable setvar1,limits={1,1000,1},value= root:Packages:NIST:gEvent_nslices 
     219        SetVariable setvar2,pos={206,51},size={160,16},title="Max Time (s)",fSize=10 
     220        SetVariable setvar2,value= root:Packages:NIST:gEvent_t_longest 
     221         
     222        PopupMenu popup0,pos={206,74},size={119,20},proc=BinTypePopMenuProc,title="Bin Spacing" 
     223        PopupMenu popup0,fSize=10 
     224        PopupMenu popup0,mode=1,popvalue="Equal",value= #"\"Equal;Fibonacci;Custom;\"" 
     225 
     226        Button button10,pos={488,305},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 
     227        Button button14,pos={488,350},size={130,20},proc=Stream_LoadDecim,title="Load From List" 
     228        SetVariable setvar3,pos={487,378},size={150,16},title="Decimation factor" 
     229        SetVariable setvar3,fSize=10 
     230        SetVariable setvar3,limits={1,inf,1},value= root:Packages:NIST:Event:gDecimation 
     231 
     232        Button button15_0,pos={488,425},size={110,20},proc=AccumulateSlicesButton,title="Add First Slice" 
     233        Button button16_1,pos={488,450},size={110,20},proc=AccumulateSlicesButton,title="Add Next Slice" 
     234        Button button17_2,pos={620,425},size={110,20},proc=AccumulateSlicesButton,title="Display Total" 
     235 
     236 
     237        CheckBox chkbox1_0,pos={25,34},size={69,14},title="Oscillatory",fSize=10 
     238        CheckBox chkbox1_0,mode=1,proc=EventModeRadioProc,value=1 
     239        CheckBox chkbox1_1,pos={25,59},size={53,14},title="Stream",fSize=10 
     240        CheckBox chkbox1_1,proc=EventModeRadioProc,value=0,mode=1 
     241        CheckBox chkbox1_2,pos={104,59},size={53,14},title="TISANE",fSize=10 
     242        CheckBox chkbox1_2,proc=EventModeRadioProc,value=0,mode=1 
     243        CheckBox chkbox1_3,pos={104,34},size={37,14},title="TOF",fSize=10 
     244        CheckBox chkbox1_3,proc=EventModeRadioProc,value=0,mode=1 
     245         
     246        GroupBox group0_0,pos={5,5},size={174,112},title="Mode",fSize=12,fStyle=1 
     247        GroupBox group0_1,pos={192,5},size={192,123},title="Binning",fSize=12,fStyle=1 
     248        GroupBox group0_2,pos={403,5},size={173,109},title="Viewing",fSize=12,fStyle=1 
     249        GroupBox group0_3,pos={476,169},size={277,92},title="Editing",fSize=12,fStyle=1 
     250        GroupBox group0_4,pos={474,278},size={279,200},title="Big Files",fSize=12 
     251        GroupBox group0_4,fStyle=1 
     252         
     253        Display/W=(10,170,460,610)/HOST=#  
     254        AppendImage/T :Packages:NIST:Event:dispsliceData 
     255        ModifyImage dispsliceData ctab= {*,*,ColdWarm,0} 
     256        ModifyImage dispsliceData ctabAutoscale=3 
    201257        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 
    202258        ModifyGraph mirror=2 
     
    208264        ModifyGraph btLen=3 
    209265        ModifyGraph tlOffset=-2 
    210         SetAxis/A left 
     266        RenameWindow #,Event_slicegraph 
    211267        SetActiveSubwindow ## 
    212268EndMacro 
    213269 
     270 
     271 
     272 
     273// mode selector 
     274//Static Constant MODE_STREAM = 0 
     275//Static Constant MODE_OSCILL = 1 
     276//Static Constant MODE_TISANE = 2 
     277//Static Constant MODE_TOF = 3 
     278// 
     279Function EventModeRadioProc(name,value) 
     280        String name 
     281        Variable value 
     282         
     283        NVAR gEventModeRadioVal= root:Packages:NIST:gEvent_mode 
     284         
     285        strswitch (name) 
     286                case "chkbox1_0": 
     287                        gEventModeRadioVal= MODE_OSCILL 
     288                        break 
     289                case "chkbox1_1": 
     290                        gEventModeRadioVal= MODE_STREAM 
     291                        break 
     292                case "chkbox1_2": 
     293                        gEventModeRadioVal= MODE_TISANE 
     294                        break 
     295                case "chkbox1_3": 
     296                        gEventModeRadioVal= MODE_TOF 
     297                        break 
     298        endswitch 
     299        CheckBox chkbox1_0,value= gEventModeRadioVal==MODE_OSCILL 
     300        CheckBox chkbox1_1,value= gEventModeRadioVal==MODE_STREAM 
     301        CheckBox chkbox1_2,value= gEventModeRadioVal==MODE_TISANE 
     302        CheckBox chkbox1_3,value= gEventModeRadioVal==MODE_TOF 
     303 
     304        return(0) 
     305End 
    214306 
    215307Function AdjustEventDataButtonProc(ba) : ButtonControl 
     
    363455        NVAR mode=root:Packages:NIST:gEvent_Mode 
    364456         
    365         if(mode == 0) 
     457        if(mode == MODE_STREAM) 
    366458                Stream_ProcessEventLog("") 
    367459        endif 
    368460         
    369         if(mode == 1) 
     461        if(mode == MODE_OSCILL) 
    370462                Osc_ProcessEventLog("") 
    371463        endif 
     
    776868// 
    777869// Would TISANE or TOF need a different loader? 
    778 // 
     870//       
    779871Function LoadEventLog_Button(ctrlName) : ButtonControl 
    780872        String ctrlName 
     
    782874        NVAR mode=root:Packages:NIST:gEvent_mode 
    783875        Variable err=0 
    784          
    785         if(mode == 0) 
    786                 err = Stream_LoadEventLog("") 
    787                 if(err == 1) 
    788                         return(0)               // user cancelled from file load 
    789                 endif 
    790         endif 
    791          
    792         if(mode == 1) 
    793                 err = Osc_LoadEventLog("") 
    794                 if(err == 1) 
    795                         return(0)               // user cancelled from file load 
    796                 endif 
    797         endif 
    798  
    799         STRUCT WMButtonAction ba 
    800         ba.eventCode = 2 
    801         ShowEventDataButtonProc(ba) 
    802  
    803         return(0) 
    804 End 
    805  
    806 // for the mode of "one continuous exposure" 
    807 // 
    808 Function Stream_LoadEventLog(ctrlName) 
    809         String ctrlName 
    810          
    811         Variable fileref 
     876        Variable fileref,totBytes 
     877        Variable fileTooLarge = 150             //limit load to 150MB 
    812878 
    813879        SVAR filename = root:Packages:NIST:gEvent_logfile 
     
    816882         
    817883        String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 
     884        String abortStr 
    818885         
    819886        Open/R/D/F=fileFilters fileref 
     
    824891                return(1) 
    825892        endif 
     893         
     894/// Abort if the files are too large 
     895        Open/R fileref as fileName 
     896                FStatus fileref 
     897        Close fileref 
     898 
     899        totBytes = V_logEOF/1e6         //in MB 
     900        if(totBytes > fileTooLarge) 
     901                sprintf abortStr,"File is %g MB, larger than the limit of %g MB. Split and Decimate.",totBytes,fileTooLarge 
     902                Abort abortStr 
     903        endif 
     904         
    826905 
    827906#if (exists("EventLoadWave")==4) 
     
    833912        SetDataFolder root:Packages:NIST:Event: 
    834913 
    835 tic() 
     914//tic() 
    836915        Wave timePt=timePt 
    837916        Wave xLoc=xLoc 
    838917        Wave yLoc=yLoc 
    839         CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes 
    840          
    841 toc() 
    842  
    843         Duplicate/O timePt rescaledTime 
    844         rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
    845         t_longest = waveMax(rescaledTime)               //should be the last point 
     918        CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes  
     919//toc() 
     920         
     921         
     922///// 
     923// now do a little processing of the times based on the type of data 
     924//       
     925        if(mode == MODE_STREAM)         // continuous "Stream" mode - start from zero 
     926                Duplicate/O timePt rescaledTime 
     927                rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
     928                t_longest = waveMax(rescaledTime)               //should be the last point       
     929        endif 
     930         
     931        if(mode == MODE_OSCILL)         // oscillatory mode - don't adjust the times, we get periodic t0 to reset t=0 
     932                Duplicate/O timePt rescaledTime 
     933                rescaledTime *= 1e-7                    //convert to seconds and that's all 
     934                t_longest = waveMax(rescaledTime)               //if oscillatory, won't be the last point, so get it this way 
     935         
     936                KillWaves/Z OscSortIndex                        //to make sure that there is no old index hanging around 
     937        endif 
     938 
     939 
    846940 
    847941        SetDataFolder root: 
    848942 
     943        STRUCT WMButtonAction ba 
     944        ba.eventCode = 2 
     945        ShowEventDataButtonProc(ba) 
     946 
    849947        return(0) 
    850948End 
    851949 
    852 // for the mode "oscillatory" 
    853 // 
    854 Function Osc_LoadEventLog(ctrlName) 
    855         String ctrlName 
    856          
    857         Variable fileref 
    858  
    859         SVAR filename = root:Packages:NIST:gEvent_logfile 
    860         NVAR nslices = root:Packages:NIST:gEvent_nslices 
    861         NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
    862          
    863         String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 
    864          
    865         Open/R/D/F=fileFilters fileref 
    866         filename = S_filename 
    867                 if(strlen(S_filename) == 0) 
    868                 // user cancelled 
    869                 DoAlert 0,"No file selected, no file loaded." 
    870                 return(1) 
    871         endif 
    872          
    873 #if (exists("EventLoadWave")==4) 
    874         LoadEvents_XOP() 
    875 #else 
    876         LoadEvents() 
    877 #endif   
    878          
    879         SetDataFolder root:Packages:NIST:Event: 
    880  
    881         Wave timePt=timePt 
    882         Wave xLoc=xLoc 
    883         Wave yLoc=yLoc 
    884         CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes 
    885          
    886         Duplicate/O timePt rescaledTime 
    887         rescaledTime *= 1e-7                    //convert to seconds and that's all 
    888         t_longest = waveMax(rescaledTime)               //if oscillatory, won't be the last point, so get it this way 
    889  
    890         KillWaves/Z OscSortIndex                        //to make sure that there is no old index hanging around 
    891  
    892         SetDataFolder root: 
    893  
    894         return(0) 
    895 End 
     950//// for the mode of "one continuous exposure" 
     951//// 
     952//Function Stream_LoadEventLog(ctrlName) 
     953//      String ctrlName 
     954//       
     955//      Variable fileref 
     956// 
     957//      SVAR filename = root:Packages:NIST:gEvent_logfile 
     958//      NVAR nslices = root:Packages:NIST:gEvent_nslices 
     959//      NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
     960//       
     961//      String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 
     962//       
     963//      Open/R/D/F=fileFilters fileref 
     964//      filename = S_filename 
     965//      if(strlen(S_filename) == 0) 
     966//              // user cancelled 
     967//              DoAlert 0,"No file selected, no file loaded." 
     968//              return(1) 
     969//      endif 
     970// 
     971//#if (exists("EventLoadWave")==4) 
     972//      LoadEvents_XOP() 
     973//#else 
     974//      LoadEvents() 
     975//#endif         
     976// 
     977//      SetDataFolder root:Packages:NIST:Event: 
     978// 
     979////tic() 
     980//      Wave timePt=timePt 
     981//      Wave xLoc=xLoc 
     982//      Wave yLoc=yLoc 
     983//      CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes 
     984//       
     985////toc() 
     986// 
     987//      Duplicate/O timePt rescaledTime 
     988//      rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
     989//      t_longest = waveMax(rescaledTime)               //should be the last point 
     990// 
     991//      SetDataFolder root: 
     992// 
     993//      return(0) 
     994//End 
     995// 
     996//// for the mode "oscillatory" 
     997//// 
     998//Function Osc_LoadEventLog(ctrlName) 
     999//      String ctrlName 
     1000//       
     1001//      Variable fileref 
     1002// 
     1003//      SVAR filename = root:Packages:NIST:gEvent_logfile 
     1004//      NVAR nslices = root:Packages:NIST:gEvent_nslices 
     1005//      NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
     1006//       
     1007//      String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 
     1008//       
     1009//      Open/R/D/F=fileFilters fileref 
     1010//      filename = S_filename 
     1011//              if(strlen(S_filename) == 0) 
     1012//              // user cancelled 
     1013//              DoAlert 0,"No file selected, no file loaded." 
     1014//              return(1) 
     1015//      endif 
     1016//       
     1017//#if (exists("EventLoadWave")==4) 
     1018//      LoadEvents_XOP() 
     1019//#else 
     1020//      LoadEvents() 
     1021//#endif         
     1022//       
     1023//      SetDataFolder root:Packages:NIST:Event: 
     1024// 
     1025//      Wave timePt=timePt 
     1026//      Wave xLoc=xLoc 
     1027//      Wave yLoc=yLoc 
     1028//      CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes 
     1029//       
     1030//      Duplicate/O timePt rescaledTime 
     1031//      rescaledTime *= 1e-7                    //convert to seconds and that's all 
     1032//      t_longest = waveMax(rescaledTime)               //if oscillatory, won't be the last point, so get it this way 
     1033// 
     1034//      KillWaves/Z OscSortIndex                        //to make sure that there is no old index hanging around 
     1035// 
     1036//      SetDataFolder root: 
     1037// 
     1038//      return(0) 
     1039//End 
    8961040 
    8971041 
     
    10151159        SVAR filepathstr = root:Packages:NIST:gEvent_logfile 
    10161160        SVAR dispStr = root:Packages:NIST:gEventDisplayString 
     1161         
     1162         
     1163////    Variable decFac = 10                    //decimation factor 
     1164////    Variable jj,keep 
    10171165         
    10181166        SetDataFolder root:Packages:NIST:Event 
     
    11231271        Print "num2 = ",num2     
    11241272        Print "num3 = ",num3     
    1125          
     1273 
    11261274// 
    11271275//       
     
    11521300        Make/O/U/N=(numXYevents) xLoc,yLoc 
    11531301        Make/O/D/N=(numXYevents) timePt 
     1302////    Make/O/U/N=(numXYevents/decFac) xLoc,yLoc 
     1303////    Make/O/D/N=(numXYevents/decFac) timePt 
    11541304//      Make/O/U/N=(totBytes/4) xLoc,yLoc               //too large, trim when done (bad idea) 
    11551305//      Make/O/D/N=(totBytes/4) timePt 
     
    11741324        tic() 
    11751325         
    1176         ii = 0 
     1326        ii = 0          //indexes the points in xLoc,yLoc,timePt 
     1327////    keep = decFac           //keep the first point 
     1328         
    11771329         
    11781330        Open/R fileref as filepathstr 
     
    12071359                                endif 
    12081360                                 
    1209                                 // this is the first point, be sure that ii = 0 
    1210                                 ii = 0 
    1211                                 xLoc[ii] = xval 
    1212                                 yLoc[ii] = yval 
    1213                                  
     1361                                // this is the first point, be sure that ii = 0, and always keep this point 
     1362////                            if(keep==decFac) 
     1363                                        ii = 0 
     1364                                        xLoc[ii] = xval 
     1365                                        yLoc[ii] = yval 
     1366////                                    keep = 0 
     1367////                            endif 
    12141368                                Print "At beginning of file, numBad = ",numBad 
    12151369                                break   // the next do loop processes the bulk of the file (** the next event == type 1 = MIR) 
     
    12241378         
    12251379        // now read the main portion of the file. 
     1380////    // keep is = 0 if bad points were removed, or is decFac is I need to keep the first point 
    12261381        do 
    12271382                do 
     
    12291384                while(strlen(buffer) == 1)               
    12301385 
    1231                 if (strlen(buffer) == 0) 
     1386                if (strlen(buffer) == 0)                                // this marks the end of the file and is our only way out 
    12321387                        break 
    12331388                endif 
     
    13031458                                        else 
    13041459                                                // time_msw has been reset, points are good now, so keep this one 
     1460////                                            if(keep==decFac) 
     1461                                                        xLoc[ii] = xval 
     1462                                                        yLoc[ii] = yval 
     1463                                                        timePt[ii] = timeval 
     1464                                                         
     1465        //                                              if(xval == 127 && yval == 0) 
     1466        //                                                      // check bit 29 
     1467        //                                                      bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1468        //                                                      Print "XY=127,0 : bit29 = ",bit29 
     1469        //                                              endif 
     1470                                                         
     1471                                                        ii+=1 
     1472                                                        rolloverHappened = 0 
     1473////                                                    keep = 0 
     1474////                                            else 
     1475////                                                    keep += 1 
     1476////                                            endif 
     1477                                        endif 
     1478                                else 
     1479                                        // normal processing of good point, keep it 
     1480////                                    if(keep==decFac) 
    13051481                                                xLoc[ii] = xval 
    13061482                                                yLoc[ii] = yval 
    13071483                                                timePt[ii] = timeval 
    1308                                                  
    1309 //                                              if(xval == 127 && yval == 0) 
    1310 //                                                      // check bit 29 
    1311 //                                                      bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
    1312 //                                                      Print "XY=127,0 : bit29 = ",bit29 
    1313 //                                              endif 
    1314                                                  
     1484                                         
     1485        //                                      if(xval == 127 && yval == 0) 
     1486        //                                              // check bit 29 
     1487        //                                              bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1488        //                                              Printf "XY=127,0 : bit29 = %u : d=%u\r",bit29,dataval 
     1489        //                                      endif 
    13151490                                                ii+=1 
    1316                                                 rolloverHappened = 0 
    1317                                         endif 
    1318                                 else 
    1319                                         // normal processing of good point, keep it 
    1320                                         xLoc[ii] = xval 
    1321                                         yLoc[ii] = yval 
    1322                                         timePt[ii] = timeval 
    1323                                  
    1324 //                                      if(xval == 127 && yval == 0) 
    1325 //                                              // check bit 29 
    1326 //                                              bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
    1327 //                                              Printf "XY=127,0 : bit29 = %u : d=%u\r",bit29,dataval 
    1328 //                                      endif 
    1329                                         ii+=1 
     1491////                                            keep = 0 
     1492////                                    else 
     1493////                                            keep += 1 
     1494////                                    endif 
    13301495                                endif 
    13311496 
     
    13661531                                endif 
    13671532                                 
    1368                                 xLoc[ii] = xval 
    1369                                 yLoc[ii] = yval 
    1370  
     1533////                            if(keep==decFac)                        //don't reset keep yet, do this only when ii increments 
     1534                                        xLoc[ii] = xval 
     1535                                        yLoc[ii] = yval 
     1536////                            endif 
     1537                                 
    13711538                                // don't fill in the time yet, or increment the index ii 
    13721539                                // the next event MUST be ATMIR with the MSW time bits 
     
    13901557                                 
    13911558                                // the XY position was in the previous event ATXYM 
    1392                                 timePt[ii] = timeval 
     1559////                            if(keep == decFac) 
     1560                                        timePt[ii] = timeval 
     1561////                            endif 
    13931562 
    13941563                                bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     
    14011570                                        nRoll = 0 
    14021571                                endif 
    1403                                                                  
    1404                                 ii+=1 
     1572                                 
     1573////                            if(keep == decFac)                       
     1574                                        ii+=1 
     1575////                                    keep = 0 
     1576////                            endif 
    14051577//                              verbose = 0 
    14061578                                break 
     
    14521624        Print "Events removed (Igor) = ",numRemoved 
    14531625         
    1454         sPrintf tmpStr,"\rBad Rollover Events = %d (%g %% of events)",numBad,numBad/numXYevents*100 
     1626        sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 
    14551627        dispStr += tmpStr 
    1456         sPrintf tmpStr,"\rTotal Events Removed = %d (%g %% of events)",numRemoved,numRemoved/numXYevents*100 
     1628        sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 
    14571629        dispStr += tmpStr 
    14581630        SetDataFolder root: 
     
    16261798        Print "Events removed (XOP) = ",numRemoved 
    16271799         
    1628         sPrintf tmpStr,"\rBad Rollover Events = %d (%g %% of events)",numBad,numBad/numXYevents*100 
     1800        sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 
    16291801        dispStr += tmpStr 
    1630         sPrintf tmpStr,"\rTotal Events Removed = %d (%g %% of events)",numRemoved,numRemoved/numXYevents*100 
     1802        sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 
    16311803        dispStr += tmpStr 
    16321804 
     
    19492121        ControlBar 100 
    19502122        Button button0,pos={18,12},size={70,20},proc=EC_AddCursorButtonProc,title="Cursors" 
    1951         Button button1,pos={153,11},size={80,20},proc=EC_AddTimeButtonProc,title="Add time" 
    1952         Button button2,pos={153,37},size={80,20},proc=EC_SubtractTimeButtonProc,title="Subtr time" 
     2123        Button button1,pos={153,12},size={80,20},proc=EC_AddTimeButtonProc,title="Add time" 
     2124        Button button2,pos={153,38},size={80,20},proc=EC_SubtractTimeButtonProc,title="Subtr time" 
    19532125        Button button3,pos={153,64},size={90,20},proc=EC_TrimPointsButtonProc,title="Trim points" 
    1954         Button button4,pos={295,12},size={90,20},proc=EC_SaveWavesButtonProc,title="Save Waves" 
    1955         Button button5,pos={294,38},size={100,20},proc=EC_ImportWavesButtonProc,title="Import Waves" 
    1956         Button button6,pos={18,39},size={80,20},proc=EC_ShowAllButtonProc,title="All Data" 
    1957         Button button7,pos={683,9},size={30,20},proc=EC_HelpButtonProc,title="?" 
     2126        Button button4,pos={295+200,12},size={90,20},proc=EC_SaveWavesButtonProc,title="Save Waves" 
     2127        Button button5,pos={295+200,38},size={100,20},proc=EC_ImportWavesButtonProc,title="Import Waves" 
     2128        Button button6,pos={18,38},size={80,20},proc=EC_ShowAllButtonProc,title="All Data" 
     2129        Button button7,pos={683,12},size={30,20},proc=EC_HelpButtonProc,title="?" 
    19582130        Button button8,pos={658,72},size={60,20},proc=EC_DoneButtonProc,title="Done" 
     2131 
     2132        Button button9,pos={295,12},size={110,20},proc=EC_FindStepButton_down,title="Find Step Down" 
     2133        Button button10,pos={295,38},size={110,20},proc=EC_FindStepButton_up,title="Find Step Up" 
     2134        Button button11,pos={295,64},size={110,20},proc=EC_DoDifferential,title="Differential" 
    19592135         
    19602136        SetDataFolder root: 
     
    21002276                        Wave xLoc = xLoc 
    21012277                        Wave yLoc = yLoc 
    2102                         Save/T xLoc,yLoc,timePt                 //will ask for a name 
     2278                        Save/T xLoc,yLoc,timePt ,rescaledTime           //will ask for a name 
    21032279                         
    21042280                        SetDataFolder root: 
     
    21392315                        KillWaves/Z OscSortIndex 
    21402316                        Wave timePt=timePt 
    2141  
    2142                         Duplicate/O timePt rescaledTime 
    2143                         if(mode==0) 
    2144                                 rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
    2145                         else 
    2146                                 rescaledTime = timePt*1e-7                                              //just take the times as-is 
    2147                         endif 
     2317                        Wave rescaledTime=rescaledTime 
     2318 
     2319//                      Duplicate/O timePt rescaledTime 
     2320//                      if(mode==MODE_STREAM) 
     2321//                              rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
     2322//                      else 
     2323//                              rescaledTime = timePt*1e-7                                              //just take the times as-is 
     2324//                      endif 
    21482325                         
    21492326                        t_longest = waveMax(rescaledTime)               //should be the last point 
     
    22082385End 
    22092386 
    2210  
    2211  
     2387//upDown 5 or -5 looks for spikes +5 or -5 std deviations from mean 
     2388Function PutCursorsAtStep(upDown) 
     2389        Variable upDown 
     2390         
     2391        SetDataFolder root:Packages:NIST:Event: 
     2392 
     2393        Wave rescaledTime=rescaledTime 
     2394        Wave rescaledTime_DIF=rescaledTime_DIF 
     2395        Variable avg,pt,zoom 
     2396         
     2397        zoom = 200              //points in each direction 
     2398         
     2399        WaveStats/Q rescaledTime_DIF 
     2400        avg = V_avg 
     2401         
     2402         
     2403        FindLevel/P/Q rescaledTime_DIF avg*upDown 
     2404        if(V_flag==0) 
     2405                pt = V_levelX 
     2406                WaveStats/Q/R=[pt-zoom,pt+zoom] rescaledTime            // find the max/min y-vallues within the point range 
     2407        else 
     2408                Print "Level not found" 
     2409                return(0) 
     2410        endif 
     2411         
     2412        Variable loLeft,hiLeft, loBottom,hiBottom 
     2413        loLeft = V_min*0.98             //+/- 2% 
     2414        hiLeft = V_max*1.02 
     2415         
     2416        SetAxis left loLeft,hiLeft 
     2417        SetAxis bottom pnt2x(rescaledTime,pt-zoom),pnt2x(rescaledTime,pt+zoom) 
     2418         
     2419        Cursor/P A rescaledTime pt+2    //at the point 
     2420        Cursor/P B rescaledTime numpnts(rescaledTime)-1         //at the end 
     2421 
     2422        SetDataFolder root: 
     2423 
     2424        return(0) 
     2425End 
     2426 
     2427 
     2428Function EC_FindStepButton_down(ctrlName) : ButtonControl 
     2429        String ctrlName 
     2430         
     2431        Variable upDown = -5 
     2432        PutCursorsAtStep(upDown) 
     2433 
     2434        return(0) 
     2435end 
     2436 
     2437 
     2438Function EC_FindStepButton_up(ctrlName) : ButtonControl 
     2439        String ctrlName 
     2440         
     2441        Variable upDown = 5 
     2442        PutCursorsAtStep(upDown) 
     2443 
     2444        return(0) 
     2445end 
     2446 
     2447 
     2448Function EC_DoDifferential(ctrlName) : ButtonControl 
     2449        String ctrlName 
     2450         
     2451        DifferentiatedTime() 
     2452        DoWindow/F EventCorrectionPanel 
     2453         
     2454        //if trace is not on graph, add it 
     2455        SetDataFolder root:Packages:NIST:Event: 
     2456 
     2457        String list = WaveList("*_DIF", ";", "WIN:EventCorrectionPanel") 
     2458        if(strlen(list) == 0) 
     2459                AppendToGraph/R rescaledTime_DIF 
     2460                ModifyGraph msize=1,rgb(rescaledTime_DIF)=(65535,0,0) 
     2461                ReorderTraces rescaledTime,{rescaledTime_DIF}           // put the differential behind the event data 
     2462        endif 
     2463        SetDataFolder root: 
     2464        return(0) 
     2465end 
    22122466 
    22132467//////////////   Custom Bins  ///////////////////// 
     
    22692523        SetVariable setvar1,pos={23,13},size={160,20},title="Number of slices",fSize=12 
    22702524        SetVariable setvar1,proc=CB_NumSlicesSetVarProc,value=root:Packages:NIST:gEvent_nslices 
    2271         SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=12 
     2525        SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=10 
    22722526        SetVariable setvar2,value=root:Packages:NIST:gEvent_t_longest    
    22732527 
     
    25052759        Prompt baseStr,"File prefix, number will be appended" 
    25062760         
     2761         
    25072762        fSplitBigFile(splitSize, baseStr) 
    2508 End 
    2509  
    2510 Function fSplitBigFile(splitSize, baseStr) 
     2763         
     2764End 
     2765 
     2766Function/S fSplitBigFile(splitSize, baseStr) 
    25112767        Variable splitSize 
    25122768        String baseStr           
     
    25172773        Variable refNum 
    25182774        String str 
     2775        SVAR listStr = root:Packages:NIST:Event:gSplitFileList 
     2776         
     2777        listStr=""              //initialize output list 
    25192778 
    25202779        Variable readSize=1e6           //1 MB 
     
    25222781        Variable numSplit 
    25232782        Variable num,ii,jj,outRef,frac 
    2524         String thePath 
     2783        String thePath, outStr 
    25252784         
    25262785        Printf "SplitSize = %u MB\r",splitSize 
     
    25302789        // Open file for read. 
    25312790        Open/R/Z=2/F="????"/P=$pathName refNum as fileName 
    2532         thePath = ParseFilePath(1, fileName, ":", 1, 0) 
     2791        thePath = ParseFilePath(1, S_fileName, ":", 1, 0) 
     2792        Print "thePath = ",thePath 
    25332793         
    25342794        // Store results from Open in a safe place. 
     
    25382798        if (err == -1) 
    25392799                Print "cancelled by user." 
    2540                 return -1 
     2800                return ("") 
    25412801        endif 
    25422802 
     
    25652825        Printf "frac = %u\r",frac 
    25662826         
    2567         baseStr = "split" 
     2827//      baseStr = "split" 
    25682828         
    25692829        for(ii=0;ii<numSplit;ii+=1) 
    2570                 Open outRef as (thePath+baseStr+num2str(ii)) 
     2830                outStr = (thePath+baseStr+num2str(ii)) 
     2831//              Print "outStr = ",outStr 
     2832                Open outRef as outStr 
    25712833 
    25722834                for(jj=0;jj<(splitSize/readSize);jj+=1) 
     
    25762838 
    25772839                Close outRef 
     2840                listStr += outStr+";" 
    25782841        endfor 
    25792842 
    25802843        Make/O/B/U/N=(frac) leftover 
    25812844        // ii was already incremented past the loop 
    2582         Open outRef as (thePath+baseStr+num2str(ii)) 
     2845        outStr = (thePath+baseStr+num2str(ii)) 
     2846        Open outRef as outStr 
    25832847        for(jj=0;jj<num;jj+=1) 
    25842848                FBinRead refNum,aBlob 
     
    25892853 
    25902854        Close outRef 
     2855        listStr += outStr+";" 
    25912856 
    25922857 
     
    25942859        Close refNum 
    25952860         
    2596          
    2597         return 0 
     2861        KillWaves/Z aBlob,leftover 
     2862        return(listStr) 
    25982863End 
    25992864 
     
    26012866 
    26022867//// save the sliced data, and accumulate slices 
    2603 // 
    2604 // need some way of ensuring that the slices match up since I' blindly adding them together. 
    2605 // 
    2606 // 
    2607 //  
     2868//  *** this works with sliced data -- that is data that has been PROCESSED 
     2869// 
     2870// need some way of ensuring that the slices match up since I'm blindly adding them together.  
    26082871// 
    26092872// mode = 0             wipe out the old accumulated, copy slicedData to accumulatedData 
    26102873// mode = 1             add current slicedData to accumulatedData 
    26112874// mode = 2             copy accumulatedData to slicedData in preparation of export or display 
    2612 // mode = 3             sing a song, dance a dance 
    2613 // 
     2875// mode = 3             unused... 
     2876// 
     2877//      "Split Large File",SplitBigFile() 
     2878//      "Accumulate First Slice",AccumulateSlices(0) 
     2879//      "Add Current Slice",AccumulateSlices(1) 
     2880//      "Display Accumulated Slices",AccumulateSlices(2)         
     2881// 
     2882Function AccumulateSlicesButton(ctrlName) : ButtonControl 
     2883        String ctrlName 
     2884         
     2885        Variable mode 
     2886        mode = str2num(ctrlName[strlen(ctrlName)-1]) 
     2887//      Print "mode=",mode 
     2888        AccumulateSlices(mode) 
     2889         
     2890        return(0) 
     2891End 
     2892 
    26142893Function AccumulateSlices(mode) 
    26152894        Variable mode 
     
    26402919        return(0) 
    26412920end 
     2921 
     2922 
     2923//////////////////////////////////////////// 
     2924// 
     2925// Panel and procedures for decimation 
     2926// 
     2927//////////////////////////////////////////// 
     2928 
     2929//Function E_ShowDecimateButton(ctrlName) : ButtonControl 
     2930//      String ctrlName 
     2931// 
     2932//      DoWindow/F DecimatePanel 
     2933//      if(V_flag ==0) 
     2934//              Execute "DecimatePanel()" 
     2935//      endif 
     2936//End 
     2937// 
     2938// 
     2939//Proc DecimatePanel() //: Panel 
     2940//       
     2941//      PauseUpdate; Silent 1           // building window... 
     2942//      NewPanel /W=(1602,44,1961,380)/K=1 
     2943////    ShowTools/A 
     2944//      Button button0,pos={29,15},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 
     2945//      SetVariable setvar0,pos={182,55},size={150,15},title="Decimation factor",fsize=10 
     2946//      SetVariable setvar0,limits={1,inf,1},value= root:Packages:NIST:Event:gDecimation 
     2947//      Button button1,pos={26,245},size={150,20},proc=LoadDecimateButtonProc,title="Load and Decimate" 
     2948//      Button button2,pos={25,277},size={150,20},proc=ConcatenateButtonProc,title="Concatenate" 
     2949//      Button button3,pos={25,305},size={150,20},proc=DisplayConcatenatedButtonProc,title="Display Concatenated" 
     2950//      Button button4,pos={29,52},size={130,20},proc=Stream_LoadDecim,title="Load From List" 
     2951//       
     2952//      GroupBox group0 title="Manual Controls",size={185,112},pos={14,220} 
     2953//EndMacro 
     2954 
     2955 
     2956Function SplitFileButtonProc(ctrlName) : ButtonControl 
     2957        String ctrlName 
     2958 
     2959        Execute "SplitBigFile()" 
     2960End 
     2961 
     2962 
     2963// show all of the data 
     2964// 
     2965Proc ShowDecimatedGraph() 
     2966 
     2967        DoWindow/F DecimatedGraph 
     2968        if(V_flag == 0) 
     2969                PauseUpdate; Silent 1           // building window... 
     2970                String fldrSav0= GetDataFolder(1) 
     2971                SetDataFolder root:Packages:NIST:Event: 
     2972                Display /W=(25,44,486,356)/K=1/N=DecimatedGraph rescaledTime_dec 
     2973                SetDataFolder fldrSav0 
     2974                ModifyGraph mode=4 
     2975                ModifyGraph marker=19 
     2976                ModifyGraph rgb(rescaledTime_dec)=(0,0,0) 
     2977                ModifyGraph msize=1 
     2978                ErrorBars rescaledTime_dec OFF  
     2979                Label left "\\Z14Time (seconds)" 
     2980                Label bottom "\\Z14Event number" 
     2981                ShowInfo 
     2982        endif 
     2983         
     2984EndMacro 
     2985 
     2986// data has NOT been processed 
     2987// 
     2988// so work with x,y,t, and rescaled time 
     2989// variables -- t_longest 
     2990Function ConcatenateButtonProc(ctrlName) : ButtonControl 
     2991        String ctrlName 
     2992         
     2993        DoAlert 1,"Is this the first file?" 
     2994        Variable first = V_flag 
     2995         
     2996        fConcatenateButton(first) 
     2997         
     2998        return(0) 
     2999End 
     3000 
     3001Function fConcatenateButton(first) 
     3002        Variable first 
     3003 
     3004 
     3005        SetDataFolder root:Packages:NIST:Event: 
     3006 
     3007        Wave timePt_dTmp=timePt_dTmp 
     3008        Wave xLoc_dTmp=xLoc_dTmp 
     3009        Wave yLoc_dTmp=yLoc_dTmp 
     3010        Wave rescaledTime_dTmp=rescaledTime_dTmp 
     3011         
     3012        NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 
     3013        NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
     3014         
     3015         
     3016        if(first==1)            //1==yes, 2==no 
     3017                //then copy the files over, adjusting the time to start from zero 
     3018                // rescaledTime starts from zero (set by the loader) 
     3019 
     3020                timePt_dTmp -= timePt_dTmp[0]                   //subtract the first value 
     3021                 
     3022                Duplicate/O timePt_dTmp timePt_dec 
     3023                Duplicate/O xLoc_dTmp xLoc_dec 
     3024                Duplicate/O yLoc_dTmp yLoc_dec 
     3025                Duplicate/O rescaledTime_dTmp rescaledTime_dec 
     3026                 
     3027                t_longest_dec = t_longest 
     3028         
     3029        else 
     3030                // concatenate the files + adjust the time 
     3031                Wave timePt_dec=timePt_dec 
     3032                Wave xLoc_dec=xLoc_dec 
     3033                Wave yLoc_dec=yLoc_dec 
     3034                Wave rescaledTime_dec=rescaledTime_dec 
     3035 
     3036                // adjust the times -- assuming they add 
     3037                // rescaledTime starts from zero (set by the loader) 
     3038                // 
     3039                // 
     3040                rescaledTime_dTmp += rescaledTime_dec[numpnts(rescaledTime_dec)-1] 
     3041                rescaledTime_dTmp += abs(rescaledTime_dec[numpnts(rescaledTime_dec)-1] - rescaledTime_dec[numpnts(rescaledTime_dec)-2]) 
     3042                 
     3043                timePt_dTmp -= timePt_dTmp[0]                   //subtract the first value       
     3044                 
     3045                timePt_dTmp += timePt_dec[numpnts(timePt_dec)-1]                // offset by the last point 
     3046                timePt_dTmp += abs(timePt_dec[numpnts(timePt_dec)-1] - timePt_dec[numpnts(timePt_dec)-2])               // plus delta so there's not a flat step 
     3047                 
     3048                Concatenate/NP/O {timePt_dec,timePt_dTmp}, tmp 
     3049                Duplicate/O tmp timePt_dec 
     3050                 
     3051                Concatenate/NP/O {xLoc_dec,xLoc_dTmp}, tmp 
     3052                Duplicate/O tmp xLoc_dec 
     3053                 
     3054                Concatenate/NP/O {yLoc_dec,yLoc_dTmp}, tmp 
     3055                Duplicate/O tmp yLoc_dec 
     3056                 
     3057                Concatenate/NP/O {rescaledTime_dec,rescaledTime_dTmp}, tmp 
     3058                Duplicate/O tmp rescaledTime_dec 
     3059                 
     3060 
     3061                KillWaves tmp 
     3062 
     3063                t_longest_dec = rescaledTime_dec[numpnts(rescaledTime_dec)-1] 
     3064 
     3065        endif 
     3066         
     3067         
     3068        SetDataFolder root: 
     3069         
     3070        return(0) 
     3071 
     3072End 
     3073 
     3074Function DisplayConcatenatedButtonProc(ctrlName) : ButtonControl 
     3075        String ctrlName 
     3076 
     3077        //copy the files over to the display set for processing 
     3078        SetDataFolder root:Packages:NIST:Event: 
     3079 
     3080        Wave timePt_dec=timePt_dec 
     3081        Wave xLoc_dec=xLoc_dec 
     3082        Wave yLoc_dec=yLoc_dec 
     3083        Wave rescaledTime_dec=rescaledTime_dec 
     3084                 
     3085        NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 
     3086        NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
     3087         
     3088        Duplicate/O timePt_dec timePt 
     3089        Duplicate/O xLoc_dec xLoc 
     3090        Duplicate/O yLoc_dec yLoc 
     3091        Duplicate/O rescaledTime_dec rescaledTime 
     3092         
     3093        t_longest = t_longest_dec        
     3094         
     3095        SetDataFolder root: 
     3096         
     3097        return(0) 
     3098 
     3099End 
     3100 
     3101 
     3102 
     3103 
     3104Function LoadDecimateButtonProc(ctrlName) : ButtonControl 
     3105        String ctrlName 
     3106 
     3107        LoadEventLog_Button("") 
     3108         
     3109        // now decimate 
     3110        SetDataFolder root:Packages:NIST:Event: 
     3111 
     3112        Wave timePt=timePt 
     3113        Wave xLoc=xLoc 
     3114        Wave yLoc=yLoc 
     3115        NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 
     3116 
     3117        NVAR decimation = root:Packages:NIST:Event:gDecimation 
     3118 
     3119 
     3120        Duplicate/O timePt, timePt_dTmp 
     3121        Duplicate/O xLoc, xLoc_dTmp 
     3122        Duplicate/O yLoc, yLoc_dTmp 
     3123        Resample/DOWN=(decimation)/N=1 timePt_dTmp 
     3124        Resample/DOWN=(decimation)/N=1 xLoc_dTmp 
     3125        Resample/DOWN=(decimation)/N=1 yLoc_dTmp 
     3126 
     3127 
     3128        Duplicate/O timePt_dTmp rescaledTime_dTmp 
     3129        rescaledTime_dTmp = 1e-7*(timePt_dTmp - timePt_dTmp[0])         //convert to seconds and start from zero 
     3130        t_longest_dec = waveMax(rescaledTime_dTmp)              //should be the last point 
     3131 
     3132        SetDataFolder root: 
     3133 
     3134         
     3135End 
     3136 
     3137// functions that take file names as arguments so that the loading an be done in batch mode 
     3138// for the mode of "one continuous exposure" 
     3139// 
     3140Function Stream_LoadDecim(ctrlName) 
     3141        String ctrlName 
     3142         
     3143        Variable fileref 
     3144 
     3145        SVAR filename = root:Packages:NIST:gEvent_logfile 
     3146        NVAR t_longest = root:Packages:NIST:gEvent_t_longest 
     3147         
     3148        SVAR listStr = root:Packages:NIST:Event:gSplitFileList 
     3149 
     3150        NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 
     3151        NVAR decimation = root:Packages:NIST:Event:gDecimation 
     3152 
     3153 
     3154 
     3155        //loop through everything in the list 
     3156        Variable num,ii 
     3157        num = ItemsInList(listStr) 
     3158         
     3159        for(ii=0;ii<num;ii+=1) 
     3160 
     3161// (1) load the file             
     3162                filename = StringFromList(ii, listStr  ,";") 
     3163                 
     3164 
     3165#if (exists("EventLoadWave")==4) 
     3166                LoadEvents_XOP() 
     3167#else 
     3168                LoadEvents() 
     3169#endif   
     3170 
     3171                SetDataFolder root:Packages:NIST:Event:                 //LoadEvents sets back to root: 
     3172 
     3173                Wave timePt=timePt 
     3174                Wave xLoc=xLoc 
     3175                Wave yLoc=yLoc 
     3176                CleanupTimes(xLoc,yLoc,timePt)          //remove zeroes 
     3177 
     3178                Duplicate/O timePt rescaledTime 
     3179                rescaledTime = 1e-7*(timePt-timePt[0])          //convert to seconds and start from zero 
     3180                t_longest = waveMax(rescaledTime)               //should be the last point 
     3181                 
     3182// (2) do the decimation, just on timePt. Ignore rescaledTime for now    
     3183                 
     3184                Duplicate/O timePt, timePt_dTmp 
     3185                Duplicate/O xLoc, xLoc_dTmp 
     3186                Duplicate/O yLoc, yLoc_dTmp 
     3187                Resample/DOWN=(decimation)/N=1 timePt_dTmp 
     3188                Resample/DOWN=(decimation)/N=1 xLoc_dTmp 
     3189                Resample/DOWN=(decimation)/N=1 yLoc_dTmp 
     3190         
     3191         
     3192                Duplicate/O timePt_dTmp rescaledTime_dTmp 
     3193                rescaledTime_dTmp = 1e-7*(timePt_dTmp - timePt_dTmp[0])         //convert to seconds and start from zero 
     3194                t_longest_dec = waveMax(rescaledTime_dTmp)              //should be the last point 
     3195                 
     3196 
     3197// (3) concatenate 
     3198                fConcatenateButton(ii+1)                //passes 1 for the first time, >1 each other time 
     3199         
     3200        endfor 
     3201 
     3202////            Now that everything is decimated and concatenated, create the rescaled time wave 
     3203//      SetDataFolder root:Packages:NIST:Event:                 //LoadEvents sets back to root: 
     3204//      Wave timePt_dec = timePt_dec 
     3205//      Duplicate/O timePt_dec rescaledTime_dec 
     3206//      rescaledTime_dec = 1e-7*(timePt_dec - timePt_dec[0])            //convert to seconds and start from zero 
     3207//      t_longest_dec = waveMax(rescaledTime_dec)               //should be the last point 
     3208         
     3209        DisplayConcatenatedButtonProc("") 
     3210         
     3211        SetDataFolder root: 
     3212 
     3213        return(0) 
     3214End 
     3215 
     3216///////////////////////////////////// 
Note: See TracChangeset for help on using the changeset viewer.