[SciPy-Dev] sum_angle() and sum_polar() functions

Robert Jördens jordens at gmail.com
Mon May 21 04:06:29 EDT 2012


On Mon, May 21, 2012 at 1:16 AM, Ralf Gommers
<ralf.gommers at googlemail.com> wrote:
> Could you time the scikits-image version, it's not obvious from reading the
> code that it will be very slow?

In [47]: from scipy.misc.pilutil import radon as scipy_radon
In [50]: from skimage.transform import radon as scikits_radon

In [46]: a=np.random.randn(1000, 1000)

In [53]: angle_sum(a, .1).shape
Out[53]: (1100,)

In [54]: scikits_radon(a, [.1]).shape
Out[54]: (1415, 1)

In [55]: scipy_radon(a, [.1]).shape
Out[55]: (1000, 1)

In [56]: %timeit angle_sum(a, .1)
10 loops, best of 3: 24.7 ms per loop

In [57]: %timeit scikits_radon(a, [.1])
10 loops, best of 3: 136 ms per loop

In [58]: %timeit scipy_radon(a, [.1])
10 loops, best of 3: 47.6 ms per loop

In [59]: a.sum()
Out[59]: -682.83728184031156

In [60]: angle_sum(a, .1).sum()
Out[60]: -682.83728184032327

In [61]: scikits_radon(a, [.1]).sum()
Out[61]: -682.83727334014043

In [62]: scipy_radon(a, [.1]).sum()
Out[62]: 124316062.0

> My impression is that it would fit best in scikits-image. Perhaps ndimage
> would be a reasonable place too. It's too specialized for numpy imho.

angle_sum() at least can be applied beyond image processing in the
analysis of coupling matrices or adjacency graphs. Both functions are
simple and generic.

-- 
Robert Jordens.



More information about the SciPy-Dev mailing list