Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottprahl committed May 1, 2024
1 parent 25ff308 commit 8c67a9a
Showing 1 changed file with 20 additions and 52 deletions.
72 changes: 20 additions & 52 deletions tests/test_one_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ def test_forward_01(self):
d_sphere = 2500
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
self.assertAlmostEqual(ur1, ur1a, delta=1e-5)
self.assertAlmostEqual(ut1, ut1a, delta=1e-5)
ut1a = tsph.MT(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=1e-4)
self.assertAlmostEqual(ut1, ut1a, delta=1e-4)

def test_forward_02(self):
"""Big gray sphere."""
Expand All @@ -44,16 +40,12 @@ def test_forward_02(self):
d_sphere = 2500
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0.9)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0.9)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
self.assertAlmostEqual(ur1, ur1a, delta=1e-5)
self.assertAlmostEqual(ut1, ut1a, delta=1e-5)
ut1a = tsph.MR(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=1e-4)
self.assertAlmostEqual(ut1, ut1a, delta=1e-4)

def test_forward_03(self):
"""Big nearly white sphere."""
Expand All @@ -63,14 +55,10 @@ def test_forward_03(self):
d_sphere = 2500
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0.98)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0.98)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=1e-4)
self.assertAlmostEqual(ut1, ut1a, delta=1e-4)

Expand All @@ -82,14 +70,10 @@ def test_forward_04(self):
d_sphere = 2500
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=1.0)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=1.0)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)

# actual result is complicated.
self.assertGreater(ur1, ur1a)
Expand All @@ -107,14 +91,10 @@ def test_forward_01(self):
d_sphere = 200
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=2e-4)
self.assertAlmostEqual(ut1, ut1a, delta=2e-4)

Expand All @@ -126,14 +106,10 @@ def test_forward_02(self):
d_sphere = 200
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0.9)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0.9)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=2e-3)
self.assertAlmostEqual(ut1, ut1a, delta=2e-3)

Expand All @@ -145,14 +121,10 @@ def test_forward_03(self):
d_sphere = 200
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=0.98)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=0.98)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)
self.assertAlmostEqual(ur1, ur1a, delta=2e-2)
self.assertAlmostEqual(ut1, ut1a, delta=2e-2)

Expand All @@ -164,14 +136,10 @@ def test_forward_04(self):
d_sphere = 200
d_sample = 10
rsph = iad.Sphere(d_sphere, d_sample, d_third=1, r_wall=1)
M = rsph.multiplier(UX1=ur1, URU=uru)
M100 = rsph.multiplier(UX1=1.0, URU=1.0)
ur1a = M / M100
ur1a = rsph.MR(ur1, uru)

tsph = iad.Sphere(d_sphere, d_sample, d_third=10, r_wall=1)
M = tsph.multiplier(UX1=ut1, URU=uru)
M100 = tsph.multiplier(UX1=1, URU=0.0)
ut1a = M / M100
ut1a = tsph.MT(ut1, uru)

# actual result is complicated.
self.assertGreater(ur1, ur1a)
Expand Down

0 comments on commit 8c67a9a

Please sign in to comment.