Ignore:
Timestamp:
Nov 16, 2012 12:06:27 PM (10 years ago)
Author:
srkline
Message:

More changes to the event mode processing, updating the panel and adding some methods for removing misencoded time point

  1. Ready for some more testing to figure out what is good and what is bad.

Added some more values in to the SASCALC for the 10m instrument (still hidden)

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
2 edited

Legend:

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

    r874 r875  
    3535// 
    3636 
    37  
    38  
    3937Proc Show_Event_Panel() 
    4038        DoWindow/F EventModePanel 
     
    6664        Variable/G root:Packages:NIST:gEvent_logint = 1 
    6765 
    68         Variable/G root:Packages:NIST:gEvent_Mode = 1           // ==0 for "stream", ==1 for Oscillatory 
     66        Variable/G root:Packages:NIST:gEvent_Mode = 0           // ==0 for "stream", ==1 for Oscillatory 
     67        Variable/G root:Packages:NIST:gRemoveBadEvents = 1              // ==1 to remove "bad" events, ==0 to read "as-is" 
    6968 
    7069        NVAR nslices = root:Packages:NIST:gEvent_nslices 
     
    9392        TitleBox tb1,variable=root:Packages:NIST:gEventDisplayString 
    9493         
    95         CheckBox chkbox1,pos={170,15},title="Oscillatory Mode?" 
     94        CheckBox chkbox1,pos={170,8},title="Oscillatory Mode?" 
    9695        CheckBox chkbox1,variable = root:Packages:NIST:gEvent_mode 
     96        CheckBox chkbox3,pos={170,27},title="Remove Bad Events?" 
     97        CheckBox chkbox3,variable = root:Packages:NIST:gRemoveBadEvents 
     98         
    9799        Button doneButton,pos={435,12}, size={50,20},title="Done",fSize=12 
    98100        Button doneButton,proc=EventDone_Proc 
     
    123125        Display/W=(20,180,480,640)/HOST=EventModePanel/N=Event_slicegraph 
    124126        AppendImage/W=EventModePanel#Event_slicegraph/T root:Packages:NIST:Event:dispsliceData 
    125         ModifyImage/W=EventModePanel#Event_slicegraph  ''#0 ctab= {*,*,Grays,0} 
     127        ModifyImage/W=EventModePanel#Event_slicegraph  ''#0 ctab= {*,*,ColdWarm,0} 
    126128        ModifyImage/W=EventModePanel#Event_slicegraph ''#0 ctabAutoscale=3 
    127129        ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 
     
    145147                        // click code here 
    146148                        Execute "ShowRescaledTimeGraph()" 
     149                        // 
     150                        DifferentiatedTime() 
     151                        // 
    147152                        break 
    148153                case -1: // control being killed 
     
    533538End 
    534539 
     540 
     541Function SortTimeData() 
     542 
     543// now before binning, sort the data 
     544 
     545        //this is slow - undoing the sorting and starting over, but if you don't, 
     546        // you'll never be able to undo the sort 
     547        // 
     548        SetDataFolder root:Packages:NIST:Event: 
     549 
     550        KillWaves/Z OscSortIndex 
     551//      Print WaveExists($"root:Packages:NIST:Event:OscSortIndex") 
     552         
     553        if(WaveExists($"root:Packages:NIST:Event:OscSortIndex") == 0 ) 
     554                Duplicate/O rescaledTime OscSortIndex 
     555                MakeIndex rescaledTime OscSortIndex 
     556                IndexSort OscSortIndex, yLoc,xLoc,timePt,rescaledTime    
     557        Endif 
     558         
     559        SetDataFolder root: 
     560        return(0) 
     561End 
     562 
     563 
     564 
    535565Function SetLinearBins(binEndTime,nslices,t_longest) 
    536566        Wave binEndTime 
     
    631661        endif 
    632662         
     663        DifferentiatedTime() 
     664         
    633665        return(0) 
    634666End 
     
    768800End 
    769801 
     802Function DifferentiatedTime() 
     803 
     804        Wave rescaledTime = root:Packages:NIST:Event:rescaledTime 
     805         
     806        Differentiate rescaledTime/D=rescaledTime_DIF 
     807//      Display rescaledTime,rescaledTime_DIF 
     808        DoWindow/F Differentiated_Time 
     809        if(V_flag == 0) 
     810                Display/N=Differentiated_Time/K=1 rescaledTime_DIF 
     811                Legend 
     812                Modifygraph gaps=0 
     813                ModifyGraph zero(left)=1 
     814                Label left "\\Z14Delta (dt/event)" 
     815                Label bottom "\\Z14Event number" 
     816        endif 
     817         
     818        return(0) 
     819End 
     820 
    770821 
    771822// 
    772823// for the bit shifts, see the decimal-binary conversion 
    773824// http://www.binaryconvert.com/convert_unsigned_int.html 
     825// 
     826//              K0 = 536870912 
     827//              Print (K0 & 0x08000000)/134217728       //bit 27 only, shift by 2^27 
     828//              Print (K0 & 0x10000000)/268435456               //bit 28 only, shift by 2^28 
     829//              Print (K0 & 0x20000000)/536870912               //bit 29 only, shift by 2^29 
     830// 
    774831// 
    775832Function LoadEvents() 
     
    786843        Variable fileref 
    787844        String buffer 
     845        String fileStr,tmpStr 
    788846        Variable dataval,timeval,type,numLines,verbose,verbose3 
    789         Variable xval,yval,rollBit,nRoll,roll_time 
     847        Variable xval,yval,rollBit,nRoll,roll_time,bit29,bit28,bit27 
     848        Variable ii,flaggedEvent,rolloverHappened,numBad=0,tmpPP=0 
    790849        Variable Xmax, yMax 
     850         
    791851        xMax = 127              // number the detector from 0->127  
    792852        yMax = 127 
    793853         
    794         verbose3 = 1 
     854        verbose3 = 1                    //prints out the rollover events (type==3) 
    795855        verbose = 0 
    796856        numLines = 0 
    797857 
    798 // this gets me the number of lines. not terribly useful         
    799 //      Open/R fileref as filepathstr 
    800 //      do 
    801 //              numLines += 1 
    802 //              FReadLine fileref, buffer 
    803 //              if (strlen(buffer) == 0) 
    804 //                      numLines -= 1                   //last FReadLine wasn't really a line 
    805 //                      break 
    806 //              endif 
    807 //      while(1) 
    808 //      Close fileref 
    809858         
    810859        // what I really need is the number of XY events 
    811         Variable numXYevents,num1,num2,num3,num0,totBytes 
     860        Variable numXYevents,num1,num2,num3,num0,totBytes,numPP,numT0,numDL,numFF,numZero 
    812861        numXYevents = 0 
    813862        num0 = 0 
     
    815864        num2 = 0 
    816865        num3 = 0 
     866        numPP = 0 
     867        numT0 = 0 
     868        numDL = 0 
     869        numFF = 0 
     870        numZero = 0 
    817871 
    818872//tic() 
     
    826880//toc() 
    827881// 
     882 
     883 
     884// do a "pre-scan to get some of the counts, so that I can allocate space. This does 
     885// double the read time, but is still faster than adding points to waves as the file is read 
     886//       
     887 
    828888        tic() 
    829          
     889 
    830890        Open/R fileref as filepathstr 
    831891        do 
     
    842902                // two most sig bits (31-30) 
    843903                type = (dataval & 0xC0000000)/1073741824                //right shift by 2^30 
    844                  
     904                                 
    845905                if(type == 0) 
    846906                        num0 += 1 
     
    858918                endif    
    859919                 
     920                bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     921                 
     922                if(type==0 || type==2) 
     923                        numPP += round(bit29) 
     924                endif 
     925                 
     926                if(type==1 || type==3) 
     927                        numT0 += round(bit29) 
     928                endif 
     929                 
     930                if(dataval == 0) 
     931                        numZero += 1 
     932                endif 
     933                 
    860934        while(1) 
    861935        Close fileref 
    862936//              done counting the number of XY events 
    863  
    864937        toc() 
     938         
     939         
    865940// 
    866941//       
     
    870945//      Printf "time MSW = num1 = %d\r",num1 
    871946//      Printf "Rollover = num3 = %d\r",num3 
    872  
    873947//      Printf "num0 + num2 = %d\r",num0+num2 
    874948 
    875         String fileStr = ParseFilePath(0, filepathstr, ":", 1, 0),tmpStr 
    876          
    877         sprintf tmpStr, "%s: %d total bytes",fileStr,totBytes  
     949// dispStr will be displayed on the panel 
     950        fileStr = ParseFilePath(0, filepathstr, ":", 1, 0) 
     951         
     952        sprintf tmpStr, "%s: %d total bytes\r",fileStr,totBytes  
    878953        dispStr = tmpStr 
    879         sPrintf tmpStr,"\rnumXYevents = %d\rXY = num0 = %d",numXYevents,num0 
     954        sprintf tmpStr,"numXYevents = %d\r",numXYevents 
    880955        dispStr += tmpStr 
    881         sPrintf tmpStr,"\rXY time = num2 = %d\rtime MSW = num1 = %d",num2,num1 
     956//      sprintf tmpStr,"XY = num0 = %d\r",num0 
     957//      dispStr += tmpStr 
     958//      sprintf tmpStr,"\rXY time = num2 = %d\rtime MSW = num1 = %d",num2,num1 
     959//      dispStr += tmpStr 
     960//      sprintf tmpStr,"XY time = num2 = %d\r",num2 
     961//      dispStr += tmpStr 
     962//      sprintf tmpStr,"time MSW = num1 = %d\r",num1 
     963//      dispStr += tmpStr 
     964        sprintf tmpStr,"PP = %d  :  ",numPP 
    882965        dispStr += tmpStr 
    883         sPrintf tmpStr,"\rRollover = num3 = %d",num3 
     966        sprintf tmpStr,"ZeroData = %d\r",numZero 
     967        dispStr += tmpStr 
     968        sprintf tmpStr,"Rollover = %d",num3 
    884969        dispStr += tmpStr 
    885970 
     
    890975//      Make/O/U/N=(totBytes/4) xLoc,yLoc               //too large, trim when done (bad idea) 
    891976//      Make/O/D/N=(totBytes/4) timePt 
     977        Make/O/D/N=1000 badTimePt,badEventNum,PPTime,PPEventNum 
     978        badTimePt=0 
     979        badEventNum=0 
     980        PPTime=0 
     981        PPEventNum=0 
    892982        xLoc=0 
    893983        yLoc=0 
    894984        timePt=0 
    895  
    896          
    897         Variable ii=0 
     985         
    898986        nRoll = 0               //number of rollover events 
    899987        roll_time = 2^26                //units of 10-7 sec 
    900988         
     989        NVAR removeBadEvents = root:Packages:NIST:gRemoveBadEvents 
     990         
    901991        time_msw=0 
    902992         
    903993        tic() 
    904994         
     995        ii = 0 
     996         
    905997        Open/R fileref as filepathstr 
     998         
     999        // remove events at the beginning up to a type==2 so that the msw and lsw times are reset properly 
     1000        if(RemoveBadEvents == 1) 
     1001                do 
     1002                        do 
     1003                                FReadLine fileref, buffer                       //skip the "blank" lines that have one character 
     1004                        while(strlen(buffer) == 1)               
     1005         
     1006                        if (strlen(buffer) == 0) 
     1007                                break 
     1008                        endif 
     1009                         
     1010                        sscanf buffer,"%x",dataval 
     1011                // two most sig bits (31-30) 
     1012                        type = (dataval & 0xC0000000)/1073741824                //right shift by 2^30 
     1013                         
     1014                        if(type == 2) 
     1015                                // this is the first event with a proper time value, so process the XY-time event as ususal 
     1016                                // and then break to drop to the main loop, where the next event == type 1 
     1017                                 
     1018                                xval = xMax - (dataval & 255)                                           //last 8 bits (7-0) 
     1019                                yval = (dataval & 65280)/256                                            //bits 15-8, right shift by 2^8 
     1020                 
     1021                                time_lsw = (dataval & 536805376)/65536                  //13 bits, 28-16, right shift by 2^16 
     1022                 
     1023                                if(verbose) 
     1024                //                                      printf "%u : %u : %u : %u\r",dataval,time_lsw,time_msw,timeval 
     1025                                        printf "%u : %u : %u : %u\r",dataval,timeval,xval,yval 
     1026                                endif 
     1027                                 
     1028                                // this is the first point, be sure that ii = 0 
     1029                                ii = 0 
     1030                                xLoc[ii] = xval 
     1031                                yLoc[ii] = yval 
     1032                                 
     1033                                Print "At beginning of file, numBad = ",numBad 
     1034                                break   // the next do loop processes the bulk of the file (** the next event == type 1 = MIR) 
     1035                        else 
     1036                                numBad += 1 
     1037                        endif 
     1038                         
     1039                        //ii+=1         don't increment the counter 
     1040                while(1) 
     1041        endif 
     1042         
     1043        // now read the main portion of the file. 
    9061044        do 
    9071045                do 
     
    9151053                sscanf buffer,"%x",dataval 
    9161054                 
     1055 
     1056//              type = (dataval & ~(2^32 - 2^30 -1))/2^30 
     1057 
     1058                // two most sig bits (31-30) 
     1059                type = (dataval & 0xC0000000)/1073741824                //right shift by 2^30 
     1060                 
     1061//              // if the first event, read the time_msw, since this is not always reset. if the first event is XYM, then it's OK, 
     1062//              // but if the first event is XY, then the first few events will have msw=0 until an XYM forces a read of MSW in the 
     1063//              // subsequent MIR event. 
     1064//              // So do it now. 
     1065//              if(ii==0 && RemoveBadEvents == 1) 
     1066//                      time_msw =  (dataval & 536805376)/65536                 //13 bits, 28-16, right shift by 2^16 
     1067//              endif 
     1068 
    9171069                // 
    9181070                //Constant ATXY = 0 
     
    9211073                //Constant ATMAR = 3 
    9221074                // 
    923 //              type = (dataval & ~(2^32 - 2^30 -1))/2^30 
    924  
    925                 // two most sig bits (31-30) 
    926                 type = (dataval & 0xC0000000)/1073741824                //right shift by 2^30 
    927                  
     1075                                                 
    9281076                if(verbose > 0) 
    9291077                        verbose -= 1 
     
    9311079//               
    9321080                switch(type) 
    933                         case ATXY: 
     1081                        case ATXY:              // 0 
    9341082                                if(verbose)              
    9351083                                        printf "XY : "           
    9361084                                endif 
     1085                                 
     1086                                // if the datavalue is == 0, just skip it now (it can only be interpreted as type 0, obviously 
     1087                                if(dataval == 0 && RemoveBadEvents == 1) 
     1088                                        break           //don't increment ii 
     1089                                endif 
     1090                                 
     1091                                // if it's a pileup event, skip it now (this can be either type 0 or 2) 
     1092                                bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1093                                if(bit29 == 1 && RemoveBadEvents == 1) 
     1094                                        PPTime[tmpPP] = timeval 
     1095                                        PPEventNum[tmpPP] = ii 
     1096                                        tmpPP += 1 
     1097                                        break           //don't increment ii 
     1098                                endif 
     1099                                 
    9371100//                              xval = ~(dataval & ~(2^32 - 2^8)) & 127 
    9381101//                              yval = ((dataval & ~(2^32 - 2^16 ))/2^8) & 127 
     
    9471110                                        t_longest = timeval 
    9481111                                endif 
    949                                 xLoc[ii] = xval 
    950                                 yLoc[ii] = yval 
    951                                 timePt[ii] = timeval 
     1112                                 
     1113                                 
     1114                                // catch the "bad" events: 
     1115                                // if an XY event follows a rollover, time_msw is 0 by definition, but does not immediately get  
     1116                                // re-evalulated here. Throw out only the immediately following points where msw is still 8191 
     1117                                if(rolloverHappened && RemoveBadEvents == 1) 
     1118                                        // maybe a bad event 
     1119                                        if(time_msw == 8191) 
     1120                                                badTimePt[numBad] = timeVal 
     1121                                                badEventNum[numBad] = ii 
     1122                                                numBad +=1 
     1123                                        else 
     1124                                                // time_msw has been reset, points are good now, so keep this one 
     1125                                                xLoc[ii] = xval 
     1126                                                yLoc[ii] = yval 
     1127                                                timePt[ii] = timeval 
     1128                                                 
     1129//                                              if(xval == 127 && yval == 0) 
     1130//                                                      // check bit 29 
     1131//                                                      bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1132//                                                      Print "XY=127,0 : bit29 = ",bit29 
     1133//                                              endif 
     1134                                                 
     1135                                                ii+=1 
     1136                                                rolloverHappened = 0 
     1137                                        endif 
     1138                                else 
     1139                                        // normal processing of good point, keep it 
     1140                                        xLoc[ii] = xval 
     1141                                        yLoc[ii] = yval 
     1142                                        timePt[ii] = timeval 
     1143                                 
     1144//                                      if(xval == 127 && yval == 0) 
     1145//                                              // check bit 29 
     1146//                                              bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1147//                                              Printf "XY=127,0 : bit29 = %u : d=%u\r",bit29,dataval 
     1148//                                      endif 
     1149                                        ii+=1 
     1150                                endif 
     1151 
    9521152 
    9531153                                if(verbose)              
     
    9551155                                        printf "d=%u : t=%u : msw=%u : lsw=%u : %u : %u \r",dataval,timeval,time_msw,time_lsw,xval,yval 
    9561156                                endif                            
    957  
    958 //                              b = FindBin(timeval,nslices) 
    959 //                              slicedData[xval][yval][b] += 1 
    960  
    961                                 ii+=1 
    962                                  
     1157         
    9631158//                              verbose = 0 
    9641159                                break 
    965                         case ATXYM: 
     1160                        case ATXYM: // 2  
    9661161                                if(verbose) 
    9671162                                        printf "XYM : " 
    9681163                                endif 
     1164                                 
     1165                                // if it's a pileup event, skip it now (this can be either type 0 or 2) 
     1166                                // - but can I do this if this is an XY-time event? This will lead to a wrong time, and a time  
     1167                                // assigned to an XY (0,0)... 
     1168                                bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1169                                if(bit29 == 1 && RemoveBadEvents == 1) 
     1170                                        Print "*****Bit 29 (PP) event set for Type==2, but not handled, ii = ",ii 
     1171//                                      break           //don't increment ii 
     1172                                endif 
     1173                                 
    9691174//                              xval = ~(dataval & ~(2^32 - 2^8)) & 127 
    9701175//                              yval = ((dataval & ~(2^32 - 2^16 ))/2^8) & 127 
    971 //                              time_lsw =  (dataval & ~(2^32 - 2^29 ))/2^16 
     1176//                              time_lsw =  (dataval & ~(2^32 - 2^29 ))/2^16            //this method gives a FP result!! likely since the "^" operation gives FP result... 
    9721177 
    9731178                                xval = xMax - (dataval & 255)                                           //last 8 bits (7-0) 
    9741179                                yval = (dataval & 65280)/256                                            //bits 15-8, right shift by 2^8 
    9751180 
    976                                 time_lsw = (dataval & 536805376)/65536                  //13 bits, 28-16, right shift by 2^16 
     1181                                time_lsw = (dataval & 536805376)/65536                  //13 bits, 28-16, right shift by 2^16 (result is integer) 
    9771182 
    9781183                                if(verbose) 
     
    9831188                                xLoc[ii] = xval 
    9841189                                yLoc[ii] = yval 
    985                                  
     1190 
    9861191                                // don't fill in the time yet, or increment the index ii 
    9871192                                // the next event MUST be ATMIR with the MSW time bits 
     
    9891194//                              verbose = 0 
    9901195                                break 
    991                         case ATMIR: 
     1196                        case ATMIR:  // 1 
    9921197                                if(verbose) 
    9931198                                        printf "MIR : " 
    9941199                                endif 
    995 //                              time_msw =  (dataval & ~(2^32 - 2^29 ))/2^16 
     1200 
    9961201                                time_msw =  (dataval & 536805376)/65536                 //13 bits, 28-16, right shift by 2^16 
    9971202                                timeval = trunc( nRoll*roll_time + (time_msw * (8192)) + time_lsw ) 
     
    10061211                                // the XY position was in the previous event ATXYM 
    10071212                                timePt[ii] = timeval 
    1008                                  
     1213 
     1214//                              bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
     1215//                              if(bit29 != 0) 
     1216//                                      Printf "bit29 = 1 at ii = %d : type = %d\r",ii,type 
     1217//                              endif 
     1218                                                                 
    10091219                                ii+=1 
    1010                                  
    1011 //                              b = FindBin(timeval,nslices) 
    1012 //                              slicedData[xval][yval][b] += 1 
    1013  
    10141220//                              verbose = 0 
    10151221                                break 
    1016                         case ATMAR: 
     1222                        case ATMAR:  // 3 
    10171223                                if(verbose3) 
    10181224//                                      verbose = 15 
    1019                                         verbose = 2 
     1225//                                      verbose = 2 
    10201226                                        printf "MAR : " 
    10211227                                endif 
     
    10241230                                 
    10251231                                // check bit 29 
    1026                                 rollBit = (dataval & 0x20000000)/536870912              //bit 29 only , shift by 2^29 
     1232                                bit29 = (dataval & 0x20000000)/536870912                //bit 29 only , shift by 2^29 
    10271233                                nRoll += 1 
    1028                                  
     1234// not doing anything with these bits yet                                
     1235                                bit27 = (dataval & 0x08000000)/134217728        //bit 27 only, shift by 2^27 
     1236                                bit28 = (dataval & 0x10000000)/268435456                //bit 28 only, shift by 2^28 
     1237 
    10291238                                if(verbose3) 
    1030                                         printf "%u : %u : %u \r",dataval,rollBit,nRoll 
     1239                                        printf "d=%u : b29=%u : b28=%u : b27=%u : #Roll=%u \r",dataval,bit29, bit28, bit27,nRoll 
    10311240                                endif 
    10321241                                 
     1242                                rolloverHappened = 1 
     1243 
    10331244                                break 
    10341245                endswitch 
    1035                                  
     1246                 
     1247//              if(ii<18) 
     1248//                      printf "TYPE=%d : ii=%d : d=%u : t=%u : msw=%u : lsw=%u : %u : %u \r",type,ii,dataval,timeval,time_msw,time_lsw,xval,yval 
     1249//              endif    
     1250                         
    10361251        while(1) 
    10371252         
     
    10411256        toc() 
    10421257         
     1258        sPrintf tmpStr,"\rBad Events = numBad = %d (%g %% of events)",numBad,numBad/numXYevents*100 
     1259        dispStr += tmpStr 
     1260 
    10431261        SetDataFolder root: 
    10441262         
     
    10501268 
    10511269Proc BinEventBarGraph() 
    1052         PauseUpdate; Silent 1           // building window... 
    1053         String fldrSav0= GetDataFolder(1) 
    1054         SetDataFolder root:Packages:NIST:Event: 
    1055         Display /W=(110,705,610,1132)/K=1 binCount vs binEndTime 
    1056         SetDataFolder fldrSav0 
    1057         ModifyGraph mode=5 
    1058         ModifyGraph marker=19 
    1059         ModifyGraph lSize=2 
    1060         ModifyGraph rgb=(0,0,0) 
    1061         ModifyGraph msize=2 
    1062         ModifyGraph hbFill=2 
    1063         ModifyGraph gaps=0 
    1064         ModifyGraph usePlusRGB=1 
    1065         ModifyGraph toMode=1 
    1066         ModifyGraph useBarStrokeRGB=1 
    1067 //      ModifyGraph log=1 
    1068         ModifyGraph standoff=0 
    1069 //      SetAxis left 0.1,4189 
    1070 //      SetAxis bottom 0.0001,180.84853 
    1071 End 
     1270         
     1271        DoWindow/F EventBarGraph 
     1272        if(V_flag == 0) 
     1273                PauseUpdate; Silent 1           // building window... 
     1274                String fldrSav0= GetDataFolder(1) 
     1275                SetDataFolder root:Packages:NIST:Event: 
     1276                Display /W=(110,705,610,1132)/N=EventBarGraph /K=1 binCount vs binEndTime 
     1277                SetDataFolder fldrSav0 
     1278                ModifyGraph mode=5 
     1279                ModifyGraph marker=19 
     1280                ModifyGraph lSize=2 
     1281                ModifyGraph rgb=(0,0,0) 
     1282                ModifyGraph msize=2 
     1283                ModifyGraph hbFill=2 
     1284                ModifyGraph gaps=0 
     1285                ModifyGraph usePlusRGB=1 
     1286                ModifyGraph toMode=1 
     1287                ModifyGraph useBarStrokeRGB=1 
     1288        //      ModifyGraph log=1 
     1289                ModifyGraph standoff=0 
     1290                Label bottom "\\Z14Time (seconds)" 
     1291                Label left "\\Z14Number of Events" 
     1292        //      SetAxis left 0.1,4189 
     1293        //      SetAxis bottom 0.0001,180.84853 
     1294        endif 
     1295End 
     1296 
    10721297 
    10731298Proc ShowBinTable() : Table 
    1074         PauseUpdate; Silent 1           // building window... 
    1075         String fldrSav0= GetDataFolder(1) 
    1076         SetDataFolder root:Packages:NIST:Event: 
    1077         Edit/W=(498,699,1003,955) /K=1 binCount,binEndTime 
    1078         ModifyTable format(Point)=1,sigDigits(binEndTime)=16,width(binEndTime)=218 
    1079         SetDataFolder fldrSav0 
     1299 
     1300        DoWindow/F BinEventTable 
     1301        if(V_flag == 0) 
     1302                PauseUpdate; Silent 1           // building window... 
     1303                String fldrSav0= GetDataFolder(1) 
     1304                SetDataFolder root:Packages:NIST:Event: 
     1305                Edit/W=(498,699,1003,955) /K=1/N=BinEventTable binCount,binEndTime 
     1306                ModifyTable format(Point)=1,sigDigits(binEndTime)=16,width(binEndTime)=218 
     1307                SetDataFolder fldrSav0 
     1308        endif 
    10801309EndMacro 
    10811310 
     
    10841313// 
    10851314Proc ShowRescaledTimeGraph() : Graph 
    1086         PauseUpdate; Silent 1           // building window... 
    1087         String fldrSav0= GetDataFolder(1) 
    1088         SetDataFolder root:Packages:NIST:Event: 
    1089         Display /W=(25,44,486,356)/K=1 rescaledTime 
    1090         SetDataFolder fldrSav0 
    1091         ModifyGraph mode=4 
    1092         ModifyGraph marker=19 
    1093         ModifyGraph rgb(rescaledTime)=(0,0,0) 
    1094         ModifyGraph msize=2 
    1095         SetAxis/A=2 left                        //only autoscale the visible data (based on the bottom limits) 
    1096         SetAxis bottom 0,1500 
    1097         ErrorBars rescaledTime OFF  
    1098         ShowInfo 
     1315 
     1316        DoWindow/F RescaledTimeGraph 
     1317        if(V_flag == 0) 
     1318                PauseUpdate; Silent 1           // building window... 
     1319                String fldrSav0= GetDataFolder(1) 
     1320                SetDataFolder root:Packages:NIST:Event: 
     1321                Display /W=(25,44,486,356)/K=1/N=RescaledTimeGraph rescaledTime 
     1322                SetDataFolder fldrSav0 
     1323                ModifyGraph mode=4 
     1324                ModifyGraph marker=19 
     1325                ModifyGraph rgb(rescaledTime)=(0,0,0) 
     1326                ModifyGraph msize=2 
     1327//              SetAxis/A=2 left                        //only autoscale the visible data (based on the bottom limits) 
     1328//              SetAxis bottom 0,1500 
     1329                ErrorBars rescaledTime OFF  
     1330                Label left "\\Z14Time (seconds)" 
     1331                Label bottom "\\Z14Event number" 
     1332                ShowInfo 
     1333        endif 
     1334         
    10991335EndMacro 
    11001336 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r868 r875  
    485485        CheckBox checkNG7,pos={66,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG7" 
    486486        CheckBox checkNG7,value=0,mode=1 
     487 
     488        CheckBox checkChamber,pos={172,48},size={57,14},proc=TableCheckProc,title="Chamber" 
     489        CheckBox checkChamber,value=1,mode=1 
     490        CheckBox checkHuber,pos={172,27},size={44,14},proc=TableCheckProc,title="Huber" 
     491        CheckBox checkHuber,value=0,mode=1 
    487492//      -- hide/unhide the 10m SANS 
    488493        if(show10mSANS) 
     
    490495                CheckBox checkNG10,value=0,mode=1 
    491496        endif 
    492 //       
    493         CheckBox checkChamber,pos={172,48},size={57,14},proc=TableCheckProc,title="Chamber" 
    494         CheckBox checkChamber,value=1,mode=1 
    495         CheckBox checkHuber,pos={172,27},size={44,14},proc=TableCheckProc,title="Huber" 
    496         CheckBox checkHuber,value=0,mode=1 
     497//               
    497498        PopupMenu popup0,pos={6,94},size={76,20},proc=SourceAperturePopMenuProc 
    498499        PopupMenu popup0,mode=1,popvalue="3.81 cm",value= root:Packages:NIST:SAS:gSourceApString 
     
    604605                        Slider SC_Slider_1,win=SASCALC,limits={133,1317,1},userTicks={root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:lblSDDNG3 } 
    605606                        Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
    606                          
     607 
     608                        // un-disable the sample table position 
     609                        CheckBox checkChamber,win=SASCALC,disable=0 
     610                        CheckBox checkHuber,win=SASCALC,disable=0 
     611                                                 
    607612                        break 
    608613                                                                 
     
    624629                        SetVariable setvar0,win=SASCALC,limits={100,1531,1} 
    625630                        Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
     631                         
     632                        // un-disable the sample table position 
     633                        CheckBox checkChamber,win=SASCALC,disable=0 
     634                        CheckBox checkHuber,win=SASCALC,disable=0 
    626635                         
    627636                        break 
     
    652661                        SetVariable setvar0,win=SASCALC,limits={100,500,1} 
    653662                        Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
     663 
     664                        // disable the sample table position, as long as the sample positions are identical for the 10 m 
     665                        CheckBox checkChamber,win=SASCALC,disable=2 
     666                        CheckBox checkHuber,win=SASCALC,disable=2 
    654667 
    655668                        break 
     
    19711984                case 10: 
    19721985                        // 10m SANS handled differently 
     1986                        // s12 == 0 by definition 
    19731987                        // TODO:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
    1974                         SSD = 500 - 155*NG - s12*(2-tableposition()) - L2Diff 
     1988                        SSD = 470 - 155*NG - s12*(2-tableposition()) - L2Diff 
    19751989                        break 
    19761990                default: 
Note: See TracChangeset for help on using the changeset viewer.