当前位置: 首页>>代码示例>>Python>>正文


Python Presentation.add_controller方法代码示例

本文整理汇总了Python中VisionEgg.FlowControl.Presentation.add_controller方法的典型用法代码示例。如果您正苦于以下问题:Python Presentation.add_controller方法的具体用法?Python Presentation.add_controller怎么用?Python Presentation.add_controller使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VisionEgg.FlowControl.Presentation的用法示例。


在下文中一共展示了Presentation.add_controller方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Presentation

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
	problem.go()

	p3 = Presentation(go_duration=(blankTime, 'seconds'), viewports=[fixCross])
	p3.go()

	p = Presentation(go_duration=('forever', ), viewports=[vr])
	p.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, key_handler)]  
	p.go()

	
	subject.inputData(trial, "RT", RT)
	subject.inputData(trial, "ACC", ACC)
	
	#BLOCK 2 - STRATEGY SELECTION
	p2 = Presentation(go_duration=('forever', ), viewports=[stratPort])
	p2.add_controller(None, None, FunctionController(during_go_func=strategy_controller, temporal_variables = FRAMES_ABSOLUTE))
	p2.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, key_handler)]        
	p2.go()
	
	subject.inputData(trial, "cur_strat", strategy)
	
	#BLOCK 3 - BLANK SCREEN
	p3 = Presentation(go_duration=(0.5, 'seconds'), viewports=[fixCross])
	p3.go()
	
	trial = trial + 1
	
	subject.printData()
	
subject.preserve()
开发者ID:CrossGini,项目名称:OpenPsyc,代码行数:32,代码来源:aVer3.py

示例2: __init__

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
class SimpleVisionEgg:
    keyboard_controller = None
    trigger_controller = None
    screen = None
    presentation = None
    keys = None
    presses = None
    releases = None

    def __init__(self):
        """We break up initialization a bit as we need to go back and forth with
        some information.  In this case, we need screen size before specifying
        the stimuli"""
        
        # pasted in from where it used to be at the beginning of the script
        # used to be outside of any methods...
        VisionEgg.start_default_logging()
        VisionEgg.watch_exceptions()
        # get screen size for setting fullscreen resolution
        # comment this block out if you don't want to use full-screen.
        screen = pygame.display.set_mode((0,0))
        WIDTH, HEIGHT = screen.get_size()
        pygame.quit()
        VisionEgg.config.VISIONEGG_SCREEN_W = WIDTH
        VisionEgg.config.VISIONEGG_SCREEN_H = HEIGHT

        self.screen = get_default_screen()
        self.keys = []
        self.presses = []
        self.releases = []

    def set_stimuli(self, stimuli, trigger=None, kb_controller=False):
        """Now that we have our stimuli, we initialize everything we can"""
        viewport = Viewport(screen=self.screen, size=self.screen.size, 
                           stimuli=stimuli)

        # We disable "check_events" so that we don't lose "instantaneous" key
        # presses and can check these in our Response classes
        self.presentation = Presentation(viewports=[viewport],
                check_events=False)

        if trigger:
            trigger_controller = KeyboardTriggerInController(trigger)
            self.presentation.add_controller(self.presentation, 
                                    'trigger_go_if_armed', trigger_controller)
            self.presentation.set(trigger_go_if_armed=0)

        if kb_controller:
            self.keyboard_controller = KeyboardResponseController()
            self.presentation.add_controller(None, None, self.keyboard_controller)


    def set_functions(self, update=None, pause_update=None):
        """Interface for cognac.StimulusController or similar"""
        self.presentation.add_controller(None, None,
                     FunctionController(during_go_func=update, 
                                        between_go_func=pause_update,
                                        return_type=NoneType) )


    def go(self, go_duration=('forever',)):
        self.presentation.parameters.go_duration = go_duration
        self.presentation.go()

    def pause(self):
        self.presentation.parameters.go_duration = (0, 'frames')

    def get_new_response(self, t, min_interval=2.0 / 60, releases=False):
        """(key, press) = get_new_response(self, t, min_interval=2.0 / 60)

        DEPRECATED!

        Use this function to get responses from the keyboard controller in real
        time.

        Returns (None, None) if no new response is available.
        Maintains three instance variables - keys, presses and releases, which
        you can also access directly (but they won't be updated during loops
        where you don't call this function)

        This function makes a number of assumptions and is a little brittle
        right now.  By not hard-coding the min_interval and maybe using key
        presses and release events directly, we'd have a much better function.
        But I don't really care right now.

        DJC
        """
        raise DeprecationWarning("please use pygame directly, as in" +
                                 "StimController.Response")
        # Note - this is deprecated anyway, but it'd probably make more sense to
        # use the keyboard_controller.get_responses() to simply get the keys
        # that are down _right_now_
        press_time = self.keyboard_controller.get_time_last_response_since_go()
        key = self.keyboard_controller.get_last_response_since_go()

        # Our first response!
        if len(self.keys) == 0:
            if key:
                self.keys.append(key)
                self.presses.append(press_time)
