[Numpy-discussion] bug in numpy recarray ?

Sebastian Haase haase at msg.ucsf.edu
Sun Jul 23 00:32:33 CDT 2006


Hi!
I'm trying to convert my numarray records code to numpy.
 >>> type(m.hdrArray)
<class 'numpy.core.records.recarray'>
 >>> m.hdrArray.d
[(array([ 1.,  1.,  1.], dtype=float32),)]

but I get:
 >>> m.hdrArray[0].getfield('d')
5.43230922614e-312

Am I missing something or is this a bug ?

Further details:
 >>> m.hdrArray.dtype.descr
[('Num', [('f1', '<i4', 3)]), ('PixelType', [('f1', '<i4')]), ('mst', 
[('f1', '<i4', 3)]), ('m', [('f1', '<i4', 3)]),
      ('d', [('f1', '<f4', 3)]),  ####!!!!
('angle', [('f1', '<f4', 3)]), ('axis', [('f1', '<i4', 3)]), ('mmm1', 
[('f1', '<f4', 3)]), ('type', [('f1', '<i2')]), ('nspg', [('f1', 
'<i2')]), ('next', [('f1', '<i4')]), ('dvid', [('f1', '<i2')]), 
('blank', [('f1', '|i1', 30)]), ('NumIntegers', [('f1', '<i2')]), 
('NumFloats', [('f1', '<i2')]), ('sub', [('f1', '<i2')]), ('zfac', 
[('f1', '<i2')]), ('mm2', [('f1', '<f4', 2)]), ('mm3', [('f1', '<f4', 
2)]), ('mm4', [('f1', '<f4', 2)]), ('ImageType', [('f1', '<i2')]), 
('LensNum', [('f1', '<i2')]), ('n1', [('f1', '<i2')]), ('n2', [('f1', 
'<i2')]), ('v1', [('f1', '<i2')]), ('v2', [('f1', '<i2')]), ('mm5', 
[('f1', '<f4', 2)]), ('NumTimes', [('f1', '<i2')]), ('ImgSequence', 
[('f1', '<i2')]), ('tilt', [('f1', '<f4', 3)]), ('NumWaves', [('f1', 
'<i2')]), ('wave', [('f1', '<i2', 5)]), ('zxy0', [('f1', '<f4', 3)]), 
('NumTitles', [('f1', '<i4')]), ('title', [('f1', '|S80', 10)])]
 >>>
 >>>
 >>> m.hdrArray[0].dtype.descr
[('Num', [('f1', '<i4', 3)]), ('PixelType', [('f1', '<i4')]), ('mst', 
[('f1', '<i4', 3)]), ('m', [('f1', '<i4', 3)]),
         ('d', [('f1', '<f4', 3)]), ####!!!!
('angle', [('f1', '<f4', 3)]), ('axis', [('f1', '<i4', 3)]), ('mmm1', 
[('f1', '<f4', 3)]), ('type', [('f1', '<i2')]), ('nspg', [('f1', 
'<i2')]), ('next', [('f1', '<i4')]), ('dvid', [('f1', '<i2')]), 
('blank', [('f1', '|i1', 30)]), ('NumIntegers', [('f1', '<i2')]), 
('NumFloats', [('f1', '<i2')]), ('sub', [('f1', '<i2')]), ('zfac', 
[('f1', '<i2')]), ('mm2', [('f1', '<f4', 2)]), ('mm3', [('f1', '<f4', 
2)]), ('mm4', [('f1', '<f4', 2)]), ('ImageType', [('f1', '<i2')]), 
('LensNum', [('f1', '<i2')]), ('n1', [('f1', '<i2')]), ('n2', [('f1', 
'<i2')]), ('v1', [('f1', '<i2')]), ('v2', [('f1', '<i2')]), ('mm5', 
[('f1', '<f4', 2)]), ('NumTimes', [('f1', '<i2')]), ('ImgSequence', 
[('f1', '<i2')]), ('tilt', [('f1', '<f4', 3)]), ('NumWaves', [('f1', 
'<i2')]), ('wave', [('f1', '<i2', 5)]), ('zxy0', [('f1', '<f4', 3)]), 
('NumTitles', [('f1', '<i4')]), ('title', [('f1', '|S80', 10)])]

Thanks,
Sebastian Haase




More information about the Numpy-discussion mailing list