[Numpy-tickets] [NumPy] #449: Swaping byteorder in recarrays with multidimensional fields doesn't work
NumPy
numpy-tickets@scipy....
Mon Feb 12 04:37:54 CST 2007
#449: Swaping byteorder in recarrays with multidimensional fields doesn't work
--------------------+-------------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version: devel
Severity: normal | Keywords:
--------------------+-------------------------------------------------------
When swaping the byteorder of a recarray with multidimensional fields,
those are not swapped at all as can be seen in:
{{{
In [45]:r=numpy.array([(1,(0,1,2))], dtype="i2,3i2")
In [46]:r.byteswap()
Out[46]:
array([(256, [0, 1, 2])],
dtype=[('f0', '<i2'), ('f1', '<i2', 3)])
}}}
Curiously, this seems to work fine with nested recarrays (without
multidimensional columns, of course):
{{{
In [47]:mydescriptor = numpy.dtype([('x', 'f4'),('y', 'f4'),('nested',
[('i', 'i2'),('j','i2')])])
In [48]:nra=numpy.array([(1.0, 2.0, (1,2)), (2.1, 3.2, (3,2))],
dtype=mydescriptor)
In [49]:nra.byteswap()
Out[49]:
array([(4.6006029882248069e-41, 8.9683101716788293e-44, (256, 512)),
(2.7156489580261977e+23, -428443648.0, (768, 512))],
dtype=[('x', '<f4'), ('y', '<f4'), ('nested', [('i', '<i2'), ('j',
'<i2')])])
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/449>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list