![]() ![]() If len(bttnPress.keys)=0: # No response was made If bttnPress.getButton(1): # at least one key was pressedīttnPress.rt.append(()) Win.callOnFlip() # t=0 on next screen flip # keep track of start time/frame for laterīameNStart = frameN # exact frame index If t >= 0.0 and bttnPress.status = NOT_STARTED: If I press a button once in a trial (each trial allowing multiple button presses) then it records it as a button press multiple times. After some tinkering it works but the output/controller is still not working properly. # Clear all events from the global and device level ioHub Event Buffers.I’m coding a Nback task and want to use a joystick/gamepad for the button press. Key_text_stim, char_stim, modifiers_stim, keypress_duration_stim,Īll_pressed_stim, event_type_stim, psychopy_key_stim] Modifiers_label, keypress_duration_label, all_pressed_label, STIM_LIST = [title_label, title2_label, key_text_label, char_label, # Having all the stim to update / draw in a list makes drawing code # more compact and reusable Height=TEXT_STIM_HEIGHT, wrapWidth=dw * 2) Psychopy_key_stim = visual.TextStim(win, units=unit_type, text= u'', Keypress_duration_stim = visual.TextStim(win, units=unit_type, text= u'',Īll_pressed_stim = visual.TextStim(win, units=unit_type, text= u'',Įvent_type_stim = visual.TextStim(win, units=unit_type, text= u'', Height=TEXT_STIM_HEIGHT, wrapWidth=LABEL_WRAP_LENGTH) Pos=,Ĭolor= 'black', alignText= 'left', anchorHoriz= 'left', Xx, yy = normalizedValue2Coord((x, y), mag, coord_size) # Sticks are 3 item lists (x, y, magnitude). Message = visual.TextStim(win, pos=( 0, - 350), text=msgText, color= 'Red', MsgText = ( 'Left Stick: Spot Pos Right Stick: Grating Pos ' 'Left Trig: SF Right Trig: Ori "A" Button: Rumble ' '"q" key: Quit') X,y,mag=gamepad.getThumbSticks() # sticks are 3 item lists (x,y,magnitude) MsgText= 'Left Stick = Spot Pos Right Stick = Grating Pos \nLeft Trig = SF Right Trig = Ori \n"r" key = Rumble "q" = Quit\n' message = visual.TextStim(myWin,pos=( 0,- 200),ĪlignHoriz= 'center',alignVert= 'center',height= 24, Screen_resolution= display.getPixelResolution() # note: globalClock has been reset to 0.0 by launchScan()Ĭaps=gamepad.getLastReadCapabilitiesInfo()įixSpot = visual.PatchStim(myWin,tex= "none", mask= "gauss",pos=( 0, 0), ![]() Max_slippage = 0.02 # how long to allow before treating a "slow" sync as missed # any slippage is almost certainly due to timing issues with your script or PC, and not MR scannerĭuration = MR_settings * MR_settings Infer_missed_sync = False # best if your script timing works without this, but this might be useful sometimes Vol = launchScan(win, MR_settings, globalClock=globalClock, simResponses=simResponses) # launch: operator selects Scan or Test (emulate) see API documentation Sync_now = False # can simulate user responses, here 3 key presses in order 'a', 'b', 'c' (they get sorted by time): Output += " 0 0.000 %s start of scanning run, vol 0\n" % key_code Output += '%d prescan skip (no sync)\n' % iĬounter = visual.TextStim(win, height=. Output = 'vol onset key\n' for i in range(- 1 * MR_settings, 0): # summary of run timing, for each key press: ![]() InfoDlg = gui.DlgFromDict(MR_settings, title= 'fMRI parameters', order=) 'skip': 0, # number of volumes lacking a sync pulse at start of scan (for T1 stabilization) 'sound': True # in test mode only, play a tone as a reminder of scanner noise ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |