Find Levels
igorman
I'm trying to implement the FindLevels function for a list of 30 data points, and I'm doing it so using a for loop. It basically goes through each point in the list, and sees how many times level crossings occur, but every time I open the designated wave to find the locations where the level crossings occur, I don't get the right numbers. Here is a code snippet:
Wave rawwave1 //The data
Variable count0 = 0
Variable numPoints = numpnts(rawwave1)
Variable i
for(i=0; i<numPoints; i+=1)
FindLevels /D=SelectiveCrossings/EDGE=0/R=(0,29) rawwave1, rawwave1[i]
count0 += 1
endfor
End
Try describing the problem more clearly. What do you want to do? Add an example analysis (not example code - a few numbers of input and the output that you would like to see).
June 24, 2013 at 02:20 pm - Permalink
Additionally, the output is the x level where it is crossed, not the point number, so wave scaling must be considered. As a quick example, consider the following numbers: 10,5,5,0. Where does it cross 5? points 1 and 2 (if you have wave scaling, the results could read as 10,20 or 0.0003,0.0006. Get my point?)
Finally, your count variable will end up being i after the for loop. What is the point of this?
June 24, 2013 at 02:44 pm - Permalink
Hi proland, thank you very much your reply. I did realize what you came to say after going through my code snippet again. The project I'm working involves going through a a large number of data sets and basically calculating this delta kronecker function type computation. In order to do this, the code snippet I had posted above was an integral part to sort through the data.
I basically have a bunch of waves with the following data,
XValues YValues
For example, the waves have been compiled into one table in the following manner.
XValue = 4, Yvalue = 1
.
.
.
Xvalue = 10, Yvalue = 1
Like you had mentioned, the destination wave is being overwritten in each iteration of the loop. I've modified my code to go for point numbers, though you have a great point in wave scaling. I will look into that too.
My only problem is basically on how I could deal with the overwriting of the destination in each iteration. In this phase of my project, for each number in the Yvalue wave, I have to find out the number of level crossings, where that particular number is crossed, as well as the different locations. And I have to do this for all points throughout the wave.
I thought for loop would help for this, but that does lead to the overwriting. I would be very grateful for suggestions, as I'm only a beginner in Igor.
June 24, 2013 at 05:14 pm - Permalink
SelectiveCrossings is an output from a given iteration of the loop. You need another output wave to which you concatenate results from each loop iteration - or something like that.
You can use the Concatenate/NP operation to concatenate SelectiveCrossings onto the real output wave.
June 24, 2013 at 06:59 pm - Permalink
for ...
FindLevels /D=SelectiveCrossings ...
Concatenate/NP=0 SelectiveCrossings AllCrossings
count0 += 1
endfor
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 25, 2013 at 03:41 am - Permalink