Changeset 915 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Jun 24, 2013 4:29:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf
r912 r915 96 96 // 97 97 98 Static Constant MODE_STREAM = 0 99 Static Constant MODE_OSCILL = 1 100 Static Constant MODE_TISANE = 2 101 Static Constant MODE_TOF = 3 102 98 103 //Menu "Macros" 99 104 // "Split Large File",SplitBigFile() … … 132 137 Variable/G root:Packages:NIST:gEvent_logint = 1 133 138 134 Variable/G root:Packages:NIST:gEvent_Mode = 0// ==0 for "stream", ==1 for Oscillatory139 Variable/G root:Packages:NIST:gEvent_Mode = MODE_OSCILL // ==0 for "stream", ==1 for Oscillatory 135 140 Variable/G root:Packages:NIST:gRemoveBadEvents = 1 // ==1 to remove "bad" events, ==0 to read "as-is" 136 141 Variable/G root:Packages:NIST:gSortStreamEvents = 0 // ==1 to sort the event stream, a last resort for a stream of data … … 146 151 Duplicate/O slicedData logslicedData 147 152 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 148 161 149 162 SetDataFolder root: 150 163 End 151 164 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 152 179 Proc EventModePanel() 153 180 PauseUpdate; Silent 1 // building window... 154 NewPanel /W=( 100,50,600,840)/N=EventModePanel/K=2181 NewPanel /W=(82,44,854,664)/N=EventModePanel/K=2 155 182 DoWindow/C EventModePanel 156 183 ModifyPanel fixedSize=1,noEdit =1 157 //ShowTools/A 184 158 185 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 201 257 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 202 258 ModifyGraph mirror=2 … … 208 264 ModifyGraph btLen=3 209 265 ModifyGraph tlOffset=-2 210 SetAxis/A left266 RenameWindow #,Event_slicegraph 211 267 SetActiveSubwindow ## 212 268 EndMacro 213 269 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 // 279 Function 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) 305 End 214 306 215 307 Function AdjustEventDataButtonProc(ba) : ButtonControl … … 363 455 NVAR mode=root:Packages:NIST:gEvent_Mode 364 456 365 if(mode == 0)457 if(mode == MODE_STREAM) 366 458 Stream_ProcessEventLog("") 367 459 endif 368 460 369 if(mode == 1)461 if(mode == MODE_OSCILL) 370 462 Osc_ProcessEventLog("") 371 463 endif … … 776 868 // 777 869 // Would TISANE or TOF need a different loader? 778 // 870 // 779 871 Function LoadEventLog_Button(ctrlName) : ButtonControl 780 872 String ctrlName … … 782 874 NVAR mode=root:Packages:NIST:gEvent_mode 783 875 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 812 878 813 879 SVAR filename = root:Packages:NIST:gEvent_logfile … … 816 882 817 883 String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 884 String abortStr 818 885 819 886 Open/R/D/F=fileFilters fileref … … 824 891 return(1) 825 892 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 826 905 827 906 #if (exists("EventLoadWave")==4) … … 833 912 SetDataFolder root:Packages:NIST:Event: 834 913 835 tic()914 //tic() 836 915 Wave timePt=timePt 837 916 Wave xLoc=xLoc 838 917 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 846 940 847 941 SetDataFolder root: 848 942 943 STRUCT WMButtonAction ba 944 ba.eventCode = 2 945 ShowEventDataButtonProc(ba) 946 849 947 return(0) 850 948 End 851 949 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 896 1040 897 1041 … … 1015 1159 SVAR filepathstr = root:Packages:NIST:gEvent_logfile 1016 1160 SVAR dispStr = root:Packages:NIST:gEventDisplayString 1161 1162 1163 //// Variable decFac = 10 //decimation factor 1164 //// Variable jj,keep 1017 1165 1018 1166 SetDataFolder root:Packages:NIST:Event … … 1123 1271 Print "num2 = ",num2 1124 1272 Print "num3 = ",num3 1125 1273 1126 1274 // 1127 1275 // … … 1152 1300 Make/O/U/N=(numXYevents) xLoc,yLoc 1153 1301 Make/O/D/N=(numXYevents) timePt 1302 //// Make/O/U/N=(numXYevents/decFac) xLoc,yLoc 1303 //// Make/O/D/N=(numXYevents/decFac) timePt 1154 1304 // Make/O/U/N=(totBytes/4) xLoc,yLoc //too large, trim when done (bad idea) 1155 1305 // Make/O/D/N=(totBytes/4) timePt … … 1174 1324 tic() 1175 1325 1176 ii = 0 1326 ii = 0 //indexes the points in xLoc,yLoc,timePt 1327 //// keep = decFac //keep the first point 1328 1177 1329 1178 1330 Open/R fileref as filepathstr … … 1207 1359 endif 1208 1360 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 1214 1368 Print "At beginning of file, numBad = ",numBad 1215 1369 break // the next do loop processes the bulk of the file (** the next event == type 1 = MIR) … … 1224 1378 1225 1379 // 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 1226 1381 do 1227 1382 do … … 1229 1384 while(strlen(buffer) == 1) 1230 1385 1231 if (strlen(buffer) == 0) 1386 if (strlen(buffer) == 0) // this marks the end of the file and is our only way out 1232 1387 break 1233 1388 endif … … 1303 1458 else 1304 1459 // 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) 1305 1481 xLoc[ii] = xval 1306 1482 yLoc[ii] = yval 1307 1483 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 1315 1490 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 1330 1495 endif 1331 1496 … … 1366 1531 endif 1367 1532 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 1371 1538 // don't fill in the time yet, or increment the index ii 1372 1539 // the next event MUST be ATMIR with the MSW time bits … … 1390 1557 1391 1558 // the XY position was in the previous event ATXYM 1392 timePt[ii] = timeval 1559 //// if(keep == decFac) 1560 timePt[ii] = timeval 1561 //// endif 1393 1562 1394 1563 bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 … … 1401 1570 nRoll = 0 1402 1571 endif 1403 1404 ii+=1 1572 1573 //// if(keep == decFac) 1574 ii+=1 1575 //// keep = 0 1576 //// endif 1405 1577 // verbose = 0 1406 1578 break … … 1452 1624 Print "Events removed (Igor) = ",numRemoved 1453 1625 1454 sPrintf tmpStr,"\rBad Rollover Events = %d (% g %% of events)",numBad,numBad/numXYevents*1001626 sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 1455 1627 dispStr += tmpStr 1456 sPrintf tmpStr,"\rTotal Events Removed = %d (% g %% of events)",numRemoved,numRemoved/numXYevents*1001628 sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 1457 1629 dispStr += tmpStr 1458 1630 SetDataFolder root: … … 1626 1798 Print "Events removed (XOP) = ",numRemoved 1627 1799 1628 sPrintf tmpStr,"\rBad Rollover Events = %d (% g %% of events)",numBad,numBad/numXYevents*1001800 sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 1629 1801 dispStr += tmpStr 1630 sPrintf tmpStr,"\rTotal Events Removed = %d (% g %% of events)",numRemoved,numRemoved/numXYevents*1001802 sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 1631 1803 dispStr += tmpStr 1632 1804 … … 1949 2121 ControlBar 100 1950 2122 Button button0,pos={18,12},size={70,20},proc=EC_AddCursorButtonProc,title="Cursors" 1951 Button button1,pos={153,1 1},size={80,20},proc=EC_AddTimeButtonProc,title="Add time"1952 Button button2,pos={153,3 7},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" 1953 2125 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={29 4,38},size={100,20},proc=EC_ImportWavesButtonProc,title="Import Waves"1956 Button button6,pos={18,3 9},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="?" 1958 2130 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" 1959 2135 1960 2136 SetDataFolder root: … … 2100 2276 Wave xLoc = xLoc 2101 2277 Wave yLoc = yLoc 2102 Save/T xLoc,yLoc,timePt //will ask for a name2278 Save/T xLoc,yLoc,timePt ,rescaledTime //will ask for a name 2103 2279 2104 2280 SetDataFolder root: … … 2139 2315 KillWaves/Z OscSortIndex 2140 2316 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 2148 2325 2149 2326 t_longest = waveMax(rescaledTime) //should be the last point … … 2208 2385 End 2209 2386 2210 2211 2387 //upDown 5 or -5 looks for spikes +5 or -5 std deviations from mean 2388 Function 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) 2425 End 2426 2427 2428 Function EC_FindStepButton_down(ctrlName) : ButtonControl 2429 String ctrlName 2430 2431 Variable upDown = -5 2432 PutCursorsAtStep(upDown) 2433 2434 return(0) 2435 end 2436 2437 2438 Function EC_FindStepButton_up(ctrlName) : ButtonControl 2439 String ctrlName 2440 2441 Variable upDown = 5 2442 PutCursorsAtStep(upDown) 2443 2444 return(0) 2445 end 2446 2447 2448 Function 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) 2465 end 2212 2466 2213 2467 ////////////// Custom Bins ///////////////////// … … 2269 2523 SetVariable setvar1,pos={23,13},size={160,20},title="Number of slices",fSize=12 2270 2524 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=1 22525 SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=10 2272 2526 SetVariable setvar2,value=root:Packages:NIST:gEvent_t_longest 2273 2527 … … 2505 2759 Prompt baseStr,"File prefix, number will be appended" 2506 2760 2761 2507 2762 fSplitBigFile(splitSize, baseStr) 2508 End 2509 2510 Function fSplitBigFile(splitSize, baseStr) 2763 2764 End 2765 2766 Function/S fSplitBigFile(splitSize, baseStr) 2511 2767 Variable splitSize 2512 2768 String baseStr … … 2517 2773 Variable refNum 2518 2774 String str 2775 SVAR listStr = root:Packages:NIST:Event:gSplitFileList 2776 2777 listStr="" //initialize output list 2519 2778 2520 2779 Variable readSize=1e6 //1 MB … … 2522 2781 Variable numSplit 2523 2782 Variable num,ii,jj,outRef,frac 2524 String thePath 2783 String thePath, outStr 2525 2784 2526 2785 Printf "SplitSize = %u MB\r",splitSize … … 2530 2789 // Open file for read. 2531 2790 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 2533 2793 2534 2794 // Store results from Open in a safe place. … … 2538 2798 if (err == -1) 2539 2799 Print "cancelled by user." 2540 return -12800 return ("") 2541 2801 endif 2542 2802 … … 2565 2825 Printf "frac = %u\r",frac 2566 2826 2567 baseStr = "split"2827 // baseStr = "split" 2568 2828 2569 2829 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 2571 2833 2572 2834 for(jj=0;jj<(splitSize/readSize);jj+=1) … … 2576 2838 2577 2839 Close outRef 2840 listStr += outStr+";" 2578 2841 endfor 2579 2842 2580 2843 Make/O/B/U/N=(frac) leftover 2581 2844 // 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 2583 2847 for(jj=0;jj<num;jj+=1) 2584 2848 FBinRead refNum,aBlob … … 2589 2853 2590 2854 Close outRef 2855 listStr += outStr+";" 2591 2856 2592 2857 … … 2594 2859 Close refNum 2595 2860 2596 2597 return 02861 KillWaves/Z aBlob,leftover 2862 return(listStr) 2598 2863 End 2599 2864 … … 2601 2866 2602 2867 //// 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. 2608 2871 // 2609 2872 // mode = 0 wipe out the old accumulated, copy slicedData to accumulatedData 2610 2873 // mode = 1 add current slicedData to accumulatedData 2611 2874 // 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 // 2882 Function 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) 2891 End 2892 2614 2893 Function AccumulateSlices(mode) 2615 2894 Variable mode … … 2640 2919 return(0) 2641 2920 end 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 2956 Function SplitFileButtonProc(ctrlName) : ButtonControl 2957 String ctrlName 2958 2959 Execute "SplitBigFile()" 2960 End 2961 2962 2963 // show all of the data 2964 // 2965 Proc 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 2984 EndMacro 2985 2986 // data has NOT been processed 2987 // 2988 // so work with x,y,t, and rescaled time 2989 // variables -- t_longest 2990 Function 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) 2999 End 3000 3001 Function 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 3072 End 3073 3074 Function 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 3099 End 3100 3101 3102 3103 3104 Function 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 3135 End 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 // 3140 Function 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) 3214 End 3215 3216 /////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.