Hi, from 1.0b1 to 1.0rc1 the default behaviour of take seems to have changed when omitting the axis argument:
In [13]: a = reshape(arange(12),(3,4))
In [14]: take(a,[2,3]) Out[14]: array([2, 3])
In [15]: take(a,[2,3],1) Out[15]: array([[ 2, 3], [ 6, 7], [10, 11]])
Is this intended?
Christian
Yep, check the release notes: http://www.scipy.org/ReleaseNotes/NumPy_1.0 search for 'take' on that page to find out what others have changed as well. bb
On 9/22/06, Christian Kristukat ckkart@hoc.net wrote:
Hi, from 1.0b1 to 1.0rc1 the default behaviour of take seems to have changed when omitting the axis argument:
In [13]: a = reshape(arange(12),(3,4))
In [14]: take(a,[2,3]) Out[14]: array([2, 3])
In [15]: take(a,[2,3],1) Out[15]: array([[ 2, 3], [ 6, 7], [10, 11]])
Is this intended?
Christian
Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys  and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=D... _______________________________________________ Numpydiscussion mailing list Numpydiscussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpydiscussion
Bill Baxter <wbaxter <at> gmail.com> writes:
Yep, check the release notes: http://www.scipy.org/ReleaseNotes/NumPy_1.0 search for 'take' on that page to find out what others have changed as well. bb
Ok. Does axis=None then mean, that take(a, ind) operates on the flattened array? This it at least what it seem to be. I noticed that the ufunc behaves differently. a.take(ind) and a.take(ind, axis=0) behave the same, so the default argument to axis is 0 rather than None.
Christian
Christian Kristukat wrote:
Bill Baxter <wbaxter <at> gmail.com> writes:
Yep, check the release notes: http://www.scipy.org/ReleaseNotes/NumPy_1.0 search for 'take' on that page to find out what others have changed as well. bb
Ok. Does axis=None then mean, that take(a, ind) operates on the flattened array? This it at least what it seem to be. I noticed that the ufunc behaves differently. a.take(ind) and a.take(ind, axis=0) behave the same, so the default argument to axis is 0 rather than None.
What do you mean. There is no "ufunc" take. There is a function take that just calls the method. The default arguments for all functions that match methods are the same as the methods (which means axis=None). However, in oldnumeric (which pylab imports by the way), the default axes are the same as they were in Numeric.
Also, if you have a 1d array, then the axis argument doesn't make any difference. Please clarify what you are saying to be sure we don't have a bug floating around.
Travis
Travis Oliphant <oliphant.travis <at> ieee.org> writes:
Christian Kristukat wrote:
Bill Baxter <wbaxter <at> gmail.com> writes:
Yep, check the release notes: http://www.scipy.org/ReleaseNotes/NumPy_1.0 search for 'take' on that page to find out what others have changed as well. bb
Ok. Does axis=None then mean, that take(a, ind) operates on the flattened array? This it at least what it seem to be. I noticed that the ufunc behaves differently. a.take(ind) and a.take(ind, axis=0) behave the same, so the default argument to axis is 0 rather than None.
What do you mean. There is no "ufunc" take. There is a function take that just calls the method. The default arguments for all functions
Sorry, I never really read about what are ufuncs. I thought those are class methods of the ndarray objects... Anyway, I was refering to the following difference:
In [7]: a Out[7]: array([[ 0, 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10, 11]])
In [8]: a.take([0]) Out[8]: array([[0, 1, 2, 3, 4, 5]])
In [9]: take(a,[0]) Out[9]: array([0])
To be sure I understood: Does axis=None then mean, that take operates on the flattened array?
Christian
Christian Kristukat wrote:
Ok. Does axis=None then mean, that take(a, ind) operates on the flattened array?
Yes, that is correct.
Sorry, I never really read about what are ufuncs. I thought those are class methods of the ndarray objects... Anyway, I was refering to the following difference:
In [7]: a Out[7]: array([[ 0, 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10, 11]])
In [8]: a.take([0]) Out[8]: array([[0, 1, 2, 3, 4, 5]])
In [9]: take(a,[0]) Out[9]: array([0])
Doh!. That is a bug. take(a,[0]) is correct a.take([0]) is not correct.
Travis
participants (3)

Bill Baxter

Christian Kristukat

Travis Oliphant