Re: [IMP-users] IMP-users Digest, Vol 30, Issue 6
Hi Dany,
We are considering removal of some of the Euler angle conversion functions, which are not frequently used by the IMP community and may not be numerically stable, while keeping only a few stable and well working ones that we will maintain.
But before we do that - can you let us know which ones are important to you? We don't want to remove something that you're already using :)
Best, Barak
On Tue, Jul 16, 2013 at 12:00 PM, imp-users-request@salilab.org wrote:
> Send IMP-users mailing list submissions to > imp-users@salilab.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://salilab.org/mailman/listinfo/imp-users > or, via email, send a message with subject or body 'help' to > imp-users-request@salilab.org > > You can reach the person managing the list at > imp-users-owner@salilab.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of IMP-users digest..." > > > Today's Topics: > > 1. Re: Rotations and Euler angles - possibly wrong > documentation/function names (Dan Cohen) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 16 Jul 2013 15:56:08 +0300 > From: Dan Cohen bojemoi@gmail.com > To: Help and discussion for users of IMP imp-users@salilab.org > Subject: Re: [IMP-users] Rotations and Euler angles - possibly wrong > documentation/function names > Message-ID: > <CAECL089r0AkEwebki37Xg5k31+_ZkcwvsHZuWuDE6eCjVh= > xFQ@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Thank you for your answer. > > I was able to pinpoint the problem - it is not a bug but it is a quite > confusing implementation so I would advise to change it. > Here goes : > > When using an zxz rotation (Implemented in FixedZXZ object) then : > A) When you print the object it will print the angles in this order : psi , > theta , phi > > Proof (From imp/modules/algebra/include/Rotation3D.h) > > FixedZXZ() {} > FixedZXZ(double psi, double theta, double phi) { > v_[0] = psi; > v_[1] = theta; > v_[2] = phi; > } > double get_psi() const { return v_[0]; } > double get_theta() const { return v_[1]; } > double get_phi() const { return v_[2]; } > IMP_SHOWABLE_INLINE(FixedZXZ, { > out << v_[0] << " " << v_[1] << " " << v_[2]; > }); > > ----- > > But when using the function get_rotation_from_fixed_zxz(double phi, double > theta, double psi) to create > such a rotation, you provide it with the Euler angles in a different order > : phi-theta-psi > > This causes in a situation in which writing the rotations to a file and > reading them back (while assuming > the same order of angles) caused me to get a different transform and > producing wrong results. > > Not a bug but quite confusing. BTW, When using the ZYZ variant the order IS > the same so there is no such problem. > > Could you confirm my understanding? > Thank you, > Dany > > > > > On 15 July 2013 21:22, Daniel Russel drussel@gmail.com wrote: > > > Sorry about the confusion. The Euler angle support has been added in a > > fairly ad hoc manner and is not extremely coherent or consistent. I think > > part of this is intrinsic to Euler angles as there are lots of > conventions > > used in different places. You can see some more discussion about what to > do > > with them at https://github.com/salilab/imp/issues/303. We didn't > > really come to any solid consensus on where to go. > > > > > > On Mon, Jul 15, 2013 at 6:59 AM, Dan Cohen bojemoi@gmail.com wrote: > > > >> Hello all, > >> > >> Please refer to Rotation3D.h > >> I add my remarks, all starting by XXXXXX : > >> > >> > >> /** \name Euler Angles > >> There are many conventions for how to define Euler angles, based on > >> choices > >> of which of the x,y,z axis to use in what order and whether the > >> rotation > >> axis is in the body frame (and hence affected by previous rotations) > >> or in > >> in a fixed frame. See > >> > >> > http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles > >> for a general description. > >> > >> - All Euler angles are specified in radians. > >> - The names are all \c rotation_from_{fixed/body}_abc() where abc is > >> the > >> ordering of x,y,z. > >> @{ > >> */ > >> > >> *XXXXXX According to that, functions with the word "fixed" in their name > >> should > >> * > >> *XXXXXX Use the Lab fixed axis for rotations and NOT the new axis. > >> * > >> > >> //! Initialize a rotation in x-y-z order from three angles > >> /** \param[in] xr Rotation around the X axis in radians > >> \param[in] yr Rotation around the Y axis in radians > >> \param[in] zr Rotation around the Z axis in radians > >> \note The three rotations are represented in the original (fixed) > >> coordinate frame. > >> See Rotation3D > >> See FixedXYZ > >> */ > >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_xyz(double xr, > double > >> yr, > >> double zr); > >> > >> *XXXXXX The above function complies with the above rule > >> * > >> //! Initialize a rotation from euler angles > >> /** > >> \param[in] phi Rotation around the Z axis in radians > >> \param[in] theta Rotation around the X axis in radians > >> \param[in] psi Rotation around the Z axis in radians > >> \note The first rotation is by an angle phi about the z-axis. > >> The second rotation is by an angle theta in [0,pi] about the > >> former x-axis , and the third rotation is by an angle psi > >> about the former z-axis. > >> See Rotation3D > >> */ > >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zxz(double phi, > >> double theta, > >> double psi); > >> > >> *XXXXXX I'm not sure what "former" means here, but probably this > >> function complies too. > >> XXXXXX Don't understand why angle parameter names are so different here > >> * > >> //! Generate a rotation object from Euler Angles > >> /** \note The first rotation is by an angle about the z-axis. > >> The second rotation is by an angle about the new y-axis. > >> The third rotation is by an angle about the new z-axis. > >> \param[in] Rot First Euler angle (radians) defining the rotation (Z > >> axis) > >> \param[in] Tilt Second Euler angle (radians) defining the rotation > (Y > >> axis) > >> \param[in] Psi Third Euler angle (radians) defining the rotation (Z > >> axis) > >> See Rotation3D > >> See FixedZYZ > >> */ > >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zyz(double Rot, > >> double Tilt, > >> double Psi); > >> > >> *XXXXXX This function is also called fixed but clearly says it is using > >> the NEW axis. > >> * > >> > >> I'm confused and add to that , the fact that the results of these > >> functions seem to be different than the ones produced by Chimera's > rotate > >> function so I'm in a problem here. > >> > >> Thank you, > >> Dany > >> > >> > >> _______________________________________________ > >> IMP-users mailing list > >> IMP-users@salilab.org > >> https://salilab.org/mailman/listinfo/imp-users > >> > >> > > > > _______________________________________________ > > IMP-users mailing list > > IMP-users@salilab.org > > https://salilab.org/mailman/listinfo/imp-users > > > > >
Hello Barak, Thank you for your responses.
I have been using : IMP.algebra.get_rotation_from_fixed_xyz Which provides the XYZ angles in the fixed "lab" coordinate system. It works well and I was able to use the results and feed them into our own algorithms.
Thank you, Dany
On 17 July 2013 00:38, Barak Raveh barak.raveh@gmail.com wrote:
> Hi Dany, > > We are considering removal of some of the Euler angle conversion > functions, which are not frequently used by the IMP community and may not > be numerically stable, while keeping only a few stable and well working > ones that we will maintain. > > But before we do that - can you let us know which ones are important to > you? We don't want to remove something that you're already using :) > > Best, > Barak > > > On Tue, Jul 16, 2013 at 12:00 PM, imp-users-request@salilab.org wrote: > >> Send IMP-users mailing list submissions to >> imp-users@salilab.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://salilab.org/mailman/listinfo/imp-users >> or, via email, send a message with subject or body 'help' to >> imp-users-request@salilab.org >> >> You can reach the person managing the list at >> imp-users-owner@salilab.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of IMP-users digest..." >> >> >> Today's Topics: >> >> 1. Re: Rotations and Euler angles - possibly wrong >> documentation/function names (Dan Cohen) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Tue, 16 Jul 2013 15:56:08 +0300 >> From: Dan Cohen bojemoi@gmail.com >> To: Help and discussion for users of IMP imp-users@salilab.org >> Subject: Re: [IMP-users] Rotations and Euler angles - possibly wrong >> documentation/function names >> Message-ID: >> <CAECL089r0AkEwebki37Xg5k31+_ZkcwvsHZuWuDE6eCjVh= >> xFQ@mail.gmail.com> >> Content-Type: text/plain; charset="iso-8859-1" >> >> Thank you for your answer. >> >> I was able to pinpoint the problem - it is not a bug but it is a quite >> confusing implementation so I would advise to change it. >> Here goes : >> >> When using an zxz rotation (Implemented in FixedZXZ object) then : >> A) When you print the object it will print the angles in this order : psi >> , >> theta , phi >> >> Proof (From imp/modules/algebra/include/Rotation3D.h) >> >> FixedZXZ() {} >> FixedZXZ(double psi, double theta, double phi) { >> v_[0] = psi; >> v_[1] = theta; >> v_[2] = phi; >> } >> double get_psi() const { return v_[0]; } >> double get_theta() const { return v_[1]; } >> double get_phi() const { return v_[2]; } >> IMP_SHOWABLE_INLINE(FixedZXZ, { >> out << v_[0] << " " << v_[1] << " " << v_[2]; >> }); >> >> ----- >> >> But when using the function get_rotation_from_fixed_zxz(double phi, double >> theta, double psi) to create >> such a rotation, you provide it with the Euler angles in a different order >> : phi-theta-psi >> >> This causes in a situation in which writing the rotations to a file and >> reading them back (while assuming >> the same order of angles) caused me to get a different transform and >> producing wrong results. >> >> Not a bug but quite confusing. BTW, When using the ZYZ variant the order >> IS >> the same so there is no such problem. >> >> Could you confirm my understanding? >> Thank you, >> Dany >> >> >> >> >> On 15 July 2013 21:22, Daniel Russel drussel@gmail.com wrote: >> >> > Sorry about the confusion. The Euler angle support has been added in a >> > fairly ad hoc manner and is not extremely coherent or consistent. I >> think >> > part of this is intrinsic to Euler angles as there are lots of >> conventions >> > used in different places. You can see some more discussion about what >> to do >> > with them at https://github.com/salilab/imp/issues/303. We didn't >> > really come to any solid consensus on where to go. >> > >> > >> > On Mon, Jul 15, 2013 at 6:59 AM, Dan Cohen bojemoi@gmail.com wrote: >> > >> >> Hello all, >> >> >> >> Please refer to Rotation3D.h >> >> I add my remarks, all starting by XXXXXX : >> >> >> >> >> >> /** \name Euler Angles >> >> There are many conventions for how to define Euler angles, based on >> >> choices >> >> of which of the x,y,z axis to use in what order and whether the >> >> rotation >> >> axis is in the body frame (and hence affected by previous >> rotations) >> >> or in >> >> in a fixed frame. See >> >> >> >> >> http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles >> >> for a general description. >> >> >> >> - All Euler angles are specified in radians. >> >> - The names are all \c rotation_from_{fixed/body}_abc() where abc >> is >> >> the >> >> ordering of x,y,z. >> >> @{ >> >> */ >> >> >> >> *XXXXXX According to that, functions with the word "fixed" in their >> name >> >> should >> >> * >> >> *XXXXXX Use the Lab fixed axis for rotations and NOT the new axis. >> >> * >> >> >> >> //! Initialize a rotation in x-y-z order from three angles >> >> /** \param[in] xr Rotation around the X axis in radians >> >> \param[in] yr Rotation around the Y axis in radians >> >> \param[in] zr Rotation around the Z axis in radians >> >> \note The three rotations are represented in the original (fixed) >> >> coordinate frame. >> >> See Rotation3D >> >> See FixedXYZ >> >> */ >> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_xyz(double xr, >> double >> >> yr, >> >> double zr); >> >> >> >> *XXXXXX The above function complies with the above rule >> >> * >> >> //! Initialize a rotation from euler angles >> >> /** >> >> \param[in] phi Rotation around the Z axis in radians >> >> \param[in] theta Rotation around the X axis in radians >> >> \param[in] psi Rotation around the Z axis in radians >> >> \note The first rotation is by an angle phi about the z-axis. >> >> The second rotation is by an angle theta in [0,pi] about the >> >> former x-axis , and the third rotation is by an angle psi >> >> about the former z-axis. >> >> See Rotation3D >> >> */ >> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zxz(double phi, >> >> double theta, >> >> double psi); >> >> >> >> *XXXXXX I'm not sure what "former" means here, but probably this >> >> function complies too. >> >> XXXXXX Don't understand why angle parameter names are so different here >> >> * >> >> //! Generate a rotation object from Euler Angles >> >> /** \note The first rotation is by an angle about the z-axis. >> >> The second rotation is by an angle about the new y-axis. >> >> The third rotation is by an angle about the new z-axis. >> >> \param[in] Rot First Euler angle (radians) defining the rotation (Z >> >> axis) >> >> \param[in] Tilt Second Euler angle (radians) defining the rotation >> (Y >> >> axis) >> >> \param[in] Psi Third Euler angle (radians) defining the rotation (Z >> >> axis) >> >> See Rotation3D >> >> See FixedZYZ >> >> */ >> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zyz(double Rot, >> >> double Tilt, >> >> double Psi); >> >> >> >> *XXXXXX This function is also called fixed but clearly says it is using >> >> the NEW axis. >> >> * >> >> >> >> I'm confused and add to that , the fact that the results of these >> >> functions seem to be different than the ones produced by Chimera's >> rotate >> >> function so I'm in a problem here. >> >> >> >> Thank you, >> >> Dany >> >> >> >> >> >> _______________________________________________ >> >> IMP-users mailing list >> >> IMP-users@salilab.org >> >> https://salilab.org/mailman/listinfo/imp-users >> >> >> >> >> > >> > _______________________________________________ >> > IMP-users mailing list >> > IMP-users@salilab.org >> > https://salilab.org/mailman/listinfo/imp-users >> > >> > >>
Hi Dan, This method is indeed stable and will be kept as part of IMP. Best, Barak
On Sun, Jul 21, 2013 at 5:46 AM, Dan Cohen bojemoi@gmail.com wrote:
> Hello Barak, Thank you for your responses. > > I have been using : IMP.algebra.get_rotation_from_fixed_xyz > Which provides the XYZ angles in the fixed "lab" coordinate system. > It works well and I was able to use the results and feed them into our own > algorithms. > > Thank you, > Dany > > > On 17 July 2013 00:38, Barak Raveh barak.raveh@gmail.com wrote: > >> Hi Dany, >> >> We are considering removal of some of the Euler angle conversion >> functions, which are not frequently used by the IMP community and may not >> be numerically stable, while keeping only a few stable and well working >> ones that we will maintain. >> >> But before we do that - can you let us know which ones are important to >> you? We don't want to remove something that you're already using :) >> >> Best, >> Barak >> >> >> On Tue, Jul 16, 2013 at 12:00 PM, imp-users-request@salilab.org wrote: >> >>> Send IMP-users mailing list submissions to >>> imp-users@salilab.org >>> >>> To subscribe or unsubscribe via the World Wide Web, visit >>> https://salilab.org/mailman/listinfo/imp-users >>> or, via email, send a message with subject or body 'help' to >>> imp-users-request@salilab.org >>> >>> You can reach the person managing the list at >>> imp-users-owner@salilab.org >>> >>> When replying, please edit your Subject line so it is more specific >>> than "Re: Contents of IMP-users digest..." >>> >>> >>> Today's Topics: >>> >>> 1. Re: Rotations and Euler angles - possibly wrong >>> documentation/function names (Dan Cohen) >>> >>> >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Tue, 16 Jul 2013 15:56:08 +0300 >>> From: Dan Cohen bojemoi@gmail.com >>> To: Help and discussion for users of IMP imp-users@salilab.org >>> Subject: Re: [IMP-users] Rotations and Euler angles - possibly wrong >>> documentation/function names >>> Message-ID: >>> <CAECL089r0AkEwebki37Xg5k31+_ZkcwvsHZuWuDE6eCjVh= >>> xFQ@mail.gmail.com> >>> Content-Type: text/plain; charset="iso-8859-1" >>> >>> Thank you for your answer. >>> >>> I was able to pinpoint the problem - it is not a bug but it is a quite >>> confusing implementation so I would advise to change it. >>> Here goes : >>> >>> When using an zxz rotation (Implemented in FixedZXZ object) then : >>> A) When you print the object it will print the angles in this order : >>> psi , >>> theta , phi >>> >>> Proof (From imp/modules/algebra/include/Rotation3D.h) >>> >>> FixedZXZ() {} >>> FixedZXZ(double psi, double theta, double phi) { >>> v_[0] = psi; >>> v_[1] = theta; >>> v_[2] = phi; >>> } >>> double get_psi() const { return v_[0]; } >>> double get_theta() const { return v_[1]; } >>> double get_phi() const { return v_[2]; } >>> IMP_SHOWABLE_INLINE(FixedZXZ, { >>> out << v_[0] << " " << v_[1] << " " << v_[2]; >>> }); >>> >>> ----- >>> >>> But when using the function get_rotation_from_fixed_zxz(double phi, >>> double >>> theta, double psi) to create >>> such a rotation, you provide it with the Euler angles in a different >>> order >>> : phi-theta-psi >>> >>> This causes in a situation in which writing the rotations to a file and >>> reading them back (while assuming >>> the same order of angles) caused me to get a different transform and >>> producing wrong results. >>> >>> Not a bug but quite confusing. BTW, When using the ZYZ variant the order >>> IS >>> the same so there is no such problem. >>> >>> Could you confirm my understanding? >>> Thank you, >>> Dany >>> >>> >>> >>> >>> On 15 July 2013 21:22, Daniel Russel drussel@gmail.com wrote: >>> >>> > Sorry about the confusion. The Euler angle support has been added in a >>> > fairly ad hoc manner and is not extremely coherent or consistent. I >>> think >>> > part of this is intrinsic to Euler angles as there are lots of >>> conventions >>> > used in different places. You can see some more discussion about what >>> to do >>> > with them at https://github.com/salilab/imp/issues/303. We didn't >>> > really come to any solid consensus on where to go. >>> > >>> > >>> > On Mon, Jul 15, 2013 at 6:59 AM, Dan Cohen bojemoi@gmail.com wrote: >>> > >>> >> Hello all, >>> >> >>> >> Please refer to Rotation3D.h >>> >> I add my remarks, all starting by XXXXXX : >>> >> >>> >> >>> >> /** \name Euler Angles >>> >> There are many conventions for how to define Euler angles, based >>> on >>> >> choices >>> >> of which of the x,y,z axis to use in what order and whether the >>> >> rotation >>> >> axis is in the body frame (and hence affected by previous >>> rotations) >>> >> or in >>> >> in a fixed frame. See >>> >> >>> >> >>> http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles >>> >> for a general description. >>> >> >>> >> - All Euler angles are specified in radians. >>> >> - The names are all \c rotation_from_{fixed/body}_abc() where abc >>> is >>> >> the >>> >> ordering of x,y,z. >>> >> @{ >>> >> */ >>> >> >>> >> *XXXXXX According to that, functions with the word "fixed" in their >>> name >>> >> should >>> >> * >>> >> *XXXXXX Use the Lab fixed axis for rotations and NOT the new axis. >>> >> * >>> >> >>> >> //! Initialize a rotation in x-y-z order from three angles >>> >> /** \param[in] xr Rotation around the X axis in radians >>> >> \param[in] yr Rotation around the Y axis in radians >>> >> \param[in] zr Rotation around the Z axis in radians >>> >> \note The three rotations are represented in the original (fixed) >>> >> coordinate frame. >>> >> See Rotation3D >>> >> See FixedXYZ >>> >> */ >>> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_xyz(double xr, >>> double >>> >> yr, >>> >> double zr); >>> >> >>> >> *XXXXXX The above function complies with the above rule >>> >> * >>> >> //! Initialize a rotation from euler angles >>> >> /** >>> >> \param[in] phi Rotation around the Z axis in radians >>> >> \param[in] theta Rotation around the X axis in radians >>> >> \param[in] psi Rotation around the Z axis in radians >>> >> \note The first rotation is by an angle phi about the z-axis. >>> >> The second rotation is by an angle theta in [0,pi] about the >>> >> former x-axis , and the third rotation is by an angle psi >>> >> about the former z-axis. >>> >> See Rotation3D >>> >> */ >>> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zxz(double phi, >>> >> double theta, >>> >> double psi); >>> >> >>> >> *XXXXXX I'm not sure what "former" means here, but probably this >>> >> function complies too. >>> >> XXXXXX Don't understand why angle parameter names are so different >>> here >>> >> * >>> >> //! Generate a rotation object from Euler Angles >>> >> /** \note The first rotation is by an angle about the z-axis. >>> >> The second rotation is by an angle about the new y-axis. >>> >> The third rotation is by an angle about the new z-axis. >>> >> \param[in] Rot First Euler angle (radians) defining the rotation >>> (Z >>> >> axis) >>> >> \param[in] Tilt Second Euler angle (radians) defining the >>> rotation (Y >>> >> axis) >>> >> \param[in] Psi Third Euler angle (radians) defining the rotation >>> (Z >>> >> axis) >>> >> See Rotation3D >>> >> See FixedZYZ >>> >> */ >>> >> IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zyz(double Rot, >>> >> double Tilt, >>> >> double Psi); >>> >> >>> >> *XXXXXX This function is also called fixed but clearly says it is >>> using >>> >> the NEW axis. >>> >> * >>> >> >>> >> I'm confused and add to that , the fact that the results of these >>> >> functions seem to be different than the ones produced by Chimera's >>> rotate >>> >> function so I'm in a problem here. >>> >> >>> >> Thank you, >>> >> Dany >>> >> >>> >> >>> >> _______________________________________________ >>> >> IMP-users mailing list >>> >> IMP-users@salilab.org >>> >> https://salilab.org/mailman/listinfo/imp-users >>> >> >>> >> >>> > >>> > _______________________________________________ >>> > IMP-users mailing list >>> > IMP-users@salilab.org >>> > https://salilab.org/mailman/listinfo/imp-users >>> > >>> > >>>
participants (2)
-
Barak Raveh
-
Dan Cohen