Wave scaling & timeseries: Calculations on two waves of different scales

I'm new to Igor, and quite like the idea of X scaling. But I'm on the verge of giving up on it. Can anyone tell me if I'm missing a crucial feature or if Igor simply can't do this?:

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])


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?
jcor wrote:
I'm new to Igor ... Abandon and interpolate?


Well, hopefully you mean abandon the idea of only considering every 70 s point, not abandon Igor Pro :-)

// create new wave

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
Try this:

Make/O/N=700 wave700; SetScale x 0, 2*PI, wave700; wave700 = sin(x)
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.
I should have added that you can read more about this by executing:

DisplayHelpTopic "Waveform Arithmetic and Assignment"
Thanks for the responses.

In my understanding, the following should then work:

make/N=20 w1 = p * 5
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 ;)
jcor wrote:
Thanks for the responses.

In my understanding, the following should then work:

make/N=20 w1 = p * 5
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 ;)


By doing this:
Display w1 vs w2

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