So I’m trying to write a numpy array to a binary PLY file, type convertion is required. What I did was
A = array([0. , 0.00333476, 0.29804176, 0.66598558])
A.astype([('idx', '<i4'), ('x', '<f4'), ('y', '<f4'), ('z', '<f4')])
Output:
array([(0, 0. , 0. , 0. ),
(0, 0.00333476, 0.00333476, 0.00333476),
(0, 0.29804176, 0.29804176, 0.29804176),
(0, 0.6659856 , 0.6659856 , 0.6659856 )],
dtype=[('idx', '<i4'), ('x', '<f4'), ('y', '<f4'), ('z', '<f4')])
Expecting:
array((0, 0.00333476, 0.29804176, 0.6659856), dtype=[('idx', '<i4'), ('x', '<f4'), ('y', '<f4'), ('z', '<f4')])
Btw, I’m on numpy version ‘1.24.4’, is this a bug?