Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-28 Thread Martin Ling
On Wed, Jul 27, 2011 at 10:29:08PM -0500, Robert Love wrote: To use quaternions I find I often need conversion to/from matrices and to/from Euler angles. Will you add that functionality? Yes, I intend to. Note that these conversions are already available in the standalone (non-dtype)

[Numpy-discussion] Issues with adding new dtypes - customizing ndarray attributes

2011-07-28 Thread Martin Ling
Hi, I'd like to kick off some discussion on general issues I've encountered while developing the quaternion dtype (see other thread, and the code at: https://github.com/martinling/numpy_quaternion) The basic issue is that the attributes of ndarray cannot be adapted to the dtype of a given array.

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-28 Thread Hans Meine
Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray): pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) == type(a2.min()), \ %s != %s % (type(a1.min()), type(a2.min())) #

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-28 Thread Matthew Brett
Hi, On Thu, Jul 28, 2011 at 7:58 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray):     pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) ==

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Ralf Gommers
On Thu, Jul 28, 2011 at 1:29 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Wed, Jul 27, 2011 at 05:25:20PM -0600, Charles R Harris wrote: Well, doc tests are just a losing proposition, no one should be using them for writing tests. It's not like this is a new discovery,

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Matthew Brett
Hi, On Thu, Jul 28, 2011 at 10:13 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Thu, Jul 28, 2011 at 1:29 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Wed, Jul 27, 2011 at 05:25:20PM -0600, Charles R Harris wrote:    Well, doc tests are just a losing proposition, no

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Nathaniel Smith
I have a different question about this than the rest of the thread. I'm confused at why there isn't a programmatic way to create a datetime dtype, other than by going through this special string-based mini-language. I guess I generally think of string-based dtype descriptors as being a legacy

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Stéfan van der Walt
On Thu, Jul 28, 2011 at 10:19 AM, Matthew Brett matthew.br...@gmail.com wrote: I don't think anyone suggested that doctests should replace unit tests; it's a bit difficult to see why that discussion started. The conversation started because array([True], dtype=bool) changed to array([True],

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Matthew Brett
Hi, 2011/7/28 Stéfan van der Walt ste...@sun.ac.za: On Thu, Jul 28, 2011 at 10:19 AM, Matthew Brett matthew.br...@gmail.com wrote: I don't think anyone suggested that doctests should replace unit tests; it's a bit difficult to see why that discussion started. The conversation started

[Numpy-discussion] ticket 1793

2011-07-28 Thread Paul Anton Letnes
Hi! In my quest for a bug-free numpy I have, I think, fixed ticket 1793. https://github.com/numpy/numpy/pull/123 Enjoy - feedback welcome, of course. Cheers, Paul. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

[Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Jeremy Conlin
I have a need to index my array(s) starting with a 1 instead of a 0. The reason for this is to be consistent with the documentation of a format I'm accessing. I know I can just '-1' from what the documentation says, but that can get cumbersome. Is there a magic flag I can pass to a numpy array

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Stéfan van der Walt
On Thu, Jul 28, 2011 at 1:48 PM, Matthew Brett matthew.br...@gmail.com wrote: The thread was first about how to deal with the change, and second I'm still curious to know of a technical solution with doctests. Ideally, one would like to specify a set of rules that a line must pass to know

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Stéfan van der Walt
Hi Jeremy On Thu, Jul 28, 2011 at 3:19 PM, Jeremy Conlin jlcon...@gmail.com wrote: I have a need to index my array(s) starting with a 1 instead of a 0. The reason for this is to be consistent with the documentation of a format I'm accessing. I know I can just '-1' from what the documentation

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Anne Archibald
Don't forget the everything-looks-like-a-nail approach: make all your arrays one bigger than you need and ignore element zero. Anne On 7/28/11, Stéfan van der Walt ste...@sun.ac.za wrote: Hi Jeremy On Thu, Jul 28, 2011 at 3:19 PM, Jeremy Conlin jlcon...@gmail.com wrote: I have a need to

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Stéfan van der Walt
On Thu, Jul 28, 2011 at 4:10 PM, Anne Archibald aarch...@physics.mcgill.ca wrote: Don't forget the everything-looks-like-a-nail approach: make all your arrays one bigger than you need and ignore element zero. Hehe, why didn't I think of that :) I guess the kind of problem I struggle with more

Re: [Numpy-discussion] dtype repr change?

2011-07-28 Thread Matthew Brett
Hi, 2011/7/28 Stéfan van der Walt ste...@sun.ac.za: On Thu, Jul 28, 2011 at 1:48 PM, Matthew Brett matthew.br...@gmail.com wrote: The thread was first about how to deal with the change, and second I'm still curious to know of a technical solution with doctests. Ideally, one would like to

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Derek Homeier
On 29.07.2011, at 1:19AM, Stéfan van der Walt wrote: On Thu, Jul 28, 2011 at 4:10 PM, Anne Archibald aarch...@physics.mcgill.ca wrote: Don't forget the everything-looks-like-a-nail approach: make all your arrays one bigger than you need and ignore element zero. Hehe, why didn't I think of

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Stéfan van der Walt
On Thu, Jul 28, 2011 at 4:26 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: I guess the kind of problem I struggle with more frequently is books written with summations over -m to +n.  In those cases, it's often convenient to use the mapping function, so that I can enter the

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Anne Archibald
The can is open and the worms are everywhere, so: The big problem with one-based indexing for numpy is interpretation. In python indexing, -1 is the last element of the array, and ranges have a specific meaning. In a hypothetical one-based indexing scheme, would the last element be element 0? if

Re: [Numpy-discussion] Can I index array starting with 1?

2011-07-28 Thread Derek Homeier
On 29.07.2011, at 1:38AM, Anne Archibald wrote: The can is open and the worms are everywhere, so: The big problem with one-based indexing for numpy is interpretation. In python indexing, -1 is the last element of the array, and ranges have a specific meaning. In a hypothetical one-based

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-28 Thread Robert Love
On Jul 28, 2011, at 7:42 AM, Martin Ling wrote: On Wed, Jul 27, 2011 at 10:29:08PM -0500, Robert Love wrote: To use quaternions I find I often need conversion to/from matrices and to/from Euler angles. Will you add that functionality? Yes, I intend to. Note that these conversions are

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-28 Thread Robert Kern
On Thu, Jul 28, 2011 at 21:48, Robert Love rblove_li...@comcast.net wrote: On Jul 28, 2011, at 7:42 AM, Martin Ling wrote: On Wed, Jul 27, 2011 at 10:29:08PM -0500, Robert Love wrote: To use quaternions I find I often need conversion to/from matrices and to/from Euler angles.  Will you add

Re: [Numpy-discussion] ticket 1793

2011-07-28 Thread Robert Kern
2011/7/28 Stéfan van der Walt ste...@sun.ac.za: On Thu, Jul 28, 2011 at 2:05 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: In my quest for a bug-free numpy I have, I think, fixed ticket 1793. https://github.com/numpy/numpy/pull/123 This brings up an interesting question.  When

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-28 Thread Charles R Harris
On Thu, Jul 28, 2011 at 8:48 PM, Robert Love rblove_li...@comcast.netwrote: On Jul 28, 2011, at 7:42 AM, Martin Ling wrote: On Wed, Jul 27, 2011 at 10:29:08PM -0500, Robert Love wrote: To use quaternions I find I often need conversion to/from matrices and to/from Euler angles. Will

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-28 Thread Charles R Harris
On Thu, Jul 28, 2011 at 8:48 PM, Robert Love rblove_li...@comcast.netwrote: On Jul 28, 2011, at 7:42 AM, Martin Ling wrote: On Wed, Jul 27, 2011 at 10:29:08PM -0500, Robert Love wrote: To use quaternions I find I often need conversion to/from matrices and to/from Euler angles. Will