def test_run(self): synfire_run.do_run(nNeurons, run_times=run_times, reset=reset, get_all=True) neos = synfire_run.get_output_pop_all_list() spikes_0_0 = neo_convertor.convert_spikes(neos[0], 0) spikes_1_1 = neo_convertor.convert_spikes(neos[1], 1) self.assertEquals(53, len(spikes_0_0)) self.assertEquals(27, len(spikes_1_1)) spike_checker.synfire_spike_checker(spikes_0_0, nNeurons) spike_checker.synfire_spike_checker(spikes_1_1, nNeurons) # v + gsyn_exc + gsyn_ihn = 3 (spikes not in analogsignalarrays if pynn8_syntax: self.assertEquals(3, len(neos[0].segments[0].analogsignalarrays)) self.assertEquals(3, len(neos[1].segments[1].analogsignalarrays)) else: self.assertEquals(3, len(neos[0].segments[0].analogsignals)) self.assertEquals(3, len(neos[1].segments[1].analogsignals)) neo_compare.compare_segments(neos[0].segments[0], neos[1].segments[0]) # neo compare does all the compares so just some safety come once v_0_0 = neo_convertor.convert_data(neos[0], "v", 0) v_1_1 = neo_convertor.convert_data(neos[1], "v", 1) self.assertEquals(nNeurons * run_times[0], len(v_0_0)) self.assertEquals(nNeurons * run_times[1], len(v_1_1)) gsyn_exc_0_0 = neo_convertor.convert_data(neos[0], "gsyn_exc", 0) gsyn_exc_1_1 = neo_convertor.convert_data(neos[1], "gsyn_exc", 1) self.assertEquals(nNeurons * run_times[0], len(gsyn_exc_0_0)) self.assertEquals(nNeurons * run_times[1], len(gsyn_exc_1_1)) gsyn_inh_0_0 = neo_convertor.convert_data(neos[0], "gsyn_inh", 0) gsyn_inh_1_1 = neo_convertor.convert_data(neos[1], "gsyn_inh", 1) self.assertEquals(nNeurons * run_times[0], len(gsyn_inh_0_0)) self.assertEquals(nNeurons * run_times[1], len(gsyn_inh_1_1))
def check_data(self, pop, expected_spikes, simtime): neo = pop.get_data("all") spikes = neo.segments[0].spiketrains v = neo.segments[0].filter(name="v")[0] gsyn_exc = neo.segments[0].filter(name="gsyn_exc")[0] for i in range(len(spikes)): check_neuron_data(spikes[i], v[:, i], gsyn_exc[:, i], expected_spikes, simtime, pop.label, i) neo_compare.compare_segments(neo.segments[0], neo.segments[1])