-
Notifications
You must be signed in to change notification settings - Fork 52
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
Improving the performance of the samplings utils (see #175) #177
Conversation
While I'm here I'm going to tidy up the class method "random": orix/orix/quaternion/rotation.py Line 530 in 692c54a
I'll also look into the orix/orix/quaternion/rotation.py Line 549 in 692c54a
|
Going to transfer this into an issue to be dealt with when the large refactor comes in at some point in the future. |
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.
Thanks for looking into the rotation sampling, @pc494.
I haven't fully understood the maths involved here, but the sample returned with angles of about 1-7 degrees accompanied by a resolution in the order of 0.5 degrees returns an empty sampling. Could you explain this to me?
Apart from this, I like that you've renamed the utilities to SO3, so that we can easily fit SO2 in the future into this orix.sampling
module.
orix/sampling/SO3_sampling.py
Outdated
e_1_min = np.cos(np.deg2rad(max_angle/2)) | ||
u_1_max = 1 - np.square(e_1_min) | ||
u_2_min = np.arcsin(e_1_min) / 2 / np.pi | ||
u_1 = np.linspace(0,u_1_max,num=int(num_steps*(u_1_max)),endpoint=True) |
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.
int(num_steps * u_1_max)
becomes zero when u_1_max
is small (see comment to get_sample_local()
). Is there some way to handle the case where max angle is small (1-7 degrees) and a resolution of below 1 degree?
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.
Yup, putting a crude fix in for this
Thanks @hakonanes for this review, it's very good. It'll take me a little while to loop back to this but when I do I think most of the style changes will be simple to implement. The version in |
That sounds like a good plan. As mentioned in #175, there is no rush. |
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.
Working on these locally, will be up shortly.
orix/sampling/SO3_sampling.py
Outdated
e_1_min = np.cos(np.deg2rad(max_angle/2)) | ||
u_1_max = 1 - np.square(e_1_min) | ||
u_2_min = np.arcsin(e_1_min) / 2 / np.pi | ||
u_1 = np.linspace(0,u_1_max,num=int(num_steps*(u_1_max)),endpoint=True) |
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.
Yup, putting a crude fix in for this
Good stuff! I'll let you merge yourself, @pc494. |
Description of the change
Improving the performance of the gridding utils by allowing a uniform sampling of a subspace (see #175 for details). I've also renamed a file to be more consistent with what I imagine this part of the code will look like in the future.
Progress of the PR
For reviewers
__init__.py
.unreleased section in
CHANGELOG.rst
.