[python-dtcwt] 426/497: added registration benchmark script

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:35 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 b185079fce3a65a8de7b9382af41adc6afdaea8a
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Fri Mar 28 11:59:50 2014 +0000

    added registration benchmark script
---
 scripts/benchmark_registration.py | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/scripts/benchmark_registration.py b/scripts/benchmark_registration.py
new file mode 100755
index 0000000..bea7107
--- /dev/null
+++ b/scripts/benchmark_registration.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+from __future__ import print_function, division
+
+import os
+import sys
+import textwrap
+import timeit
+
+# Add project root to path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
+
+def main():
+    t = timeit.Timer(
+        setup=textwrap.dedent('''
+            import dtcwt
+            import dtcwt.registration
+            import tests.datasets as datasets
+
+            print('Loading datasets...')
+            f1, f2 = datasets.regframes('tennis')
+
+            print('Transforming datasets...')
+            transform = dtcwt.Transform2d()
+            t1 = transform.forward(f1, nlevels=6)
+            t2 = transform.forward(f2, nlevels=6)
+        '''),
+        stmt=textwrap.dedent('''
+            print('Registering datasets...')
+            reg = dtcwt.registration.estimatereg(t1, t2)
+        ''')
+    )
+
+    number = 10
+    try:
+        secs = t.timeit(number)
+        print('{0:.2f}s for {1} iterations => {2:.2f}s/iteration'.format(
+                secs, number, secs / number
+            ))
+    except:
+        t.print_exc()
+
+if __name__ == '__main__':
+    main()

-- 
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