
unknown/inappropriate name or symbol

BLawrie
wavesize=numpnts(conjugate)/2
Make/N=(wavesize) conj2, probe2
for(i=0;i<=wavesize;i=i+1)
conj2[x2pnt(conj2,i)]=(conjugate[x2pnt(conjugate,2*i)]+conjugate[x2pnt(conjugate,2*i+1)])/2
probe2[x2pnt(probe2,i)]=(probe[x2pnt(probe,2*i)]+probe[x2pnt(probe,2*i+1)])/2
endfor
However, Igor complains that all occurrences of conjugate and probe within the for loop represent an "unknown/inappropriate name or symbol." Any suggestions would be greatly appreciated.
This is a "wave assignment statement" and is much faster than a loop. To read about it, execute:
Now to your original question. If you were trying to do this in a user-defined function, the problem is that you need to tell Igor what conjugate and probe are (waves?, numeric variables?, string variables?, operations?) using "wave references". Here is an example:
For help on wave references:
The Test1 function is of limited use because it is hard-coded to use waves named conjugate and probe and can not be used for any other waves. This can be fixed by making the input waves parameters to the function so that any pair of waves can be passed in.
For an explanation of the $ symbol:
Now we improve this by using wave assignment statements instead of a loop:
June 23, 2012 at 04:20 am - Permalink
I would question your assumption that the most appropriate way of compressing the data is to average pairs of points. This might be appropriate if the 2-point intervals were themselves separated. However if the original data is evenly sampled, you might consider a simple alternative wherein each point is replaced by a weighted sum of itself and two adjacent neighbors. This is exactly what the Smooth operation, with 'num' equal 1 does: the weighting coefficients are 1/4, 1/2, 1/4. Then, in the smoothed wave take every other point to get the smaller wave with half the number of points. For example
You could also create 'conj2big' as a /FREE wave in your procedure, or kill it when done.
June 26, 2012 at 11:37 am - Permalink
To perform the comparison I used a wave of white Gaussian noise. This has more or less uniform frequency content over its entire spectral range. Two smaller waves, with half the points, were calculated from the large wave using the two methods described previously, and scaled to the same range as the initial wave (but with 2x the sample interval). Then the (complex) FFTs were compared to the original wave's FFT over the low-frequency half of its domain. (The higher frequency content is not relevant to the down-sampled waves.) For each down-sampled wave the comparison metric was the sum over frequencies of the absolute squares of the complex difference between the down-sampled and original FFTs. The tests were repeated over a large number of trials, and the results were averaged.
The final, averaged spectral deviation for the 3-pt method was 0.68 that of the pair-averaged method. This eased one of my concerns that 3-pt averaging might potentially cause excess filtering, with resultant 'x' domain distortion. This seems not to be the case. I do not claim this method will always be the best to down-sample any waveform, but suggest it is worth considering.
June 28, 2012 at 07:15 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 28, 2012 at 08:58 am - Permalink
pair : 1.00 ; 3-pt smooth : 0.685 ; Resample : 0.653
The winner is.......RESAMPLE !! (but not by much)
In the original 'x' domain, the 3-pt and Resample waves were quite close to each other, and distinct from the pair-sampled waves.
Thanks for the suggestion, John.
June 28, 2012 at 10:58 am - Permalink