#! /usr/bin/env python
import numarray, numarray.strings, numarray.records
doubles = numarray.array([1.0], 'Float64') strings = numarray.strings.array('abcdefgh', itemsize=8, kind=numarray.strings.RawCharArray) print numarray.records.array(buffer=[strings, strings]) print print numarray.records.array(buffer=[doubles, doubles]) print print numarray.records.array(buffer=[strings, doubles]) """ The output is:
RecArray[ ('abcdefgh'), ('abcdefgh') ]
RecArray[ (1.0, 1.0) ]
Traceback (most recent call last): File "./mess.py", line 12, in ? print numarray.records.array(buffer=[strings, doubles]) File "/usr/local/lib/python2.4/site-packages/numarray/records.py", line 397, in array byteorder=byteorder, aligned=aligned) File "/usr/local/lib/python2.4/site-packages/numarray/records.py", line 106, in fromrecords raise ValueError, "inconsistent data at row %d,field %d" % (row, col) ValueError: inconsistent data at row 1,field 0
The numarray docs (11.2) say: The first argument, buffer, may be any one of the following: ... (5) a list of numarrays. There must be one such numarray for each field.
What is going on here? """