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 warning for all possible paths and cyclic path #20131
Conversation
✅ Hi, I am the SymPy bot (v160). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.7. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Codecov Report
@@ Coverage Diff @@
## master #20131 +/- ##
==============================================
+ Coverage 64.466% 75.867% +11.401%
==============================================
Files 671 671
Lines 173707 173809 +102
Branches 41020 41053 +33
==============================================
+ Hits 111982 131864 +19882
+ Misses 55307 36203 -19104
+ Partials 6418 5742 -676 |
@moorepants Pls check now |
Maybe this code should use the Or otherwise maybe a more generic routine could be added to iterables and used here. |
Can you please elaborate |
The release notes don't need to mention test cases. They should only be for end-users. |
I would like for @moorepants to confirm this is what he had in mind. My opinion is we generally should be minimal in omitting warnings in SymPy, though there are legitimate use-cases for them. |
These warnings will only occur if the user sets up their kinematics incorrectly. I think it is a useful feature for the user and it is also pertinent now that this automatic calculation of velocities has been implemented. We should, in general, let the user know if they incorrectly define relationships among points or reference frames. |
@moorepants Check now please |
Should it rather be an error? Another issue with warnings is that they are only emitted once by default (though that might not be the case if the message is different). |
No because the selection in the algorithm could be correct and the problem could successfully be defined if the extraneous position connection doesn't effect the result. |
These warnings shouldn't be error , as the calculated velocity is correct , but the veloctiy that is calculated would be dependent on how user creates the point tree. So I think the idea is to tell user that calculated veloctiy is dependent on how they define relation between points. |
@moorepants Does it seems right or require further changes? |
@moorepants Please review it |
Please be patient, as we are all doing this as volunteers. I'll review when I have the time. I recommend working on other PRs while you wait for reviews. |
with warnings.catch_warnings(): | ||
warnings.simplefilter('error') | ||
with ignore_warnings(UserWarning): | ||
assert P4.vel(B) == q1.diff(t) * B.x + u2 * B.y + 2 * q2.diff(t) * B.z |
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.
It'd be helpful to have a comment explaining what is happening in each warning catch, as it isn't obvious from a quick read of the code. Does this one now cause a warning? Which one the cyclic or multipath one?
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.
multiplath warning
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.
Added comment
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.
So here it is supposed to get that warning? It isn't clear what each warning catch (in each test is doing). You should write a comment just above with
in each one that is something like "there are two possible paths in this point tree, thus a warning is raised". Should you also ensure that the correct warning is raised, as there are two possible warnings.
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.
Added comments and also ensured that correct warning is being raised
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.
Sorry about requesting that, I missed that the names of the functions explained what was going on too. I thought they were all old tests you added warning catching too. Regardless, it is clearer now. Thanks.
This LGTM and can be merged when tests pass. |
Thanks 😄 |
References to other Issues or PRs
fix #20129
Brief description of what is fixed or changed
Added User Warnings for all possible paths and userwarnings for cyclic paths.
Other comments
Release Notes
- Added user warnings for all possible paths are found in particle.py.
- Added user warning for cyclic paths in particle.py.