[Numpy-tickets] [NumPy] #462: numpy.rec parser problem

NumPy numpy-tickets@scipy....
Mon Mar 5 19:40:38 CST 2007

#462: numpy.rec parser problem
 Reporter:  chanley     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  high        |   Milestone:          
Component:  numpy.core  |     Version:  devel   
 Severity:  critical    |    Keywords:          
 The format_parser in the records module in numpy.core cannot handle a
 repeat count of zero.  This feature is actually important in pyfits so
 that a user can define a field that has zero length.  The difference
 between the numpy and numarray behavior is illustrated below:

 In [10]: import numarray.records as r

 In [11]: x = r.array(None,formats="a8,3f8,0f8,i4,f4,a1,f4,3f4,a1,f4,3f4",

 In [12]: from numpy import rec

 In [13]: y =
 <type 'exceptions.TypeError'>             Traceback (most recent call

 /data/sparty1/dev/devCode/<ipython console> in <module>()

 in array(obj, dtype, shape, offset, strides, formats, names, titles,
  byteorder, copy)
     516     elif formats is not None:
     517         dtype = format_parser(formats, names, titles,
 --> 518                               aligned, byteorder)._descr
     519     else:
     520         kwds = {'formats': formats,

 /data/sparty1/dev/site-packages/lib/python/numpy/core/records.py in
 __init__(self, formats, names, titles, aligned, byteorder)
      46         self._parseFormats(formats, aligned)
      47         self._setfieldnames(names, titles)
 ---> 48         self._createdescr(byteorder)
      50     def _parseFormats(self, formats, aligned=0):

 /data/sparty1/dev/site-packages/lib/python/numpy/core/records.py in
  _createdescr(self, byteorder)
     107                           'formats':self._f_formats,
     108                           'offsets':self._offsets,
 --> 109                           'titles':self._titles})
     110         if (byteorder is not None):
     111             byteorder = _byteorderconv[byteorder[0]]

 <type 'exceptions.TypeError'>: data type not understood


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

More information about the Numpy-tickets mailing list