[Scipy-tickets] [SciPy] #1565: bug in ndimage.variance

SciPy Trac scipy-tickets@scipy....
Mon Nov 21 21:07:00 CST 2011


#1565: bug in ndimage.variance
-----------------------------------+----------------------------------------
 Reporter:  kazboris021            |       Owner:  somebody   
     Type:  defect                 |      Status:  new        
 Priority:  normal                 |   Milestone:  Unscheduled
Component:  scipy.ndimage          |     Version:  0.9.0      
 Keywords:  scipy, numpy, ndimage  |  
-----------------------------------+----------------------------------------
Description changed by warren.weckesser:

Old description:

> running this code:
>
> from numpy import mgrid
> from scipy import ndimage
>
> x,y = mgrid[:10,:20]
> ndimage.variance(x, x > 5, [0,1])
>
> produces traceback:
>
> Traceback (most recent call last):
>   File "test.py", line 7, in <module>
>     ndimage.variance(x, x > 5, [0,1])
>   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
> line 596, in variance
>     count, sum, sum_c_sq = _stats(input, labels, index, centered=True)
>   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
> line 423, in _stats
>     sums_c = _sum_centered(new_labels)
>   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
> line 408, in _sum_centered
>     centered_input = input - means[labels]
> ValueError: shape mismatch: objects cannot be broadcast to a single shape
>
> I'm running on ubuntu 11.10 x64
> numpy: 1.5.1
> scipy: 0.9.0

New description:

 running this code:
 {{{
 from numpy import mgrid
 from scipy import ndimage

 x,y = mgrid[:10,:20]
 ndimage.variance(x, x > 5, [0,1])
 }}}
 produces traceback:
 {{{
 Traceback (most recent call last):
   File "test.py", line 7, in <module>
     ndimage.variance(x, x > 5, [0,1])
   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
 line 596, in variance
     count, sum, sum_c_sq = _stats(input, labels, index, centered=True)
   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
 line 423, in _stats
     sums_c = _sum_centered(new_labels)
   File "/usr/lib/python2.7/dist-packages/scipy/ndimage/measurements.py",
 line 408, in _sum_centered
     centered_input = input - means[labels]
 ValueError: shape mismatch: objects cannot be broadcast to a single shape
 }}}
 I'm running on ubuntu 11.10 x64
 numpy: 1.5.1
 scipy: 0.9.0

--

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1565#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list