Пример #1
0
 def test_set_with_standard_celltype(self):
     p = Population(10, MockStandardCellType)
     p.all_cells = numpy.array([MockID()]*10, dtype=object) #numpy.arange(10)
     p._mask_local = numpy.ones((10,), bool)
     p.set("foo", 32)
     assert_equal(nest.SetStatus.call_args[0][1], {"FOO": 32.0})
     p.set("hoo", 33.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"HOO": 99.0})
     p.set("woo", 6.0)
     assert_equal(nest.SetStatus.call_args[0][1], {})
     p.all_cells[0].set_parameters.assert_called_with(woo=6.0)
Пример #2
0
 def test_set_with_standard_celltype(self):
     p = Population(10, MockStandardCellType)
     p.all_cells = numpy.array([MockID()] * 10, dtype=object)  # numpy.arange(10)
     p._mask_local = numpy.ones((10,), bool)
     p.set("foo", 32)
     assert_equal(nest.SetStatus.call_args[0][1], {"FOO": 32.0})
     p.set("hoo", 33.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"HOO": 99.0})
     p.set("woo", 6.0)
     assert_equal(nest.SetStatus.call_args[0][1], {})
     p.all_cells[0].set_parameters.assert_called_with(woo=6.0)
Пример #3
0
 def test_set_with_native_celltype(self):
     gd_orig = nest.GetDefaults
     nest.GetDefaults = Mock(return_value={"FOO": 1.2, "HOO": 3.4, "WOO": 5.6})
     p = Population(10, MockNativeCellType)
     p.all_cells = numpy.array([MockID()]*10, dtype=object) #numpy.arange(10)
     p._mask_local = numpy.ones((10,), bool)
     p.set("FOO", 32)
     assert_equal(nest.SetStatus.call_args[0][1], {"FOO": 32.0})
     p.set("HOO", 33.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"HOO": 33.0})
     p.set("WOO", 6.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"WOO": 6.0})
     nest.GetDefaults = gd_orig
Пример #4
0
 def test_set_with_native_celltype(self):
     gd_orig = nest.GetDefaults
     nest.GetDefaults = Mock(return_value={"FOO": 1.2, "HOO": 3.4, "WOO": 5.6})
     p = Population(10, MockNativeCellType)
     p.all_cells = numpy.array([MockID()] * 10, dtype=object)  # numpy.arange(10)
     p._mask_local = numpy.ones((10,), bool)
     p.set("FOO", 32)
     assert_equal(nest.SetStatus.call_args[0][1], {"FOO": 32.0})
     p.set("HOO", 33.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"HOO": 33.0})
     p.set("WOO", 6.0)
     assert_equal(nest.SetStatus.call_args[0][1], {"WOO": 6.0})
     nest.GetDefaults = gd_orig