Thanks for your help, everyone. I've got things working properly now with struct.pack and the oh-so-very helpful * operator that lets you feed it lists.
On Fri, Jan 7, 2011 at 3:53 PM, Peter Williams <[email protected] > wrote: > On Fri, 2011-01-07 at 13:49 -0700, Terry Filiba wrote: > > I think this will only work if the endianness of the machine matches > > the endianness of the FPGA. When we call struct pack using the greater > > than symbol, we explicitly force it to use a big endian representation > > of the binary data regardless of the machine the script is running on. > > -Terry > > The astype() function can take care of that, though it is a bit less > convenient. > > In [3]: str (numpy.ones (1).astype ('<d').data) > Out[3]: '\x00\x00\x00\x00\x00\x00\xf0?' > In [4]: str (numpy.ones (1).astype ('>d').data) > Out[4]: '?\xf0\x00\x00\x00\x00\x00\x00' > > Peter > > -- > Peter Williams / [email protected] > Department of Astronomy, UC Berkeley > > >