#.........这里部分代码省略.........
开发者ID:davclark,项目名称:SimpleVisionEgg,代码行数:103,代码来源:SimpleVisionEgg.py

示例3: Viewport

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
viewport = Viewport(screen=screen, stimuli=[stimulus])

########################################
#  Create presentation object and go!  #
########################################

p = Presentation(go_duration=(5.0,'seconds'), viewports=[viewport])

##############################################
#  Connect the controller with the stimulus  #
##############################################

keyboard_response = KeyboardResponseController()

# Add the keyboard controller to the presentation's list of controllers
p.add_controller(None, None, keyboard_response)

########
#  Go  #
########

for i in range(3):
    p.go()

    # Print responses collected during the presentation
#   print "all       =",keyboard_response.get_responses_since_go()
#   print "all_time  =",keyboard_response.get_time_responses_since_go()
    print "first     =",keyboard_response.get_first_response_since_go()
    print "first_time=",keyboard_response.get_time_first_response_since_go()
#   print "last      =",keyboard_response.get_last_response_since_go()
#   print "last_time =",keyboard_response.get_time_last_response_since_go()
开发者ID:Complex501,项目名称:visionegg,代码行数:33,代码来源:demo_keyboardresponse.py

示例4: min

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
max_vel = min(screen.size[0],screen.size[1]) * 0.4

# define position as a function of time
def get_target_position(t):
    global mid_x, mid_y, max_vel
    return ( max_vel*sin(0.1*2.0*pi*t) + mid_x , # x
             max_vel*sin(0.1*2.0*pi*t) + mid_y ) # y

# Create an instance of the Controller class
target_position_controller = FunctionController(during_go_func=get_target_position)

#############################################################
#  Connect the controllers with the variables they control  #
#############################################################

p.add_controller(target,'position', target_position_controller )

#######################
#  Run the stimulus!  #
#######################

base_dir = VisionEgg.config.VISIONEGG_USER_DIR
if not os.path.isdir(base_dir):
    base_dir = VisionEgg.config.VISIONEGG_SYSTEM_DIR
save_directory = os.path.join(base_dir,'movie')
if not os.path.isdir(save_directory):
    os.mkdir(save_directory)
    if not os.path.isdir(save_directory):
        print "Error: cannot make movie directory '%s'."%save_directory
print "Saving movie to directory '%s'."%save_directory
basename = "movie_"+os.path.splitext(os.path.basename(sys.argv[0]))[0]
开发者ID:Complex501,项目名称:visionegg,代码行数:33,代码来源:makeMovie.py

