[Numpy-discussion] subclassing ndarray and keeping same ufunc behavior

2016-11-15 Thread Stuart Reynolds
I'm trying to subclass an ndarray so that I can add some additional fields. When I do this however, I get new odd behavior when my object is passed to a variety of numpy functions. For example nanmin returns now return an object of the type of my new array class, whereas previously I'd get a float6

Re: [Numpy-discussion] subclassing ndarray and keeping same ufunc behavior

2016-11-15 Thread Stuart Reynolds
Doh! Thanks for that. On Tue, Nov 15, 2016 at 10:48 AM, Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote: > Hi Stuart, > > It certainly seems correct behaviour to return the subclass you > created: after all, you might want to keep the information on > `columns` (e.g., consider doing nanmin

[Numpy-discussion] Possible to pickle new state in NDArray subclasses?

2016-12-14 Thread Stuart Reynolds
I'm trying to subclass an NDArray as shown here: https://docs.scipy.org/doc/numpy/user/basics.subclassing.html My problem is that when I save the new class' state with pickle, the new attributes are lost. I don't seem to be able to override __getstate__ or __setstate__ to achieve this? Is it p

Re: [Numpy-discussion] composing Euler rotation matrices

2017-02-01 Thread Stuart Reynolds
[off topic] Nothing good ever comes from using Euler matrices. All the cool kids a using quaternions these days. They're (in some ways) simpler, can be interpolated easily, don't suffer from gimbal lock (discontinuity), and are not confused about which axis rotation is applied first (for Euler you