Create a Result Class to handle Result + Histogram #25
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.
This pull request refactors and improves the image acquisition result handling in the
deapiclient. The main changes include introducing a newResultclass to encapsulate image results, refactoring theget_resultmethod for clarity and flexibility, and adding helper methods for pixel format conversions. These changes enhance code maintainability, usability, and plotting capabilities.Result encapsulation and usability improvements:
Resultclass (indeapi/data_types.py) to encapsulate the image, pixel format, attributes, and histogram returned fromget_result, including a richplotmethod for visualization and a custom__repr__for easier debugging.get_resultindeapi/client.pyto return aResultobject instead of a tuple, simplifying downstream usage.Refactoring and flexibility in
get_result:get_resultmethod indeapi/client.pyfor clarity: simplified the parsing and assignment of attribute fields, improved histogram extraction, and replaced repetitive code with a loop over field names.**kwargs) to customize attributes such as window size, zoom, and stretch parameters, making the API more flexible.Pixel format handling improvements:
to_numpy_dtypeandfrom_numpy_dtypehelper methods to thePixelFormatenum for seamless conversion between enum values and numpy data types, and used these methods inget_result. [1] [2]Logging and code cleanup:
Miscellaneous:
__repr__methods forAttributesandHistogramfor better debugging output. [1] [2]