Giter VIP home page Giter VIP logo

Comments (5)

MarkWieczorek avatar MarkWieczorek commented on May 26, 2024

I think that this is correct. The documentation says

Note that this routine uses the “y convention”, where the second rotation is with respect to the new y axis. If alpha, beta, and gamma were originally defined in terms of the “x convention”, where the second rotation was with respect to the new x axis, the Euler angles according to the y convention would be alpha_y=alpha_x-pi/2, beta_x=beta_y, and gamma_y=gamma_x+pi/2.

Now, according to http://mathworld.wolfram.com/EulerAngles.html, the conversion from x to y convention is the same as in the above documentation. Nevertheless, I acknowledge that these definitions are very confusing, so I could be wrong.

from shtools.

dogod621 avatar dogod621 commented on May 26, 2024

You are right, I make mistake when calculate ZYZ and ZXZ matrix.
Sorry for I didn't check the calculation twice.

So does rotate function in SHCoeffs class use euler angle ZYZ as parameters?
Is code in src/SHRotateCoef.f95 line 110 not performing x-convention to y-convention, but something else?

    alpha = alpha - pi2
    gamma = gamma + pi2
    beta = -beta

if that is true,
then the code comment in https://shtools.oca.eu/shtools/pages/mydoc/notebooks/tutorial_3.html is wrong.

...
alpha = 0.  # around z-axis
beta = 90.  # around x-axis (lon=0)
gamma = 10.  # around z-axis again

coeffs_l5m0_rot = coeffs_l5m0.rotate(alpha, beta, gamma, degrees=True)
...

from shtools.

MarkWieczorek avatar MarkWieczorek commented on May 26, 2024

Could you try doing a calculating to see if you get the result you expect? I did not write the rotation routine, and it is quite possible that the snippet of code you extracted from within the routine is correct.

from shtools.

MarkWieczorek avatar MarkWieczorek commented on May 26, 2024

I figured it out. All of the documentation for the functions is correct: SHTOOLS uses the y-convention, and the default is to rotate the coordinate system, not the physical body. However, the description in the tutorial is indeed wrong. I have updated this with the following:

The rotations are specified by the three Euler angles alpha, beta, and gamma. There are several different conventions for specifying these angles, and they can either provide the angles for rotating the physical body or coordinate system. Please read the documentation of this method carefully before proceeding! SHTOOLS uses the "y-convention" where the three angles correspond to (in this order):

Rotation about the z axis by alpha,
Rotation about the new y axis by beta,
Rotation about the new z axis by gamma.

By using the angles alpha, beta, and gamma as is, the coordinate system will be rotated without rotation of the physical body. To instead rotate the physical body, and not the coordinate system, you would specify the angles -gamma, -beta, and -alpha.

Then, the example is

alpha = 30.  # rotation around the initial z-axis
beta = 90.  # rotation aroung the new y-axis
gamma = 0.  # rotation around the new z-axis

coeffs_l5m0_rot = coeffs_l5m0.rotate(-gamma, -beta, -alpha, degrees=True)

I hope this clears things up. I really hate rotation angles...

from shtools.

dogod621 avatar dogod621 commented on May 26, 2024

Thanks man, i hate rotation angles too

from shtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.