Coverage for tests/test_quadApprox.py: 53%

15 statements  

« prev     ^ index     » next       coverage.py v7.2.1, created at 2023-03-12 01:17 -0800

1import unittest 

2 

3import numpy as np 

4from numpy.testing import assert_allclose 

5 

6import astshim as ast 

7from astshim.test import MappingTestCase 

8 

9 

10class TestQuadApprox(MappingTestCase): 

11 

12 def test_QuadApprox(self): 

13 # simple parabola 

14 coeff_f = np.array([ 

15 [0.5, 1, 2, 0], 

16 [0.5, 1, 0, 2], 

17 ], dtype=float) 

18 polymap = ast.PolyMap(coeff_f, 1) 

19 qa = ast.QuadApprox(polymap, [-1, -1], [1, 1], 3, 3) 

20 self.assertAlmostEqual(qa.rms, 0) 

21 self.assertEqual(len(qa.fit), 6) 

22 assert_allclose(qa.fit, [0, 0, 0, 0, 0.5, 0.5]) 

23 

24 

25if __name__ == "__main__": 25 ↛ 26line 25 didn't jump to line 26, because the condition on line 25 was never true

26 unittest.main()