def testPConnection(self): N = 30 p = 0.5 pyAex.MAPVERS = 3 s = create_default_population(self.nsetup, 'seq', N) t = create_default_population(self.nsetup, 'ifslwta', N) t2 = create_default_population(self.nsetup, 'ifslwta', 124 - N, offset=N) mon = self.nsetup.monitors.import_monitors_otf(t)[0] mon_zero = self.nsetup.monitors.import_monitors_otf(t2)[0] c = pyNCS.PConnection(s, t, 'excitatory0', 'random_all2all', {'p': p}) m = c.mapping P = int(p * 127) for i in s.soma.paddr: for j in t.synapses['excitatory0'].paddr: self.assert_([i, j, P] in m.mapping) for n in range(len(s.soma.paddr)): self.assert_( [s.soma.paddr[n], t.synapses['excitatory0'].paddr[n], P ] in m.mapping) self.nsetup.prepare() input_stim = s.soma.spiketrains_poisson(400) self.nsetup.chips['ifslwta'].set_parameter('nsynstdw0', .5) out = self.nsetup.run(input_stim) self.assertTrue( np.all(350 > mon.sl.mean_rates()) and np.all(mon.sl.mean_rates() > 100)) self.assertTrue(np.all(mon_zero.sl.mean_rates() < 2))
def testMonitors(self): N=3 s=create_default_population(self.nsetup,'seq',N) t=create_default_population(self.nsetup, 'ifslwta', N) c=pyNCS.PConnection(s,t,'excitatory0') stmon1=pyNCS.monitors.SpikeMonitor(t.soma) self.nsetup.monitors.import_monitors([stmon1]) input_stim=s.soma.spiketrains_poisson(rate = np.linspace(10,100,N), duration=500) self.nsetup.prepare() self.nsetup.chips['ifslwta'].set_parameter('nsynstdw0',.6) out = self.nsetup.run(input_stim) r= stmon1.sl.mean_rates() self.assertTrue(np.all(r>0))
def testSequencers_nsetup(self): N=3 s=create_default_population(self.nsetup,'seq',N) t=create_default_population(self.nsetup,'ifslwta', N) c=pyNCS.PConnection(s,t,'excitatory0') sequencers = self.nsetup.sequencers mon_in, = sequencers.create(s) mon_in.create_spiketrains('poisson', rate = np.linspace(100,2000,N), duration = 1000) stmon1=pyNCS.monitors.SpikeMonitor(t.soma) self.nsetup.monitors.import_monitors([stmon1]) self.nsetup.prepare() self.nsetup.chips['ifslwta'].set_parameter('nsynstdw0',.7) out = self.nsetup.run() r= stmon1.sl.mean_rates() self.assertTrue(np.all(r > 0))
seq_pop = pyNCS.Population('default', 'Default Population') seq_pop.populate_by_number(nsetup, 'seq', 'excitatory', 60) seq_pop1 = seq_pop[:30] seq_pop2 = seq_pop[30:] exc_pop = pyNCS.Population('default', 'Default Population') exc_pop.populate_by_number(nsetup, 'ifslwta', 'excitatory', 60) exc_pop1 = exc_pop[:30] exc_pop2 = exc_pop[30:] mon = nsetup.monitors.import_monitors_otf([exc_pop1, exc_pop2]) c1 = pyNCS.PConnection(seq_pop1, exc_pop1, 'excitatory0', 'random_all2all', {'p': 1.0}) c2 = pyNCS.PConnection(seq_pop2, exc_pop2, 'excitatory1', 'random_all2all', {'p': .1}) nsetup.chips['ifslwta'].set_parameter('nsynstdw0', .45) nsetup.chips['ifslwta'].set_parameter('nsynstdw1', .45) stim = seq_pop.soma.spiketrains_inh_poisson( np.array([np.linspace(1, 1000, 10)] * 60), np.linspace(0, 1000, 10)) out = nsetup.run(stim) from pylab import * ion() pyNCS.monitors.RasterPlot(mon) pyNCS.monitors.MeanRatePlot(mon)