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

Thouis (Ray) Jones thouis at broad.mit.edu
Mon May 4 17:11:11 EDT 2009


On Mon, May 4, 2009 at 16:43,  <josef.pktd at gmail.com> wrote:
> The use case, I wrote my application for, also allowed for labels that
> are strings. The return inverse of unique1d is very flexible since it
> can handle many different types including structured arrays, but for
> numeric labels, I just found out, that it is a large speed penalty. If
> the labels are already integers or can be easily converted to
> integers, then not using unique1d to create the integer labels should
> be much faster.

Using bincount probably requires calling unique1d (or some equivalent)
for this usage, since otherwise the call to bincount could create a
very large output (2^32 or even 2^64 bins).

Ray Jones



More information about the SciPy-Dev mailing list