Exemplo n.º 1
0
            message = incorrect_message
        
        if bl == 0: # only give a message in the learning block
            trial_routine.wait_for_time_limit(
                components=[message], 
                time_seconds=messages_duration, 
                label='choice_feedback')

        data = data.append(
            {'trial':int(t+1), 'rt':rt, 'choice':key, 'accuracy':accuracy_trial, 'image':image_trial, 'block':['learning', 'transfer'][bl],
             'difficulty':block['difficulty'][t], 'correct_response':correct_resp_trial, 'category':block['category'][t]},
            ignore_index=True) # record the responses

        #save data to file
        for label in expInfo.keys():
            data[label] = expInfo[label]
        data.to_csv(fileName + '.csv')

# final message with accuracy feedback
accuracy_learning = int(data.loc[data.block == 'learning', 'accuracy'].mean()*100)
accuracy_transfer = int(data.loc[data.block == 'transfer', 'accuracy'].mean()*100)

end_transfer_message.text = "Congratulations, you finished the experiment. You accuracy was {}% in the learning part and {}% in the test.".format(accuracy_learning, accuracy_transfer)
trial_routine.wait_for_time_limit(
        components=[end_transfer_message], 
        time_seconds=message_beginning_duration, 
        label='message_end')

#cleanup
mywin.close()
core.quit()
Exemplo n.º 2
0
                # imagePaths.pop(0)
            except:
                pass
    elif states[0] == 'ITI':
        backgroundImage.setAutoDraw(True)
        fix.draw()
        
# #         try:
#         print('hiding this image=',imagePaths[currImage-1],end='\n\n')
#         imagePaths[currImage-1].setAutoDraw(False)
# #         except:
# #             pass
# #         image.setAutoDraw(False)
    elif states[0] == 'waiting':
#         image.image='./carchair_exp_feedback/bedChair_1_5.png'
        backgroundImage.setAutoDraw(False)
        image.setAutoDraw(True)
        # sys.stdout.flush()
    # refresh the screen
    mywin.flip()
# print('frameTime=',frameTime)

# write data out!
# behavioral data
data.to_csv(newfile)
# eye-tracking data
mywin.close()
core.quit()


Exemplo n.º 3
0
    clicks.append(q_rating)
    responses.append(response)
    scales.append(q_name)

    win.flip()

print('h')
#save survey data
data = pd.DataFrame({
    'scale': scales,
    'response_clicked': clicks,
    'response': responses
})

data.to_csv(file_name, sep=',', index=False, na_rep='na', header=True)

#def task_setup(cb, win):

title = visual.TextStim(win, text="Word Rating Task")
sp_text = visual.TextStim(win,
                          text="Press the spacebar to continue.",
                          height=.06,
                          units='norm',
                          pos=(0.0, -0.4))
title.draw()
sp_text.draw()
win.flip()
event.waitKeys()
win.flip()