harmonica icon indicating copy to clipboard operation
harmonica copied to clipboard

Refactor code to have a single `Ellipsoid` class

Open santisoler opened this issue 1 month ago • 1 comments

Refactor the ellipsoid code to have a single Ellipsoid class that can represent any type of ellipsoid. Ditch the specific classes for each ellipsoid type. Update the forward modelling code for gravity and magnetics. Make use of an extra rotation matrix that aligns the x, y, z local coordinate system to the ellipsoid's semiaxes in decreasing order, so a >= b >= c. Modify the analytic solutions for oblate ellipsoids in such way that they are defined by a == b > c (instead of a < b = c as Takahashi et al. and Clark et al. do). Make rotation angles and center as optional arguments for the Ellipsoid class. Fix numerical instabilities of triaxial ellipsoids when they approximate prolate or oblate ellipsoids (when two semiaxes lengths are close enough to each other). Update the tests and add a few more for the new bits of code.

Relevant issues/PRs:

Part of #594

santisoler avatar Dec 01 '25 19:12 santisoler

TODO:

  • [x] add tests for the ~get_permutation_matrix~ get_semiaxes_rotation_matrix function (fixed a bug on it)
  • [x] test gravity and magnetic fields of triaxial ellipsoids vs oblates and prolates (when two of the semiaxes are similar to each other).

santisoler avatar Dec 01 '25 20:12 santisoler