[SciPy-User] moving window (2D) correlation coefficient

Stéfan van der Walt stefan at sun.ac.za
Thu Feb 11 01:35:55 EST 2010


On 10 February 2010 22:02, Zachary Pincus <zachary.pincus at yale.edu> wrote:
>> Well, speed is more important than readability this time :-) It's
>> terabytes of data I'll need to push through this function...
>
> OK, then cython is likely preferable here.

I'd say the Cython version is bound to be more readable than any
vectorised form one could contrive.  As an example of how to calculate
correlation coefficients in Cython using Summed Area Tables, have a
look at

http://dip.sun.ac.za/~stefan/code/supreme.git/?p=stefan/supreme.git;a=blob;f=supreme/register/ncorr.pyx;hb=HEAD#l21

(sorry for the horrible URL)

Further down, the function "ncc" declares normalised cross-correlation.

Regards
Stéfan



More information about the SciPy-User mailing list