Flanker
In [ ]:
Copied!
from sweetbean import Block, Experiment
from sweetbean.stimulus import Blank, Feedback, Fixation, Flanker
from sweetbean.variable import TimelineVariable
from sweetbean import Block, Experiment
from sweetbean.stimulus import Blank, Feedback, Fixation, Flanker
from sweetbean.variable import TimelineVariable
In [ ]:
Copied!
timeline = [
{"direction": "left", "distractor": "right", "correct_key": "f"},
{"direction": "right", "distractor": "right", "correct_key": "j"},
{"direction": "left", "distractor": "left", "correct_key": "f"},
{"direction": "right", "distractor": "left", "correct_key": "j"},
]
timeline = [
{"direction": "left", "distractor": "right", "correct_key": "f"},
{"direction": "right", "distractor": "right", "correct_key": "j"},
{"direction": "left", "distractor": "left", "correct_key": "f"},
{"direction": "right", "distractor": "left", "correct_key": "j"},
]
In [ ]:
Copied!
direction = TimelineVariable("direction")
distractor = TimelineVariable("distractor")
correct_key = TimelineVariable("correct_key")
direction = TimelineVariable("direction")
distractor = TimelineVariable("distractor")
correct_key = TimelineVariable("correct_key")
In [ ]:
Copied!
fixation = Fixation(1000)
so_s = Blank(400)
flanker = Flanker(2000, direction, distractor, ["j", "f"], correct_key)
so_f = Blank(300)
feedback = Feedback(800, window=2)
fixation = Fixation(1000)
so_s = Blank(400)
flanker = Flanker(2000, direction, distractor, ["j", "f"], correct_key)
so_f = Blank(300)
feedback = Feedback(800, window=2)
In [ ]:
Copied!
block = Block([fixation, so_s, flanker, so_f, feedback], timeline)
block = Block([fixation, so_s, flanker, so_f, feedback], timeline)
In [ ]:
Copied!
# Create an image of the stimuli sequence of the block
block.to_image(
"flanker.png",
data=[None, None, {"correct": True}, None, None],
zoom_factor=[3, 3, 1, 3, 3],
sequence=True,
)
# Create an image of the stimuli sequence of the block
block.to_image(
"flanker.png",
data=[None, None, {"correct": True}, None, None],
zoom_factor=[3, 3, 1, 3, 3],
sequence=True,
)
In [ ]:
Copied!
# Create an HTML file of the experiment
experiment = Experiment([block])
experiment.to_html("flanker.html")
# Create an HTML file of the experiment
experiment = Experiment([block])
experiment.to_html("flanker.html")