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


Python Context.add_rule方法代码示例

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


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

示例1: Context

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import add_rule [as 别名]
      to operate on only a single output vector...better way of doing?
TODO: Would be nice to add something that catches exceptions when ExecSteps
      or Constraints don't work and tells you what the string is. 
TODO: Have warnings when variables are made without being prepended by $ or 
      other?
TODO: Why is nothing shown for initialization during copies?
TODO: Appending to numpy arrays is bad, do some other way
"""

# create context
s = Context()

# add stimulus sizes to root node...would be nicer if they went in stimulus node
s.add_rule('init',
           '$kernel_length = 10',
           '$output_length = 50',
           '$bcm_radius = 4',
           '$stim_size  = 20',
           '$time_delay = 5')
# NOTE: these are one longer than you think - fix?



# add a container for stimulus and 'focus' on it
s.add_node('$name = "stimulus"')
s.set_focus('$name == "stimulus"')

# add a distribution rule for stimulus points
s.add_rule('init',
           '$child_grid = Grid(xl=$stim_size, yl=$stim_size, dx=2, dy=2)',
           'print $child_grid.positions')
开发者ID:abjose,项目名称:surfsim3,代码行数:33,代码来源:old_tests.py

示例2: Context

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import add_rule [as 别名]
      to operate on only a single output vector...better way of doing?
TODO: Have warnings when variables are made without being prepended by $ or 
      other?
TODO: Why is nothing shown for initialization during copies?
TODO: Could....add a second init step so there's one before connections
      and one after?
TODO: want to change copy_node so that it takes constraints?
"""

# create context
s = Context()

# add stimulus sizes to root node...would be nicer if they went in stimulus node
s.add_rule('init',
           '$kernel_length = 10',
           '$output_length = 50',
           '$bcm_radius = 4.',
           '$stim_size  = 20',
           '$max_delay  = 3')
           # add all grids here? just name differently...
# NOTE: these are one longer than you think - fix?



# add a container for stimulus and 'focus' on it
s.add_node('$name = "stimulus"')
s.set_focus('$name == "stimulus"')

# add a distribution rule for stimulus points
s.add_rule('init',
           # dx and dy were initially 2 for both of these, changing temporarily
           '$stim_grid = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
开发者ID:abjose,项目名称:surfsim2,代码行数:34,代码来源:tests.py

示例3: Context

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import add_rule [as 别名]
s = Context()

# add stimulus sizes to root node...would be nicer if they went in stimulus node
s.add_rule('init',
           # NOTE: these are one longer than you think - fix?
           '$kernel_length = 10',
           '$output_length = 50',
           '$stim_size  = 20',
           '$p_h_radius = 500.',
           '$p_b_radius = 500.',
           '$h_b_radius = 500.',
           '$b_a_radius = 500.',
           '$b_g_radius = 500.',
           '$a_g_radius = 500.',
           '$stim_grid = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           '$p_grid  = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           '$h_grid  = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           '$b_grid  = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           '$a_grid  = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           '$g_grid  = Grid(xl=$stim_size, yl=$stim_size, dx=1, dy=1)',
           #'$stim = SinusoidStim($stim_size, $stim_size)', # why two?
           #'$stim = JigglySinusoidStim($stim_size, 10)',
           #'$stim = InvertingSinusoidStim($stim_size, 20)',
           #'$stim = SquareWaveStim($stim_size, 8)',
           #'$stim = BarStim($stim_size, 10)',
           '$stim = FullFieldStim($stim_size, 20)',
           '$stim.step()', 
           '$stim_data = $stim.output')
s.add_rule('update',
           '$stim.step()', 
           '$stim_data = $stim.output')
开发者ID:abjose,项目名称:surfsim2,代码行数:33,代码来源:tests2.py


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