From: Antonio V. <ant...@ti...> - 2012-06-25 17:47:08
|
Hi Alvaro, thank you for reporting. I filed an issue on GitHub to track the problem: https://github.com/PyTables/PyTables/issues/160 ciao Il 25/06/2012 12:03, Alvaro Tejero Cantero ha scritto: > Hi, > > In view of the upcoming release I thought I'd report this because at > the time I cannot fix it myself: > > I am using a structured array with a dtype specified with the > following numpy-accepted > format (quotation follows from > http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html): > > [(field_name, field_dtype, field_shape), ...] > > obj should be a list of fields where each field is described by a > tuple of length 2 or 3. (Equivalent to the descr item in the > __array_interface__ attribute.) > > The first element, field_name, is the field name (if this is '' then a > standard field name, 'f#', is assigned). The field name may also be a > 2-tuple of strings where the first string is either a “title” (which > may be any string or unicode string) or meta-data for the field which > can be any object, and the second string is the “name” which must be a > valid Python identifier. > > This is my concrete example: > > header = [(('timestamp', 't'), 'u4'), > (('unit (cluster) id', 'unit'),'u2')] > > This is what PyTables says upon passing either the structured array or > np.dtype(header) to the createTables function: > >> test.createTable('/', 'spike', s, 'test') > > --------------------------------------------------------------------------- > ValueError Traceback (most recent call last) > /home/tejero/Dropbox/O/ridge/doc/<ipython-input-40-5fdbd9feb41d> in <module>() > ----> 1 test.createTable('/', 'spike', s, 'test') > > /home/tejero/Local/Envs/test/lib/python2.7/site-packages/tables/file.pyc > in createTable(self, where, name, description, title, filters, > expectedrows, chunkshape, byteorder, createparents) > 768 description=description, title=title, > 769 filters=filters, expectedrows=expectedrows, > --> 770 chunkshape=chunkshape, byteorder=byteorder) > 771 > 772 > > /home/tejero/Local/Envs/test/lib/python2.7/site-packages/tables/table.pyc > in __init__(self, parentNode, name, description, title, filters, > expectedrows, chunkshape, byteorder, _log) > 805 self._v_recarray = nparray > 806 self.description, self._rabyteorder = \ > --> 807 descr_from_dtype(nparray.dtype) > 808 > 809 # No description yet? > > > /home/tejero/Local/Envs/test/lib/python2.7/site-packages/tables/description.pyc > in descr_from_dtype(dtype_) > 723 fields = {} > 724 fbyteorder = '|' > --> 725 for (name, (dtype, pos)) in dtype_.fields.items(): > 726 kind = dtype.base.kind > 727 byteorder = dtype.base.byteorder > > ValueError: too many values to unpack > > -á. > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > -- Antonio Valentino |