Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions INSTRUCTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,46 @@ Incorrect! It is the color not the word
incorrectEND

EnglishEnd


Chinese

instructionsSTART
你的任务是尽可能准确且快速地判断所显示单词的颜色。
你会在彩色单词的两侧看到两个选项。
如果正确选项在左边,请按X键,如果正确选项在右边,请按M键。

在下面的示例中,由于单词的颜色是绿色,你应按X(左)。
instructionsEND

practiceSTART
按空格键测试六次试验,然后开始正式测试。
practiceEND

testSTART
干得好!

如果你有任何问题,请现在向实验负责人提问。

尽量快速且准确地回答。

按空格键开始实验。
testEND

doneSTART
实验结束,

请通知实验负责人

按空格键结束实验
doneEND

rightSTART
正确!
rightEND

incorrectSTART
错误!是颜色而不是单词。
incorrectEND

ChineseEnd
22 changes: 20 additions & 2 deletions stroopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def create_window(self, color=(1, 1, 1)):
def settings(self):
experiment_info = {'Subid': '', 'Age': '', 'Experiment Version': 0.1,
'Sex': ['Male', 'Female', 'Other'],
'Language': ['English', 'Swedish'], u'date':
'Language': ['English', 'Swedish','Chinese'], 'NativeLanguage':['Yes','No'],u'date':
data.getDateStr(format="%Y-%m-%d_%H:%M")}

info_dialog = gui.DlgFromDict(title='Stroop task', dictionary=experiment_info,
Expand All @@ -45,7 +45,7 @@ def create_text_stimuli(self, text=None, pos=[0.0, 0.0], name='', color=None):

def create_trials(self, trial_file, randomization='random'):
'''Doc string'''
data_types = ['Response', 'Accuracy', 'RT', 'Sub_id', 'Sex']
data_types = ['Response', 'Accuracy', 'RT', 'Sub_id', 'Sex','NativeLanguage','Language']
with open(trial_file, 'r') as stimfile:
_stims = csv.DictReader(stimfile)
trials = data.TrialHandler(list(_stims), 1,
Expand All @@ -60,6 +60,8 @@ def present_stimuli(self, color, text, position, stim):
position = position
if settings['Language'] == "Swedish":
text = swedish_task(text)
elif settings['Language'] == "Chinese":
text = chinese_task(text)
else:
text = text
_stimulus.pos = position
Expand Down Expand Up @@ -118,6 +120,8 @@ def running_experiment(self, trials, testtype):
trial['Response'] = keys[0]
trial['Sub_id'] = settings['Subid']
trial['Sex'] = settings['Sex']
trial['Language'] = settings['Language']
trial['NativeLanguage'] = settings['NativeLanguage']
write_csv(settings[u'DataFile'], trial)

event.clearEvents()
Expand Down Expand Up @@ -164,6 +168,8 @@ def display_instructions(start_instruction=''):
example_words = ['green', 'blue', 'green']
if settings['Language'] == 'Swedish':
example_words = [swedish_task(word) for word in example_words]
elif settings['Language'] == 'Chinese':
example_words = [chinese_task(word) for word in example_words]

for i, pos in enumerate(positions):
examples[i].pos = pos
Expand Down Expand Up @@ -203,6 +209,18 @@ def swedish_task(word):
swedish = "gul"
return swedish

def chinese_task(word):
chinese = '+'
if word == "blue":
chinese = u"蓝色"
elif word == "red":
chinese = u"红色"
elif word == "green":
chinese = u"绿色"
elif word == "yellow":
chinese = "黄色"
return chinese


if __name__ == "__main__":
background = "Black"
Expand Down