| 564 | | # |
|---|
| 565 | | # def testFixedNumberPre(self): |
|---|
| 566 | | # c1 = neuron.FixedNumberPreConnector(10) |
|---|
| 567 | | # c2 = neuron.FixedNumberPreConnector(3) |
|---|
| 568 | | # c3 = neuron.FixedNumberPreConnector(random.RandomDistribution('poisson',[5])) |
|---|
| 569 | | # for srcP in [self.source5, self.source22]: |
|---|
| 570 | | # for tgtP in [self.target6, self.target33]: |
|---|
| 571 | | # for c in c1, c2: |
|---|
| 572 | | # prj1 = neuron.Projection(srcP, tgtP, c) |
|---|
| 573 | | # self.assertEqual(len(prj1.connections), c.n*len(tgtP)) |
|---|
| 574 | | # prj3 = neuron.Projection(srcP, tgtP, c3) # just a test that no Exceptions are raised |
|---|
| 575 | | # |
|---|
| 576 | | # def testFixedNumberPost(self): |
|---|
| 577 | | # c1 = neuron.FixedNumberPostConnector(10) |
|---|
| 578 | | # c2 = neuron.FixedNumberPostConnector(3) |
|---|
| 579 | | # c3 = neuron.FixedNumberPostConnector(random.RandomDistribution('poisson',[5])) |
|---|
| 580 | | # for srcP in [self.source5, self.source22]: |
|---|
| 581 | | # for tgtP in [self.target6, self.target33]: |
|---|
| 582 | | # for c in c1, c2: |
|---|
| 583 | | # prj1 = neuron.Projection(srcP, tgtP, c) |
|---|
| 584 | | # self.assertEqual(len(prj1.connections), c.n*len(srcP)) |
|---|
| 585 | | # prj2 = neuron.Projection(srcP, tgtP, c3) # just a test that no Exceptions are raised |
|---|
| 586 | | # |
|---|
| 587 | | # def testSaveAndLoad(self): |
|---|
| 588 | | # prj1 = neuron.Projection(self.source33, self.target33, 'oneToOne') |
|---|
| 589 | | # prj1.setDelays(1) |
|---|
| 590 | | # prj1.setWeights(1.234) |
|---|
| 591 | | # prj1.saveConnections("connections.tmp", gather=False) |
|---|
| 592 | | # #prj2 = neuron.Projection(self.source33, self.target33, 'fromFile',"connections.tmp") |
|---|
| 593 | | # if neuron.num_processes() > 1: |
|---|
| 594 | | # distributed = True |
|---|
| 595 | | # else: |
|---|
| 596 | | # distributed = False |
|---|
| 597 | | # prj3 = neuron.Projection(self.source33, self.target33, neuron.FromFileConnector("connections.tmp", |
|---|
| 598 | | # distributed=distributed)) |
|---|
| 599 | | # w1 = []; w2 = []; w3 = []; d1 = []; d2 = []; d3 = [] |
|---|
| 600 | | # # For a connections scheme saved and reloaded, we test if the connections, their weights and their delays |
|---|
| 601 | | # # are equal. |
|---|
| 602 | | # hoc_list1 = getattr(h, prj1.label) |
|---|
| 603 | | # #hoc_list2 = getattr(h, prj2.label) |
|---|
| 604 | | # hoc_list3 = getattr(h, prj3.label) |
|---|
| 605 | | # for connection_id in prj1.connections: |
|---|
| 606 | | # w1.append(hoc_list1.object(prj1.connections.index(connection_id)).weight[0]) |
|---|
| 607 | | # #w2.append(hoc_list2.object(prj2.connections.index(connection_id)).weight[0]) |
|---|
| 608 | | # w3.append(hoc_list3.object(prj3.connections.index(connection_id)).weight[0]) |
|---|
| 609 | | # d1.append(hoc_list1.object(prj1.connections.index(connection_id)).delay) |
|---|
| 610 | | # #d2.append(hoc_list2.object(prj2.connections.index(connection_id)).delay) |
|---|
| 611 | | # d3.append(hoc_list3.object(prj3.connections.index(connection_id)).delay) |
|---|
| 612 | | # #assert (w1 == w2 == w3) and (d1 == d2 == d3) |
|---|
| 613 | | # assert (w1 == w3) and (d1 == d3) |
|---|
| 614 | | # |
|---|
| 615 | | # def testSettingDelays(self): |
|---|
| 616 | | # """Delays should be set correctly when using a Connector object.""" |
|---|
| 617 | | # for srcP in [self.source5, self.source22]: |
|---|
| 618 | | # for tgtP in [self.target6, self.target33]: |
|---|
| 619 | | # prj1 = neuron.Projection(srcP, tgtP, neuron.AllToAllConnector(delays=0.321)) |
|---|
| 620 | | # hoc_list = getattr(neuron.h, prj1.label) |
|---|
| 621 | | # assert hoc_list.object(0).delay == 0.321, "Delay should be 0.321, actually %g" % hoc_list.object(0).delay |
|---|
| 622 | | # |
|---|
| 623 | | #class ProjectionSetTest(unittest.TestCase): |
|---|
| 624 | | # """Tests of the setWeights(), setDelays(), randomizeWeights() and |
|---|
| 625 | | # randomizeDelays() methods of the Projection class.""" |
|---|
| 626 | | # |
|---|
| 627 | | # def setUp(self): |
|---|
| 628 | | # self.target = neuron.Population((3,3), neuron.IF_curr_alpha) |
|---|
| 629 | | # self.source = neuron.Population((3,3), neuron.SpikeSourcePoisson,{'rate': 200}) |
|---|
| 630 | | # self.distrib_Numpy = RandomDistribution(rng=NumpyRNG(12345), distribution='uniform', parameters=(0,1)) |
|---|
| 631 | | # self.distrib_Native= RandomDistribution(rng=NativeRNG(12345), distribution='uniform', parameters=(0,1)) |
|---|
| 632 | | # |
|---|
| 633 | | # def testSetWeights(self): |
|---|
| 634 | | # prj1 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 635 | | # prj1.setWeights(2.345) |
|---|
| 636 | | # weights = [] |
|---|
| 637 | | # hoc_list = getattr(h, prj1.label) |
|---|
| 638 | | # for connection_id in prj1.connections: |
|---|
| 639 | | # #weights.append(HocToPy.get('%s.object(%d).weight' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 640 | | # weights.append(hoc_list.object(prj1.connections.index(connection_id)).weight[0]) |
|---|
| 641 | | # result = 2.345*numpy.ones(len(prj1.connections)) |
|---|
| 642 | | # assert (weights == result.tolist()) |
|---|
| 643 | | # |
|---|
| 644 | | # def testSetDelays(self): |
|---|
| 645 | | # prj1 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 646 | | # prj1.setDelays(2.345) |
|---|
| 647 | | # delays = [] |
|---|
| 648 | | # hoc_list = getattr(h, prj1.label) |
|---|
| 649 | | # for connection_id in prj1.connections: |
|---|
| 650 | | # #delays.append(HocToPy.get('%s.object(%d).delay' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 651 | | # delays.append(hoc_list.object(prj1.connections.index(connection_id)).delay) |
|---|
| 652 | | # result = 2.345*numpy.ones(len(prj1.connections)) |
|---|
| 653 | | # assert (delays == result.tolist()) |
|---|
| 654 | | # |
|---|
| 655 | | # def testRandomizeWeights(self): |
|---|
| 656 | | # # The probability of having two consecutive weights vector that are equal should be 0 |
|---|
| 657 | | # prj1 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 658 | | # prj2 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 659 | | # prj1.randomizeWeights(self.distrib_Numpy) |
|---|
| 660 | | # prj2.randomizeWeights(self.distrib_Native) |
|---|
| 661 | | # w1 = []; w2 = []; w3 = []; w4 = [] |
|---|
| 662 | | # hoc_list1 = getattr(h, prj1.label) |
|---|
| 663 | | # hoc_list2 = getattr(h, prj2.label) |
|---|
| 664 | | # for connection_id in prj1.connections: |
|---|
| 665 | | # #w1.append(HocToPy.get('%s.object(%d).weight' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 666 | | # #w2.append(HocToPy.get('%s.object(%d).weight' % (prj2.label, prj1.connections.index(connection_id)))) |
|---|
| 667 | | # w1.append(hoc_list1.object(prj1.connections.index(connection_id)).weight[0]) |
|---|
| 668 | | # w2.append(hoc_list2.object(prj2.connections.index(connection_id)).weight[0]) |
|---|
| 669 | | # prj1.randomizeWeights(self.distrib_Numpy) |
|---|
| 670 | | # prj2.randomizeWeights(self.distrib_Native) |
|---|
| 671 | | # for connection_id in prj1.connections: |
|---|
| 672 | | # #w3.append(HocToPy.get('%s.object(%d).weight' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 673 | | # #w4.append(HocToPy.get('%s.object(%d).weight' % (prj2.label, prj1.connections.index(connection_id)))) |
|---|
| 674 | | # w3.append(hoc_list1.object(prj1.connections.index(connection_id)).weight[0]) |
|---|
| 675 | | # w4.append(hoc_list2.object(prj2.connections.index(connection_id)).weight[0]) |
|---|
| 676 | | # self.assertNotEqual(w1, w3) and self.assertNotEqual(w2, w4) |
|---|
| 677 | | # |
|---|
| 678 | | # def testRandomizeDelays(self): |
|---|
| 679 | | # # The probability of having two consecutive delays vector that are equal should be 0 |
|---|
| 680 | | # prj1 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 681 | | # prj2 = neuron.Projection(self.source, self.target, 'allToAll') |
|---|
| 682 | | # prj1.randomizeDelays(self.distrib_Numpy) |
|---|
| 683 | | # prj2.randomizeDelays(self.distrib_Native) |
|---|
| 684 | | # d1 = []; d2 = []; d3 = []; d4 = [] |
|---|
| 685 | | # hoc_list1 = getattr(h, prj1.label) |
|---|
| 686 | | # hoc_list2 = getattr(h, prj2.label) |
|---|
| 687 | | # for connection_id in prj1.connections: |
|---|
| 688 | | # #d1.append(HocToPy.get('%s.object(%d).delay' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 689 | | # #d2.append(HocToPy.get('%s.object(%d).delay' % (prj2.label, prj1.connections.index(connection_id)))) |
|---|
| 690 | | # d1.append(hoc_list1.object(prj1.connections.index(connection_id)).delay) |
|---|
| 691 | | # d2.append(hoc_list2.object(prj2.connections.index(connection_id)).delay) |
|---|
| 692 | | # prj1.randomizeDelays(self.distrib_Numpy) |
|---|
| 693 | | # prj2.randomizeDelays(self.distrib_Native) |
|---|
| 694 | | # for connection_id in prj1.connections: |
|---|
| 695 | | # #d3.append(HocToPy.get('%s.object(%d).delay' % (prj1.label, prj1.connections.index(connection_id)))) |
|---|
| 696 | | # #d4.append(HocToPy.get('%s.object(%d).delay' % (prj2.label, prj1.connections.index(connection_id)))) |
|---|
| 697 | | # d3.append(hoc_list1.object(prj1.connections.index(connection_id)).delay) |
|---|
| 698 | | # d4.append(hoc_list2.object(prj2.connections.index(connection_id)).delay) |
|---|
| 699 | | # self.assertNotEqual(d1, d3) and self.assertNotEqual(d2, d4) |
|---|
| 700 | | # |
|---|
| 701 | | # |
|---|
| | 564 | |
|---|
| | 565 | def testFixedNumberPre(self): |
|---|
| | 566 | c1 = neuron.FixedNumberPreConnector(10) |
|---|
| | 567 | c2 = neuron.FixedNumberPreConnector(3) |
|---|
| | 568 | c3 = neuron.FixedNumberPreConnector(random.RandomDistribution('poisson',[5])) |
|---|
| | 569 | for srcP in [self.source5, self.source22]: |
|---|
| | 570 | for tgtP in [self.target6, self.target33]: |
|---|
| | 571 | for c in c1, c2: |
|---|
| | 572 | prj1 = neuron.Projection(srcP, tgtP, c) |
|---|
| | 573 | self.assertEqual(len(prj1.connections), c.n*len(tgtP)) |
|---|
| | 574 | prj3 = neuron.Projection(srcP, tgtP, c3) # just a test that no Exceptions are raised |
|---|
| | 575 | |
|---|
| | 576 | def testFixedNumberPost(self): |
|---|
| | 577 | c1 = neuron.FixedNumberPostConnector(10) |
|---|
| | 578 | c2 = neuron.FixedNumberPostConnector(3) |
|---|
| | 579 | c3 = neuron.FixedNumberPostConnector(random.RandomDistribution('poisson',[5])) |
|---|
| | 580 | for srcP in [self.source5, self.source22]: |
|---|
| | 581 | for tgtP in [self.target6, self.target33]: |
|---|
| | 582 | for c in c1, c2: |
|---|
| | 583 | prj1 = neuron.Projection(srcP, tgtP, c) |
|---|
| | 584 | self.assertEqual(len(prj1.connections), c.n*len(srcP)) |
|---|
| | 585 | prj2 = neuron.Projection(srcP, tgtP, c3) # just a test that no Exceptions are raised |
|---|
| | 586 | |
|---|
| | 587 | def testSaveAndLoad(self): |
|---|
| | 588 | prj1 = neuron.Projection(self.source33, self.target33, neuron.OneToOneConnector()) |
|---|
| | 589 | prj1.setDelays(1) |
|---|
| | 590 | prj1.setWeights(1.234) |
|---|
| | 591 | prj1.saveConnections("connections.tmp", gather=False) |
|---|
| | 592 | if neuron.num_processes() > 1: |
|---|
| | 593 | distributed = True |
|---|
| | 594 | else: |
|---|
| | 595 | distributed = False |
|---|
| | 596 | prj2 = neuron.Projection(self.source33, self.target33, neuron.FromFileConnector("connections.tmp", |
|---|
| | 597 | distributed=distributed)) |
|---|
| | 598 | w1 = []; w2 = []; d1 = []; d2 = [] |
|---|
| | 599 | # For a connections scheme saved and reloaded, we test if the connections, their weights and their delays |
|---|
| | 600 | # are equal. |
|---|
| | 601 | for c1,c2 in zip(prj1.connections, prj2.connections): |
|---|
| | 602 | w1.append(c1.nc.weight[0]) |
|---|
| | 603 | w2.append(c2.nc.weight[0]) |
|---|
| | 604 | d1.append(c1.nc.delay) |
|---|
| | 605 | d2.append(c2.nc.delay) |
|---|
| | 606 | assert (w1 == w2), 'w1 = %s\nw2 = %s' % (w1, w2) |
|---|
| | 607 | assert (d1 == d2), 'd1 = %s\nd2 = %s' % (d1, d2) |
|---|
| | 608 | |
|---|
| | 609 | def testSettingDelays(self): |
|---|
| | 610 | """Delays should be set correctly when using a Connector object.""" |
|---|
| | 611 | for srcP in [self.source5, self.source22]: |
|---|
| | 612 | for tgtP in [self.target6, self.target33]: |
|---|
| | 613 | prj1 = neuron.Projection(srcP, tgtP, neuron.AllToAllConnector(delays=0.321)) |
|---|
| | 614 | assert prj1.connections[0].nc.delay == 0.321, "Delay should be 0.321, actually %g" % prj1.connections[0].nc.delay |
|---|
| | 615 | |
|---|
| | 616 | class ProjectionSetTest(unittest.TestCase): |
|---|
| | 617 | """Tests of the setWeights(), setDelays(), randomizeWeights() and |
|---|
| | 618 | randomizeDelays() methods of the Projection class.""" |
|---|
| | 619 | |
|---|
| | 620 | def setUp(self): |
|---|
| | 621 | self.target = neuron.Population((3,3), neuron.IF_curr_alpha) |
|---|
| | 622 | self.source = neuron.Population((3,3), neuron.SpikeSourcePoisson,{'rate': 200}) |
|---|
| | 623 | self.distrib_Numpy = random.RandomDistribution(rng=random.NumpyRNG(12345), distribution='uniform', parameters=(0.2,1)) |
|---|
| | 624 | self.distrib_Native= random.RandomDistribution(rng=random.NativeRNG(12345), distribution='uniform', parameters=(0.2,1)) |
|---|
| | 625 | |
|---|
| | 626 | def testSetWeights(self): |
|---|
| | 627 | prj1 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 628 | prj1.setWeights(2.345) |
|---|
| | 629 | weights = [] |
|---|
| | 630 | for c in prj1.connections: |
|---|
| | 631 | weights.append(c.nc.weight[0]) |
|---|
| | 632 | result = 2.345*numpy.ones(len(prj1.connections)) |
|---|
| | 633 | assert (weights == result.tolist()) |
|---|
| | 634 | |
|---|
| | 635 | def testSetDelays(self): |
|---|
| | 636 | prj1 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 637 | prj1.setDelays(2.345) |
|---|
| | 638 | delays = [] |
|---|
| | 639 | for c in prj1.connections: |
|---|
| | 640 | delays.append(c.nc.delay) |
|---|
| | 641 | result = 2.345*numpy.ones(len(prj1.connections)) |
|---|
| | 642 | assert (delays == result.tolist()) |
|---|
| | 643 | |
|---|
| | 644 | def testRandomizeWeights(self): |
|---|
| | 645 | # The probability of having two consecutive weights vector that are equal should be 0 |
|---|
| | 646 | prj1 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 647 | prj2 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 648 | prj1.randomizeWeights(self.distrib_Numpy) |
|---|
| | 649 | prj2.randomizeWeights(self.distrib_Native) |
|---|
| | 650 | w1 = []; w2 = []; w3 = []; w4 = [] |
|---|
| | 651 | for c in prj1.connections: |
|---|
| | 652 | w1.append(c.nc.weight[0]) |
|---|
| | 653 | w2.append(c.nc.weight[0]) |
|---|
| | 654 | prj1.randomizeWeights(self.distrib_Numpy) |
|---|
| | 655 | prj2.randomizeWeights(self.distrib_Native) |
|---|
| | 656 | for c in prj1.connections: |
|---|
| | 657 | w3.append(c.nc.weight[0]) |
|---|
| | 658 | w4.append(c.nc.weight[0]) |
|---|
| | 659 | self.assertNotEqual(w1, w3) and self.assertNotEqual(w2, w4) |
|---|
| | 660 | |
|---|
| | 661 | def testRandomizeDelays(self): |
|---|
| | 662 | # The probability of having two consecutive delays vector that are equal should be 0 |
|---|
| | 663 | prj1 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 664 | prj2 = neuron.Projection(self.source, self.target, neuron.AllToAllConnector()) |
|---|
| | 665 | prj1.randomizeDelays(self.distrib_Numpy) |
|---|
| | 666 | prj2.randomizeDelays(self.distrib_Native) |
|---|
| | 667 | d1 = []; d2 = []; d3 = []; d4 = [] |
|---|
| | 668 | for c in prj1.connections: |
|---|
| | 669 | d1.append(c.nc.weight[0]) |
|---|
| | 670 | d2.append(c.nc.weight[0]) |
|---|
| | 671 | prj1.randomizeWeights(self.distrib_Numpy) |
|---|
| | 672 | prj2.randomizeWeights(self.distrib_Native) |
|---|
| | 673 | for c in prj1.connections: |
|---|
| | 674 | d3.append(c.nc.weight[0]) |
|---|
| | 675 | d4.append(c.nc.weight[0]) |
|---|
| | 676 | self.assertNotEqual(d1, d3) and self.assertNotEqual(d2, d4) |
|---|
| | 677 | |
|---|
| | 678 | |
|---|
| 797 | | #class IDTest(unittest.TestCase): |
|---|
| 798 | | # """Tests of the ID class.""" |
|---|
| 799 | | # |
|---|
| 800 | | # def setUp(self): |
|---|
| 801 | | # neuron.Population.nPop = 0 |
|---|
| 802 | | # self.pop1 = neuron.Population((5,), neuron.IF_curr_alpha,{'tau_m':10.0}) |
|---|
| 803 | | # self.pop2 = neuron.Population((5,4), neuron.IF_curr_exp,{'v_reset':-60.0}) |
|---|
| 804 | | # |
|---|
| 805 | | # def testIDSetAndGet(self): |
|---|
| 806 | | # if self.pop1[3] in self.pop1.gidlist: |
|---|
| 807 | | # self.pop1[3].tau_m = 20.0 |
|---|
| 808 | | # self.assertEqual(20.0, self.pop1[3].tau_m) |
|---|
| 809 | | # if self.pop1[0] in self.pop1.gidlist: |
|---|
| 810 | | # self.assertEqual(10.0, self.pop1[0].tau_m) |
|---|
| 811 | | # if self.pop2[3,2] in self.pop2.gidlist: |
|---|
| 812 | | # self.pop2[3,2].v_reset = -70.0 |
|---|
| 813 | | # self.assertEqual(-70.0, self.pop2[3,2].v_reset) |
|---|
| 814 | | # if self.pop2[0,0] in self.pop2.gidlist: |
|---|
| 815 | | # self.assertEqual(-60.0, self.pop2[0,0].v_reset) |
|---|
| 816 | | # |
|---|
| 817 | | # def testGetCellClass(self): |
|---|
| 818 | | # self.assertEqual(neuron.IF_curr_alpha, self.pop1[0].cellclass) |
|---|
| 819 | | # self.assertEqual(neuron.IF_curr_exp, self.pop2[4,3].cellclass) |
|---|
| 820 | | # |
|---|
| 821 | | # def testSetAndGetPosition(self): |
|---|
| 822 | | # self.assert_((self.pop2[0,2].position == (0.0,2.0,0.0)).all()) |
|---|
| 823 | | # new_pos = (0.5,1.5,0.0) |
|---|
| 824 | | # self.pop2[0,2].position = new_pos |
|---|
| 825 | | # self.assert_((self.pop2[0,2].position == (0.5,1.5,0.0)).all()) |
|---|
| 826 | | # new_pos = (-0.6,3.5,-100.0) # check that position is set-by-value from new_pos |
|---|
| 827 | | # self.assert_((self.pop2[0,2].position == (0.5,1.5,0.0)).all()) |
|---|
| | 774 | class IDTest(unittest.TestCase): |
|---|
| | 775 | """Tests of the ID class.""" |
|---|
| | 776 | |
|---|
| | 777 | def setUp(self): |
|---|
| | 778 | neuron.Population.nPop = 0 |
|---|
| | 779 | self.pop1 = neuron.Population((5,), neuron.IF_curr_alpha,{'tau_m':10.0}) |
|---|
| | 780 | self.pop2 = neuron.Population((5,4), neuron.IF_curr_exp,{'v_reset':-60.0}) |
|---|
| | 781 | |
|---|
| | 782 | def testIDSetAndGet(self): |
|---|
| | 783 | if self.pop1[3] in self.pop1: |
|---|
| | 784 | self.pop1[3].tau_m = 20.0 |
|---|
| | 785 | self.assertEqual(20.0, self.pop1[3].tau_m) |
|---|
| | 786 | if self.pop1[0] in self.pop1: |
|---|
| | 787 | self.assertEqual(10.0, self.pop1[0].tau_m) |
|---|
| | 788 | if self.pop2[3,2] in self.pop2: |
|---|
| | 789 | self.pop2[3,2].v_reset = -70.0 |
|---|
| | 790 | self.assertEqual(-70.0, self.pop2[3,2].v_reset) |
|---|
| | 791 | if self.pop2[0,0] in self.pop2: |
|---|
| | 792 | self.assertEqual(-60.0, self.pop2[0,0].v_reset) |
|---|
| | 793 | |
|---|
| | 794 | def testGetCellClass(self): |
|---|
| | 795 | self.assertEqual(neuron.IF_curr_alpha, self.pop1[0].cellclass) |
|---|
| | 796 | self.assertEqual(neuron.IF_curr_exp, self.pop2[4,3].cellclass) |
|---|
| | 797 | |
|---|
| | 798 | def testSetAndGetPosition(self): |
|---|
| | 799 | self.assert_((self.pop2[0,2].position == (0.0,2.0,0.0)).all()) |
|---|
| | 800 | new_pos = (0.5,1.5,0.0) |
|---|
| | 801 | self.pop2[0,2].position = new_pos |
|---|
| | 802 | self.assert_((self.pop2[0,2].position == (0.5,1.5,0.0)).all()) |
|---|
| | 803 | new_pos = (-0.6,3.5,-100.0) # check that position is set-by-value from new_pos |
|---|
| | 804 | self.assert_((self.pop2[0,2].position == (0.5,1.5,0.0)).all()) |
|---|