event.clearEvents() # reset all triggers to zero et.sendTriggers(port,0) # experimental phases (unique things on screen) fix_phase = fixDot[:] +[progress_bar,progress_bar_start,progress_bar_end] stim_phase = fixDot[:] + [progress_bar,progress_bar_start,progress_bar_end,leftbar,rightbar,leftProb,rightProb,leftframe,rightframe] select_phase = fixDot[:] +[progress_bar,progress_bar_start,progress_bar_end,selectbar,leftbar,rightbar,leftProb,rightProb,rightframe,leftframe] feedback_phase = fixDot[:] +[progress_bar,progress_bar_start,progress_bar_end,progress_update,selectbar,leftbar,rightbar,leftProb,rightProb,rightframe,leftframe] #################### ### START EXP ### #################### while 'c' not in event.getKeys(): et.drawFlip(win,[startExp]) ###################### ### START BLOCKS ### ###################### for block_no in range(param['n_blocks']): trial_info['block_no']=block_no+1 block_correct = 0 # start block message startBlock.text = stim_info["startBlock_text"].format(block_no+1, param['n_blocks']) while True: et.drawFlip(win,[startBlock]) cont=captureResponse(port,keys = [response_info['pause_resp'],None]) if cont == response_info['pause_resp']: while captureResponse(port,keys=resp_keys+ [None]) in resp_keys: win.flip()
### SET TIMING ### #################### pause_frames = round(timing_info['pause_dur'] * win_info['framerate']) feed_frames = round(timing_info['feed_dur'] * win_info['framerate']) fix_frames = round(timing_info['fix_dur'] * win_info['framerate']) noise_seq = np.random.uniform( timing_info['noise_mean'] - timing_info['noise_range'], timing_info['noise_mean'] + timing_info['noise_range'], size=(n_blocks, n_trials + param['n_zero'])) #################### ### START EXP ### #################### # show block intro while 'c' not in event.getKeys(): et.drawFlip(win, [startExp]) ########################### ### START BLOCK LOOP # ### ########################### for block_no in range(n_blocks): # create trial sequence trial_seq = np.tile(np.arange(n_cohs), int(n_trials / n_cohs)) # add zero-coherence trials trial_seq = np.concatenate( (trial_seq, np.ones(param['n_zero'], dtype=int) * n_cohs)) np.random.shuffle(trial_seq) # make sure every coherence lvl is matched with both directions equal number of times dir_list = [-1, 1] * int(n_trials / 2 / n_cohs)