Interval Gaps and Means
astrotool
I don't quite understand how to tell it to look for a difference between values and then insert a point there
For the mean I am guessing I would tell it to take a mean for points between NaN and NaN or something like that? I just don't know how to do that, plus how would I combine the means between the NaN points to generate one total mean for the wave?
So here is my thoughts for the inserting NaN point
Since != takes a left hand operand and a right hand operand, both of which are scalar numbers. It returns true (1) if the operands are not equal or false (0) if they are equal
Could I somehow tell != to equal the previous point plus 1 second. So if that is not the case it would return a false (0), and then tell it to turn that false into a NaN with something like this
Wave w = wave0 w = w[p]==0 ? NaN : w[p]w = w[p]==0 ? NaN : w[p]
I assume, you are marking time in one wave TIME and wanting to set values in another wave DATA based on TIME steps being larger than a certain CUTOFF. Based on my understanding, I think this (untested) should work ...
When calculating means, NaN is ignored.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 23, 2008 at 02:45 pm - Permalink
Is there a way I can make your code into the values at the point, instead of the point itself, so then I subtract the two point's values and if they are >5 then it inserts a Nan point?
May 23, 2008 at 03:04 pm - Permalink
Unfortunately, I don't fully understand what you mean to test.
Perhaps you could provide a brief summary of the data you have, a (better) description of what you are trying to do with them, and a sample of code that you wrote and that should do what you want (but does not).
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 25, 2008 at 09:09 am - Permalink
I attached my actual IGOR experiment showing a graph that I have made and the data and procedure I use associated with it.
Goals:
-For each different level of SS I need to remove the first 120 seconds of data
-Remove the line that is created between the two different time intervals for each specific SS
-Remove the first 4 minutes of data from when the cycle starts over again and SS 0.2% (red) goes from very high values back down to its stable low values.
So I had been wanting to put NaN values between when the time intervals were different to get rid of the line that connects the data, and then wanted to figure out how to delete the next 120 points when it finds a larger than 1 second time interval, but any way to accomplish the above goals is what I am looking for.
May 27, 2008 at 05:20 pm - Permalink
Determine the point number that corresponds to 120 seconds. Then, redimension the wave to eliminate data from point 0 to this point. Or just set the data you want to eliminate in the wave to NaN.
Use symbols such as dots.
Determine the point value where this occurs. Set the data prior to this point to NaN or redimension the wave correspondingly.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 27, 2008 at 06:58 pm - Permalink
wave TimeSS02, CCNss02
Duplicate/R=[] Timess02, TimeSS02Cleaned
TimeSS02Cleaned = Timess02[p] - Timess02[p-500]
TimeSS02Cleaned = TimeSS02Cleaned == 500 ? TimeSS02Cleaned[p] : NaN
CCNss02 = TimeSS02Cleaned == 500 ? CCnss02[p] : NaN
End
and it seems to work pretty good.
May 28, 2008 at 12:12 pm - Permalink
Here are three questions to help you clean up your coding:
1) Why is the /R=[] portion included on the Duplicate command?
2) What happens at the line TimeSS05Cleaned = Timess05[p] - Timess05[p-250] when p = 0 (since Timess05 only exists from p=0 and above)?
3) How can you "fix" the above problem (hint: consider that Value[p] - Value[p-x] = Value[p+x] - Value[p])?
Also, while it may work as written, I believe the wave test is better to follow the format ...
Again, here are three questions to help you figure this out yourself:
1) What do you want pass to CleanUp(...), a variable value or a wave reference? Look at the differences of the two simple functions ...
variable xvalue
print xvalue
return 0
end
Function DoAWave(xwave)
wave xwave
xwave = xwave*2
return 0
end
2) What are you actually passing to CleanUp(...) in the way you have written it, a variable value or a wave reference?
3) Why do you pass something to CleanUp(...) that you then define specifically in the function ... ie, consider the difference between the two functions below ...
variable xvalue
xvalue = 3
print xvalue
return 0
end
Function OpenInput(xvalue)
variable xvalue
print xvalue
return 0
end
Put these as procedures and then type FixedInput(10) and OpenInput(10) on the command line to see the results.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 28, 2008 at 12:22 pm - Permalink
1) I used /R=[] because the Help Browser said "To include all of a given dimension, use /R=[]", I have only had Igor for 3 weeks now so I am doing my best trying to figure this stuff out and so I put in anything the help says if it seems to work
2) When I run the p - (p-250) line it just enters NaN for all the values until point 250, which is what I need it to do as well as put NaN for the gap times
3)I could probably do the code (p+x) - p, but when I was imagining how I wanted it to go over the points I wanted it to consider the point, and then the points before it not after it. Again, I am new to programming anything so I just did it how I thought of it and it seems to work great now
May 28, 2008 at 12:51 pm - Permalink
You're probably just misunderstanding the help on this issue (or possibly it's not very clear). You'd only need to include an empty set of brackets if you also wanted to included a subset of a higher dimension. For example, if you have a 2D wave and wanted to duplicate only a single column of the wave, but want to include all rows, you'd want to do something like this:
There's no need to use a set of empty brackets if you want to duplicate the entire wave. I don't believe it will cause any problems, however.
May 28, 2008 at 02:24 pm - Permalink
Consider this as an example of a shorter way to set the points 0 to 250 to NaN ...
dwave[0,250] = NaN
display dwave
The subsequent code line sets the gap markers to NaN.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
May 29, 2008 at 04:59 am - Permalink