示例5: aplicacion

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
def aplicacion():
  global p,inten,coord
  pos=[0.4,0.5,0.6,0.7,0.8]
  pos2=[1.3,1.4,1.5,1.6,1.7,1.8]
  rellenar()
  shuffle(coord)
  i = len(coord)-1
  target.parameters.position = coord[i][:2]
  (xpos,ypos)=target.parameters.position
  x=xpos-screen.size[0]/2
  y=ypos-screen.size[1]/2
  anrad=math.atan2(y, x)
  angrad=math.degrees(anrad)
 
  if angrad>=0:
      if angrad<=90: 
        orientacion=-45
        xx=2.0
        yy=2.0
      else:
       orientacion=-135
       xx=-2.0
       yy=2.0
  else:
      aux=angrad*(-1)
      if aux<=90:
        orientacion=45
        xx=2.0
        yy=-2.0
      else:
        orientacion=135
        xx=-2.0
        yy=-2.0
  
  fixpoint.parameters.position=((screen.size[0]/2.0)+xx, (screen.size[1]/2.0)+yy)
  fixpoint.parameters.orientation=orientacion
  
  
  viewport = Viewport(screen=screen, stimuli=[fixpoint,fixcirc])
  p = Presentation(go_duration=(1.0,'seconds'),viewports=[viewport])
  p.parameters.handle_event_callbacks = [(pygame.locals.KEYDOWN, keydown),
                                       (pygame.locals.KEYUP, keyup),
                                       (pygame.locals.QUIT, quit_app)]
  p.add_controller(None, None, FunctionController(during_go_func=settings))
  #winsound.PlaySound('instruccion',winsound.SND_FILENAME)
  p.go()
  
  while len(coord)!= 0:
    if end:
        break
    i = len(coord)-1
    target.parameters.position = coord[i][:2]
    dur=pos[random.randrange(0,4,1)]
    (xpos,ypos)=target.parameters.position
    x=xpos-screen.size[0]/2
    y=ypos-screen.size[1]/2
    anrad=math.atan2(y, x)
    angrad=math.degrees(anrad)
    #fixpoint.parameters.orientation=(-angrad) 
    if angrad>=0:
      if angrad<=90: 
        orientacion=-45
        xx=2.0
        yy=2.0
      else:
       orientacion=-135
       xx=-2.0
       yy=2.0
    else:
      aux=angrad*(-1)
      if aux<=90:
        orientacion=45
        xx=2.0
        yy=-2.0
      else:
        orientacion=135
        xx=-2.0
        yy=-2.0
  
    fixpoint.parameters.position=((screen.size[0]/2.0)+xx, (screen.size[1]/2.0)+yy)
    fixpoint.parameters.orientation=orientacion
    
  
    viewport = Viewport(screen=screen, stimuli=[fixpoint,fixcirc])
    p = Presentation(go_duration=(dur,'seconds'),viewports=[viewport])
    p.parameters.handle_event_callbacks = [ (pygame.locals.QUIT, quit_app)]
	
    
    p.add_controller(None, None, FunctionController(during_go_func=settings))
    p.go()

    inten = coord[i][-1]
    target.parameters.color = (1.0,1.0,1.0,inten)      #Se muestra el estimulo Duracion 0.3 segundos
    viewport = Viewport(screen=screen, stimuli=[target,fixpoint,fixcirc])
    p = Presentation(go_duration=(0.3,'seconds'),viewports=[viewport])
    p.parameters.handle_event_callbacks = [ (pygame.locals.QUIT, quit_app)]
                          
    p.add_controller(None, None, FunctionController(during_go_func=settings))
    p.go()
    target.parameters.color = (0.0,0.0,0.0,1.0)  #Desaparece el estimulo tiempo para registrar
#.........这里部分代码省略.........
开发者ID:rakelup,项目名称:Trainning-game-,代码行数:103,代码来源:entrenaFuentesFinal.py

示例6: range

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
# Generate some images
image_list = []
for i in range(num_images):
    image = Image.new("RGB",image_size,(0,0,255)) # Blue background
    draw = ImageDraw.Draw(image)
    line_x = image_size[0]/float(num_images) * i
    draw.line((line_x, 0, line_x, image_size[1]), fill=(255,255,255))
    image_list.append(image)

texture_list = map(Texture,image_list) # create instances of Texture from images

screen = get_default_screen()

stimulus = TextureStimulus(texture=texture_list[0],
                           position = (screen.size[0]/2.0,screen.size[1]/2.0),
                           anchor='center',
                           size=image_size)

viewport = Viewport(screen=screen,
                    stimuli=[stimulus])

p = Presentation(go_duration=(num_images*duration_per_image,'seconds'),viewports=[viewport])

def put_image(t):
    i = int(t/duration_per_image) # choose image
    stimulus.parameters.texture = texture_list[i]
p.add_controller(None,None,FunctionController(during_go_func=put_image))

p.go()
开发者ID:Complex501,项目名称:visionegg,代码行数:31,代码来源:image_sequence_slow.py

示例7: min

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
mid_x = screen.size[0]/2.0
mid_y = screen.size[1]/2.0
max_vel = min(screen.size[0],screen.size[1]) * 0.4

# define target position as a function of time
def get_target_position(t):
    global mid_x, mid_y, max_vel
    return ( max_vel*sin(0.1*2.0*pi*t) + mid_x , # x
             max_vel*sin(0.1*2.0*pi*t) + mid_y ) # y

def get_drum_angle(t):
    return 10.0*t

# Create instances of the Controller class
target_position_controller = FunctionController(during_go_func=get_target_position)
drum_angle_controller = FunctionController(during_go_func=get_drum_angle)

