summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2014-10-01 10:32:31 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2014-10-01 10:32:31 +0200
commit9335f9a4f78b561b8c875704a2e52ba27a45ad9b (patch)
tree3cb3446b0479a6c10751895a7704192fba47b236 /examples
parent68f2f8e6297be829d29ef428784ac0002348877b (diff)
removed performance tests
Diffstat (limited to 'examples')
-rw-r--r--examples/perf_isi.py46
-rw-r--r--examples/perf_spike.py42
2 files changed, 0 insertions, 88 deletions
diff --git a/examples/perf_isi.py b/examples/perf_isi.py
deleted file mode 100644
index 8b44946..0000000
--- a/examples/perf_isi.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# performance measure of the isi calculation
-
-from __future__ import print_function
-
-import numpy as np
-import matplotlib.pyplot as plt
-import time
-from functools import partial
-
-import pyspike as spk
-#import pyspike.distances # for the python functions
-
-def measure_perf(func, loops=10):
- times = np.empty(loops)
- for i in xrange(loops):
- start = time.clock()
- func()
- times[i] = time.clock() - start
- return np.min(times)
-
-print("# approximate number of spikes\tcython time [ms]\tpython time [ms]")
-
-# fix seed to get reproducible results
-np.random.seed(1)
-
-# max times
-Ns = np.arange(10000, 50001, 10000)
-for N in Ns:
-
- # first generate some data
- times = 2.0*np.random.random(1.1*N)
- t1 = np.cumsum(times)
- # only up to T
- t1 = spk.add_auxiliary_spikes(t1[t1<N], N)
-
- times = 2.0*np.random.random(N)
- t2 = np.cumsum(times)
- # only up to T
- t2 = spk.add_auxiliary_spikes(t2[t2<N], N)
-
- t_cython = measure_perf(partial(spk.isi_distance, t1, t2))
-
- t_python = measure_perf(partial(spk.distances.isi_distance_python,
- t1, t2))
-
- print("%d\t%.3f\t%.1f" % (N, t_cython*1000, t_python*1000))
diff --git a/examples/perf_spike.py b/examples/perf_spike.py
deleted file mode 100644
index 5b1c1cc..0000000
--- a/examples/perf_spike.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# performance measure of the isi calculation
-
-from __future__ import print_function
-
-import numpy as np
-import matplotlib.pyplot as plt
-import time
-from functools import partial
-
-import pyspike as spk
-
-def measure_perf(func, loops=10):
- times = np.empty(loops)
- for i in xrange(loops):
- start = time.clock()
- func()
- times[i] = time.clock() - start
- return np.min(times)
-
-print("# approximate number of spikes\tcython time [ms]\tpython time [ms]")
-
-# max times
-Ns = np.arange(10000, 50001, 10000)
-for N in Ns:
-
- # first generate some data
- times = 2.0*np.random.random(1.1*N)
- t1 = np.cumsum(times)
- # only up to T
- t1 = spk.add_auxiliary_spikes(t1[t1<N], N)
-
- times = 2.0*np.random.random(N)
- t2 = np.cumsum(times)
- # only up to T
- t2 = spk.add_auxiliary_spikes(t2[t2<N], N)
-
- t_cython = measure_perf(partial(spk.spike_distance, t1, t2))
-
- t_python = measure_perf(partial(spk.distances.spike_distance_python,
- t1, t2))
-
- print("%d\t%.3f\t%.1f" % (N, t_cython*1000, t_python*1000))