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

38

39

40

import unittest 

 

import numpy as np 

from numpy.testing import assert_allclose 

 

import astshim as ast 

from astshim.test import MappingTestCase 

 

 

class TestZoomMap(MappingTestCase): 

 

def test_basics(self): 

"""Test basics of ZoomMap including applyForward 

""" 

for nin in (1, 2, 3): 

for zoom in (1.0, -1.1, 359.3): 

zoommap = ast.ZoomMap(nin, zoom) 

self.assertEqual(zoommap.className, "ZoomMap") 

self.assertEqual(zoommap.nIn, nin) 

self.assertEqual(zoommap.nOut, nin) 

self.assertTrue(zoommap.isLinear) 

 

self.checkBasicSimplify(zoommap) 

self.checkCopy(zoommap) 

 

indata = np.array([ 

[1.0, 2.0, -6.0, 30.0, 1.0], 

[3.0, 99.0, -5.0, 21.0, 0.0], 

[-5.0, 3.0, -7.0, 37.0, 0.0], 

[7.0, -23.0, -3.0, 45.0, 0.0], 

], dtype=float)[0:nin] 

self.checkRoundTrip(zoommap, indata) 

self.checkMappingPersistence(zoommap, indata) 

 

topos = zoommap.applyForward(indata) 

assert_allclose(indata * zoom, topos) 

 

 

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

unittest.main()