[python-dtcwt] 64/497: start test suite for 3d transform

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 3e843fb547bafc4c8fa00c10a4968d687ad45e44
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Thu Aug 8 10:56:30 2013 +0100

    start test suite for 3d transform
---
 tests/testxfm3.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/testxfm3.py b/tests/testxfm3.py
new file mode 100644
index 0000000..b0c22b6
--- /dev/null
+++ b/tests/testxfm3.py
@@ -0,0 +1,24 @@
+import os
+from nose.tools import raises
+from nose.plugins.attrib import attr
+
+import numpy as np
+
+def setup():
+    global sphere
+    X, Y, Z = np.meshgrid(np.arange(-63,64), np.arange(-63,64), np.arange(-63,64))
+
+    r = np.sqrt(X*X + Y*Y + Z*Z)
+    sphere = np.where(r <= 55, 1.0, 0.0)
+
+def test_sphere():
+    # Check general aspects of sphere are OK
+    assert sphere.shape == (127,127,127)
+    assert sphere.min() >= 0
+    assert sphere.max() <= 1
+
+    # Check volume of sphere is ok to within 5%
+    sphere_vol = (4.0/3.0) * np.pi * 55*55*55
+    assert np.abs(np.sum(sphere.flatten()) - sphere_vol) < 5e-2*sphere_vol
+
+# vim:sw=4:sts=4:et

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list