sot / Quaternion

Quaternion manipulation
https://sot.github.io/Quaternion
BSD 3-Clause "New" or "Revised" License
3 stars 7 forks source link

Ska.quatutil test now fails against master #17

Closed jeanconn closed 4 years ago

jeanconn commented 4 years ago

Running ska_testr on Ska.quatutil, it looks like test_quat_x_to_vec is failing. I suspect this is due to it just testing something it shouldn't be testing, but haven't looked at it in detail.

This is probably not a bug in Quaternion but I'm going to label it a bug here for the time being so we don't promote without understanding it.

jeanconn commented 4 years ago
platform linux -- Python 3.6.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 -- /fido.real/ska3/envs/ska3quat/bin/python
cachedir: .cache
rootdir: /proj/sot/ska/jeanproj/git/ska_testr/outputs/41eef3d_Linux_x86_64_fido/Ska.quatutil/Ska.quatutil, inifile:
plugins: remotedata-0.3.0, openfiles-0.3.0, doctestplus-0.1.3, arraydiff-0.2
collected 8 items                                                               

test_quatutils.py::test_radec2eci PASSED
test_quatutils.py::test_radec2yagzag PASSED
test_quatutils.py::test_eci2radec PASSED
test_quatutils.py::test_vectorized_eci2radec PASSED
test_quatutils.py::test_yagzag2radec PASSED
test_quatutils.py::test_vectorized_radec PASSED
test_quatutils.py::test_vectorized_yagzag PASSED
test_quatutils.py::test_quat_x_to_vec keep_z [ 0.15466882 -0.48099577  0.86297197] [[ 0.15466882 -0.48099577  0.86297197]]
FAILED

=================================== FAILURES ===================================
______________________________ test_quat_x_to_vec ______________________________

    def test_quat_x_to_vec():
        vecs = np.random.random((100, 3)) - 0.5
        for vec in vecs:
            vec = Ska.quatutil._norm(vec)
            for method in ('keep_z', 'shortest', 'radec'):
                q = Ska.quatutil.quat_x_to_vec(vec, method)
                vec1 = np.dot(q.transform, [1.0, 0, 0])
                print(method, vec, vec1)
                for i in range(3):
>                   assert_almost_equal(vec[i], vec1[i])

test_quatutils.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nose.tools.trivial.Dummy testMethod=nop>, first = 0.15466882093447784
second = array([ 0.15466882, -0.48099577,  0.86297197]), places = None
msg = None, delta = None

    def assertAlmostEqual(self, first, second, places=None, msg=None,
                          delta=None):
        """Fail if the two objects are unequal as determined by their
               difference rounded to the given number of decimal places
               (default 7) and comparing to zero, or by comparing that the
               between the two objects is more than the given delta.

               Note that decimal places (from zero) are usually not the same
               as significant digits (measured from the most significant digit).

               If the two objects compare equal then they will automatically
               compare almost equal.
            """
>       if first == second:
E       ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
javierggt commented 4 years ago

This failure is also fixed by PR #19. It happens in line 123 of quatutil.py