![]() It is an adaptation of the course writtenīy the first two authors, for NBS Presentation for the This course was written by Daniel von Rhein, Pascal de Water and Wilbert van Ham for the Programming with PsychoPy, 0 Introduction An introductory programming guide for time-accurate experiments Authors: Click here for the web version of this tutorial Python for Social Scientists 3 ) # for i_trial in xrange(data.shape): # ax.scatter(data ax. sum ( axis = 1 )) print ( 'average results: ', ( data. array ( data ) print ( ' alphas = ', alphas ) print ( '# of trials :', np. shape ) print ( 'analyzing results' ) alphas = np. load ( f, encoding = 'latin1' ) print ( fn, results. glob ( './files/data/discriminating_v2_*pickle' ): print ( 'Loading ', fn ) with open ( fn, 'rb' ) as f : data = pickle. Import glob #from psychopy import misc import pickle fig = plt. close () #save data info = alphas info = results misc. flip () results = 2 * ( left = getResponse ()) - 1 win. randint ( n_alpha ) # a random number between 0 and 1 presentStimulus ( i_alpha, left ) wait_for_response. randint ( 2 ) # a random number between 0 and 1 i_alpha = numpy. zeros (( n_alpha, info )) for i_trial in range ( info ): wait_for_next. flip () n_alpha = len ( alphas ) results = numpy. draw () # while clock.getTime() < i_frame/FPS: # print clock.getTime(), i_frame/FPS # print('waiting') win. left ) * fasts + left * slows ) stimLeft. setTex ( left * fasts + ( 1 - left ) * slows ) stimRight. reset () for i_frame in range ( info ): # length of the stimulus wait_for_next. rand () * ( info - info )) phase_down = numpy. def presentStimulus ( i_alpha, left ): """ Present stimulus TODO : switch randomly up / down """ phase_up = numpy. else : print "hit LEFT or RIGHT (or Esc) (You hit %s )" % key clock = core. quit () return None #valid response - check to see if correct elif key in : if key in : return 0. ![]() clearEvents () #clear the event buffer to start with resp = None #initially while 1 : #forever until we return a keypress for key in event. ![]() TextStim ( win, text = u "+", units = 'norm', height = 0.15, color = 'BlanchedAlmond', pos =, alignHoriz = 'center', alignVert = 'center' ) def getResponse (): event. TextStim ( win, text = u "?", units = 'norm', height = 0.15, color = 'DarkSlateBlue', pos =, alignHoriz = 'center', alignVert = 'center' ) wait_for_next = visual. GratingStim ( win, size = ( info / 2, info / 2 ), pos = ( info / 4, 0 ), units = 'pix', interpolate = True, mask = 'gauss', autoLog = False ) #this stim changes too much for autologging to be useful wait_for_response = visual. GratingStim ( win, size = ( info / 2, info / 2 ), pos = ( - info / 4, 0 ), units = 'pix', interpolate = True, mask = 'gauss', autoLog = False ) #this stim changes too much for autologging to be useful stimRight = visual. Window (, info ], fullscr = True ) stimLeft = visual. get_grids ( info, info, info ) slows = fasts = print ( 'go! ' ) win = visual. ![]() ![]() localtime ()) fileName = 'data/discriminating_v2_' + info + '_' + info + '.pickle' print ( 'generating data' ) alphas = fx, fy, ft = mc. in time frames info = 32 # length of the presented period. N_Y # size of image info = 32 # a full period. DEBUG ) import os, numpy import MotionClouds as mc import time, datetime #if no file use some defaults info = info = 'anonymous' info = w info = h info = 50 info = mc. #!/usr/bin/env python """ Using psychopy to perform an experiment on discriminating clouds (c) Laurent Perrinet - INT/CNRS & Jonathan Vacher - CeReMaDe """ # width and height of your screen w, h = 1920, 1200 w, h = 2560, 1440 # iMac 27'' # width and height of the stimulus w_stim, h_stim = 1024, 1024 print ( 'launching experiment' ) from psychopy import visual, core, event, logging, misc logging. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |