Exemple #1
0
def Kanisza_square(width, height, radius, backgroung_color=GRAY, square_color=GRAY,
                   color_tl=BLACK, color_tr=BLACK, color_bl=BLACK,  color_br=BLACK):
    """ Creates a surface with Kanisza illusory square

    (see https://openi.nlm.nih.gov/detailedresult?img=PMC4211395_fnhum-08-00854-g0001&req=4 )

    """

    surface = BlankScreen(backgroung_color)

    # coordinates  of the corners of the rectangle (also that of the circles' centers)
    left = - width // 2
    right = width // 2
    top = height // 2
    bottom = - height // 2

    c_tl = Circle(radius, color_tl, position = (left, top), anti_aliasing = 10)
    c_tr = Circle(radius, color_tr, position = (right, top), anti_aliasing = 10)
    c_bl = Circle(radius, color_bl, position = (left, bottom), anti_aliasing = 10)
    c_br = Circle(radius, color_br, position = (right, bottom), anti_aliasing = 10)
    rect = Rectangle((width, height), square_color,  position = (0, 0), corner_anti_aliasing = True)

    c_tl.plot(surface)
    c_tr.plot(surface)
    c_bl.plot(surface)
    c_br.plot(surface)
    rect.plot(surface)

    return surface
expyriment.control.initialize(exp)

NTRIALS = 10
assert NTRIALS % 2 == 0  # should be an even number
ITI = 1000

# Prepare stimuli, trials anb blocks
target_visual = FixCross(size=(25, 25), line_width=4)
target_audio = Audio('click.wav')

trial_visual = expyriment.design.Trial()
trial_visual.add_stimulus(target_visual)
trial_audio = expyriment.design.Trial()
trial_audio.add_stimulus(target_audio)

blankscreen = BlankScreen()

block_visual = expyriment.design.Block()
for i in range(NTRIALS):
    block_visual.add_trial(trial_visual)

block_audio = expyriment.design.Block()
for i in range(NTRIALS):
    block_audio.add_trial(trial_audio)

block_audiovisual = expyriment.design.Block()
for i in range(NTRIALS // 2):
    block_audiovisual.add_trial(trial_audio)
    block_audiovisual.add_trial(trial_visual)

exp.add_block(block_visual)
Exemple #3
0
import expyriment
import random

from expyriment.stimuli import FixCross, BlankScreen

exp = expyriment.design.Experiment(name="Hot Stroop")
expyriment.control.initialize(exp)
kb = expyriment.io.Keyboard()

NCONG = 15
NINCONG = 15
NTRIALS = NCONG + NINCONG
MAXDURATION = 2000
target = FixCross(size=(25, 25), line_width=4)
blankscreen = BlankScreen()

expyriment.control.start()
response_device = exp.keyboard

# Consigne
consigne = """Vous allez voir apparaitre à l'écran un visage exprimant une émotion ainsi qu'un mot signifiant une émotion.
L'objectif de cette tâche est de dénommer l'émotion exprimée par le visage (et non pas par le mot).
Vous devez répondre le plus rapidement possible avec le moins d'erreurs possible.
Pour répondre vous utiliserez le clavier de l'ordinateur avec les 4 touches suivantes :
C = colère
V = joie
B = peur
N = tristesse
Pour commencer appuyer sur la barre espace du clavier."""

# Dictionnaire de paires (mots/images) qui sont congruentes