Hide keyboard shortcuts

Hot-keys 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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

import unittest 

 

import numpy as np 

from numpy.testing import assert_allclose 

 

import astshim as ast 

from astshim.test import MappingTestCase 

 

 

class TestSlaMap(MappingTestCase): 

 

def test_SlaMap(self): 

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

slamap = ast.SlaMap() 

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

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

self.assertEqual(slamap.nIn, 2) 

self.assertEqual(slamap.nOut, 2) 

 

self.checkBasicSimplify(slamap) 

self.checkCopy(slamap) 

 

indata = np.array([ 

[0.0, 1.0, 3.0], 

[-0.5, 0.9, 0.1], 

]) 

outdata = slamap.applyForward(indata) 

pred_outdata = indata 

pred_outdata[0] = last - indata[0] 

assert_allclose(outdata, pred_outdata) 

 

self.checkRoundTrip(slamap, indata) 

self.checkMappingPersistence(slamap, indata) 

 

 

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

unittest.main()