Skip to content

Commit 7a65b7e

Browse files
committed
fix instructions on flipped cab
1 parent b60ca6e commit 7a65b7e

8 files changed

Lines changed: 71 additions & 38 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
2+
13
# Stimuli extracted for AssBind
24
tasks/AssBind/stim/
35

@@ -134,4 +136,4 @@ dmypy.json
134136
.DS_Store
135137

136138
#pycharm
137-
.idea
139+
.idea
312 KB
Loading
309 KB
Loading
314 KB
Loading
317 KB
Loading
310 KB
Loading

tasks/AssBind/instruct.py

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ def get_is_first(run_num):
88
return run_num == 0
99
# present instructions
1010
@Subroutine
11-
def Instruct(self, config, text_names, run_num):#, resp_keys, touch, font_size):
11+
def Instruct(self, config, text_names, run_num, flip_resp=False):#, resp_keys, touch, font_size):
1212

1313
is_first = Func(get_is_first, run_num).result
1414

15-
texts = get_text(config)
15+
texts = get_text(config, flip_resp=flip_resp)
1616
with If(is_first):
1717
with Parallel():
1818
if not config.TOUCH:
@@ -116,7 +116,14 @@ def Instruct(self, config, text_names, run_num):#, resp_keys, touch, font_size):
116116

117117

118118
# this function reads in the text for each instruction slide and dynamically changes it based on response keys
119-
def get_text(config):#resp_keys, touch):
119+
def get_text(config, flip_resp=False):#resp_keys, touch):
120+
if flip_resp:
121+
resp_keys = {
122+
'old': config.RESP_KEYS['new'],
123+
'new': config.RESP_KEYS['old'],
124+
}
125+
else:
126+
resp_keys = config.RESP_KEYS
120127

121128
# dictionary containing the text for each instruction slide
122129
inst = {}
@@ -155,24 +162,48 @@ def get_text(config):#resp_keys, touch):
155162
'%s to begin. '
156163

157164
# dictionary containing image path, response keys, and text for each slide
158-
texts = {'main': {'image': None,
159-
'keys': [config.RESP_KEYS['new'], config.RESP_KEYS['old']],
160-
'text': inst['main']},
161-
'ex1': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beehouse.jpg"))),
162-
'keys': [config.RESP_KEYS['new']],
163-
'text': inst['ex1']},
164-
'ex2': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "canoejoystick.jpg"))),
165-
'keys': [config.RESP_KEYS['new']],
166-
'text': inst['ex2']},
167-
'ex3': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beehouse.jpg"))),
168-
'keys': [config.RESP_KEYS['old']],
169-
'text': inst['ex3']},
170-
'ex4': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beejoystick.jpg"))),
171-
'keys': [config.RESP_KEYS['new']],
172-
'text': inst['ex4']},
173-
'remind': {'image': None,
174-
'keys': [config.RESP_KEYS['new'], config.RESP_KEYS['old']],
175-
'text': inst['remind']}}
165+
if flip_resp:
166+
texts = {'main': {'image': None,
167+
'keys': [resp_keys['new'], resp_keys['old']],
168+
'text': inst['main']},
169+
'ex1': {'image': str(
170+
config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "flip_beehouse.jpg"))),
171+
'keys': [resp_keys['new']],
172+
'text': inst['ex1']},
173+
'ex2': {'image': str(
174+
config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "flip_canoejoystick.jpg"))),
175+
'keys': [resp_keys['new']],
176+
'text': inst['ex2']},
177+
'ex3': {'image': str(
178+
config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "flip_beehouse.jpg"))),
179+
'keys': [resp_keys['old']],
180+
'text': inst['ex3']},
181+
'ex4': {'image': str(
182+
config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "flip_beejoystick.jpg"))),
183+
'keys': [resp_keys['new']],
184+
'text': inst['ex4']},
185+
'remind': {'image': None,
186+
'keys': [resp_keys['new'], resp_keys['old']],
187+
'text': inst['remind']}}
188+
else:
189+
texts = {'main': {'image': None,
190+
'keys': [resp_keys['new'], resp_keys['old']],
191+
'text': inst['main']},
192+
'ex1': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beehouse.jpg"))),
193+
'keys': [resp_keys['new']],
194+
'text': inst['ex1']},
195+
'ex2': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "canoejoystick.jpg"))),
196+
'keys': [resp_keys['new']],
197+
'text': inst['ex2']},
198+
'ex3': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beehouse.jpg"))),
199+
'keys': [resp_keys['old']],
200+
'text': inst['ex3']},
201+
'ex4': {'image': str(config.resource_path(os.path.join(config.TASK_DIR, "inst", "examples", "beejoystick.jpg"))),
202+
'keys': [resp_keys['new']],
203+
'text': inst['ex4']},
204+
'remind': {'image': None,
205+
'keys': [resp_keys['new'], resp_keys['old']],
206+
'text': inst['remind']}}
176207

