-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest_oh92.py
47 lines (33 loc) · 1009 Bytes
/
test_oh92.py
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
41
42
43
44
45
46
47
import unittest
import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__)) + os.sep + "..")
from sense.surface import Oh92
import numpy as np
class TestOh92(unittest.TestCase):
def setUp(self):
self.eps = 4.+0.j
self.ks = 1.
self.theta = 0.5
def tearDown(self):
pass
def test_init(self):
O = Oh92(self.eps, self.ks, self.theta)
def test_pq(self):
# test with inc=0
O = Oh92(self.eps, 0., 0.)
self.assertEqual(O.q, 0.)
self.assertEqual(O.p, 1.)
# some non zero inc
O = Oh92(self.eps, 0., np.pi)
self.assertEqual(O.q, 0.)
self.assertEqual(O.p, 49.)
def test_scat(self):
O = Oh92(self.eps, self.ks, self.theta)
self.assertEqual(O.hh, O.p*O.vv)
self.assertEqual(O.hv, O.q*O.vv)
def test_vv(self):
O = Oh92(self.eps, 0., self.theta)
self.assertEqual(O.vv, 0.)
if __name__ == '__main__':
unittest.main()