Note
Click here to download the full example code
event_trigger_average
import numpy as np
import pynapple as nap
import jax.numpy as jnp
from time import perf_counter
import matplotlib.pyplot as plt
Machine Configuration
import jax
print(jax.devices())
Out:
[CpuDevice(id=0)]
def get_mean_perf_class(tsg, tsd, ep, binsize):
n = 10
tmp = np.zeros(n)
for i in range(n):
t1 = perf_counter()
out = nap.compute_event_trigger_average(tsg, tsd, binsize, (binsize*10, binsize*10), ep)
t2 = perf_counter()
tmp[i] = t2 - t1
return np.mean(tmp), np.std(tmp)
def benchmark_event_trigger_average(binsize):
times = []
for T in np.arange(100000, 1000000, 100000):
time_array = np.arange(T) / 2
data_array = np.arange(16 * T).reshape(T, 4, 2, 2)
starts = np.arange(1, T // 2 - 1, 20)
ends = np.arange(1, T // 2 - 1, 20) + 8
ep = nap.IntervalSet(start=starts, end=ends)
tsd = nap.TsdTensor(t=time_array, d=data_array)
tsg = nap.TsGroup(
{i:nap.Ts(time_array[::2]) for i in range(10)}
)
sta = nap.compute_event_trigger_average(tsg, tsd, binsize, (binsize*10, binsize*10), ep)
m, s = get_mean_perf_class(tsg, tsd, ep, binsize)
times.append([T, m, s])
return np.array(times)
Calling with numba
binsize = 1.0
nap.nap_config.set_backend("numba")
num_times = benchmark_event_trigger_average(binsize)
Calling with jax
nap.nap_config.set_backend("jax")
jax_times = benchmark_event_trigger_average(binsize)
Out:
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
/mnt/home/gviejo/pynajax/src/pynajax/utils.py:131: UserWarning: Converting 'd' to jax.ndarray. The provided array was of type 'ndarray'.
return cast_to_jax(array, array_name, suppress_conversion_warnings)
Figure
plt.figure()
for arr, label in zip(
[num_times, jax_times],
["numba backend", "pynajax backend"],
):
plt.plot(arr[:, 0], arr[:, 1], "o-", label=label)
plt.fill_between(arr[:, 0], arr[:, 1] - arr[:, 2], arr[:, 1] + arr[:, 2], alpha=0.2)
plt.legend()
plt.xlabel("Number of Time points")
plt.ylabel("Time (s)")
plt.title("Event_trigger_average benchmark")
plt.show()
Out:
/mnt/home/gviejo/pynajax/docs/examples/plot_benchmark_event_trigger_average.py:75: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
plt.show()
Saving
Total running time of the script: ( 8 minutes 7.255 seconds)
Download Python source code: plot_benchmark_event_trigger_average.py
Download Jupyter notebook: plot_benchmark_event_trigger_average.ipynb