-
Notifications
You must be signed in to change notification settings - Fork 652
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
Switch guessers to catching and raising NoDataErrors #4755
Switch guessers to catching and raising NoDataErrors #4755
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4755 +/- ##
===========================================
- Coverage 93.59% 93.57% -0.03%
===========================================
Files 177 189 +12
Lines 21708 22775 +1067
Branches 3052 3052
===========================================
+ Hits 20318 21312 +994
- Misses 943 1016 +73
Partials 447 447 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From reading the issue and glancing at the code, changing the raised ValueError to NoDataError makes sense and seems more consistent.
I am not really familiar with the new guesser code so this is just a surface-level review. Other reviews would be great.
@lilyminium I'll leave it to you to gather more opinions if you need them.
I think what @IAlibay means is that there is a nested exception error message: a = np.array([
[0., 0., 150.], [0., 0., 150.], [200., 0., 150.],
[0., 0., 150.], [100., 100., 150.], [200., 100., 150.],
[0., 200., 150.], [100., 200., 150.], [200., 200., 150.]
])
u = mda.Universe(a, n_atoms=9, to_guess=['elements'])
> ...
> NoDataError: This Universe does not contain name information
> During handling of the above exception, another exception occurred:
> ...
> NoDataError: there is no reference attributes in this universeto guess types from which is kinda ugly. you can explicitly suppress the chaining of exceptions using the from None syntax (see suggestions) |
Yes, thanks so much @yuxuanzhuang, that's exactly what I was looking at! Sorry I conflated that with the error type for some reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with @yuxuanzhuang's suggestions.
Co-authored-by: Yuxuan Zhuang <yuzhuang@stanford.edu>
Co-authored-by: Yuxuan Zhuang <yuzhuang@stanford.edu>
Fixes #4749 (maybe?)
Changes made in this Pull Request:
PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4755.org.readthedocs.build/en/4755/