Splitting low-level routines, and exposing a “raw” access to the image array. #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR solves #23, and introduces a new accessor
ImageArrayRawto theCameraclass.Description
As explained in #23, there is a tiny issue with the
tcodeinferred when reading the image array from the camera. The typeslandLare not fully portable, since it doesn't work on macOS. On macOS, the C type "long" is 8 bytes, while on Linux and Windows it’s usually 4 bytes. Hence, it is recommended to change these toiandIrespectively, which are fully portable on every platform. I couldn't find an explicit Python ref to paste here unfortunately.While doing tests to validate the solution, it became obvious the low-level routine would benefit from a small refactoring, to be split in multiple smaller methods with separated concerns. This is what this PR also introduces.
The original accessor
def ImageArray(self)has been completely preserved. But in the case of binary data, the building of nested lists isn't always necessary, nor really desirable. Hence, thanks to the refactoring, it became possible to expose right-away thearray.array(which is anyway built) via a new accesordef ImageArrayRaw(self).Open questions / notes
l/L->i/Ichanges and the reafctoring, but I'm open to split the PR if you prefer.