Closed ddasilva closed 1 year ago
Hi @ddasilva,
Thank you for StringifyBytesConverter. It's working fine with most conversions. However, when I try to convert the "REG" packet array in the ECM Packet Structure, I get an error with the conversion saying, TypeError: only integer scalar arrays can be converted to a scalar index. Just wanted to know if the conversion can only be applied to PacketFields or even PacketArrays. I've attached the code and the test dataset for your reference.
Thanks, Nischay Test Code + Data.zip
Thanks @nischayn99, I'll take a look. I'm on travel so it will probably be next week.
Merging #75 (2efe53a) into main (c1a50c0) will increase coverage by
0.21%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #75 +/- ##
==========================================
+ Coverage 95.52% 95.74% +0.21%
==========================================
Files 7 7
Lines 604 635 +31
==========================================
+ Hits 577 608 +31
Misses 27 27
Impacted Files | Coverage Δ | |
---|---|---|
ccsdspy/converters.py | 100.00% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Hi @ddasilva,
Thank you for StringifyBytesConverter. It's working fine with most conversions. However, when I try to convert the "REG" packet array in the ECM Packet Structure, I get an error with the conversion saying, TypeError: only integer scalar arrays can be converted to a scalar index. Just wanted to know if the conversion can only be applied to PacketFields or even PacketArrays. I've attached the code and the test dataset for your reference.
Thanks, Nischay Test Code + Data.zip
Thanks for sending this test data and code. I had forgotten to handle the case of expanding arrays. I pushed a new commit to this branch which fixes the issue, and your code now runs for me. I also added a test to make sure there isn't a regression in the future.
Hi @ddasilva, Thank you for StringifyBytesConverter. It's working fine with most conversions. However, when I try to convert the "REG" packet array in the ECM Packet Structure, I get an error with the conversion saying, TypeError: only integer scalar arrays can be converted to a scalar index. Just wanted to know if the conversion can only be applied to PacketFields or even PacketArrays. I've attached the code and the test dataset for your reference. Thanks, Nischay Test Code + Data.zip
Thanks for sending this test data and code. I had forgotten to handle the case of expanding arrays. I pushed a new commit to this branch which fixes the issue, and your code now runs for me. I also added a test to make sure there isn't a regression in the future.
Thank you, @ddasilva.
This implements the change requested in #73.
A new converter class is added, called
ccsdspy.converters.StringifyBytesConverter
, which will convert an array to number representations such as binary, hexidecimal, or octal. The full docstring of the class is quoted below:An example of the usage follows.