Visual search
In [ ]:
Copied!
from sweetbean import Block, Experiment
from sweetbean.stimulus import Symbol
from sweetbean.variable import TimelineVariable
from sweetbean import Block, Experiment
from sweetbean.stimulus import Symbol
from sweetbean.variable import TimelineVariable
In [ ]:
Copied!
timeline = [
{
"items": [
{"shape": "circle", "x": -300, "y": 0, "color": "#666"},
{"shape": "circle", "x": 0, "y": 0, "color": "#666"},
{"shape": "triangle", "x": 300, "y": 0, "color": "red"}, # target
],
"correct_key": "f", # F = present, J = absent
},
{
"items": [
{"shape": "circle", "x": -300, "y": 0, "color": "#666"},
{"shape": "circle", "x": 0, "y": 0, "color": "#666"},
{"shape": "circle", "x": 300, "y": 0, "color": "#666"},
],
"correct_key": "j",
},
]
timeline = [
{
"items": [
{"shape": "circle", "x": -300, "y": 0, "color": "#666"},
{"shape": "circle", "x": 0, "y": 0, "color": "#666"},
{"shape": "triangle", "x": 300, "y": 0, "color": "red"}, # target
],
"correct_key": "f", # F = present, J = absent
},
{
"items": [
{"shape": "circle", "x": -300, "y": 0, "color": "#666"},
{"shape": "circle", "x": 0, "y": 0, "color": "#666"},
{"shape": "circle", "x": 300, "y": 0, "color": "#666"},
],
"correct_key": "j",
},
]
In [ ]:
Copied!
fix = Symbol(shape="cross", color="#4d4d4d", duration=400)
fix = Symbol(shape="cross", color="#4d4d4d", duration=400)
In [ ]:
Copied!
search = Symbol(
items=TimelineVariable("items"),
duration=2000,
choices=["f", "j"],
correct_key=TimelineVariable("correct_key"),
)
search = Symbol(
items=TimelineVariable("items"),
duration=2000,
choices=["f", "j"],
correct_key=TimelineVariable("correct_key"),
)
In [ ]:
Copied!
block = Block([fix, search], timeline)
block = Block([fix, search], timeline)
In [ ]:
Copied!
Experiment([block]).to_html("visual_search.html")
Experiment([block]).to_html("visual_search.html")