[SciPy-dev] Should ndimage.measurements.* should return lists if index is a list?

Thouis (Ray) Jones thouis at broad.mit.edu
Fri May 1 16:37:42 EDT 2009


On Fri, May 1, 2009 at 16:11,  <josef.pktd at gmail.com> wrote:
> After a recent comment by Anne, I looked at the weights option in np.bincount.
> It is as fast to calculate group/label means with np.bincount as with
> the current ndimage and it scales the same, but it works only for all
> indices and not for min, max.
> weights can be calculated for any element wise function.
> group labels can be anything that np.unique1d can handle, string
> labels take twice as long

I think you can get min/max by sorting by (label, value) and then
using diff on the sorted labels to find the indices where a label
changes.

Ray Jones



More information about the SciPy-Dev mailing list