def test_connection_helper(self): s = p.Section() pp = p.PointProcess(p.ExpSyn, s) stim = pp.stimulate() self.assertEqual( NetCon, type(connection(stim, pp)), "connection helper did not return the expected NetCon", ) self.assertRaises(NotConnectedError, connection, s, s) self.assertRaises(NotConnectableError, connection, p.Vector(), s) self.assertRaises(NotConnectableError, connection, s, p.Vector())
def test_netcon_record(self): s1 = p.Section() se = p.ExpSyn(s1) ns = se.stimulate(start=1, number=3, interval=1, weight=100) r = s1.record() s2 = p.Section() r2 = s2.record() syn = p.ExpSyn(s2) nc = s1.connect_points(syn) v = p.Vector() t = p.time nc.record(v) v2 = nc.record() v3 = nc.record() p.finitialize() p.continuerun(10) self.assertEqual(v, v2, "NetCon recorder should be a singleton.") self.assertEqual(v2, v3, "NetCon recorder should be a singleton.") self.assertNotEqual(len(v), 0, "NetCon recorder should record a spike.") self.assertEqual( len(v), len(v2), "Different NetCon recorders should record same spikes.")
def test_netcon_errors(self): s = p.Section() t = p.Vector() with self.assertRaises(HocConnectError, msg="Didn't catch NetCon error"): p.NetCon(s, t) with self.assertRaises(HocConnectError, msg="Didn't catch NetCon error"): p.NetCon(t, s) with self.assertRaises(HocConnectError, msg="Didn't catch NetCon error"): p.NetCon(5, 12)
def test(): with catch_hoc_error(): v = p.Vector() v.__neuron__().record(p.Section())
def _record_i(self, point_process): from patch import p v = p.Vector() v.record(point_process._ref_i) return [v]