#############################################################
#  Connect the controllers with the variables they control  #
#############################################################

p.add_controller(target,'position', target_position_controller )
p.add_controller(drum,'angular_position', drum_angle_controller )

#######################
#  Run the stimulus!  #
#######################

p.go()

开发者ID:Complex501,项目名称:visionegg,代码行数:31,代码来源:targetBackground2D.py

示例8: FunctionController

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
dot_controller = FunctionController(during_go_func=setDots)
coherence_controller = FunctionController(during_go_func=setCoherence)
direction_controller = FunctionController(during_go_func=setDirection)
inst_controller = FunctionController(during_go_func=changeInstructions)
inst_on_controller = FunctionController(during_go_func=setInstructions)
inst3_on_controller = FunctionController(during_go_func=setTimeOn)
inst3_position_controller = FunctionController(during_go_func=setTimePos)
fixation_texture_controller = FunctionController(during_go_func=setFixationTexture)
samplefix_controller = FunctionController(during_go_func=setSampleFix)

state_controller = FunctionController(during_go_func=getState)

#######################################################
#  Connect the controllers with objects they control  #
#######################################################
p.add_controller(p,'trigger_go_if_armed',trigger_in_controller)

# on or off before pres
p.add_controller(str_instruct_1,'on', stimulus_off_controller)
p.add_controller(str_instruct_2,'text', inst_controller)
p.add_controller(str_instruct_2,'on', stimulus_on_controller)
p.add_controller(str_instruct_2,'on', inst_on_controller)
p.add_controller(dotStim,'on', stimulus_on_controller)
p.add_controller(fixation,'on', stimulus_on_controller)

# on or off during pres
p.add_controller(fixation,'max_alpha', fixation_controller)
p.add_controller(dotStim,'on', dot_controller)
p.add_controller(dotStim,'signal_fraction', coherence_controller)
p.add_controller(dotStim,'signal_direction_deg', direction_controller)
p.add_controller(fixation,'texture', fixation_texture_controller)
开发者ID:jeffzemla,项目名称:oft_exp,代码行数:33,代码来源:exp.py

示例9: __init__

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]

#.........这里部分代码省略.........
    def on_init(self):
        # Set screen's background color
        self.screen.set(bgcolor=(0., 0., 0.)) # black

        # Set target's properties
        self.TopTarget.set(size=(HSize, VSize),
                           color= (1.0, 1.0, 1.0, 1.0),
                           position=(w/2, h*0.8))
        self.BotTarget.set(size=(HSize, VSize),
                           color=(1.0, 1.0, 1.0, 1.0),
                           position=(w/2, h*0.2))
        self.LeftTarget.set(size=(VSize, HSize),
                            color=(1.0, 1.0, 1.0, 1.0),
                            position=(w*0.2, h/2))
        self.RightTarget.set(size=(VSize, HSize),
                             color=(1.0, 1.0, 1.0, 1.0),
                             position=(w*0.8, h/2))

        # Message
        # self.text.set(text='Please wait for next trial...',
        #               color=(1.0, 0.5, 0.5),
        #               position=(w/2, h*0.8),
        #               font_size=50,
        #               anchor='center',
        #               on=False)

        # Arrows
        self.arrow.set(texture=Texture('images\left2.bmp'),
                        position=(w/2, h/2),
                        anchor='center',
                        on=False)

        # Show initializing message
        self.initialize.add_controller(self.mess, 'text',     FunctionController(during_go_func=self.showMess))

        # Set control's parameters and corresponding function. Controlling targers
        self.targetShow.add_controller(self.TopTarget, 'on',     FunctionController(during_go_func=self.topFlick))
        self.targetShow.add_controller(self.BotTarget, 'on',     FunctionController(during_go_func=self.botFlick))
        self.targetShow.add_controller(self.LeftTarget, 'on',    FunctionController(during_go_func=self.leftFlick))
        self.targetShow.add_controller(self.RightTarget, 'on',   FunctionController(during_go_func=self.rightFlick))

        # Controlling others
        # self.p2.add_controller(self.text, 'on',         FunctionController(during_go_func=self.appear))
        self.cueShow.add_controller(self.arrow, 'on',        FunctionController(during_go_func=self.arrow_appear))
        self.cueShow.add_controller(self.arrow, 'texture',   FunctionController(during_go_func=self.random_cue))


    def on_execute(self):
        if self.on_init() == False:
            self._running = False

        # Prompting
        self.initialize.go()

        # Experiment goes..
        for i in range(0,numTrial):
            self.cueShow.go()
            self.targetShow.go()

        self.on_writing()

    # TODO
    # Maybe we need a method for closing the program


    #################################################
