• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python control.initialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中expyriment.control.initialize函数的典型用法代码示例。如果您正苦于以下问题:Python initialize函数的具体用法?Python initialize怎么用?Python initialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: run_exp

def run_exp():
    #control.run_test_suite()
    #control.set_develop_mode(True)

    # init
    control.defaults.initialize_delay = 0
    exp = design.Experiment(background_colour=(0, 0, 0))
    control.initialize(exp)

    # stimuli
    stimulus = expyriment.stimuli.Rectangle((1000, 1000))
    blank = expyriment.stimuli.BlankScreen()

    # stimuli preload
    stimulus.preload()
    blank.preload()

    # main loop
    mean = 0
    for k in range(1, 1000):
        t = stimulus.present()
        t += blank.present()
        mean += t
        print(t, mean / k)
        exp.clock.wait(500)
    control.end()
开发者ID:nikolaims,项目名称:nfb,代码行数:26,代码来源:qt_plus_expyriment.py


示例2: initialize

def initialize(remote_control=None, filename=None):
    """returns remote_control and file

     If remote_control or filename is None, the function will ask it (user input)

     """

    global trakstar, udp_connection, exp
    trakstar = TrakSTARInterface()
    thr_init_trackstar = Thread(target = trakstar.initialize)
    thr_init_trackstar.start()

    screen_size = get_monitor_resolution()

    # expyriment
    control.defaults.initialize_delay = 0
    control.defaults.pause_key = None
    control.defaults.window_mode = True
    control.defaults.window_size = [screen_size[0] - screen_size[0] / 10,
                                    screen_size[1] - screen_size[1] / 10]
    control.defaults.fast_quit = True
    control.defaults.open_gl = False
    control.defaults.event_logging = 0
    exp = design.Experiment()
    exp.set_log_level(0)
    control.initialize(exp)
    exp.mouse.show_cursor()

    if remote_control is None:
        logo_text_line(text="Use remote control? (y/N)").present()
        key = exp.keyboard.wait([ord("z"), ord("y"), ord("n"),
                        misc.constants.K_SPACE, misc.constants.K_RETURN ])[0]
        if key == ord("y") or key == ord("z"):
            remote_control = True
        else:
            remote_control = False

    if filename is None:
        bkg = logo_text_line("")
        filename = io.TextInput("Filename", background_stimulus=bkg).get()
        filename = filename.replace(" ", "_")

    logo_text_line(text="Trakstar is initializing...").present()
    thr_init_trackstar.join() # wait finishing trackstar thread

    if trakstar.is_init:
        udp_connection = trakstar.udp
        logo_text_line(text="Trakstar initialized").present()
    else:
        logo_text_line(text="Trakstar failed to initialize").present()
        exp.keyboard.wait()
    return remote_control, filename
开发者ID:lindemann09,项目名称:pytrak,代码行数:52,代码来源:main.py


示例3: initialize

def initialize(exp, remote_control=None):
    control.initialize(exp)
    exp.mouse.show_cursor()

    if remote_control is None:
        logo_text_line(text="Use remote control? (Y/n)").present()
        key = exp.keyboard.wait([ord("z"), ord("y"), ord("n"),
                                 misc.constants.K_SPACE,
                                 misc.constants.K_RETURN])[0]
        if key == ord("n"):
            remote_control = False
        else:
            remote_control = True

    return remote_control
开发者ID:lindemann09,项目名称:pyForceDAQ,代码行数:15,代码来源:base.py


示例4: init_display

def init_display(experiment):

	"""See openexp._canvas.legacy"""

	import pygame

	# Configure Expyriment
	io.defaults.mouse_track_button_events = False
	control.defaults.initialize_delay = 0
	control.defaults.event_logging = 0
	control.defaults.window_mode = experiment.get(u'fullscreen') == u'no'
	control.defaults.fast_quit = True
	control.defaults.window_size = experiment.resolution()
	control.defaults.auto_create_subject_id = True
	control.defaults.open_gl = experiment.get_check(u'expyriment_opengl', \
		xpyriment.settings[u'expyriment_opengl'][u'default']) == u'yes'
	control.defaults.audiosystem_sample_rate = experiment.get(u'sound_freq')
	control.defaults.audiosystem_bit_depth = experiment.get(u'sound_sample_size')
	control.defaults.audiosystem_channels = experiment.get(u'sound_channels')
	control.defaults.audiosystem_buffer_size = experiment.get(u'sound_buf_size')

	# Initialize
	exp = control.initialize()
	experiment._time_func = pygame.time.get_ticks
	experiment._sleep_func = pygame.time.delay
	experiment.time = experiment._time_func
	experiment.sleep = experiment._sleep_func
	experiment.window = exp.screen._surface
	experiment.expyriment = exp

	# TODO: In order to set the window title and to allow mouse responses we
	# need to bypass expyriment for now
	pygame.display.set_caption(u'OpenSesame (Expyriment backend)')
	pygame.event.set_allowed(pygame.MOUSEBUTTONDOWN)
	pygame.event.set_allowed(pygame.MOUSEBUTTONUP)
开发者ID:EoinTravers,项目名称:OpenSesame,代码行数:35,代码来源:xpyriment.py


