[Numpy-discussion] missing function in numpy.ma?

Eric Firing efiring at hawaii.edu
Thu Apr 3 15:47:41 EDT 2008


Charles Doutriaux wrote:
> Travis, Pierre,
> 
> Goood news what's in trunk right now seems to work great with our stuff, 
> I only had to replace numpy.core.ma.take with numpy.ma.take 
> (numpy.oldnumeric.ma.take didn't seem to work)

I don't know if it fixes the problem you ran into, but there is a clear 
bug fixed by the following:

efiring at manini:~/programs/py/numpy_svn/trunk/numpy/oldnumeric$ svn diff
Index: ma.py
===================================================================
--- ma.py       (revision 4958)
+++ ma.py       (working copy)
@@ -2264,6 +2264,6 @@
      return new_average(a, axis, weights, returned)

  def take(a, indices, axis=0):
-    return new_take(a, indices, axis=0)
+    return new_take(a, indices, axis)

Eric


> 
> So as soon as 1.0.5 is out, I'll start working toward using numpy.ma only.
> 
> Also, I have one little request, i remember you said oldnumeric would be 
> gone in the next version. But our users will have hundreds (thousands?)  
> of script convert with "import numpy.oldnumeric.ma as MA" or "import 
> numpy.oldnumeric as Numeric"
> And although we're insisting and using numpy and numpy.ma right away, 
> i'm sure 99% of them will ignore this. So would be be horrible to leave 
> as shortcut (with a warning while loading probably, actually we could 
> have the warning already in numpy 1.0.5 ?) from numpy.oldnumeric back to 
> numpy ? same for oldnumeric.ma pointing back to numpy.ma. I realize it's 
> not really clean... At least it would be great to have the warning 
> raised in 1.0.5 that it will disappear in 1.1. Like that users might be 
> more inclined to start converting "cleaninly"
> 
> Thanks for considering this and also thanks a LOT for all your help on 
> this issue!
> 
> C.
> 
> 
> Travis E. Oliphant wrote:
>> Charles Doutriaux wrote:
>>   
>>> Hi Travis,
>>> Ok we're almost there, in my test suite i get:
>>>     maresult = numpy.core.ma.take(ta, indices, axis=axis)
>>> AttributeError: 'module' object has no attribute 'ma'
>>>     data = numpy.core.ma.take(ax[:], indices)
>>> AttributeError: 'module' object has no attribute 'ma'
>>>   
>>>     
>> I think the problem here is that numpy.core.ma is no longer the correct 
>> place.    This should be
>>
>> numpy.oldnumeric.ma.take  because numpy.oldnumeric.ma is the correct 
>> location.
>>
>> In my mind you shouldn't really have been using "numpy.core.ma", but 
>> instead numpy.ma because whether things are in core or lib could change 
>> ;-) 
>>
>> -Travis
>>
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion at scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>
>>   
> 
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list