Closed scandey closed 1 year ago
Thanks @scandey, I'll take a look and get back to you
Hi @scandey,
I appreciate you reporting this. It looks like this is a bug with FixedLength
, but not the VariableLength
class (the VariableLength
uses a separate decoder). When I changed FixedLength
to VariableLength
in your example code, it runs cleanly.
I imagine you have an private use case that is driving this bug report... would you mind trying your use case with the VariableLength
class? If it works, then we will at least know that we have a workaround as to not hold up your development.
Hi @scandey,
I also implemented a fix for this bug on this branch, and added a regression test. Could you give that a try as well? https://github.com/CCSDSPy/ccsdspy/tree/gh-issue-78-fix
Thank you! I can load the file with the VariableLength workaround or FixedLength (on the bugfix branch), though the signed integers for either seem to be a little broken. I'm getting a scale of 15x for negative integers... The 12-bit signed integer 0x800 returns -30720. Perhaps a new issue is in order for that though?
There is some very strange behavior going on when a Packet Array field has 12 bits and the file being opened has an odd number of packets in it.
Ends up with the following value error. All but the last field seem to be executing, but it gets stuck on the last one. (not sure that the earlier ones are actually correct though...)
Unfortunately this is beyond my debugging prowess, I really couldn't follow the logic of that section of code to find the (presumed) off-by-one error. I did generate a quick script to replicate the issue and a similar script with 8 bit values instead of 12 that does not replicate the issue. Both scripts can be run directly or as faux-notebooks in VSCode. (EDIT: Behavior will replicate with either 1.1.1 or main)
Example script for twelve bit array
Equivalent working code for 8 bit array