

\n \nHusk 'z' hvis den venstre lyser og 'x' hvis den højre lyser. If ( response != stim and not stim) or ( stim and response != None):ĮrrorText = "Du kom til at lave en fejl. getKeys(, waitRelease = False, clear = True) # Clear keypresses. Stimuli =, stimuli, stimuli, stimuli, stimuli, stimuli, stimuli, stimuli] TextStim( win, text = text8, color = 'white', height = 0.1, pos = ( xpos, 0.65), wrapWidth = 1.7). \n \nRemember to still respond as quickly as possible without making mistakes."
If getkeys space psychopy trial#
\n \nHusk stadig at reagere så hurtigt som muligt, uden at lave fejl." if dk else "We start off with a trial round. TextStim( win, text = text7, color = 'white', height = 0.1, pos = ( xpos, 0.65), wrapWidth = 1.7). \n \nSuebsequently, there will be a small delay." \n \nSenere vil der være en lille forsinkelse." if dk else "At the beginning the circle will light up simultaniously with the squares. Text7 = "I starten vil cirklen lyse op samtidig med firkanterne. TextStim( win, text = text6, color = 'white', height = 0.1, pos = ( xpos, 0.65), wrapWidth = 1.7). In this case you are NOT supposed to press any key." I disse tilfælde skal du IKKE trykke på noget." if dk else "Sometimes the circle will turn red.

Text6 = "Nogen gange vil cirklen også lyse rød. TextStim( win, text = text5, color = 'white', height = 0.1, pos = ( xpos, 0.65), wrapWidth = 1.7). Text5 = "Vi introducerer nu også denne cirkel." if dk else "We now add a circle between the two squares." TextStim( win, text = errorText, color = 'white', height = 0.1, pos = ( xpos, 0), wrapWidth = 1.7). \n \nYou are not supposed to hold down the keys, only press them. \n \nRemember to press 'z' if the left square turns blue and 'x' if the right square turns blue. \n \nPrøv igen." if dk else "You made a mistake. Og du skal reagere inden den stopper med at lyse \n \nDu skal ikke holde knapperne nede, men bare trykke på dem. 'correct response' : 'z' if i 0 and key = :Įlif response != stim:ĮrrorText = "Du kom til at lave en fejl. # i is a counter for cycling through all possible stimuli. "neutralImg" : "hands/numberless-mir.jpg" if mirrored else "hands/numberless.jpg",ĭicName = str( index + finger + "-" + "0") "spatial congruency": congruency if mirrored else not congruency, "correct response" : "x" if finger = "index" else "z", Index = str( i) if i >= 10 else str( "0" + str( i))Ĭongruency = True if ( finger = "index" and number = 1) or ( finger = "middle" and number = 2) else FalseĭicName = str( index + finger + "-" + str( number)) # Make list of possible stimuli for implicit experiment Thank you.From psychopy import core, monitors, visual, event, gui I will appreciate any idea why that is happening and any advice of what I should do to get the time of the keypresses in milliseconds.

If getkeys space psychopy code#
But even with the position as in the example code I get the list with float type numbers, which are not somehow related to the “()” I set before. However, if I change its position it stops saving data. Keys = (keyList=, timeStamped=Clock)Įxit_keys = (timeStamped = False, keyList = )Īccording to the algorythm it would be correct to place the block Clock = () Stream = p.open(format = p.get_format_from_width(sound_stim.getsampwidth()), Print('Channels: '+ str(sound_stim.getnchannels())) Print('Sample Rate: ' + str(sample_rate) + 's/sec')ĭuration = round(num_samples / sample_rate, 4) Print('Num Samples: ' + str(num_samples)) Sound_stim = wave.open('stim_audio.wav', 'rb') Output_file = open(results_file, mode = 'w') I try “” function, specifyng the “timeStamped” parameter. The problem is that I can not get the time of the keypresses. Participants are supposed to listen to the audio stimuli and respond with pressing “Space” button while listening. The general idea is to gather responses from the keypresses. Hello there! I am using Python and PsychoPy to write a code for my button-click test.
