Skip to content

Instantly share code, notes, and snippets.

@rkmaddox
Last active September 11, 2015 20:56
Show Gist options
  • Save rkmaddox/88e692527926325719a3 to your computer and use it in GitHub Desktop.
Save rkmaddox/88e692527926325719a3 to your computer and use it in GitHub Desktop.
import expyfun
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
wait_times = np.array([1, 10, 30]) * 1e-3
n_waits = len(wait_times)
n_iter = 1000
times = np.zeros((n_waits, n_iter))
with expyfun.ExperimentController('wait_test', output_dir=None, participant='',
session='') as ec:
for ii in range(n_iter):
if np.mod(ii, 30) == 0:
ec.screen_text(str(int((100. * ii) / n_iter)))
ec.flip()
for wi, wait in enumerate(wait_times):
start = ec.current_time
ec.wait_secs(wait)
times[wi, ii] = ec.current_time - start
times *= 1000
plt.plot(times.T - np.atleast_2d(wait_times * 1e3), '.')
plt.legend(['%i ms' % (wt * 1000) for wt in wait_times])
plt.xlabel('Trial')
plt.ylabel('Timing difference (ms)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment