This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mental-nav-stim.mwel
253 lines (200 loc) · 9.7 KB
/
mental-nav-stim.mwel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Display variables and macros
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%define mask_width = display_bounds('right')
stimulus_display (
background_color = br, bg, bb
redraw_on_every_refresh = true
announce_stimuli_on_implicit_updates = false
)
%define num_images = 8
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// Range replicator macros
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%define for_each_stim ()
range_replicator (
variable = stim_index
from = 0
to = num_images - 1
step = 1
)
%end
%define for_each_option_stim ()
range_replicator (
variable = option_stim_index
from = 0
to = num_images - 1
step = 1
)
% end
%define for_each_seq_len ()
range_replicator (
variable = seq_len
from = 0
to = 4
step = 1
)
% end
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// Visibility macros
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%define view_fixation_point = fixation
%define view_center_indicator = pre_drift or drift or post_drift or pre_choice or choice or feedback
%define view_window_mask = not choice
%define stim_index_seq = stim_pos[${stim_index}]
%define stim_index_vis = stim_bin[${stim_index}]
%define option_stim_index_vis = options_bin[${option_stim_index}]
%define view_stims = stim_index_vis and ((pre_drift and stim_index_seq == start_stim_index) or (drift and not testing) or (post_drift and not testing) or ((pre_choice or choice or feedback) and stim_index_seq == end_stim_index))
%define view_stim_masks = stim_index_vis and (pre_drift and stim_index_seq != start_stim_index) or drift or post_drift or ((pre_choice or choice or feedback) and stim_index_seq == end_stim_index)
%define view_seq_len_stim = ${seq_len} == n_stims - 2 and not end_trial
%define view_option_stims = (option_stim_index_vis) and ((pre_choice or choice) or (feedback and selected == stim_pos[${option_stim_index}]))
%define view_option_selector_0 = (choice or (feedback and selected_0))
%define view_option_selector_1 = (choice or (feedback and selected_1))
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// Color macros
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%define red = choice or (feedback and (failure or ignore))
%define green = choice or (feedback and success)
%define blue = choice
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// Stimulus drift macros
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%define stim_offset = -(start_stim_index) * stim_size - (start_stim_index + 1) * stim_padding
%define cycle = end_stim_index == start_stim_index
%define wrap = stim_drift_direction * (end_stim_index - start_stim_index) > 0
%define stim_drift_transition_dur = (next_frame_time() - stim_drift_start_time) / 1e6
%define stim_drift_transition = drift_transition * stim_drift_direction * stim_drift_speed * stim_drift_transition_dur
%define stim_drift_transition_end = stim_padding + stim_size
%define stim_drift_symb_dist = (1 - cycle) * abs(wrap * n_stims - abs(start_stim_index - end_stim_index)) + (cycle) * n_stims
%define stim_drift_spat_dist = (1 - cycle) * abs(wrap * n_stims + stim_drift_direction * (start_stim_index - end_stim_index)) + (cycle) * (n_stims)
%define stim_drift_dur = (next_frame_time() - stim_drift_start_time) / 1e6
%define stim_drift = drift_transition * stim_drift_transition + stim_drift_fixed
%define stim_drift_end = (stim_drift_symb_dist * stim_size) + (stim_drift_spat_dist * stim_padding)
%define stim_seq_length = (n_stims) * (stim_size) + (n_stims) * stim_padding
%define stim_wrapped_right = ((stim_position_x < (display_bounds('left') + 2 * stim_size)))
%define stim_wrapped_left = ((stim_position_x > (display_bounds('right') - 2 * stim_size)))
%define stim_position_x = stim_offset + stim_index_seq * (stim_size) + (stim_index_seq + 1) * stim_padding + drift * stim_drift + (1 - drift) * stim_drift_fixed
%define stim_position_x_wrapped = (stim_wrapped_right + -1 * stim_wrapped_left) * stim_seq_length + stim_position_x
%define option_stim_position_x = option_distance * cos(2 * pi() / num_options * options_pos[${option_stim_index}])
%define option_stim_position_y = option_distance * sin(2 * pi() / num_options * options_pos[${option_stim_index}])
%define option_stim_selector_position_x (index) option_selector_distance * cos(2 * pi() / num_options * index)
%define option_stim_selector_position_y (index) option_selector_distance * sin(2 * pi() / num_options * index)
%define alpha_multiplier_drift = (1 - testing) * min(max(alpha_m * stim_drift_dur, 0), 1) + testing
%define keyboard_selected (index) index == 0 and l_pressed or index == 1 and a_pressed
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// Stimuli
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
rectangle center_indicator (
color = 0.75, 0.75, 0.75
x_size = stim_size + 0.75
y_size = stim_size + 0.75
y_position = 0
x_position = 0
alpha_multiplier = view_center_indicator
)
rectangle center_indicator_fill (
color = 0.5, 0.5, 0.5
x_size = stim_size + 0.25
y_size = stim_size + 0.25
y_position = 0
x_position = 0
alpha_multiplier = view_center_indicator
)
rectangle window_mask_left (
color = br, bg, bb
x_size = mask_width
y_size = stim_size*3/2
x_position = - (mask_width + num_visible_stims * stim_size) / 2 - 0.75
y_position = 0
alpha_multiplier = view_window_mask
)
rectangle window_mask_right (
color = br, bg, bb
x_size = mask_width
y_size = stim_size*3/2
x_position = (mask_width + num_visible_stims * stim_size) / 2 + 0.75
y_position = 0
alpha_multiplier = view_window_mask
)
stimulus_group mask_stims {
for_each_stim {
rectangle 'mask_stim_${stim_index}' (
color = 0.1, 0.1, 0.1
x_size = stim_size
x_position = stim_position_x_wrapped
y_position = 0
alpha_multiplier = view_stim_masks * (drift * alpha_multiplier_drift + (1 - drift) * alpha_multiplier_fixed)
)
}
}
stimulus_group option_stims {
for_each_option_stim {
image_file 'img_option_stim_${option_stim_index}' (
path = "/Users/aidapiccato/PyCharmProjects/mental-navigation-mworks/images/objects1/${option_stim_index}.jpg"
x_size = option_stim_size
x_position = option_stim_position_x
y_position = option_stim_position_y
alpha_multiplier = view_option_stims
)
}
}
stimulus_group img_stims {
for_each_stim {
image_file 'img_stim_${stim_index}' (
path = "/Users/aidapiccato/PyCharmProjects/mental-navigation-mworks/images/objects1/${stim_index}.jpg"
x_size = stim_size
x_position = stim_position_x_wrapped
y_position = 0
alpha_multiplier = view_stims
)
}
}
stimulus_group seq_len_stims {
for_each_seq_len {
image_file 'seq_len_stim_${seq_len}' (
path = "/Users/aidapiccato/PyCharmProjects/mental-navigation-mworks/images/icons/${seq_len}.png"
x_size = seq_len_stim_size
x_position = 0
y_position = 8
alpha_multiplier = view_seq_len_stim
)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Option selectors
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Option selector 'index' corresponds to the sequence index
circular_fixation_point option_selector_0 (
trigger_width = fixation_width
trigger_watch_x = pointer_x // eye_h * (1 - use_mouse) + use_mouse * pointer_x
trigger_watch_y = pointer_y //eye_v * (1 - use_mouse) + use_mouse * pointer_y
trigger_flag = selected_0
x_position = option_stim_selector_position_x (0)
y_position = option_stim_selector_position_y (0)
x_size = 1
color = red, green, blue
alpha_multiplier = view_option_selector_0
)
circular_fixation_point option_selector_1 (
trigger_width = fixation_width
trigger_watch_x = pointer_x // eye_h * (1 - use_mouse) + use_mouse * pointer_x
trigger_watch_y = pointer_y // eye_v * (1 - use_mouse) + use_mouse * pointer_y
trigger_flag = selected_1
x_position = option_stim_selector_position_x (1)
y_position = option_stim_selector_position_y (1)
x_size = 1
color = red, green, blue
alpha_multiplier = view_option_selector_1
)
%define display_option_selectors()
live_queue_stimulus(option_selector_0)
live_queue_stimulus(option_selector_1)
update_display()
%end
text break_prompt (
text = 'You can now take a short break, after which you will move on to a new sequence. The task will resume in ' + (string)(60 - (int)((next_frame_time() - break_start_time)/1s)) + ' seconds.'
font_name = 'Helvetica Neue'
font_size = 30
x_size = 30.0
y_size = 10.0
)