comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Reading binary files made by Python
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reading binary files made by Python [message #49276 is a reply to message #49267] Mon, 10 July 2006 08:55 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Sheldon wrote:
> Maarten wrote:
>> Sheldon wrote:
>>
>>> I have created som binary files using python and tried to read them
>>> with IDL. I used the binary_template as well but IDL completely
>>> misinterprets the data and returns wrong values and values that were
>>> never written in the file.
>>
>> I would recommend to write out the data in a portable file format, like
>> HDF (pytables is an easy way to do that). You can then use the idl HDF
>> routines to ingest the data, avoiding the larger part of the headaches.
>>
>> Maarten
>>
>> pytables: http://www.pytables.org/
>
> This is a very good idea. I think that I will do just that. The data
> was written and read on the same machine. Silly me, I thought that
> binary is just a binary but I guess not. Will try the HDF format.

Binary is just binary :) Try to keep it simple and just use OPENR/READU
and your knowledge of the file. Do it interactively a few bytes at a
time. You'll at least know exactly when things go wrong...

FWIW, I would consider XDR if you can do that from the Python side. It
is *much* easier to use than HDF, CDF, etc. and sounds like it is
exactly what you are looking for. The only potential issue is that I
don't think MATLAB reads it so if that is a requirement I would go back
to your original approach.

-Rick
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: format codes
Next Topic: Reading Binary

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 08:02:39 PDT 2025

Total time taken to generate the page: 1.44241 seconds