Coverage for tests/test_slaMap.py: 35%

24 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-11-08 21:54 -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 TestSlaMap(MappingTestCase): 

11 

12 def test_SlaMap(self): 

13 last = 0.1 # an arbitrary value small enough to avoid wrap 

14 slamap = ast.SlaMap() 

15 slamap.add("R2H", [last]) 

16 self.assertEqual(slamap.className, "SlaMap") 

17 self.assertEqual(slamap.nIn, 2) 

18 self.assertEqual(slamap.nOut, 2) 

19 

20 self.checkBasicSimplify(slamap) 

21 self.checkCopy(slamap) 

22 

23 indata = np.array([ 

24 [0.0, 1.0, 3.0], 

25 [-0.5, 0.9, 0.1], 

26 ]) 

27 outdata = slamap.applyForward(indata) 

28 pred_outdata = indata 

29 pred_outdata[0] = last - indata[0] 

30 assert_allclose(outdata, pred_outdata) 

31 

32 self.checkRoundTrip(slamap, indata) 

33 self.checkMappingPersistence(slamap, indata) 

34 

35 

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

37 unittest.main()