开发者ID:quangNguyen122,项目名称:SSVEP_experiment,代码行数:70,代码来源:Stimulation.py

示例10: FixationSpot

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
                                      texture_min_filter=gl.GL_NEAREST,
                                      texture_mag_filter=gl.GL_NEAREST,
                                      )

fixation_spot = FixationSpot(position=(screen.size[0]/2,screen.size[1]/2),
                             anchor='center',
                             color=(255,0,0,0),
                             size=(4,4))

viewport = Viewport(screen=screen,
                    stimuli=[static_checkerboard,
                             dynamic_checkerboard,
                             fixation_spot])

p = Presentation(go_duration=(dynamic_time+static_time,'seconds'),
                 viewports=[viewport])

# Use a controller to hook into go loop, but control texture buffer
# through direct manipulation.
dynamic_texture_object = dynamic_checkerboard.parameters.texture.get_texture_object()
width,height = dynamic_checkerboard_size
# (Note: numpy arrays have indices flipped from images, thus the re-ordering)
flipped_shape = (height,width)
def control_dynamic(t):
    if t <= dynamic_time:
        random_data = numpy.random.randint(0,2,size=(dynamic_checkerboard_size[1],dynamic_checkerboard_size[0]))*255
        dynamic_texture_object.put_sub_image( random_data )
p.add_controller(None,None,FunctionController(during_go_func=control_dynamic))

p.go()
开发者ID:Complex501,项目名称:visionegg,代码行数:32,代码来源:visual_jitter.py

示例11: get_default_screen

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
"""Use frame information to display stimuli."""

import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import get_default_screen, Viewport
from VisionEgg.FlowControl import Presentation, FunctionController, FRAMES_ABSOLUTE
from VisionEgg.Text import Text

screen = get_default_screen()
screen.parameters.bgcolor = (0.0,0.0,1.0) # background blue (RGB)

textvar = Text(color=(1.0,1.0,1.0), # alpha is ignored (set with max_alpha_param)
               position=(screen.size[0]/4,screen.size[1]/2),
               font_size=50,
               anchor='left')

def text_func(f_abs):
    return "framecount: % 4d"%f_abs

t_controller = FunctionController(during_go_func=text_func,
                                  temporal_variables = FRAMES_ABSOLUTE)

viewport = Viewport(screen=screen,
                    size=screen.size,
                    stimuli=[textvar])

p = Presentation(go_duration=(5.0,'seconds'),viewports=[viewport])
p.add_controller(textvar,'text',t_controller)
p.go()
开发者ID:Complex501,项目名称:visionegg,代码行数:32,代码来源:framecount.py

示例12: Text

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
	anchor = 'center',
    position = (screen.size[0]/2, screen.size[1]/2),
)


cur_time = Text(
	text		= "",
	font_size 	= 15,
	color		= (.75,.75,.75),
	anchor		= 'lowerleft',
	position	= (0,0),
	)

viewport_instructions = Viewport( screen=screen, stimuli = [ instructions, cur_time ] )
p1 = Presentation(go_duration=('forever',), viewports=[viewport_instructions])
p1.add_controller(None,None,FunctionController(during_go_func=displayTime))
p1.parameters.handle_event_callbacks =  [ (pygame.locals.KEYDOWN, waitForTrigger) ]

# setup main experimental loop
loadStims 		= 0
wrote_response 	= 0

stimulus =      TextureStimulus(
                    anchor                  = 'center',
                    size                    = stimuli_size,
                    position                = (screen.size[0]/2.0, screen.size[1]/2.0),
                    texture_min_filter      = gl.GL_LINEAR,
                    shrink_texture_ok       = 1,
		    # PW 2012/11/26
                    mipmaps_enabled = False
                )
开发者ID:gablab,项目名称:fouse,代码行数:33,代码来源:fsbos.py

示例13: RGB

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
                        color2           = (1.0, 0.5,  0.1), # RGB (alpha ignored if given)
                        contrast         = 0.2,
                        pedestal         = 0.1,
                        mask             = mask, # optional
                        position         = ( screen.size[0]/2.0, screen.size[1]/2.0 ),
                        anchor           = 'center',
                        size             = ( 300.0 , 300.0 ),
                        spatial_freq     = 20.0 / screen.size[0], # units of cycles/pixel
                        temporal_freq_hz = 1.0,
                        orientation      = 270.0 )

