-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fix inherited methods in the Orientation class #373
Comments
question about this because it came up, what should happen in the following situation? from orix.quaternion import Orientation, symmetry
pg432 = symmetry.O
pg622 = symmetry.get_point_group(180)
o1 = Orientation((1, 0, 0, 0), symmetry=pg432)
o2 = Orientation((1, 0, 0, 0), symmetry=pg622)
r1 = Rotation((1, 0, 0, 0))
r2 = Rotation((1, 0, 0, 0))
m12 = o1 - o2
m21 = o2 - o1
what should Also, same question for Also not sure how If you let me know how you want it, I can write this code, it was on my todo list anyway. functions to fix are |
Thank you for listing these use cases, we should provide sensible returns for all of them. I've updated the top comment with your suggestions. This #249 (comment) by @harripj on the (undocumented) misorientation convention in orix might be relevant. We discussed somewhere, and decided I believe, to retire the |
Okay, my two cents: I really like the orix convention that for all combinations of Rot/Ori/Mis, AB gives the same class as B. in that sense, I don't care too much for the o1~o2, since it implies ~o1*o2 should do the inverse, and it also goes against the class inheritance convention just described. In that way, I like having o1 - o2, because it describes a different process, and refers to the delta between the two orientations, which is more or less what a misorientation is. That said, I brought it up to @paytonej, (my old boss), and they disagree, they see AB as matrix multiplication, and in that sense (o1o2.T) should just give a misorientaion. this more or less agrees with what @harripj is saying, and also makes sense too. |
I like the interpretation of |
I like your explanation @hakonanes and maybe it could find its way into the docs at some point (if not there already!). I would also be in favour of keeping the subtract syntax as it is more simple for the user. I also think the syntax implies a directionality, |
Alright, I like that logic. Followup to all this then, for symmetry inheritance, I was going to write everything to stick to the following rules:
L_CS = (A._symmetry[0], B._symmetry[0])
R_CS = (A._symmetry[1], B._symmetry[1])
AB._symmetry = (L_CS, R_CS)
if B.__class__ == Orientation, AB._symmetry[0] = C1
This way, you CAN multiply orientations from different crystal symmetries (it drives me nuts that MTEX wont allow this), but it warns you that you are making a dangerous move. Also, it makes it obvious when a misorientation or orientation was multiplied by an improper symmetry object, but doesn't punish you for multiplying by something with a symmetry of C1. |
I think your rules look reasonable, apart from rule 3 which I don't understand: Will a resulting misorientation's |
There has to be a more elegant way to do this, but I imagined it like this: o1._symmetry = S1
o2._symmetry = S2
m12._symmetry[0] = Symmetry(np.vstack([S1[0].data, S2[0].data]))
m12._symmetry[1] = Symmetry(np.vstack([S1[1].data, S2[1].data])) would work the same for |
The
Orientation
class inherits methods and properties fromRotation
,Quaternion
andObject3d
. Currently, these methods and attributes aren't handled properly (e.g. symmetry isn't kept):Rotation
__mul__()
: which object with which symmetry (if any) should be returned?Quaternion
mean()
Object3d
Please add methods and attributes missing from the lists.
The text was updated successfully, but these errors were encountered: