-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathsimple_benchmarks.ipy
More file actions
29 lines (18 loc) · 1.08 KB
/
simple_benchmarks.ipy
File metadata and controls
29 lines (18 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# must be run in ipython
import numpy as np
import trackpy as tp
def b(command):
get_ipython().magic(command)
dummy_noise_image = np.random.randint(0, 100, (100, 100))
real_image_raw = tp.ImageSequence('../trackpy/tests/video/image_sequence')[0]
real_image = tp.bandpass(real_image_raw, 1, 10, threshold=1)
print('Compiling Numba...')
tp.locate(dummy_noise_image, 9, engine='numba')
print('Locate using Python Engine with Default Settings (Accurate)')
b("timeit tp.locate(real_image, 9, engine='python', preprocess=False)")
print('Locate using Python Engine with Fast Settings (Sloppy)')
b("timeit tp.locate(real_image, 9, engine='python', preprocess=False, filter_before=False, filter_after=False, max_iterations=0, characterize=False)")
print('Locate using Numba Engine with Default Settings (Accurate)')
b("timeit tp.locate(real_image, 9, engine='numba', preprocess=False)")
print('Locate using Numba Engine with Fast Settings (Sloppy)')
b("timeit tp.locate(real_image, 9, engine='numba', preprocess=False, filter_before=False, filter_after=False, max_iterations=0, characterize=False)")