Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

160 clean up abstractspotanalysisimageprocessor #162

Conversation

bbean23
Copy link
Collaborator

@bbean23 bbean23 commented Aug 20, 2024

This PR is a biggie. It includes:

  • combining AbstractSpotAnalysisImageProcessor and it's ...Leger class
  • moving much of the cacheing logic to CacheableImage
  • adding lots of tests
  • code cleanup and documentation

@bbean23 bbean23 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Aug 20, 2024
@bbean23 bbean23 self-assigned this Aug 20, 2024
@bbean23 bbean23 marked this pull request as ready for review September 9, 2024 17:12
@bbean23 bbean23 force-pushed the 160-clean-up-abstractspotanalysisimageprocessor branch from cfd9edc to 0d1cbda Compare October 21, 2024 16:51
@rcbrost
Copy link
Collaborator

rcbrost commented Oct 31, 2024

Randy Brost started reviewing this on Thursday October 31 at 9:27 AM.

Copy link
Collaborator

@e10harvey e10harvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for these changes, @bbean23. Most of my comments are related to the end-user documentation. However, I think given the nature of these changes, it makes sense to share before and after performance metrics. Is there a example or test you could run to share memory usage and runtime before & after these changes?

EDIT: Target branch should be develop rather than main.

opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
Comment on lines +26 to +30
self.example_array = np.zeros((40, 40, 3), dtype=np.uint8)
self.example_array[:20, :20, 0] = 255
self.example_array[20:, :20, 1] = 255
self.example_array[:20, 20:, 2] = 255
self.example_array[20:, 20:, :2] = 255
Copy link
Collaborator

@e10harvey e10harvey Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a function that generates a randomly sized example array and sets the members you want to 255.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I agree that random input data is a good idea in unit tests. However here I disagree. I don't think that a randomly sized example array will help us to catch bugs in these unit tests and isn't worth the effort here.

opencsp/common/lib/cv/test/test_CacheableImage.py Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@bbean23 bbean23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I've addressed all your comments. Please approve when ready.

opencsp/common/lib/cv/CacheableImage.py Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
opencsp/common/lib/cv/test/test_CacheableImage.py Outdated Show resolved Hide resolved
Comment on lines +26 to +30
self.example_array = np.zeros((40, 40, 3), dtype=np.uint8)
self.example_array[:20, :20, 0] = 255
self.example_array[20:, :20, 1] = 255
self.example_array[:20, 20:, 2] = 255
self.example_array[20:, 20:, :2] = 255
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I agree that random input data is a good idea in unit tests. However here I disagree. I don't think that a randomly sized example array will help us to catch bugs in these unit tests and isn't worth the effort here.

"""Check memory usage and convert images to files (aka file path
strings) as necessary in order to reduce memory usage."""
total_mem_size = CacheableImage.all_cacheable_images_size()
if total_mem_size <= memory_limit_bytes:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this same comment to the code

opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
Comment on lines 552 to 553
Note: this replaces the internal reference to source_path, if any, with
the newly given path.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, going back in and expanding the documentation on this saved me from a potential bug! Thanks!

opencsp/common/lib/cv/CacheableImage.py Show resolved Hide resolved
opencsp/common/lib/cv/CacheableImage.py Outdated Show resolved Hide resolved
@e10harvey e10harvey changed the base branch from main to develop November 11, 2024 16:11
@e10harvey e10harvey merged commit 7fc448f into sandialabs:develop Nov 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants