[Nipy-devel] The use of np.asarray
Per B. Sederberg
Wed Jul 8 21:14:51 CDT 2009
At Thu, 9 Jul 2009 02:43:36 +0200,
Gael Varoquaux wrote:
> [1 <text/plain; utf-8 (8bit)>]
> On Wed, Jul 08, 2009 at 05:41:51PM -0700, Jonathan Taylor wrote:
> > Aha, I didn't get that the first time. So, does np.asanyarray preserve
> > masked arrays?
> Yes, it preserves any subclasses of array. So if we get to implementing
> named-axis arrays (Fernando is quite enthousiastic about that), they are
> also preserved.
I thought I'd chime in here, first in support of changing np.asarray
to np.asanyarray, but mainly to mention that a colleague and I have
recently finished a first-round pass at an nd-array subclass with
named-axes. We call it DimArray and it's seemingly working quite well
as the foundation for a timeseries module we've been working on (aimed
at EEG, MEG, etc..., so perhaps we could join in the nipy EEG work).
DimArray has a handful of extra functionality that you might find
quite useful, like fancy indexing based on dimension names and that
you can call any ndarray method of DimArray using dimension names
instead of numerical axis.
In any case, we'd love feedback and for people to try it out. You can
find the git repository here:
Look for the dimarray sub-directory for the DimArray class, it's
parent class AttrArray, and docs where we started illustrating how to
use it. The rest of the ptsa (python time-series analysis) code is in
the middle of a massive refactoring now that we have a working
DimArray class, so you probably won't find too much of use there, yet.
If anyone thinks DimArray will be helpful, are there any suggestions
for how we should release the code? Would it make sense as a SciKit?
Thanks and keep up the good work with nipy.
> [2 <text/plain; us-ascii (7bit)>]
> Nipy-devel mailing list
More information about the Nipy-devel