Esempio n. 1
0
  def testDestroySegment(self):
    """ Creates a segment, destroys it, and makes sure it got destroyed along
        with all of its synapses.
    """
    connections = Connections(1024)

    connections.createSegment(10)
    segment2 = connections.createSegment(20)
    connections.createSegment(30)
    connections.createSegment(40)

    connections.createSynapse(segment2, 80, 0.85)
    connections.createSynapse(segment2, 81, 0.85)
    connections.createSynapse(segment2, 82, 0.15)

    self.assertEqual(4, connections.numSegments())
    self.assertEqual(3, connections.numSynapses())

    connections.destroySegment(segment2)

    self.assertEqual(3, connections.numSegments())
    self.assertEqual(0, connections.numSynapses())

    (numActiveConnected,
     numActivePotential) = connections.computeActivity([80, 81, 82], 0.5)

    self.assertEqual(0, numActiveConnected[segment2.flatIdx])
    self.assertEqual(0, numActivePotential[segment2.flatIdx])
Esempio n. 2
0
    def testDestroySegment(self):
        """ Creates a segment, destroys it, and makes sure it got destroyed along
        with all of its synapses.
    """
        connections = Connections(1024)

        connections.createSegment(10)
        segment2 = connections.createSegment(20)
        connections.createSegment(30)
        connections.createSegment(40)

        connections.createSynapse(segment2, 80, 0.85)
        connections.createSynapse(segment2, 81, 0.85)
        connections.createSynapse(segment2, 82, 0.15)

        self.assertEqual(4, connections.numSegments())
        self.assertEqual(3, connections.numSynapses())

        connections.destroySegment(segment2)

        self.assertEqual(3, connections.numSegments())
        self.assertEqual(0, connections.numSynapses())

        (numActiveConnected,
         numActivePotential) = connections.computeActivity([80, 81, 82], 0.5)

        self.assertEqual(0, numActiveConnected[segment2.flatIdx])
        self.assertEqual(0, numActivePotential[segment2.flatIdx])
Esempio n. 3
0
  def testDestroySegmentWithDestroyedSynapses(self):
    """ Destroy a segment that has a destroyed synapse and a non-destroyed
        synapse. Make sure nothing gets double-destroyed.
    """
    connections = Connections(1024)

    segment1 = connections.createSegment(11)
    segment2 = connections.createSegment(12)

    connections.createSynapse(segment1, 101, .85)
    synapse2a = connections.createSynapse(segment2, 201, .85)
    connections.createSynapse(segment2, 202, .85)

    self.assertEqual(3, connections.numSynapses())

    connections.destroySynapse(synapse2a)

    self.assertEqual(2, connections.numSegments())
    self.assertEqual(2, connections.numSynapses())

    connections.destroySegment(segment2)

    self.assertEqual(1, connections.numSegments())
    self.assertEqual(1, connections.numSynapses())
Esempio n. 4
0
    def testDestroySegmentWithDestroyedSynapses(self):
        """ Destroy a segment that has a destroyed synapse and a non-destroyed
        synapse. Make sure nothing gets double-destroyed.
    """
        connections = Connections(1024)

        segment1 = connections.createSegment(11)
        segment2 = connections.createSegment(12)

        connections.createSynapse(segment1, 101, .85)
        synapse2a = connections.createSynapse(segment2, 201, .85)
        connections.createSynapse(segment2, 202, .85)

        self.assertEqual(3, connections.numSynapses())

        connections.destroySynapse(synapse2a)

        self.assertEqual(2, connections.numSegments())
        self.assertEqual(2, connections.numSynapses())

        connections.destroySegment(segment2)

        self.assertEqual(1, connections.numSegments())
        self.assertEqual(1, connections.numSynapses())
Esempio n. 5
0
  def testDestroySegmentsThenReachLimit(self):
    """ Destroy some segments then verify that the maxSegmentsPerCell is still
        correctly applied.
    """
    connections = Connections(1024, 2, 2)

    segment1 = connections.createSegment(11)
    segment2 = connections.createSegment(11)

    self.assertEqual(2, connections.numSegments())
    connections.destroySegment(segment1)
    connections.destroySegment(segment2)
    self.assertEqual(0, connections.numSegments())

    connections.createSegment(11)
    self.assertEqual(1, connections.numSegments())
    connections.createSegment(11)
    self.assertEqual(2, connections.numSegments())
    segment3 = connections.createSegment(11)
    self.assertEqual(2, connections.numSegments(11))
    self.assertEqual(2, connections.numSegments())
Esempio n. 6
0
    def testDestroySegmentsThenReachLimit(self):
        """ Destroy some segments then verify that the maxSegmentsPerCell is still
        correctly applied.
    """
        connections = Connections(1024, 2, 2)

        segment1 = connections.createSegment(11)
        segment2 = connections.createSegment(11)

        self.assertEqual(2, connections.numSegments())
        connections.destroySegment(segment1)
        connections.destroySegment(segment2)
        self.assertEqual(0, connections.numSegments())

        connections.createSegment(11)
        self.assertEqual(1, connections.numSegments())
        connections.createSegment(11)
        self.assertEqual(2, connections.numSegments())
        segment3 = connections.createSegment(11)
        self.assertEqual(2, connections.numSegments(11))
        self.assertEqual(2, connections.numSegments())