NelisW / pyradi

a Python toolkit to perform optical and infrared computational radiometry
http://nelisw.github.io/pyradi-docs/_build/html/index.html
MIT License
58 stars 34 forks source link

Error when reading ptw files with ryptw.readPTWHeader() #24

Open MarijnMostert opened 3 years ago

MarijnMostert commented 3 years ago

Since the latests release, I get an error when reading ptw files using ryptw.readPTWHeader(). On line 417, 7 bytes are read and then passed to mybyte(), which checks if it receives only one byte and throws an error otherwise.

Header.h_Reserved134 = mybyte(headerinfo[134:141])
def mybyte(x):
        # will return an error if x is more than a byte length
        ans = ord(x)
        return ans

This throws an error in this case, but I'm not sure this is intended.

Something similar is done on lines 425 and 448

soylentdeen commented 3 years ago

Hi, I'm also seeing the same error. Is there a definition of the header format so that we can debug?

soylentdeen commented 3 years ago

@NelisW, I am trying to process a .PTW file which works fine with the previous version of ryptw.py. Presumably nothing changed with the .PTW definition, or is it possible that the file which is creating the .PTW file (WiDyVISION 3.9.1, https://new-imaging-technologies.com/software/) is not adhering to the standard file format?

soylentdeen commented 3 years ago

In the event this is an issue with ryptw.py, do you have any idea whether or not this is a quick fix, or should I revert to the old version for the time being?

MarijnMostert commented 3 years ago

Hi! I don't know what information is supposed to be contained in the bytes in question, but in previous versions they were simply discarded. I wasn't interested in it either, so the fix (it was a quick fix) to get it working again was commenting out lines 417, 425, and 448. In fact, I commented out line 450 too as there appears to be a typo there as well.

soylentdeen commented 3 years ago

that is definitely one way to fix the problem :-) Let's just hope it doesn't affect anything!

davidtrem commented 2 years ago

I am having exactly the same problem, with the current version of pyradi (head) Any better solution or any more detail on the underlying issue ?

davidtrem commented 2 years ago

It seems that this commit introduce the regression cb02dda67f34175a2e3e0ce957c89d715c6475e9 Which is really strange has it seems unrelated. Furthermore, it reverts a nice improvement in reading speed :-(