[SciPy-dev] Should ndimage.measurements.* should return lists if index is a list?
Thouis (Ray) Jones
Sat Apr 18 15:47:50 CDT 2009
Here's a first attempt at a patch. It fixes the corner case of a
single index to match the index type (scalar for scalar, list for
single element sequence), also the case of index= to return  for
any measurement. Finally, it improves type checking of the index
type, which was only being checked for sum() and not any of the other
Zach, would you mind reviewing? If it looks good, I'll add some tests
for the new functionality and submit a patch via trac.
On Fri, Apr 17, 2009 at 22:06, Zachary Pincus <firstname.lastname@example.org> wrote:
>> Current behavior:
>>>>> from scipy import ndimage
>>>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=[1,2])
>> [1.0, 4.0]
>>>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=)
>>>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=1)
>> I think the second result should be [1.0]. We're using the ndimage
>> code for image processing, and have to wrap the measurement functions
>> to make the code general for the case where there is only one object
>> in the image.
> I've run into this too, and had the same thought. It's such a corner-
> case that it doesn't seem like gratuitous API-breakage to make this
> Scipy-dev mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 12119 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-dev/attachments/20090418/d669b7fd/attachment.obj
More information about the Scipy-dev