import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from npgamma import calc_gamma
grid = 0.02
scale_factor = 1.3
x = np.arange(-1.8, 1.8 + 0.001, grid)
y = np.arange(-1.5, 1.5 + 0.001, grid)
coords = (y, x)
xx, yy = np.meshgrid(x, y)
dose_ref = np.exp(-(xx**10 + yy**10))
dose_eval = dose_ref * scale_factor
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=1)
1 loop, best of 3: 1.11 s per loop
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=2)
1 loop, best of 3: 699 ms per loop
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=3)
1 loop, best of 3: 526 ms per loop
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=4)
1 loop, best of 3: 500 ms per loop
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=5)
1 loop, best of 3: 575 ms per loop
%%timeit
calc_gamma(
coords, dose_ref,
coords, dose_eval,
0.1, 0.03, lower_dose_cutoff=0.2,
maximum_test_distance=0.2, num_threads=10)
1 loop, best of 3: 688 ms per loop