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

from __future__ import absolute_import, division, print_function 

import unittest 

 

import numpy as np 

from numpy.testing import assert_allclose 

 

import astshim as ast 

from astshim.test import MappingTestCase 

 

 

class TestQuadApprox(MappingTestCase): 

 

def test_QuadApprox(self): 

# simple parabola 

coeff_f = np.array([ 

[0.5, 1, 2, 0], 

[0.5, 1, 0, 2], 

], dtype=float) 

polymap = ast.PolyMap(coeff_f, 1) 

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

self.assertAlmostEqual(qa.rms, 0) 

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

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

 

 

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

unittest.main()