Weighted mean quaternion/orientation #435
DorianDepriester
started this conversation in
Ideas
Replies: 2 comments 5 replies
2 replies
|
Yet, as another step toward complexity, let's assume that one wants to use a matrix of weights. The following function seems to work without any loop: def weighted_mean_matrix(o, mat):
o2 = o.map_into_symmetry_reduced_zone()
q = o2.data
qq = np.einsum('pi,ij,ik->pjk', mat, q, q)
w, v = np.linalg.eig(qq)
w_max = np.argmax(w, axis=1)
q_mean= v[np.arange(mat.shape[0]), :, w_max]
return Orientation(Quaternion(q_mean), o.symmetry)Again, this should be tested (as made above) |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
Hello,
I was looking for a way to compute the weighted mean orientation of crystals. Starting from the discussion in issue #434, and mixing it with the current implementation of the mean method(), together with the the full Eq. (13) in the given reference, I ended with this:
I am probably wrong (that's why I haven't made a pull request). Anyway, I think this feature could be useful (at least for me 😉).
All reactions