O'Reilly logo

Python for Experimental Psychologists by Edwin S. Dalmaijer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX: CODE LISTING

 

 

 

 

 

Make some noise (1)

import numpy

from matplotlib import pyplot

noise = numpy.random.rand(500, 500, 3)

pyplot.imshow(noise)

pyplot.show()

Chapter 3: Display

Pygaze

constants.py

# Display settings (type and resolution).

DISPTYPE = ‘pygame’

DISPSIZE = (1920, 1080)

# Default foreground and background colour.

FGC = (0, 0, 0)

BGC = (128, 128, 128)

experiment.py

from pygaze.display import Display

import pygaze.libtime as timer

# Initialise a new Display instance.

disp = Display()

# Update the display (this makes the grey background visible).

disp.show()

# Pause for two seconds.

timer.pause(2000)

# Close the Display again.

disp.close()

Pyschopy

constants.py

# Window resolution.

DISPSIZE = (1920, 1080)

# Default ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required