test failures due to float non equality
On my system I'm seeing the following test failures:
servo:~/ligo/src/calibration/pydarm [master*] 0$ PYTHONPATH=~/ligo/src/python-declarative:~/ligo/src/dtt2hdf python3 -m unittest discover -p '*_test.py'
....................F....F...............
======================================================================
FAIL: test_compute_epics_records (test.darm_test.TestComputeEpicsRecords)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jrollins/ligo/src/calibration/pydarm/test/darm_test.py", line 438, in test_compute_epics_records
self.assertAlmostEqual(
AssertionError: 1.0000001359402821 != 1.0 within 7 places (1.3594028214214404e-07 difference)
======================================================================
FAIL: test_measurement_class (test.measurement_test.TestGetRawTF)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jrollins/ligo/src/calibration/pydarm/test/measurement_test.py", line 53, in test_measurement_class
self.assertAlmostEqual(self.angle_from_dtt[n],
AssertionError: 128.63558380911294 != -128.63558959960938 within 4 places (257.27117340872235 difference)
----------------------------------------------------------------------
Ran 41 tests in 8.078s
FAILED (failures=2)
servo:~/ligo/src/calibration/pydarm [master*] 1$
The values being testing appear to be equal within the specified precision, so what's going on? I inspected the types and note that they are <class 'numpy.float64'>
and <class 'numpy.float32'>
respectively, which I assume must account for it. Should we cast them to the same type for the test?
Edited by Jameson Rollins