Wave scaling & timeseries: Calculations on two waves of different scales
jcor
I have two instruments, one reporting in 7s intervals, the other reporting in 10s intervals.
I want take the ratio of the two signals.
I want to graph the result point-by-point.
In the past (Python/SciPy) I've achieved this by interpolating each signal to 1s, performing my calculations, then graphing every seventh point of the result. (By passing a list of 7-spaced integers as an "index".)
Is there a nice way to use the Scaling feature of igor to avoid this interpolation? I've gotten halfway with
// [...] load 7s data as w7, load 10s data as w10 [...]
Make/N=(numpnts(w7)) new_wave = w7[p] / w10(w7[p])
Make/N=(numpnts(w7)) new_wave = w7[p] / w10(w7[p])
Which I think is a great way to be able to do it, but unfortunately, it's terrible for graphically comparing new_wave and w10 (which I do something else to later). Abandon and interpolate?
Well, hopefully you mean abandon the idea of only considering every 70 s point, not abandon Igor Pro :-)
variable endtime = min(numpnts(w10)*10,numpnts(w7)*7)
variable npnts = floor(endtime/70) + 1
make/n=(npts) new_wave
SetScale/P x 0,70,"s", new_wave
// do math at every 70 s interval
new_wave = w7[10*p]/w10[7*p]
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
November 16, 2009 at 01:57 pm - Permalink
Make/O/N=1000 wave1000; SetScale x 0, 2*PI, wave1000; wave1000 = sin(x)
Display wave700, wave1000
ModifyGraph rgb(wave1000)=(0,0,65535),offset(wave1000)={0,0.1}
Duplicate/O wave1000, waveRatio
waveRatio = wave1000(x) / wave700(x)
Display waveRatio
The spikes are where the denominator is close to zero.
The command:
waveRatio = wave1000(x) / wave700(x)
calculates 1000 ratios, one for each point in the destination wave. During each calculation, the function x returns the value of the point in the destination being evaluated. The use of (x) syntax makes Igor interpolate in the source waves.
The range of x is determined by the X scaling of the destination wave.
November 16, 2009 at 04:16 pm - Permalink
DisplayHelpTopic "Waveform Arithmetic and Assignment"
November 16, 2009 at 04:18 pm - Permalink
In my understanding, the following should then work:
Make/N = 10 w2 = p
SetScale x,5,15, w2
//doesn't work:
Display w1 vs w2
This doesn't work because the resulting x axis starts at 0, when it should start at 5.
It does, however, only plot 10 points (since w2 has 10), which is nice. Am I missing a detail, or must the axis be set manually?
(up to this point, Igor does a good job simplifying my data analysis - so no, I'm not about to abandon it ;)
November 19, 2009 at 06:38 am - Permalink
By doing this:
You are telling Igor to plot values from w1 using corresponding values from w2 as the X values. You are telling Igor to ignore the X scaling on w1 when making the graph.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 19, 2009 at 01:04 pm - Permalink
November 20, 2009 at 02:38 pm - Permalink