[Numpy-tickets] [NumPy] #271: Bug in ma.repeat

NumPy numpy-tickets at scipy.net
Mon Sep 4 17:30:09 CDT 2006


#271: Bug in ma.repeat
--------------------+-------------------------------------------------------
 Reporter:  PGM     |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  Other   |     Version:          
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 Folks,
 The `repeat` function in MA doesn't work with the default `axis=None`.
 (indeed, shape(af)[None] doesn't work). Cf code below:
 (version 1.0b4)

 #...........................................................

 >>> MA.array([1],mask=False).repeat(10,0)

 array([1 1 1 1 1 1 1 1 1 1])

 >>> MA.array([1],mask=False).repeat(10)

 ---------------------------------------------------------------------------
 /usr/lib64/python2.4/site-packages/numpy/core/ma.py in repeat(a, repeats,
 axis)
    1544     af = filled(a)
    1545     if isinstance(repeats, types.IntType):
 -> 1546         repeats = tuple([repeats]*(shape(af)[axis]))
    1547
    1548     m = getmask(a)

 TypeError: tuple indices must be integers
 > /usr/lib64/python2.4/site-packages/numpy/core/ma.py(1546)repeat()
    1545     if isinstance(repeats, types.IntType):
 -> 1546         repeats = tuple([repeats]*(shape(af)[axis]))
    1547

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/271>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list