Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-13 Thread Matthew Brett
Ah, To answer my own question: Suggestion 1: Wrap the .sort method call in a tiny python wrapper of the form: def sort(self, axis=-1, kind='quicksort', order=None): if axis=None: _c_sort(self.ravel(), axis, kind, order) else: _c_sort(self, axis, kind, order) I guess

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-13 Thread Matthew Brett
Hi, Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? Should the sort method have its docstring changed to reflect the fact that axis=None is not valid? Sorry to press on, but it would be good to resolve this somehow. Is there some reason not to:

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-13 Thread Charles R Harris
On Feb 13, 2008 1:52 PM, Matthew Brett [EMAIL PROTECTED] wrote: Ah, To answer my own question: Suggestion 1: Wrap the .sort method call in a tiny python wrapper of the form: def sort(self, axis=-1, kind='quicksort', order=None): if axis=None: _c_sort(self.ravel(), axis,

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Matthew Brett [EMAIL PROTECTED] wrote: Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? It is, sometimes; just make an array object to point to the flattened version and sort that: In [16]: b = a[:] In [17]: b.shape = (16,) In [18]:

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Anne Archibald [EMAIL PROTECTED] wrote: An efficient way to handle in-place (or out-of-place, come to think of it) median along multiple axes is actually to take medians along all axes in succession. That saves you some sorting effort, and some programming effort, and doesn't

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Matthew Brett
Hi, To rephrase: Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? Should the sort method have its docstring changed to reflect the fact that axis=None is not valid? Matthew On Feb 10, 2008 7:50 PM, Matthew Brett [EMAIL PROTECTED] wrote: Hi, I just