示例5: init_display

	def init_display(experiment):

		import pygame

		# Configure Expyriment
		io.defaults.mouse_track_button_events = False
		control.defaults.initialize_delay = 0
		control.defaults.event_logging = 0
		control.defaults.window_mode = experiment.var.fullscreen != u'yes'
		control.defaults.fast_quit = True
		control.defaults.window_size = experiment.resolution()
		control.defaults.auto_create_subject_id = True
		control.defaults.open_gl = experiment.var.get(u'expyriment_opengl',
			xpyriment.settings[u'expyriment_opengl'][u'default']) == u'yes'
		control.defaults.audiosystem_sample_rate = experiment.var.sound_freq
		control.defaults.audiosystem_bit_depth = \
			experiment.var.sound_sample_size
		control.defaults.audiosystem_channels = experiment.var.sound_channels
		control.defaults.audiosystem_buffer_size = \
			experiment.var.sound_buf_size

		# Initialize. If Expyriment jumps into interactive mode, it reads from
		# the stdin, and crashes. Thus we explicitly disable the interactive-
		# mode detection.
		control._experiment_control.is_interactive_mode = lambda: False
		exp = control.initialize()
		experiment.window = exp.screen._surface
		experiment.expyriment = exp

		# TODO: In order to set the window title and to allow mouse responses we
		# need to bypass expyriment for now
		pygame.display.set_caption(u'OpenSesame (Expyriment backend)')
		pygame.event.set_allowed(pygame.MOUSEBUTTONDOWN)
		pygame.event.set_allowed(pygame.MOUSEBUTTONUP)
开发者ID:JdenHartog,项目名称:OpenSesame,代码行数:34,代码来源:xpyriment.py


示例6: init_display

def init_display(experiment):

	"""See openexp._canvas.legacy"""

	global exp
	
	# Configure Expyriment
	io.defaults.mouse_track_button_events = False	
	control.defaults.initialize_delay = 0
	control.defaults.event_logging = 0
	control.defaults.window_mode = experiment.get('fullscreen') == 'no'
	control.defaults.fast_quit = True
	control.defaults.window_size = experiment.resolution()
	control.defaults.auto_create_subject_id = True	
	control.defaults.open_gl = experiment.get_check('expyriment_opengl', \
		xpyriment.settings['expyriment_opengl']['default']) == 'yes'
	
	# Initialize
	exp = control.initialize()	
	experiment._time_func = _time
	experiment._sleep_func = exp.clock.wait
	experiment.time = experiment._time_func
	experiment.sleep = experiment._sleep_func
	experiment.window = exp.screen._surface
	experiment.expyriment = exp
	
	# TODO: In order to set the window title and to allow mouse responses we
	# need to bypass expyriment for now
	import pygame
	pygame.display.set_caption('OpenSesame (Expyriment backend)')
	pygame.event.set_allowed(pygame.MOUSEBUTTONDOWN)
	pygame.event.set_allowed(pygame.MOUSEBUTTONUP)
开发者ID:biancini,项目名称:OpenSesame,代码行数:32,代码来源:xpyriment.py


示例7: is_overlapping

        """

        if position is None:
            position = defaults.dot_position
        if colour is None:
            colour = defaults.dot_colour
        Circle.__init__(self, diameter=radius * 2, colour=colour, position=position)

    def is_overlapping(self, other, minimal_gap=0):
        """DEPRECATED METHOD: Please use 'overlapping_with_circle'"""
        return self.overlapping_with_circle(other, minimal_gap)

    def is_center_inside(self, other):
        """DEPRECATED METHOD: Please use 'center_inside_circle'"""
        return self.center_inside_circle(other)

    def is_inside(self, other):
        """DEPRECATED METHOD: Please use 'inside_circle'"""
        return self.inside_circle(other)


if __name__ == "__main__":
    from expyriment import control

    control.set_develop_mode(True)
    defaults.event_logging = 0
    exp = control.initialize()
    dot = Dot(radius=100)
    dot.present()
    exp.clock.wait(1000)
开发者ID:smathot,项目名称:expyriment,代码行数:30,代码来源:_dot.py


示例8: block

from expyriment import control, design, io, misc, stimuli
from expyriment.design.extras import StimulationProtocol


# SETTINGS
BLOCK_LENGTH = 8  # In volumes
NR_REPETITIONS = 6  # For each block (rest and imagery)
TR = 2.0
SCAN_TRIGGER = misc.constants.K_5
SCAN_TRIGGER_LTP_ADDRESS = None  # None = USB (keyboard emulation)


# DESIGN
exp = design.Experiment("Motor Imagery (Swimming)")
control.initialize(exp)
protocol = StimulationProtocol("time")

fixcross = stimuli.FixCross()
fixcross.preload()
blocks = {"rest":[stimuli.TextLine("REST",
                                   text_size=70,
                                   text_colour=misc.constants.C_RED,
                                   text_font="monospace"),
                  stimuli.Audio("stimuli/rest.wav")],
          "swim":[stimuli.TextLine("SWIM",
                                   text_size=70,
                                   text_colour=misc.constants.C_GREEN,
                                   text_font="monospace"),
                  stimuli.Audio("stimuli/swim.wav")]}
开发者ID:MichaelUM,项目名称:expyriment-stash,代码行数:29,代码来源:motor_imagery.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python control.set_develop_mode函数代码示例发布时间:2022-05-24
下一篇:
Python expr_mgmt.get_commands函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap