-
Notifications
You must be signed in to change notification settings - Fork 1
Weighted Torque Bug #64
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
Conversation
- Restored the original method for computing weighted torque - Clarified handling of small moment of inertia values in the docstring, explaining why values below machine precision are treated as zero - No functional changes beyond reverting to the previous calculation method
- Added a check to skip the calculation if the torque is already zero, highlighted in issue #55, reducing unnecessary calculations - Retained the divide-by-zero check to ensure numerical stability when computing weighted torques - Improved docstring to reflect the updated logic
|
In the get_weighted_torques function (in GeometricFunctions.py), there is a check for if the moment of inertia is zero (line 359). I think that if the torques is not zero and the moment of inertia is zero, it should raise a divide by zero error and not just ignore the moment of inertia weighting while carrying on as if nothing unusual happened. As far as I can tell, the physics of the torques and moment of inertia mean that this case should not happen, but I think it is better to have error handling than just trusting it isn't an issue. |
… of inertia is zero instead of proceeding with unweighted torque calculation.
skfegan
left a 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.
All the logic I expected is there with appropriate error messages.
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.
The code looks to me like it reflects the output of the discussion with Richard this morning. We basically have one scenario that the program can carry on by setting the torque to zero and two situations that would lead to a graceful crash with informative error messages.
@skfegan I'm not going to hit approve on this review, can you check that you agree and then approve in your review for Harry to merge.
|
@harryswift01 oddly this approved with a review ended in "comment"! Can you hold off merging until Sarah has looked too. |
Ah no Sarah was just fast! |
Summary
This PR addresses issues related to the weighted torque calculation by reverting to the original method, optimizing the calculation to prevent crashes, and improving documentation for clarity.
Changes
Revert weighted torque calculation and improve documentation:
Optimize weighted torque calculation to reduce crashes:
Impact