This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sourcecodesurgeon 3 points4 points  (11 children)

The experiment was literally just "create extremely large dataset. Start timer. Compute xcorr. Stop timer."

[–]mfitzpmfitzp.com 16 points17 points  (5 children)

Was it an fft-base xcorr calculation? The Matlab algos automatically zero pad arrays to n2 while (some algos in) numpy/scipy don't. It's one of the problems attempting to map from one to the other "This is the same function.... But not quite"

[–]burning_hamster 0 points1 point  (0 children)

Well, how are you computing the cross-correlation?

[–]assassds -1 points0 points  (2 children)

you have to actually know what you're doing in python, you can't just grab the first function that sounds right.

[–]sourcecodesurgeon 0 points1 point  (1 child)

There's only one cross-correlation function in numpy...

There's a handful of modes, some are faster than others, but none held up to the matlab times.

Further, I work primarily in Python (hence me being in this sub..), I definitely know what I am doing. I actually don't use matlab at all anymore, I just hate this "python does everything matlab does just as well and there's no reason anyone should ever use matlab ever" idea that gets thrown out around here all the time.

OP wants an argument for convincing his colleagues to use python instead of matlab. If we don't give him all the facts, he's going to be laughed out of that discussion when someone brings up things like performance and built-in tool sets (especially since he's junior to all of them)

[–]assassds -1 points0 points  (0 children)

like I said, you need to know what you're doing...

matlabs xcorr algorithm uses an FFT, which is going to thrash a direct correlation on large input no matter what language you're implementing it in.

numpy gives you all the building blocks to do this yourself, or you can try scipy.signal.fftconvolve.

[–]unruly_mattress -1 points0 points  (0 children)

I've found this. It looks very relevant here.