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


Python Simulation.objects方法代码示例

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


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

示例1: test_get_objects

# 需要导入模块: from topo.base.simulation import Simulation [as 别名]
# 或者: from topo.base.simulation.Simulation import objects [as 别名]
    def test_get_objects(self):
        s = Simulation()

        s['pulse1'] = PulseGenerator(period = 1)
        s['pulse2'] = PulseGenerator(period = 3)
        s['sum_unit'] = SumUnit()
        n1 = s['pulse1'].name
        n2 = s['pulse2'].name

        s.connect('pulse1','sum_unit',delay=1)
        s.connect('pulse2','sum_unit',delay=1)
        t1 = s.objects()
        e1 = [ep for ep in t1.values() if isinstance(ep,PulseGenerator) and ep.name == n1]
        t2 = s.objects()
        e2 = [ep for ep in t2.values() if isinstance(ep,PulseGenerator) and ep.name == n2]
        assert e1.pop().name == n1, 'Object names do not match'
        assert e2.pop().name == n2, 'Object names do not match'
开发者ID:wiktor-b,项目名称:topographica,代码行数:19,代码来源:testsimulation.py

示例2: test_get_objects

# 需要导入模块: from topo.base.simulation import Simulation [as 别名]
# 或者: from topo.base.simulation.Simulation import objects [as 别名]
    def test_get_objects(self):
        s = Simulation()

        s["pulse1"] = PulseGenerator(period=1)
        s["pulse2"] = PulseGenerator(period=3)
        s["sum_unit"] = SumUnit()
        n1 = s["pulse1"].name
        n2 = s["pulse2"].name

        s.connect("pulse1", "sum_unit", delay=1)
        s.connect("pulse2", "sum_unit", delay=1)
        t1 = s.objects()
        e1 = [ep for ep in t1.values() if isinstance(ep, PulseGenerator) and ep.name == n1]
        t2 = s.objects()
        e2 = [ep for ep in t2.values() if isinstance(ep, PulseGenerator) and ep.name == n2]
        assert e1.pop().name == n1, "Object names do not match"
        assert e2.pop().name == n2, "Object names do not match"
开发者ID:sf-issues,项目名称:topographica,代码行数:19,代码来源:testsimulation.py


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