[SciPy-user] where bug

Ryan Krauss ryanlists at gmail.com
Tue Oct 10 12:23:00 EDT 2006


Thanks to Travis and Johannes.  As long as I know its a feature, I
will adjust my code accordingly.

Ryan

On 10/10/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> Ryan Krauss wrote:
> > I am having a problem running some slightly older code under a fairly
> > new Scipy for the first time.  The code uses where and something like
> > this:
> > In [23]: t=arange(0,1,0.01)
> >
> > In [24]: where(t>0.5)
> > Out[24]:
> > (array([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
> >        68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
> >        85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]),)
> >
> > used to return just the array instead of the tuple with the array in
> > it.  Is this a feature or a bug?
> It's a feature (the old behavior was a bug...).  The functionality of
> where is actually from NumPy and has changed to be consistent with
> Numarray.    You can get the old behavior with flatnonzero(...) or of
> course where(...)[0].
>
> -Travis
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list