Add doctest skip directives to timing calls

This commit is contained in:
Juan Nunez-Iglesias
2015-01-22 11:57:49 +11:00
parent 097f8eaaa0
commit 110ac37dc4
+5 -4
View File
@@ -151,7 +151,8 @@ the third imaging dimension has lower resolution than the other two,
and processing must be done frame-wise. When frames are the leading
dimension, we can use the following syntax:
>>> for image in image3d: # iterate over first dimension
>>> for image in image3d: # doctest: +SKIP
... # iterate over the leading dimension (frames)
... do_something_to(image)
@@ -177,15 +178,15 @@ in a different order, even if the number of operations is the same:
>>> import time
>>> im3d = np.random.rand(100, 1024, 1024)
>>> t0 = time.time(); x = in_order_multiply(im3d, 5); t1 = time.time()
>>> print("%.2f seconds" % (t1 - t0))
>>> print("%.2f seconds" % (t1 - t0)) # doctest: +SKIP
0.14 seconds
>>> im3d_t = np.transpose(im3d).copy() # place "frames" dimension at end
>>> im3d_t.shape
(1024, 1024, 100)
>>> s0 = time.time(); x = out_of_order_multiply(im3d, 5); s1 = time.time()
>>> print("%.2f seconds" % (s1 - s0))
>>> print("%.2f seconds" % (s1 - s0)) doctest: +SKIP
1.18 seconds
>>> print("Speedup: %.1fx" % ((s1 - s0) / (t1 - t0)))
>>> print("Speedup: %.1fx" % ((s1 - s0) / (t1 - t0))) doctest: +SKIP
Speedup: 8.6x