Пример #1
0
TEXT_BREAK = 'Press any key to continue...'  # text of regular break
KEYS_QUIT = ['escape']  # Keys that quits the experiment

TEXT_INSTRUCT = """
    Press LEFT if the lines are horizontal.
    Press RIGHT if the lines are vertical.

    Keep your gaze at the cross at all times."""
"""
 SHOW DIALOGUE AND INITIATE PSYCHOPY STIMULI
 This is computationally heavy stuff. Thus we do it in the beginning of our experiment
"""

# Import stuff
import ppc
print 'the physical diameter of the gabor patch should be', ppc.deg2cm(
    GABOR_SIZE, MON_DISTANCE), 'cm'
print 'the physical size of the fixation cross should be', ppc.deg2cm(
    FIX_HEIGHT, MON_DISTANCE), 'cm'

from psychopy import core, visual, gui, monitors, sound, event
import random

# Intro-dialogue. Get subject-id and other variables.
# Save input variables in "V" dictionary (V for "variables")
V = {
    'subject': '',
    'condition': ['trueFix', 'falseFix'],
    'age': '',
    'gender': ['male', 'female']
}
if not gui.DlgFromDict(V, order=['subject', 'age', 'gender']).OK:
Пример #2
0
      is the expected size.
    * Draw some different kinds of stimuli using cm as units and verify size.
    * Some stimuli aren't the actual expected size. Adjust the parameters
      so that they are the size that you want.

    * Pro: draw different kinds of stimuli using deg and verify whether they
	  have the expected size. (hint: math.tan, math.radians)
    * Pro: textStims are smaller than the expected size. The relationship is
	  however approximately linear. Determine the linear function that makes
	  the actual size correspond to the specified size. Do you think it would
	  be general across monitors? And/or general across fonts?
"""

# Checking size in degrees. size = tan(angle_in_radians) * distance
import ppc
print ppc.deg2cm(10, 65)
print ppc.deg2cm(3, 60)


# ----------------------
# EQUILUMINANT STIMULI
# ... especially if you calibrate your monitor and get a conversion matrix
# ----------------------

# Specify colors using the DKL colorspace
# It is DKL = [luminance, hue, saturation] where
# luminance is degrees -90 to 90
# hue is degrees 0 to 360
# saturation is excentricity 0 to 1
stim_shape1 = visual.ShapeStim(win, units='cm', size=5,
    fillColorSpace='dkl', fillColor=[0, 45, 1], pos=[0, 2])  # strong, medium luminance
Пример #3
0
TEXT_INSTRUCT = """
    Press LEFT if the lines are horizontal.
    Press RIGHT if the lines are vertical.

    Keep your gaze at the cross at all times."""


"""
 SHOW DIALOGUE AND INITIATE PSYCHOPY STIMULI
 This is computationally heavy stuff. Thus we do it in the beginning of our experiment
"""

# Import stuff
import ppc
print 'the physical diameter of the gabor patch should be', ppc.deg2cm(GABOR_SIZE, MON_DISTANCE), 'cm'
print 'the physical size of the fixation cross should be', ppc.deg2cm(FIX_HEIGHT, MON_DISTANCE), 'cm'

from psychopy import core, visual, gui, monitors, sound, event
import random

# Intro-dialogue. Get subject-id and other variables.
# Save input variables in "V" dictionary (V for "variables")
V = {'subject':'', 'condition': ['trueFix', 'falseFix'], 'age':'', 'gender':['male', 'female']}
if not gui.DlgFromDict(V, order=['subject', 'age', 'gender']).OK:
    core.quit()

# Stuff
clock = core.Clock()  # A clock wich will be used throughout the experiment to time events on a trial-per-trial basis (stimuli and reaction times).
writer = ppc.csvWriter(str(V['subject']), saveFolder=SAVE_FOLDER)  # writer.write(trial) will write individual trials with low latency