def pedestal_func(t):
    # Calculate pedestal over time. (Pedestal range [0.1,0.9] and
    # contrast = 0.2 limits total range to [0.0,1.0])
    temporal_freq_hz = 0.2
    return 0.4 * sin(t*2*pi * temporal_freq_hz) + 0.5

###############################################################
#  Create viewport - intermediary between stimuli and screen  #
###############################################################

viewport = Viewport( screen=screen, stimuli=[stimulus] )

########################################
#  Create presentation object and go!  #
########################################

p = Presentation(go_duration=(10.0,'seconds'),viewports=[viewport])
p.add_controller(stimulus,'pedestal',FunctionController(during_go_func=pedestal_func))
p.go()
开发者ID:Complex501,项目名称:visionegg,代码行数:32,代码来源:color_grating.py

示例14: PyroServer

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
from VisionEgg.FlowControl import Presentation
from VisionEgg.Gratings import *
from VisionEgg.PyroHelpers import *

pyro_server = PyroServer()

# get visionegg stimulus ready to go
screen = get_default_screen()
stimulus = SinGrating2D()
viewport = Viewport(screen=screen,stimuli=[stimulus])
p = Presentation(viewports=[viewport])

# make a controller, serve it via pyro, and glue it to the Presentation
tf_controller = PyroConstantController(during_go_value=0.0)
pyro_server.connect(tf_controller,'tf_controller')
p.add_controller(stimulus,'temporal_freq_hz', tf_controller)

sf_controller = PyroConstantController(during_go_value=0.0)
pyro_server.connect(sf_controller,'sf_controller')
p.add_controller(stimulus,'spatial_freq', sf_controller)

contrast_controller = PyroConstantController(during_go_value=0.0)
pyro_server.connect(contrast_controller,'contrast_controller')
p.add_controller(stimulus,'contrast', contrast_controller)

orient_controller = PyroConstantController(during_go_value=0.0)
pyro_server.connect(orient_controller,'orient_controller')
p.add_controller(stimulus,'orientation', orient_controller)

duration_controller = PyroConstantController(during_go_value=(5.0,'seconds'))
pyro_server.connect(duration_controller,'duration_controller')
开发者ID:Complex501,项目名称:visionegg,代码行数:33,代码来源:gratingPyroServer.py

示例15: Texture

# 需要导入模块: from VisionEgg.FlowControl import Presentation [as 别名]
# 或者: from VisionEgg.FlowControl.Presentation import add_controller [as 别名]
		fname2 = "%s_%s_%s_%s_%s_S2.bmp" % (ratio, n1, color, size, exemplar)
		
	####
	t1 = Texture(Image.open(os.path.join(stimLib,fname1)))
	t2 = Texture(Image.open(os.path.join(stimLib,fname2)))
	
	phase = ""
	s1 = TextureStimulus(texture = t1, position = (x, y), anchor = 'center')
	s2 = TextureStimulus(texture = t2, position = (x * 3, y), anchor = 'center')	

	texture_object1 = s1.parameters.texture.get_texture_object()
	texture_object2 = s2.parameters.texture.get_texture_object()

	v = Viewport(screen=screen, stimuli=[s1,s2])
	p = Presentation(go_duration=('forever', ), viewports=[v])
	p.add_controller(None, None, FunctionController(during_go_func=put_image_dual, temporal_variables = TIME_SEC_ABSOLUTE))

	if response == "voice":
		p.parameters.handle_event_callbacks=[(pygame.locals.MOUSEBUTTONDOWN, mouseGrade), (pygame.locals.KEYDOWN, quitHandler)]
	else:
		p.parameters.handle_event_callbacks=[(pygame.locals.MOUSEBUTTONDOWN, mouseFunc), (pygame.locals.KEYDOWN, quitHandler)]

	p.go()
	
	if response == "voice":
		sub.inputData(trial, "misfire", misfire)


	if trial % break_trial == 0 and trial != trials:
		print trial, "BREAK TIME"
		experiments.showImage(screen, os.path.join(basePath, "break.BMP"), 0)
开发者ID:CrossGini,项目名称:OpenPsyc,代码行数:33,代码来源:samar.py


注:本文中的VisionEgg.FlowControl.Presentation.add_controller方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。