[NumPy-Tickets] [NumPy] #1873: Recarrays do not work with numpy.lib.stride_tricks.as_strided

NumPy Trac numpy-tickets@scipy....
Mon Jun 20 19:04:56 CDT 2011


#1873: Recarrays do not work with numpy.lib.stride_tricks.as_strided
--------------------+-------------------------------------------------------
 Reporter:  irwin   |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  1.6.0      
 Keywords:          |  
--------------------+-------------------------------------------------------
 It seems that as_strided does not work as it should for recarrays. I think
 the issue is that the named fields of a recarray do not survive being run
 through as_strided. For example, the second print statement below is not
 able to output the array using numpy 1.6:

 -----
 import numpy
 import numpy.lib.stride_tricks

 t = numpy.dtype({'names': ['a', 'b'], 'formats': [numpy.float64,
 numpy.float64]}, align = True)

 a = numpy.zeros(10, dtype = t)
 print a
 print numpy.lib.stride_tricks.as_strided(a)
 -----

 I had a look at stride_tricks.py, but I am not familiar enough with
 __array_interface__ to suggest a fix. I would be grateful if someone else
 is able to resolve this.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1873>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list