177208
#texts = {'main': {'file': 'inst.rst', 'keys': [config.RESP_KEYS['new'], config.RESP_KEYS['old']]},
178209
#'ex1': {'file': 'ex1.rst', 'keys': [config.RESP_KEYS['new']]},
@@ -198,20 +229,20 @@ def get_text(config):#resp_keys, touch):
198229
"Touch the screen")
199230

200231
else:
201-
texts['main']['replacements'] = ("press the %s key" %config.RESP_KEYS['old'], "press %s key" %config.RESP_KEYS['new'],
202-
"Press the %s or %s key" %(config.RESP_KEYS['old'], config.RESP_KEYS['new']))
203-
texts['ex1']['replacements'] = ("press %s," %config.RESP_KEYS['new'],
204-
"Press the %s key" %config.RESP_KEYS['new'])
205-
texts['ex2']['replacements'] = ("press %s," %config.RESP_KEYS['new'],
206-
"Press the %s key" %config.RESP_KEYS['new'])
207-
texts['ex3']['replacements'] = ("press %s," %config.RESP_KEYS['old'],
208-
"Press the %s key" %config.RESP_KEYS['old'])
209-
texts['ex4']['replacements'] = ("press %s," %config.RESP_KEYS['new'],
210-
"Press the %s key" %config.RESP_KEYS['new'])
211-
texts['remind']['replacements'] = ("press %s key" %config.RESP_KEYS['old'],
212-
"press %s key" %config.RESP_KEYS['new'],
213-
"Press the %s or %s key" %(config.RESP_KEYS['old'],
214-
config.RESP_KEYS['new']))
232+
texts['main']['replacements'] = ("press the %s key" %resp_keys['old'], "press %s key" %resp_keys['new'],
233+
"Press the %s or %s key" %(resp_keys['old'], resp_keys['new']))
234+
texts['ex1']['replacements'] = ("press %s," %resp_keys['new'],
235+
"Press the %s key" %resp_keys['new'])
236+
texts['ex2']['replacements'] = ("press %s," %resp_keys['new'],
237+
"Press the %s key" %resp_keys['new'])
238+
texts['ex3']['replacements'] = ("press %s," %resp_keys['old'],
239+
"Press the %s key" %resp_keys['old'])
240+
texts['ex4']['replacements'] = ("press %s," %resp_keys['new'],
241+
"Press the %s key" %resp_keys['new'])
242+
texts['remind']['replacements'] = ("press %s key" %resp_keys['old'],
243+
"press %s key" %resp_keys['new'],
244+
"Press the %s or %s key" %(resp_keys['old'],
245+
resp_keys['new']))
215246

216247

217248
for doc in texts:

tasks/AssBind/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def AssBindExp(self, config, sub_dir, task_dir=None, block=0,
7878
text_names = ['main', 'ex1', 'ex2', 'ex3', 'ex4', 'remind']
7979
rem_names = ['remind']
8080
with If(reminder_only):
81-
Instruct(config=config, text_names=rem_names, run_num=block)
81+
Instruct(config=config, text_names=rem_names, run_num=block, flip_resp=flip_resp)
8282
with Else():
83-
Instruct(config=config, text_names=text_names, run_num=block)
83+
Instruct(config=config, text_names=text_names, run_num=block, flip_resp=flip_resp)
8484

8585
Wait(1.0)
8686

0 commit comments

Comments
 (0)