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

add specific exception when ellipse construction attempted without opencv-python installed #136

Merged
merged 9 commits into from
Dec 22, 2022

Conversation

zacharyburnett
Copy link
Collaborator

@zacharyburnett zacharyburnett commented Dec 22, 2022

Addresses spacetelescope/jwst#7409
related to spacetelescope/jwst#7414

This PR addresses the issue brought up in spacetelescope/jwst#7409; a lack of specificity when using jump.use_ellipses = True without an opencv installation. Instead of a UserWarning being printed at import time, a ModuleNotFoundError is raised in runtime if ellipse functionality is selected and opencv-python is not detected.

ELLIPSE_PACKAGE_WARNING = '`opencv-python` must be installed (`pip install stcal[opencv]`) in order to use ellipses'

Checklist

  • added entry in CHANGES.rst (either in Bug Fixes or Changes to API)
  • updated relevant tests
  • updated relevant documentation
  • updated relevant milestone(s)
  • added relevant label(s)

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Base: 78.19% // Head: 78.45% // Increases project coverage by +0.25% 🎉

Coverage data is based on head (1dbb1af) compared to base (9d95972).
Patch coverage: 40.62% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   78.19%   78.45%   +0.25%     
==========================================
  Files          24       24              
  Lines        4843     4855      +12     
==========================================
+ Hits         3787     3809      +22     
+ Misses       1056     1046      -10     
Flag Coverage Δ
unit 78.45% <40.62%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/stcal/jump/jump.py 14.05% <36.66%> (+1.91%) ⬆️
tests/test_jump.py 62.96% <100.00%> (+31.48%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

'certain snowball detection and usage of ellipses will be inoperable')
ELLIPSE_PACKAGE = 'opencv-python'
except (ImportError, ModuleNotFoundError):
ELLIPSE_PACKAGE_WARNING = '`opencv-python` must be installed (`pip install stcal[opencv]`) in order to use ellipses'
Copy link
Collaborator Author

@zacharyburnett zacharyburnett Dec 22, 2022

Choose a reason for hiding this comment

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

this message accompanies the ModuleNotFoundError only if opencv functionality is used without it being installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants