Coverage for tests/test_shiftMap.py: 38%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

22 statements  

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 TestShiftMap(MappingTestCase): 

11 

12 def test_ShiftMapBasics(self): 

13 offset = np.array([1.1, -2.2, 3.3]) 

14 shiftmap = ast.ShiftMap(offset) 

15 self.assertEqual(shiftmap.className, "ShiftMap") 

16 self.assertEqual(shiftmap.nIn, 3) 

17 self.assertEqual(shiftmap.nOut, 3) 

18 

19 self.checkBasicSimplify(shiftmap) 

20 self.checkCopy(shiftmap) 

21 

22 indata = np.array([ 

23 [1.1, -43.5], 

24 [2.2, 1309.31], 

25 [3.3, 0.005], 

26 ]) 

27 outdata = shiftmap.applyForward(indata) 

28 pred_outdata = (indata.T + offset).T 

29 assert_allclose(outdata, pred_outdata) 

30 self.checkRoundTrip(shiftmap, indata) 

31 self.checkMappingPersistence(shiftmap, indata) 

32 

33 

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

35 unittest.main()