|
From: Perry G. <pe...@st...> - 2006-01-10 19:20:43
|
I think it would be a good thing, but right now we are more focused on =20=
seeing what is involved in porting some of our libraries first. I'll =20
try to find out how much work it would be though.
Perry
On Jan 10, 2006, at 1:58 PM, Francesc Altet wrote:
> Hi,
>
> Is there any plan to provide a conversion between recarrays in numpy
> and numarray?. For the moment it does not seem to work:
>
> In [83]: r=3Dnumarray.records.array([(1,11,'a'),(2,22,'b')], =20
> formats=3D'u1,f4,a1')
>
> In [84]: a=3Dnumpy.array(r, dtype=3D'u1,f4,a1')
>
> In [85]: numarray.records.array(a)
> =
-----------------------------------------------------------------------=20=
> ----
> exceptions.ValueError Traceback (most =20=
> recent
> call last)
>
> /tmp/<console>
>
> /usr/lib/python2.3/site-packages/numarray-1.5.0-py2.3-linux-i686.egg/=20=
> numarray/records.py
> in array(buffer, formats, shape, names, byteorder, aligned)
> 406 byteorder=3Dbyteorder, aligned=3Daligned)
> 407 else:
> --> 408 raise ValueError("Unknown input type")
> 409
> 410 def _RecGetType(name):
>
> ValueError: Unknown input type
>
> In [86]: numpy.array(r)
> Out[86]: array([0Aa, =B0Ab], dtype=3D(void,6))
>
> However, if one specifies the format in for the numarray-->numpy it
> does seem to work:
>
> In [87]: numpy.array(r, dtype=3D'u1,f4,a1')
> Out[87]: array([(1, 11.0, 'a'), (2, 22.0, 'b')], dtype=3D(void,6))
>
> But not in the sense numpy-->numarray:
>
> In [88]: numarray.records.array(a, formats=3D'u1,f4,a1')
> =
-----------------------------------------------------------------------=20=
> ----
> exceptions.ValueError Traceback (most =20=
> recent
> call last)
>
> /tmp/<console>
>
> /usr/lib/python2.3/site-packages/numarray-1.5.0-py2.3-linux-i686.egg/=20=
> numarray/records.py
> in array(buffer, formats, shape, names, byteorder, aligned)
> 406 byteorder=3Dbyteorder, aligned=3Daligned)
> 407 else:
> --> 408 raise ValueError("Unknown input type")
> 409
> 410 def _RecGetType(name):
>
> ValueError: Unknown input type
>
> Having this would be great for supporting heterogeneous arrays in
> PyTables.
>
> Regards,
>
> --=20
>> 0,0< Francesc Altet =A0 =A0 http://www.carabos.com/
> V V C=E1rabos Coop. V. =A0=A0Enjoy Data
> "-"
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
=20
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD =
SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dclick
> _______________________________________________
> Numpy-discussion mailing list
> Num...@li...
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
|