Probably the final fix for unit tests

This commit is contained in:
John Tramm 2019-11-22 19:27:42 +00:00
parent 84e351f153
commit 7d3dcfedc0
2 changed files with 7 additions and 7 deletions

View file

@ -26,7 +26,7 @@ _dll.calc_zn_rad.argtypes = [c_int, c_double, ndpointer(c_double)]
_dll.rotate_angle_c.restype = None
_dll.rotate_angle_c.argtypes = [ndpointer(c_double), c_double,
ndpointer(c_double), ndpointer(c_uint64), c_int]
POINTER(c_double), ndpointer(c_uint64), c_int]
_dll.maxwell_spectrum.restype = c_double
_dll.maxwell_spectrum.argtypes = [c_double, ndpointer(c_uint64), c_int]
@ -210,12 +210,12 @@ def rotate_angle(uvw0, mu, phi, prn_seeds, stream ):
"""
uvw0_arr = np.array(uvw0, dtype=np.float64)
phi_arr = np.array(phi, dtype=np.float64)
if phi_arr.size == 0:
phi_arr = None
prn_seeds_arr = np.array(prn_seeds, dtype=np.uint64)
if phi is None:
_dll.rotate_angle_c(uvw0_arr, mu, None, prn_seeds_arr, stream)
else:
_dll.rotate_angle_c(uvw0_arr, mu, c_double(phi), prn_seeds_arr, stream)
_dll.rotate_angle_c(uvw0_arr, mu, phi_arr, prn_seeds_arr, stream)
uvw = uvw0_arr
return uvw

View file

@ -154,7 +154,7 @@ def test_calc_zn_rad():
def test_rotate_angle():
uvw0 = np.array([1., 0., 0.])
phi = [0.]
phi = 0.
mu = 0.
prn_seeds = [1, 2, 3, 4, 5, 6]
stream = 0
@ -176,7 +176,7 @@ def test_rotate_angle():
# Now to test phi is None
mu = 0.9
phi = []
phi = None
# When seed = 1, phi will be sampled as 1.9116495709698769
# The resultant reference is from hand-calculations given the above