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


Python NodeIOController.build_node_probe方法代码示例

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


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

示例1: test_build_node_probe

# 需要导入模块: from nengo_spinnaker.builder.node import NodeIOController [as 别名]
# 或者: from nengo_spinnaker.builder.node.NodeIOController import build_node_probe [as 别名]
    def test_build_node_probe(self):
        """Test that building a Probe of a Node results in adding a new object
        to the model and tries to build a new connection from the Node to the
        Probe.
        """
        with nengo.Network():
            a = nengo.Node(lambda t, x: x**2, size_in=3, size_out=3)
            p = nengo.Probe(a)

        # Create a model to manipulate
        model = mock.Mock(name="model", spec_set=[
            "object_operators", "seeds", "make_connection", "dt"
        ])
        model.object_operators = dict()
        model.seeds = {p: 123}
        model.dt = 0.001

        def make_conn_fn(connection):
            assert connection.pre_obj is a
            assert connection.post_obj is p
            assert connection.synapse is p.synapse

        model.make_connection = make_conn = mock.Mock(wraps=make_conn_fn)

        # Create the builder and build
        nioc = NodeIOController()
        nioc.build_node_probe(model, p)

        # Assert that make_connection was called ONCE
        assert make_conn.call_count == 1

        # Assert that a ValueSink was inserted in the model
        assert isinstance(model.object_operators[p], ValueSink)
        assert model.object_operators[p].probe is p
开发者ID:project-rig,项目名称:nengo_spinnaker,代码行数:36,代码来源:test_node.py


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