From: Marten van Kerkwijk m.h.vankerkwijk@gmail.com
Though based on my experience with Quantity, I'd also argue that the more annoying problems are not so much with `ndarray` itself, but rather with the helper functions.
Just to give an alternative view - as another astronomer I would say that concerns about the use of subclassing in Astropy is one of the reasons I rarely use it.
To take an example, if I’m relying on the Quantity class to keep track of my units, then if I have an (N,3) array-like of positions in parsecs, that’s just one step away from going through the sausage-machine of scipy.spatial.cKDTree.query (to find distances to neighbours) and my units are toast.
That probably sounds stronger than I meant - keeping track of units systematically is neither easy nor unimportant and I have enormous respect for the developers of Astropy and the community they have built around it.
Peter Creasey
Hi Peter,
In the context of the discussion here, the fact that Quantity is a subclass and not a duck-type array makes no difference for scipy code - in either case, the code would eat the unit (if it would work at all). My only argument was that sub-classing is not particularly worse than trying to make a duck-type. In the end, it would seem to me for anything reasonably interesting, the code sadly becomes rather complex.
Anyway, for me, Quantity is mostly a way to avoid stupid mistakes with units - it has certainly helped save me lots of headaches already.
All the best,
Marten