
Using findlevels to find crossings

igorman
I'm new to the Igor environment. I'm currently having a project where I have a wave of data points, about 5.9 x 10^6 points. I had to write a program that finds the places at which a particular value(s) was crossed, for example something like 557.007, 580.444. I have to find the points where these values are crossed both as the numbers increase or on the way of decrease (similar to going up a curve, or going down a curve). I was advised to use the FindLevels operation to do this and all seemed be going well. But when my output was seen on the table, I could only get the iteration to go up to 127 points, while my data wave consists of 5.6 x 10^9 points. Is there a particular limit to the Findlevels operation? I was thinking of using a for loop + findlevels mechanism to accommodate for this, but am not too sure how to get it done. I would be grateful for tips and explanations.
The data looks like this:
0 562.21
1 558.002
2 555.361
3 551.643
4 555.463
5 562.009
6 556.385
7 556.553
8 552.292
9 552.115
10 557.492
11 556.408
12 556.867
13 557.39
14 557.722
15 557.043
16 564.752
...
5.9E6 557.689
Here is my code:
#pragma rtGlobals=1 // Use modern global access method. Function GetPoint(inputwave1, inputwave2, inputwave3) Wave inputwave1 // Data points wave Wave inputwave2 Wave inputwave3 Variable crossing0 Variable crossing1 crossing0 = inputwave2[0] // crossing0 = Boundaries10[0] = 557.007 print crossing0 crossing1 = inputwave2[1] // crossing0 = Boundaries10[1] = 580.444 print crossing1 FindLevels/B=5/D=LevelCrossings1a/EDGE=1/R=(0,5899999)/Q inputwave1, crossing0 //basically finds crossings going up for Boundaries 10[0] in Trace = inputwave1 FindLevels/B=5/D=LevelCrossings1b/EDGE=2/R=(0,5899999)/Q inputwave1, crossing0 //basically finds crossings going down for Boundaries 10[0] in Trace = inputwave1 FindLevels/B=5/D=LevelCrossings2a/EDGE=1/R=(0,5899999)/Q inputwave1, crossing1 //basically finds crossings going up for Boundaries 10[1] in Trace = inputwave1 FindLevels/B=5/D=LevelCrossings2b/EDGE=2/R=(0,5899999)/Q inputwave1, crossing1 //basically finds crossings going up for Boundaries 10[1] in Trace = inputwave1 Wave LevelCrossings1a Make/O LevelCrossings1a Wave LevelCrossings1b Make/O LevelCrossings1b Wave LevelCrossings2a Make/O LevelCrossings2a Wave LevelCrossings2b Make/O LevelCrossings2b End
May 27, 2013 at 12:23 pm - Permalink