4Misc_Start4Platform@ xHH@Rg(HHdh xHH@Rg(HHdh x HH@Rg(HHdh ^Graph*WDashSettings#  ! "@6Normal@ Lucida Console<HHHH$$4 4 4 4 4 4 ohome;3dC:Users:Jim:Desktop:C:Users:Jim:Desktop:.G:@D:ЍFE:J ׍ۍҍG:Ѝ:Ѝ?ݹDG:ЍĐݹ`O$$C:ers:ȐRecentWindowsGraph0:target;risingY vs risingX;...Graph1:durationIgor Reference.ihfTable0:risingX,fallingX,duration,indexOfDurationsLongEnough 4Misc_EndTXOPState_Start PeakFunctions2-644XOPState_EndV_Flag?V_LevelsFoundP@make/O/N=1000 target= sin(x/8)*10 display target make/O/N=1000 target= sin(x*x/100)*10 make/O/N=1000 target= sin(x*x/1000)*10 make/O/N=1000 target= sin(x*x/10000)*10 findlevels/D=rising/Edge=1 target,5 V_Flag= 1; V_LevelsFound= 16; edit rising rename rising, risingX findlevels/D=fallingx/edge=2 target,5 V_Flag= 1; V_LevelsFound= 16; appendToTable fallingX duplicate/O risingX, risingY;risingy= target(risingx[p]) duplicate/O fallingX, fallingY;fallingy = target(fallingx[p]) append risingY vs risingx append fallingY vs fallingx ModifyGraph mode(risingY)=3,marker(risingY)=17,rgb(risingY)=(0,0,65535),mode(fallingY)=3,marker(fallingY)=23,rgb(fallingY)=(4369,4369,4369) duplicate/O risingX, aboveThresholdTime aboveThresholdTime = fallingx-risingx display abovethresholdtime AppendToTable aboveThresholdTime rename aboveThresholdTime, duration tryit() V_Flag= 1; V_LevelsFound= 4; V_Flag= 1; V_LevelsFound= 4; AppendToTable longEnough tryit() V_Flag= 1; V_LevelsFound= 64; V_Flag= 1; V_LevelsFound= 64; tryit() V_Flag= 1; V_LevelsFound= 64; V_Flag= 1; V_LevelsFound= 64; rename longEnough, indexOfDurationsLongEnough !'" #"target????n;kH>>ۥ>Ҿ>>_?,?H?f?ׂ??l?0?d?r?LC?ij@'@V@p*@7@1nE@BS@ta@}p@ ~@@L@@@͚@@@@@"Q@[@w@@@ۥ@l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@@?@@z@z@@U@F@P@9@@@@=@@H@@:@@@@6@<@@@@@@@,@@a@@@F@T@@@@@@P@/@@$@g@@@ @m"@duration@????,>\F@62@+@q%'@ЯT7$@ Ech,"@snU @@@WU@@qQR@@~@gH@I/d@{g@@@2sqK@u1*@ !+@΀w@h@ 3^@1@=1@^aFD@mw7@j6m@B,-@W 6@ @K\@py @a @ @Y\ @=V @_ @Աa @w+ @@-DW @B @ @<@8 @s!` @@r@&= @1%d$@TFG@@t@@=8R@ǖ@4`X@Y*@T$\@@(@w@U2JA@$l#@B5[@k@O딒@Xs@@P{"0`indexOfDurationsLongEnough0????  !"#$%&'()*+,-./*// Platform=WindowsNT, IGORVersion=7.060, architecture=Intel, systemTextEncoding="Windows-1252", historyTextEncoding="Windows-1252", procwinTextEncoding="Windows-1252", recreationTextEncoding="Windows-1252", build=30177 #pragma TextEncoding = "Windows-1252" Silent 101 // use | as bitwise or -- not comment. DefaultFont "Arial" Graph1() MoveWindow/C 4.5,555.5,717.75,711.5 MoveWindow/P 388.5,197.75,1088.25,545.75 Graph0() Table0() KillStrings/Z root:gWMSetNextTextFilesTextEncoding Window Table0() : Table PauseUpdate; Silent 1 // building window... Edit/W=(36.75,246.5,585.75,546.5) risingX,fallingX,duration,indexOfDurationsLongEnough ModifyTable format(Point)=1 EndMacro Window Graph0() : Graph PauseUpdate; Silent 1 // building window... Display /W=(35.25,41.75,673.5,244.25) target AppendToGraph risingY vs risingX AppendToGraph fallingY vs fallingX ModifyGraph mode(risingY)=3,mode(fallingY)=3 ModifyGraph marker(risingY)=17,marker(fallingY)=23 ModifyGraph rgb(risingY)=(0,0,65535),rgb(fallingY)=(4369,4369,4369) EndMacro Window Graph1() : Graph PauseUpdate; Silent 1 // building window... Display /W=(34.5,272,429,480.5) duration EndMacro 5#pragma TextEncoding = "Windows-1252" #pragma rtGlobals=3 // Use modern global access method and strict wave access. Macro tryit() Make/O/N=1000 target= sin(x*x/2500)*10 // point scaling findlevels/D=risingX/EDGE=1 target,5 findlevels/D=fallingX/EDGE=2 target,5 // there are two cases: rising edge is earliest, or falling edge is earliest // since se want above the threshold, we discard an earlier falling edge. // this code assumes X is increasing with point number Variable firstRisingX= risingX[0] Variable firstFallingX= fallingX[0] if( firstFallingX < firstRisingX ) DeletePoints 0, 1, fallingX endif // if a rising edge has no corresponding falling edge, add one at the end of the wave Variable nRising = numpnts(risingX) Variable nFalling = numpnts(fallingX) if( nRising > nFalling ) // difference should be at most 1 InsertPoints nFalling, 1, fallingX fallingX[nFalling]= rightx(target) endif // debugging for Graph0 Duplicate/O risingX, risingY; risingY=target(risingX[p]) // risingY should be approx threshold Duplicate/O fallingX, fallingY; fallingY=target(fallingX[p]) // ditto // compute the duration above the threshold as falling-rising times. Duplicate/O risingX, duration duration = fallingX - risingX // duration above threshold Extract/INDX duration, indexOfDurationsLongEnough, duration>=3 // the indexOfDurationsLongEnough wave contains only the indexes of the durations that are >= 3.0. // durations shorter than that are not included, so it may well be shorter than risingX & fallingX End