Averaging 2D waves
mas1126
Hello,
I'm trying to calculate the average and std errors of some 2D waves. Typically, I use the Average Waves package (which handles NaNs correctly and calculates the error). This seems to only work for 1D waves though.
Any advice? Btw, I'm still using Igor 6...
Thanks!
There are many possibilities but you can start with WaveStats or ImageStats.
September 28, 2020 at 02:30 pm - Permalink
You might be able to unfold your 2D waves, use Average Waves on the 1D version, and then re-fold them. If you have a, say, 150x200 point 2D wave, you can use Redimension/N=(150*200) 2DWave. Igor will simply change the dimensions and not move any data. Then to go back, Redimension/N=(150, 200) 2DWave.
A bit inconvenient, but I think it will work. The output waves containing the average and error will need to be folded in the same way.
September 28, 2020 at 05:01 pm - Permalink
The mention of the average waves package makes me think you want to average the rows or columns of a 2D wave.
MatrixOP is the answer to most things involving 2D waves, and to deal with NaNs take a look at the this thread.
for averaging columns, you would use
MatrixOP avg = sumcols(replaceNaNs(w,0)) / sumcols(equal(numType(w),0))
where w is the 2D wave
September 29, 2020 at 12:36 am - Permalink
And MatrixOP has varCols, too, so you can compute the standard error of the mean, with a bit of work on a MatrixOP expression.
September 29, 2020 at 09:56 am - Permalink
I like MatrixOP too but you will not get very far with it in IP6.
September 29, 2020 at 04:30 pm - Permalink