pbrod / nvector

Nvector is a suite of tools written in Python to solve geographical position calculations.
Other
57 stars 7 forks source link

test for test_n_E_and_wa2R_EL seems incorrect #7

Closed espinielli closed 5 years ago

espinielli commented 5 years ago

I have run the same test as in test_n_E_and_wa2R_EL using the reference Matlab implementation (using Octave) and the result is not the one used as Python test

        R_EL1 = [[0, 1.0, 0],
                 [1.0, 0, 0],
                 [0, 0, -1.0]]

but rather

>> n_E_and_wa2R_EL([0 0 1]', wander_azimuth = (pi / 2))
ans =

  -6.1230e-17  -1.0000e+00   6.1230e-17
  -1.0000e+00   6.1230e-17  -7.4983e-33
   3.7492e-33  -6.1230e-17  -1.0000e+00

HTH

pbrod commented 5 years ago

Thanks for the notification. I will fix this bug.

pbrod commented 5 years ago

It seems that the E_ROTATION_MATRIX in nvector._core is the culprit since it was given as a integer matrix. Thus the matrix multiplication of dot(R_Ee, n_E) in the n_E2lat_lon function was also an integer matrix so that the longitude was computed as arctan(0, 0) which is 0 instead of arctan(0.0, -0.0) which is pi.