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

Move some image parsing logic #209

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

cshanahan1
Copy link
Contributor

@cshanahan1 cshanahan1 commented Feb 8, 2024

Move part of the image parsing logic to its own function to avoid an issue in Background one_sided/two_sided.

Background.one_sided/two_sided were calling an instance method from _Image_Parser. This works as is, but if you were to then try to call another instance method from within that one, it does not understand 'self' and will cause an error. I moved the bit of code that Background needed to its own function to avoid this issue (which doesn't exist in main yet, but does in work on another branch I have).

Also fixed a bug where checking if data was u.quantity.Quantity was never triggered because the check for np.ndarray happened first.

I don't think this needs a change log.

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (715361e) 81.77% compared to head (b2e032f) 81.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   81.77%   81.92%   +0.15%     
==========================================
  Files          10       10              
  Lines        1004     1007       +3     
==========================================
+ Hits          821      825       +4     
+ Misses        183      182       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cshanahan1 cshanahan1 marked this pull request as ready for review February 8, 2024 15:34
Copy link
Contributor

@tepickering tepickering left a comment

Choose a reason for hiding this comment

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

looks good! only comment would be to tweak the test to cover the missed line that codecov flagged.

…assmethod, and fix issue with parsing quantities
@cshanahan1 cshanahan1 force-pushed the parse_img_background_fix branch from 57ee48c to b2e032f Compare February 8, 2024 19:17
@cshanahan1
Copy link
Contributor Author

looks good! only comment would be to tweak the test to cover the missed line that codecov flagged.

i added some coverage and realized in the process that the isinstance(image, u.quantity.Quantity) was never actually being triggered because isinstance(image, np.ndarray) was being checked first. It didn't seem to cause any noticeable issues since this already existed on main, but I fixed it just in case.

@cshanahan1 cshanahan1 merged commit cb5071f into astropy:main Feb 8, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants