-
Notifications
You must be signed in to change notification settings - Fork 11
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 radians option to angle_between_vectors
and add value ranges to bond distribution functions.
#35
Conversation
Codecov Report
@@ Coverage Diff @@
## master #35 +/- ##
=======================================
Coverage 99.68% 99.69%
=======================================
Files 7 7
Lines 318 328 +10
=======================================
+ Hits 317 327 +10
Misses 1 1
|
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.
Might want to add tests for theta_min
/theta_max
and l_min
/l_max
just to validate that these values don't break anything. Also what happens if the min and max are set such that they are outside the distribution?
cmeutils/geometry.py
Outdated
else: | ||
return angle |
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.
else: | |
return angle | |
return angle |
Yeah, I can add a test. To your question, that's kind of the point of having the min and max values. For example, say some bond distribution only has values between 1 and 2, but you want the distribution to go from zero to 3, so you'd set min=0, max=3 and the distribution would include the entire range from min to max, even if a good portion of it is zero. Unless I'm not understanding what you mean by outside the distribution. |
What I mean using your example of a bond distribution with values between 1 and 2, what if you set the min and max to 1.5 to 3? Some of the distribution isn't captured. Is there anything we should do to handle that? (I don't mean these as leading questions, I'm just thinking about possible hangups.) |
If that's the case then I'm pretty sure numpy.histogram just trims the distribution based on the range you give it. We could maybe add a warning if any part of the array of values returned (bond lengths, angles) lies outside of either min or max values, but it wouldn't error out. |
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 🙌
This PR does a couple of things:
Adds a parameter so that
geometry.angle_between_vectors
can return the angle in degrees or radians. It defaults to degreesAdds a radians option to the bond and angle distribution functions.
Adds min and max options to the distribution functions, so that it can work similar to the
gsd_rdf
function