def test_connect_with_standard_text_file_not_distributed(self): numpy.savetxt("test.connections", self.connection_list) C = connectors.FromFileConnector("test.connections", distributed=False) syn = sim.StaticSynapse() prj = sim.Projection(self.p1, self.p2, C, syn) self.assertEqual(prj.get(["weight", "delay"], format='list', gather=False), # use gather False because we are faking the MPI [(0, 1, 0.5, 0.14), (2, 3, 0.3, 0.12)])
def test_connect_with_standard_text_file_distributed(self): local_connection_list = [ c for c in self.connection_list if c[1] % 2 == 1 ] numpy.savetxt("test.connections.1", local_connection_list) C = connectors.FromFileConnector("test.connections", distributed=True) C.connect(self.prj) assert_equal(self.prj.connections, [(17, 80, 0.5, 0.14), (19, 82, 0.3, 0.12)])
def test_connect_with_standard_text_file_not_distributed(self): numpy.savetxt("test.connections", self.connection_list) C = connectors.FromFileConnector("test.connections", distributed=False) C.connect(self.prj) assert_equal(self.prj.connections, [(17, 79, 0.1, 0.1), (17, 80, 0.5, 0.14), (19, 82, 0.3, 0.12), (19, 81, 0.4, 0.13), (20, 79, 0.2, 0.11)])
def test_connect_with_standard_text_file_not_distributed(self, sim=sim): np.savetxt("test.connections", self.connection_list) C = connectors.FromFileConnector("test.connections", distributed=False) syn = sim.StaticSynapse() prj = sim.Projection(self.p1, self.p2, C, syn) self.assertEqual(prj.get(["weight", "delay"], format='list'), [(0, 0, 0.1, 0.1), (3, 0, 0.2, 0.11), (0, 1, 0.5, 0.14), (2, 2, 0.4, 0.13), (2, 3, 0.3, 0.12)])
def test_with_plastic_synapses_not_distributed(self, sim=sim): connection_list = [ (0, 0, 0.1, 0.1, 100, 100), (3, 0, 0.2, 0.11, 110, 99), (2, 3, 0.3, 0.12, 120, 98), # local (2, 2, 0.4, 0.13, 130, 97), (0, 1, 0.5, 0.14, 140, 96), # local ] file = recording.files.StandardTextFile("test.connections.2", mode='wb') file.write(connection_list, {"columns": ["i", "j", "weight", "delay", "U", "tau_rec"]}) C = connectors.FromFileConnector("test.connections.2", distributed=False) syn = sim.TsodyksMarkramSynapse(tau_facil=88.8) prj = sim.Projection(self.p1, self.p2, C, syn) self.assertEqual(prj.get(["weight", "delay", "U", "tau_rec", "tau_facil"], format='list', gather=False), # use gather False because we are faking the MPI [(0, 1, 0.5, 0.14, 140.0, 96.0, 88.8), (2, 3, 0.3, 0.12, 120.0, 98.0, 88.8)])