[SciPy-User] dtype of LabView binary files

LittleBigBrain braingateway@gmail....
Wed Nov 10 03:34:02 CST 2010


On Tue, Nov 9, 2010 at 11:34 PM, Xunchen Liu <xunchen.liu@gmail.com> wrote:
>
> Hello,
> It seems there is only one web page here talking about the dtype of the
> binary file saved from Labview:
I also used Labview before. But I think u misunderstood something. The
labview does not
determine any datatype. You need to specify it in your Labview G-code.
For example, I specify my code as 'little-endian', int64.
Then I need to read them with dtype='<i8'
If I specify my G-code with 'big-endian', float64.
Then I need to read them with dtype='>f8'
It is also true for G-code reading binaries. There is not mystery
mechanism to auto-detect the data type.

> http://www.shocksolution.com/2008/06/25/reading-labview-binary-files-with-python/
> I followed Travis' suggestion on that page to convert one of my Labview
> binary file using
> data=numpy.fromfile('name',dtype='>d')
> but this gives a array doubled the shape of my recorded data and also the
> value of the data are not right.
> For example, the attached is the text file and binary file saved by Labview.
> the text file reads:
no matter what ur text file looks like, what is the exactly data type
you specified in
Labview? Can you build a G-code to read this correct value from your binaries?
Did u specify a header in G-code for writing binaries? I knew G-code
have some nice
mechanism to write a header or a filesize code in front of the
binaries. But I think by
default this is OFF. Please, be sure you understand what your G-code generated.

> array([-2332., -2420., -2460., ...,  1660.,  1788.,  1804.])
> while the binary file reads (with dtype='>d')
> array([-3.30078125,  0.        , -3.30297852, ...,  0. ,       -2.6953125 ,
>  0.        ])
> Anyone knows what dtype I should use, or how should I build the correct
> dtype for it?
> Thanks a lot!
> Xunchen Liu
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


More information about the SciPy-User mailing list