Align datasets
bkuchhal
Hi! I have 2 datasets--wave0 and wave1--which are identical to each other as can be seen below. But they are drifted away from each other. I want to align them together on top of each other. I correlated these datasets and was able to figure out the delay. But since both of them have 2 million points, correlation tends to work slow. Moreover, I have thousands of such drifted datasets thereby making the process much slower. Is there a quicker way of figuring out the delay? Thank you!
In general, correlation would be calculated using the FFT. The performance of the FFT depends on the exact number of points in the wave. If the number of points in your wave is N, you can execute
PrimeFactors N
The result is printed in the history (and in W_PrimeFactors). The performance of the FFT calculation depends on the largest prime in the list. You could pad your input wave or truncate it so that N does not contain large prime factors. For best performance N should be a power of 2.
May 9, 2024 at 08:32 am - Permalink
If the location of the offset is consistent, one thing you could do is to extract the range of interest that is likely to be different before doing the correlation.
Duplicate/R=(startTime, endTime) data2, data2_extract
Correlate data1_extract, data2_extract
Duplicate/R is very fast. A correlation of the full size waves runs in 1.5s for me (slow), while extracting 50 ms region + correlating runs in 0.09s.
May 9, 2024 at 08:43 am - Permalink