Skip to content

Instantly share code, notes, and snippets.

@drammock
Created October 16, 2015 19:49
Show Gist options
  • Save drammock/1645b12fdf4edd9ccdb4 to your computer and use it in GitHub Desktop.
Save drammock/1645b12fdf4edd9ccdb4 to your computer and use it in GitHub Desktop.
test script for setting background color in ExperimentController
# -*- coding: utf-8 -*-
import numpy as np
from expyfun import ExperimentController
kwargs = dict(exp_name='test', session='000', participant='foo')
with ExperimentController(**kwargs) as ec:
ec.flip()
ec.set_background_color('red')
ec.screen_text('red', color='k')
ec.flip()
ec.wait_secs(2)
ec.set_background_color('0.5')
ec.screen_text('"0.5" (should be mid gray)', color='k')
ec.flip()
ec.wait_secs(2)
ec.set_background_color(np.ones(3) * 0.5)
ec.screen_text('np.ones(3) * 0.5 (should be mid gray)', color='k')
ec.flip()
ec.wait_secs(2)
ec.set_background_color(np.ones(3) * 0.01)
ec.screen_text('np.ones(3) * 0.01 (should be nearly black)', color='r')
ec.flip()
ec.wait_secs(2)
ec.set_background_color('0.01')
ec.screen_text('"0.01" (should be nearly black)', color='r')
ec.flip()
ec.wait_secs(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment