Changeset 918 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
 Timestamp:
 Jul 9, 2013 10:52:52 AM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf
r917 r918 14 14 //  examples? 15 15 // 16 //  ?? need way to get correspondence between .hst files and VAX files? Names are all different. See 17 // DateAndTime2HSTName() functions and similar @ bottom of this file 18 // 16 19 // x add the XOP to the distribution package 17 20 // 18 //  Need to make sure that the rescaledTime and the differentiated time graphs are21 // x Need to make sure that the rescaledTime and the differentiated time graphs are 19 22 // being properly updated when the data is processed, modified, etc. 20 23 // … … 32 35 //  Add a switch to allow Sorting of the Stream data to remove the "timereversed" data 33 36 // points. Maybe not kosher, but would clean things up. 37 // 38 // 39 /////////////// SWITCHES ///////////////// 40 // 41 // for the "File Too Big" limit: 42 // Variable/G root:Packages:NIST:Event:gEventFileTooLarge = 150 // 150 MB considered too large 43 // 44 // for the tolerance of "step" detection 45 // Variable/G root:Packages:NIST:Event:gStepTolerance = 5 // 5 = # of standard deviations from mean. See PutCursorsAtStep() 34 46 // 35 47 // … … 120 132 121 133 Function Init_Event() 122 String/G root:Packages:NIST:gEvent_logfile 123 String/G root:Packages:NIST:gEventDisplayString="Details of the file load" 124 125 Variable/G root:Packages:NIST:AIMTYPE_XY=0 // XY Event 126 Variable/G root:Packages:NIST:AIMTYPE_XYM=2 // XY Minor event 127 Variable/G root:Packages:NIST:AIMTYPE_MIR=1 // Minor rollover event 128 Variable/G root:Packages:NIST:AIMTYPE_MAR=3 // Major rollover event 129 130 Variable/G root:Packages:NIST:gEvent_time_msw = 0 131 Variable/G root:Packages:NIST:gEvent_time_lsw = 0 132 Variable/G root:Packages:NIST:gEvent_t_longest = 0 133 134 Variable/G root:Packages:NIST:gEvent_tsdisp //Displayed slice 135 Variable/G root:Packages:NIST:gEvent_nslices = 10 //Number of time slices 136 137 Variable/G root:Packages:NIST:gEvent_logint = 1 138 139 Variable/G root:Packages:NIST:gEvent_Mode = MODE_OSCILL // ==0 for "stream", ==1 for Oscillatory 140 Variable/G root:Packages:NIST:gRemoveBadEvents = 1 // ==1 to remove "bad" events, ==0 to read "asis" 141 Variable/G root:Packages:NIST:gSortStreamEvents = 0 // ==1 to sort the event stream, a last resort for a stream of data 142 143 Variable/G root:Packages:NIST:gEvent_ForceTmaxBin=1 //==1 to enforce t_longest in userdefined custom bins 144 145 NVAR nslices = root:Packages:NIST:gEvent_nslices 146 147 SetDataFolder root: 134 148 135 NewDataFolder/O/S root:Packages:NIST:Event 149 136 137 String/G root:Packages:NIST:Event:gEvent_logfile 138 String/G root:Packages:NIST:Event:gEventDisplayString="Details of the file load" 139 140 Variable/G root:Packages:NIST:Event:AIMTYPE_XY=0 // XY Event 141 Variable/G root:Packages:NIST:Event:AIMTYPE_XYM=2 // XY Minor event 142 Variable/G root:Packages:NIST:Event:AIMTYPE_MIR=1 // Minor rollover event 143 Variable/G root:Packages:NIST:Event:AIMTYPE_MAR=3 // Major rollover event 144 145 Variable/G root:Packages:NIST:Event:gEvent_time_msw = 0 146 Variable/G root:Packages:NIST:Event:gEvent_time_lsw = 0 147 Variable/G root:Packages:NIST:Event:gEvent_t_longest = 0 148 149 Variable/G root:Packages:NIST:Event:gEvent_tsdisp //Displayed slice 150 Variable/G root:Packages:NIST:Event:gEvent_nslices = 10 //Number of time slices 151 152 Variable/G root:Packages:NIST:Event:gEvent_logint = 1 153 154 Variable/G root:Packages:NIST:Event:gEvent_Mode = MODE_OSCILL // ==0 for "stream", ==1 for Oscillatory 155 Variable/G root:Packages:NIST:Event:gRemoveBadEvents = 1 // ==1 to remove "bad" events, ==0 to read "asis" 156 Variable/G root:Packages:NIST:Event:gSortStreamEvents = 0 // ==1 to sort the event stream, a last resort for a stream of data 157 158 Variable/G root:Packages:NIST:Event:gEvent_ForceTmaxBin=1 //==1 to enforce t_longest in userdefined custom bins 159 160 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 161 162 150 163 Make/D/O/N=(XBINS,YBINS,nslices) slicedData 151 164 Duplicate/O slicedData logslicedData … … 154 167 155 168 // for decimation 169 Variable/G root:Packages:NIST:Event:gEventFileTooLarge = 150 // 150 MB considered too large 156 170 Variable/G root:Packages:NIST:Event:gDecimation = 100 157 Variable/G root:Packages:NIST: gEvent_t_longest_decimated = 0171 Variable/G root:Packages:NIST:Event:gEvent_t_longest_decimated = 0 158 172 159 173 // for large file splitting 160 174 String/G root:Packages:NIST:Event:gSplitFileList = "" // a list of the file names as split 175 176 // for editing 177 Variable/G root:Packages:NIST:Event:gStepTolerance = 5 // 5 = # of standard deviations from mean. See PutCursorsAtStep() 161 178 162 179 SetDataFolder root: … … 193 210 Button button0,fSize=12 194 211 TitleBox tb1,pos={475,500},size={135,24},fSize=10 195 TitleBox tb1,variable= root:Packages:NIST: gEventDisplayString212 TitleBox tb1,variable= root:Packages:NIST:Event:gEventDisplayString 196 213 197 214 CheckBox chkbox2,pos={376,151},size={81,14},proc=LogIntEvent_Proc,title="Log Intensity" 198 CheckBox chkbox2,fSize=10,variable= root:Packages:NIST: gEvent_logint215 CheckBox chkbox2,fSize=10,variable= root:Packages:NIST:Event:gEvent_logint 199 216 CheckBox chkbox3,pos={14,125},size={119,14},title="Remove Bad Events?",fSize=10 200 CheckBox chkbox3,variable= root:Packages:NIST: gRemoveBadEvents217 CheckBox chkbox3,variable= root:Packages:NIST:Event:gRemoveBadEvents 201 218 202 219 Button doneButton,pos={708,36},size={50,20},proc=EventDone_Proc,title="Done" … … 216 233 SetVariable setvar0,pos={208,149},size={160,16},proc=sliceSelectEvent_Proc,title="Display Time Slice" 217 234 SetVariable setvar0,fSize=10 218 SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST: gEvent_tsdisp235 SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:Event:gEvent_tsdisp 219 236 SetVariable setvar1,pos={206,26},size={160,16},title="Number of slices",fSize=10 220 SetVariable setvar1,limits={1,1000,1},value= root:Packages:NIST: gEvent_nslices237 SetVariable setvar1,limits={1,1000,1},value= root:Packages:NIST:Event:gEvent_nslices 221 238 SetVariable setvar2,pos={206,51},size={160,16},title="Max Time (s)",fSize=10 222 SetVariable setvar2,value= root:Packages:NIST: gEvent_t_longest239 SetVariable setvar2,value= root:Packages:NIST:Event:gEvent_t_longest 223 240 224 241 PopupMenu popup0,pos={206,74},size={119,20},proc=BinTypePopMenuProc,title="Bin Spacing" … … 228 245 229 246 Button button10,pos={488,305},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 230 Button button14,pos={488,350},size={130,20},proc=Stream_LoadDecim,title="Load From List" 247 Button button14,pos={488,350},size={120,20},proc=Stream_LoadDecim,title="Load Split List" 248 Button button19,pos={619,350},size={120,20},proc=Stream_LoadAdjustedList,title="Load Edited List" 231 249 SetVariable setvar3,pos={487,378},size={150,16},title="Decimation factor" 232 250 SetVariable setvar3,fSize=10 … … 284 302 Variable value 285 303 286 NVAR gEventModeRadioVal= root:Packages:NIST: gEvent_mode304 NVAR gEventModeRadioVal= root:Packages:NIST:Event:gEvent_mode 287 305 288 306 strswitch (name) … … 456 474 String ctrlName 457 475 458 NVAR mode=root:Packages:NIST: gEvent_Mode476 NVAR mode=root:Packages:NIST:Event:gEvent_Mode 459 477 460 478 if(mode == MODE_STREAM) … … 472 490 473 491 // toggle the checkbox for log display to force the display to be correct 474 NVAR gLog = root:Packages:NIST: gEvent_logint492 NVAR gLog = root:Packages:NIST:Event:gEvent_logint 475 493 LogIntEvent_Proc("",gLog) 476 494 … … 491 509 // now with the number of slices and max time, process the events 492 510 493 NVAR t_longest = root:Packages:NIST: gEvent_t_longest494 NVAR nslices = root:Packages:NIST: gEvent_nslices511 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 512 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 495 513 496 514 SetDataFolder root:Packages:NIST:Event //don't count on the folder remaining here … … 620 638 // now with the number of slices and max time, process the events 621 639 622 NVAR yesSortStream = root:Packages:NIST: gSortStreamEvents //do I sort the events?623 NVAR t_longest = root:Packages:NIST: gEvent_t_longest624 NVAR nslices = root:Packages:NIST: gEvent_nslices640 NVAR yesSortStream = root:Packages:NIST:Event:gSortStreamEvents //do I sort the events? 641 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 642 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 625 643 626 644 SetDataFolder root:Packages:NIST:Event //don't count on the folder remaining here … … 876 894 String ctrlName 877 895 878 NVAR mode=root:Packages:NIST: gEvent_mode896 NVAR mode=root:Packages:NIST:Event:gEvent_mode 879 897 Variable err=0 880 898 Variable fileref,totBytes 881 Variable fileTooLarge = 150//limit load to 150MB882 883 SVAR filename = root:Packages:NIST: gEvent_logfile884 NVAR nslices = root:Packages:NIST: gEvent_nslices885 NVAR t_longest = root:Packages:NIST: gEvent_t_longest899 NVAR fileTooLarge = root:Packages:NIST:Event:gEventFileTooLarge //limit load to 150MB 900 901 SVAR filename = root:Packages:NIST:Event:gEvent_logfile 902 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 903 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 886 904 887 905 String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 888 906 String abortStr 907 908 PathInfo catPathName 909 if(V_flag==0) 910 DoAlert 0,"Please 'Pick Path' to the data from the Main (yellow) Panel." 911 return(0) 912 endif 913 889 914 890 915 Open/R/D/P=catPathName/F=fileFilters fileref … … 968 993 // Variable fileref 969 994 // 970 // SVAR filename = root:Packages:NIST: gEvent_logfile971 // NVAR nslices = root:Packages:NIST: gEvent_nslices972 // NVAR t_longest = root:Packages:NIST: gEvent_t_longest995 // SVAR filename = root:Packages:NIST:Event:gEvent_logfile 996 // NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 997 // NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 973 998 // 974 999 // String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" … … 1014 1039 // Variable fileref 1015 1040 // 1016 // SVAR filename = root:Packages:NIST: gEvent_logfile1017 // NVAR nslices = root:Packages:NIST: gEvent_nslices1018 // NVAR t_longest = root:Packages:NIST: gEvent_t_longest1041 // SVAR filename = root:Packages:NIST:Event:gEvent_logfile 1042 // NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 1043 // NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 1019 1044 // 1020 1045 // String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" … … 1089 1114 endif 1090 1115 1091 NVAR selectedslice = root:Packages:NIST: gEvent_tsdisp1116 NVAR selectedslice = root:Packages:NIST:Event:gEvent_tsdisp 1092 1117 1093 1118 sliceSelectEvent_Proc("", selectedslice, "", "") … … 1112 1137 String varName 1113 1138 1114 NVAR nslices = root:Packages:NIST: gEvent_nslices1115 NVAR selectedslice = root:Packages:NIST: gEvent_tsdisp1139 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 1140 NVAR selectedslice = root:Packages:NIST:Event:gEvent_tsdisp 1116 1141 1117 1142 if(varNum < 0) … … 1166 1191 Function LoadEvents() 1167 1192 1168 NVAR time_msw = root:Packages:NIST: gEvent_time_msw1169 NVAR time_lsw = root:Packages:NIST: gEvent_time_lsw1170 NVAR t_longest = root:Packages:NIST: gEvent_t_longest1171 1172 SVAR filepathstr = root:Packages:NIST: gEvent_logfile1173 SVAR dispStr = root:Packages:NIST: gEventDisplayString1193 NVAR time_msw = root:Packages:NIST:Event:gEvent_time_msw 1194 NVAR time_lsw = root:Packages:NIST:Event:gEvent_time_lsw 1195 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 1196 1197 SVAR filepathstr = root:Packages:NIST:Event:gEvent_logfile 1198 SVAR dispStr = root:Packages:NIST:Event:gEventDisplayString 1174 1199 1175 1200 … … 1331 1356 roll_time = 2^26 //units of 107 sec 1332 1357 1333 NVAR removeBadEvents = root:Packages:NIST: gRemoveBadEvents1358 NVAR removeBadEvents = root:Packages:NIST:Event:gRemoveBadEvents 1334 1359 1335 1360 time_msw=0 … … 1657 1682 #if (exists("EventLoadWave")==4) 1658 1683 1659 // NVAR time_msw = root:Packages:NIST: gEvent_time_msw1660 // NVAR time_lsw = root:Packages:NIST: gEvent_time_lsw1661 NVAR t_longest = root:Packages:NIST: gEvent_t_longest1662 1663 SVAR filepathstr = root:Packages:NIST: gEvent_logfile1664 SVAR dispStr = root:Packages:NIST: gEventDisplayString1684 // NVAR time_msw = root:Packages:NIST:Event:gEvent_time_msw 1685 // NVAR time_lsw = root:Packages:NIST:Event:gEvent_time_lsw 1686 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 1687 1688 SVAR filepathstr = root:Packages:NIST:Event:gEvent_logfile 1689 SVAR dispStr = root:Packages:NIST:Event:gEventDisplayString 1665 1690 1666 1691 SetDataFolder root:Packages:NIST:Event … … 1724 1749 // 1725 1750 1726 NVAR removeBadEvents = root:Packages:NIST: gRemoveBadEvents1751 NVAR removeBadEvents = root:Packages:NIST:Event:gRemoveBadEvents 1727 1752 1728 1753 tic() … … 1938 1963 Make/O/D/N=(128,128) curSlice 1939 1964 1940 NVAR nslices = root:Packages:NIST: gEvent_nslices1965 NVAR nslices = root:Packages:NIST:Event:gEvent_nslices 1941 1966 WAVE binEndTime = root:Packages:NIST:Event:binEndTime 1942 1967 … … 2213 2238 2214 2239 // updates the longest time (as does every operation of adjusting the data) 2215 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2240 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2216 2241 t_longest = waveMax(rescaledTime) 2217 2242 … … 2248 2273 2249 2274 // updates the longest time (as does every operation of adjusting the data) 2250 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2275 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2251 2276 t_longest = waveMax(rescaledTime) 2252 2277 … … 2290 2315 2291 2316 // updates the longest time (as does every operation of adjusting the data) 2292 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2317 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2293 2318 t_longest = waveMax(rescaledTime) 2294 2319 … … 2330 2355 End 2331 2356 2357 // 2332 2358 // this duplicates all of the bits that would be done if the "load" button was pressed 2333 //2334 2359 // 2335 2360 Function EC_ImportWavesButtonProc(ba) : ButtonControl … … 2341 2366 SetDataFolder root:Packages:NIST:Event: 2342 2367 2343 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2344 SVAR dispStr = root:Packages:NIST: gEventDisplayString2368 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2369 SVAR dispStr = root:Packages:NIST:Event:gEventDisplayString 2345 2370 String tmpStr="",fileStr,filePathStr 2346 2371 … … 2354 2379 endif 2355 2380 2356 NVAR mode = root:Packages:NIST: gEvent_Mode // ==0 for "stream", ==1 for Oscillatory2381 NVAR mode = root:Packages:NIST:Event:gEvent_Mode // ==0 for "stream", ==1 for Oscillatory 2357 2382 // clear out the old sort index, if present, since new data is being loaded 2358 2383 KillWaves/Z OscSortIndex 2359 2384 Wave timePt=timePt 2360 2385 Wave rescaledTime=rescaledTime 2361 2362 // Duplicate/O timePt rescaledTime2363 // if(mode==MODE_STREAM)2364 // rescaledTime = 1e7*(timePttimePt[0]) //convert to seconds and start from zero2365 // else2366 // rescaledTime = timePt*1e7 //just take the times asis2367 // endif2368 2386 2369 2387 t_longest = waveMax(rescaledTime) //should be the last point … … 2443 2461 WaveStats/M=1/Q rescaledTime_DIF 2444 2462 avg = V_avg 2445 2446 2463 2447 2464 FindLevel/P/Q rescaledTime_DIF avg*upDown 2448 2465 if(V_flag==0) … … 2488 2505 minVal = abs(V_min) 2489 2506 2490 2491 2507 pt = abs(maxVal  avg) > abs(minVal  avg) ? maxPt : minPt 2492 2508 … … 2502 2518 2503 2519 SetDataFolder root: 2504 2505 2520 2506 2521 return(0) 2507 2522 End … … 2510 2525 String ctrlName 2511 2526 2512 Variable upDown = 5 2513 PutCursorsAtStep(upDown) 2527 // Variable upDown = 5 2528 NVAR upDown = root:Packages:NIST:Event:gStepTolerance 2529 2530 PutCursorsAtStep(1*upDown) 2514 2531 2515 2532 return(0) … … 2520 2537 String ctrlName 2521 2538 2522 Variable upDown = 5 2539 // Variable upDown = 5 2540 NVAR upDown = root:Packages:NIST:Event:gStepTolerance 2541 2523 2542 PutCursorsAtStep(upDown) 2524 2543 … … 2578 2597 Function Init_CustomBins() 2579 2598 2580 NVAR nSlice = root:Packages:NIST: gEvent_nslices2581 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2582 2583 Variable/G root:Packages:NIST: gEvent_ForceTmaxBin=1 //==1 to enforce t_longest in userdefined custom bins2599 NVAR nSlice = root:Packages:NIST:Event:gEvent_nslices 2600 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2601 2602 Variable/G root:Packages:NIST:Event:gEvent_ForceTmaxBin=1 //==1 to enforce t_longest in userdefined custom bins 2584 2603 2585 2604 SetDataFolder root:Packages:NIST:Event: … … 2617 2636 Button button2,pos={216,42},size={80,20},title="Update",proc=CB_UpdateWavesButton 2618 2637 SetVariable setvar1,pos={23,13},size={160,20},title="Number of slices",fSize=12 2619 SetVariable setvar1,proc=CB_NumSlicesSetVarProc,value=root:Packages:NIST: gEvent_nslices2638 SetVariable setvar1,proc=CB_NumSlicesSetVarProc,value=root:Packages:NIST:Event:gEvent_nslices 2620 2639 SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=10 2621 SetVariable setvar2,value=root:Packages:NIST: gEvent_t_longest2640 SetVariable setvar2,value=root:Packages:NIST:Event:gEvent_t_longest 2622 2641 2623 2642 CheckBox chkbox1,pos={216,14},title="Enforce Max Time?" 2624 CheckBox chkbox1,variable = root:Packages:NIST: gEvent_ForceTmaxBin2643 CheckBox chkbox1,variable = root:Packages:NIST:Event:gEvent_ForceTmaxBin 2625 2644 Button button3,pos={500,14},size={90,20},proc=CB_SaveBinsButtonProc,title="Save Bins" 2626 2645 Button button4,pos={500,42},size={100,20},proc=CB_ImportBinsButtonProc,title="Import Bins" … … 2694 2713 case 2: // mouse up 2695 2714 // click code here 2696 NVAR nSlice = root:Packages:NIST: gEvent_nslices2715 NVAR nSlice = root:Packages:NIST:Event:gEvent_nslices 2697 2716 2698 2717 SetDataFolder root:Packages:NIST:Event: … … 2737 2756 case 2: // mouse up 2738 2757 // click code here 2739 NVAR nSlice = root:Packages:NIST: gEvent_nslices2740 NVAR t_longest = root:Packages:NIST: gEvent_t_longest2741 NVAR enforceTmax = root:Packages:NIST: gEvent_ForceTmaxBin2758 NVAR nSlice = root:Packages:NIST:Event:gEvent_nslices 2759 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 2760 NVAR enforceTmax = root:Packages:NIST:Event:gEvent_ForceTmaxBin 2742 2761 2743 2762 // update the waves, and recalculate everything for the display … … 3119 3138 Wave rescaledTime_dTmp=rescaledTime_dTmp 3120 3139 3121 NVAR t_longest_dec = root:Packages:NIST: gEvent_t_longest_decimated3122 NVAR t_longest = root:Packages:NIST: gEvent_t_longest3140 NVAR t_longest_dec = root:Packages:NIST:Event:gEvent_t_longest_decimated 3141 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 3123 3142 3124 3143 … … 3192 3211 Wave rescaledTime_dec=rescaledTime_dec 3193 3212 3194 NVAR t_longest_dec = root:Packages:NIST: gEvent_t_longest_decimated3195 NVAR t_longest = root:Packages:NIST: gEvent_t_longest3213 NVAR t_longest_dec = root:Packages:NIST:Event:gEvent_t_longest_decimated 3214 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 3196 3215 3197 3216 Duplicate/O timePt_dec timePt … … 3222 3241 Wave xLoc=xLoc 3223 3242 Wave yLoc=yLoc 3224 NVAR t_longest_dec = root:Packages:NIST: gEvent_t_longest_decimated3243 NVAR t_longest_dec = root:Packages:NIST:Event:gEvent_t_longest_decimated 3225 3244 3226 3245 NVAR decimation = root:Packages:NIST:Event:gDecimation … … 3244 3263 End 3245 3264 3265 3266 3267 3268 3269 3270 3271 // 3246 3272 // loads a list of files, decimating each chunk as it is read in 3247 3273 // … … 3251 3277 Variable fileref 3252 3278 3253 SVAR filename = root:Packages:NIST: gEvent_logfile3254 NVAR t_longest = root:Packages:NIST: gEvent_t_longest3279 SVAR filename = root:Packages:NIST:Event:gEvent_logfile 3280 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 3255 3281 3256 3282 SVAR listStr = root:Packages:NIST:Event:gSplitFileList 3257 NVAR t_longest_dec = root:Packages:NIST: gEvent_t_longest_decimated3283 NVAR t_longest_dec = root:Packages:NIST:Event:gEvent_t_longest_decimated 3258 3284 NVAR decimation = root:Packages:NIST:Event:gDecimation 3259 3285 … … 3263 3289 3264 3290 // if "stream" mode is not checked  abort 3265 NVAR gEventModeRadioVal= root:Packages:NIST: gEvent_mode3291 NVAR gEventModeRadioVal= root:Packages:NIST:Event:gEvent_mode 3266 3292 if(gEventModeRadioVal != MODE_STREAM) 3267 3293 Abort "The mode must be 'Stream' to use this function" … … 3279 3305 endif 3280 3306 3281 3282 3307 3283 3308 //loop through everything in the list … … 3342 3367 End 3343 3368 3369 3370 3371 // 3372 // loads a list of files that have been adjusted and saved 3373 //  does not decimate 3374 // 3375 Function Stream_LoadAdjustedList(ctrlName) 3376 String ctrlName 3377 3378 Variable fileref 3379 3380 SVAR filename = root:Packages:NIST:Event:gEvent_logfile 3381 NVAR t_longest = root:Packages:NIST:Event:gEvent_t_longest 3382 3383 SVAR listStr = root:Packages:NIST:Event:gSplitFileList 3384 NVAR t_longest_dec = root:Packages:NIST:Event:gEvent_t_longest_decimated 3385 // NVAR decimation = root:Packages:NIST:Event:gDecimation 3386 3387 String pathStr 3388 PathInfo catPathName 3389 pathStr = S_Path 3390 3391 // if "stream" mode is not checked  abort 3392 NVAR gEventModeRadioVal= root:Packages:NIST:Event:gEvent_mode 3393 if(gEventModeRadioVal != MODE_STREAM) 3394 Abort "The mode must be 'Stream' to use this function" 3395 return(0) 3396 endif 3397 3398 // if the list has been edited, turn it into a list 3399 WAVE/T/Z tw = root:Packages:NIST:Event:SplitFileWave 3400 if(WaveExists(tw)) 3401 listStr = TextWave2SemiList(tw) 3402 else 3403 ShowSplitFileTable() 3404 DoAlert 0,"Enter the file names in the table, then click 'Load From List' again." 3405 return(0) 3406 endif 3407 3408 3409 //loop through everything in the list 3410 Variable num,ii 3411 num = ItemsInList(listStr) 3412 3413 for(ii=0;ii<num;ii+=1) 3414 3415 // (1) load the file, prepending the path 3416 filename = pathStr + StringFromList(ii, listStr ,";") 3417 3418 SetDataFolder root:Packages:NIST:Event: 3419 LoadWave/T/O fileName 3420 3421 SetDataFolder root:Packages:NIST:Event: //LoadEvents sets back to root: ?? 3422 3423 // this is what is loaded  _dec extension is what is concatenated, and will be copied back later 3424 Wave timePt=timePt 3425 Wave xLoc=xLoc 3426 Wave yLoc=yLoc 3427 Wave rescaledTime=rescaledTime 3428 3429 // CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 3430 3431 // Duplicate/O timePt rescaledTime 3432 // rescaledTime = 1e7*(timePttimePt[0]) //convert to seconds and start from zero 3433 // t_longest = waveMax(rescaledTime) //should be the last point 3434 3435 // (2) No decimation 3436 3437 Duplicate/O timePt, timePt_dTmp 3438 Duplicate/O xLoc, xLoc_dTmp 3439 Duplicate/O yLoc, yLoc_dTmp 3440 Duplicate/O rescaledTime, rescaledTime_dTmp 3441 3442 3443 // (3) concatenate 3444 fConcatenateButton(ii+1) //passes 1 for the first time, >1 each other time 3445 3446 endfor 3447 3448 DisplayConcatenatedButtonProc("") // this resets the longest time, too 3449 3450 SetDataFolder root: 3451 3452 return(0) 3453 End 3454 3344 3455 ///////////////////////////////////// 3456 3457 // ddmonyyyy hh:mm:ss > Event file name 3458 // the VAX uses 24 hr time for hh 3459 // 3460 // scans as string elements since I'm reconstructing a string name 3461 Function/S DateAndTime2HSTName(dateandtime) 3462 string dateAndTime 3463 3464 String day,yr,hh,mm,ss,time_secs 3465 Variable mon 3466 string str,monStr,fileStr 3467 3468 str=dateandtime 3469 sscanf str,"%2s%3s%4s %2s:%2s:%2s",day,monStr,yr,hh,mm,ss 3470 mon = monStr2num(monStr) 3471 3472 fileStr = "Event"+yr+num2str(mon)+day+hh+mm+ss+".hst" 3473 Print fileStr 3474 3475 return(fileStr) 3476 end 3477 3478 // ddmonyyyy hh:mm:ss > Event file name 3479 // the VAX uses 24 hr time for hh 3480 // 3481 // scans as string elements since I'm reconstructing a string name 3482 Function DateAndTime2HSTNumber(dateandtime) 3483 string dateAndTime 3484 3485 String day,yr,hh,mm,ss,time_secs 3486 Variable mon,num 3487 string str,monStr,fileStr 3488 3489 str=dateandtime 3490 sscanf str,"%2s%3s%4s %2s:%2s:%2s",day,monStr,yr,hh,mm,ss 3491 mon = monStr2num(monStr) 3492 3493 fileStr = yr+num2str(mon)+day+hh+mm+ss 3494 num = str2num(fileStr) 3495 3496 return(num) 3497 end 3498 3499 Function HSTName2Num(str) 3500 String str 3501 3502 Variable num 3503 sscanf str,"Event%d.hst",num 3504 return(num) 3505 end 3506 /////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.