pyCGM icon indicating copy to clipboard operation
pyCGM copied to clipboard

Refactored pelvis axis unit test only accurate to 5 decimal places

Open MattGonz opened this issue 4 years ago • 0 comments

The original test for pyCGM_Single/pyCGM.py/pelvisJointCenter expects the z component of the pelvis origin to equal 1032.89349365. https://github.com/cadop/pyCGM/blob/1750a62ccda8c60171ebe3d45f929c96e00a8300/pyCGM_Single/tests/test_pycgm_axis.py#L966

The new test for pelvisJointCenter (now pyCGM_Single/pyCGM.py/calc_axis_pelvis) expects the same value but in scientific notation: 1.03289349e+03

https://github.com/MattGonz/pyCGM/blob/15a9030e9c6e0835ab12f0e2bde0315488ce9b55/pyCGM_Single/tests/test_pycgm_axis.py#L973

It seems that when 1.03289349e+03 is evaluated and asserted almost equal to 1032.89349365 using np.testing.assert_almost_equal to six decimal places, the test fails.

image

Manual assertion: np.testing.assert_almost_equal(1032.89349365, 1032.89349, 6)

AssertionError:
Arrays are not almost equal to 6 decimals
 ACTUAL: 1032.89349365
 DESIRED: 1032.89349

MattGonz avatar Aug 27 '21 01:08 MattGonz