summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_cache.py2
-rw-r--r--test/test_parabola.py10
-rw-r--r--test/test_rayleigh.py2
-rw-r--r--test/test_reemission.py3
4 files changed, 9 insertions, 8 deletions
diff --git a/test/test_cache.py b/test/test_cache.py
index b6b40d9..3ea10aa 100644
--- a/test/test_cache.py
+++ b/test/test_cache.py
@@ -1,4 +1,4 @@
-from unittest_find from unittest_find import unittest
+from unittest_find import unittest
import os
import shutil
import tempfile
diff --git a/test/test_parabola.py b/test/test_parabola.py
index 54708d7..fee8c0d 100644
--- a/test/test_parabola.py
+++ b/test/test_parabola.py
@@ -7,7 +7,7 @@ from numpy.testing import assert_almost_equal
class Test1D(unittest.TestCase):
def setUp(self):
self.x = numpy.array([[-1.0], [0.0], [1.0]])
- self.y = unumpy.uarray(([2.0, 1.0, 6.0], [0.1, 0.1, 0.1]))
+ self.y = unumpy.uarray([2.0, 1.0, 6.0], [0.1, 0.1, 0.1])
self.a = 1.0
self.b = numpy.array([2.0])
self.c = numpy.array([[3.0]])
@@ -25,9 +25,9 @@ class Test1D(unittest.TestCase):
assert_almost_equal(c[0,0].nominal_value, 3.0)
# Compare to ROOT TGraph fitting uncerts
- assert_almost_equal(a.std_dev(), 0.1)
- assert_almost_equal(b[0].std_dev(), 0.0707107)
- assert_almost_equal(c[0,0].std_dev(), 0.122474, decimal=5)
+ assert_almost_equal(a.std_dev, 0.1)
+ assert_almost_equal(b[0].std_dev, 0.0707107)
+ assert_almost_equal(c[0,0].std_dev, 0.122474, decimal=5)
class Test2D(unittest.TestCase):
@@ -46,7 +46,7 @@ class Test2D(unittest.TestCase):
+ x0 * self.b[0] + x1 * self.b[1] \
+ x0**2 * self.c[0,0] + x0 * x1 * self.c[0,1] \
+ x1 * x0 * self.c[1,0] + x1**2 * self.c[1,1]
- self.y[i] = ufloat((value, 0.1))
+ self.y[i] = ufloat(value, 0.1)
def test_parabola_eval(self):
y = parabola.parabola_eval(self.x, self.a, self.b, self.c)
diff --git a/test/test_rayleigh.py b/test/test_rayleigh.py
index 91e45ca..b10cdd8 100644
--- a/test/test_rayleigh.py
+++ b/test/test_rayleigh.py
@@ -52,6 +52,6 @@ class TestRayleigh(unittest.TestCase):
# (1 + \cos^2 \theta)\sin \theta according to GEANT4 physics
# reference manual.
f = ROOT.TF1("pol_func", "[0]*(1+cos(x)**2)*sin(x)", 0, np.pi)
- h.Fit(f)
+ h.Fit(f, 'NQ')
self.assertGreater(f.GetProb(), 1e-3)
diff --git a/test/test_reemission.py b/test/test_reemission.py
index a061dd8..29360e7 100644
--- a/test/test_reemission.py
+++ b/test/test_reemission.py
@@ -1,6 +1,5 @@
from unittest_find import unittest
import numpy as np
-import scipy.stats
#import matplotlib.pyplot as plt
from chroma.geometry import Solid, Geometry, Surface, Material
@@ -12,6 +11,7 @@ from chroma.event import Photons, SURFACE_DETECT
from chroma.tools import enable_debug_on_crash
class TestReemission(unittest.TestCase):
+ @unittest.skip('need to implement scipy stats functions here')
def testBulkReemission(self):
'''Test bulk reemission
@@ -19,6 +19,7 @@ class TestReemission(unittest.TestCase):
shifting sphere, forcing reemission, and check that the final
wavelength distribution matches the wls spectrum.
'''
+ import scipy.stats
nphotons = 1e5
# set up detector -- a sphere of 'scintillator' surrounded by a