Skip to content

Commit

Permalink
import timeit
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Jul 13, 2023
1 parent e9c015a commit 2a2a66f
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions examples/tutorials/ctapipe_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


import tempfile
import timeit
from copy import deepcopy

import astropy.units as u
Expand Down Expand Up @@ -610,10 +611,7 @@ def num_islands_python(camera, clean):
disp.add_colorbar()

######################################################################
# .. code-block:: bash
#
# %%timeit
# num_islands_python(geometry, clean)
timeit.timeit(lambda: num_islands_python(geometry, clean), number=1000) / 1000


######################################################################
Expand All @@ -640,11 +638,7 @@ def num_islands_scipy(geometry, clean):
disp.add_colorbar()

######################################################################
# .. code-block:: bash
#
# %%timeit
# num_islands_scipy(geometry, clean)

timeit.timeit(lambda: num_islands_scipy(geometry, clean), number=10000) / 10000

######################################################################
# **A lot less code, and a factor 3 speed improvement**
Expand All @@ -656,7 +650,4 @@ def num_islands_scipy(geometry, clean):
#

######################################################################
# .. code-block:: bash
#
# %%timeit
# number_of_islands(geometry, clean)
timeit.timeit(lambda: number_of_islands(geometry, clean), number=100000) / 100000

0 comments on commit 2a2a66f

Please sign in to comment.