BIDS / datarray

Prototyping numpy arrays with named axes for data management.
http://bids.github.com/datarray
Other
87 stars 20 forks source link

np.outer() doesn't preserve axis names #45

Closed terhorst closed 13 years ago

terhorst commented 13 years ago

Calling np.outer() on two DataArray vectors drops the axis names:

>>> A = DataArray([1,2,3], 'a'); B = DataArray([2,3,4], 'b')
>>> np.outer(A,B)
array([[ 2,  3,  4],
       [ 4,  6,  8],
       [ 6,  9, 12]])
terhorst commented 13 years ago

Upon further consideration, since np.outer isn't a ufunc I'm not sure how we would override the behavior. The only case where it makes sense to preserve the axis names is when taking the outer product of two vectors. This could maybe be moved out to a utility library; I don't think it belongs in the core DataArray code.