def test_spikes_per_noise(repetitions, population_trials, noise_list=range(0, 10), noise_time=[-10, 10], init_noise=100): # list_avgLatencies = [] # list_stdLatencies = [] list_noise = [] #list_synchrony = [] for noise_Lvl in noise_list: list_trial = [] for trial in range(population_trials): SNN = snn.LIF_Network() population = range(1, SNN.count_neurons) run_noise(SNN, init_noise, noise_time) sim_results = test_basic(repetitions, SNN, noise_Lvl, noise_time) list_spike_times = dp.list_firing_times( sim_results[repetitions - 1], population) list_trial.append(list_spike_times) list_noise.append(list_trial) return list_noise
def test_spikeCount(inputRate, timeInterval, neurons, repetitions, inputProb): SNN = snn.LIF_Network(neurons, int(inputRate * timeInterval)) SNN.initial_noise() sim_results = test(repetitions, SNN, inputProb) countSpikes = [] for r in range(repetitions): countSpikes.append(len(sim_results[r])) return countSpikes
def test_signal_level(inputRate, timeInterval, neurons, repetitions, inputProb): SNN = snn.LIF_Network(neurons, int(inputRate * timeInterval)) SNN.initial_noise() sim_results = test(repetitions, SNN, inputProb) signalLevelList = [] for r in range(repetitions): (s_max, t_max) = dp.max_signal(sim_results[r], range(2, neurons)) signalLevelList.append(s_max) return signalLevelList
def test_input_level(inputRateList, timeInterval, neurons, inputProb): snn.neurons_per_population = neurons snn.delay_SP_max = timeInterval repetitions = 100 initialSpikeCount = [] finalSpikeCount = [] for r in inputRateList: snn.synapses_per_neuron = r * timeInterval SNN = snn.LIF_Network(neurons, int(r * timeInterval)) SNN.initial_noise() sim_results = test(repetitions, SNN, inputProb) initialSpikeCount.append(float(len(sim_results[0])) / neurons) finalSpikeCount.append( float(len(sim_results[repetitions - 1])) / neurons) return (initialSpikeCount, finalSpikeCount)
## wr = csv.writer(f) ## wr.writerows(list_sim) # #pF.rasterPlotPop(list_sim, [[1,100],[101,200], [201,300]], ['b', 'r', 'g', 'k'], "testPrediction") # # ###### Simple Predictive repetitions = 101 noise = 2. pop_counts = [50, 50] source_pop1 = [0, 1, 15, [0, 500], [0., 10.]] source_pop2 = [0, 2, 15, [400, 900], [0., 10.]] pop1_pop2 = [1, 2, 15, [1, 5], [0., 1.]] connections = [source_pop1, source_pop2, pop1_pop2] SNN = snn.LIF_Network(pop_counts, connections) list_sim = tF.test_basic(repetitions, SNN, noise) pF.rasterPlotPop(list_sim, [[1, 50], [51, 100]], ['b', 'r', 'g', 'k'], "testPrediction") ###### 3 Predictions repetitions = 201 noise = 2. pop_counts = [50, 50, 50] source_pop1 = [0, 1, 8, [0, 500], [0., 10.]] source_pop2 = [0, 2, 7, [500, 1000], [0., 10.]] source_pop3 = [0, 3, 7, [1000, 1500], [0., 10.]] pop1_pop2 = [1, 2, 6, [1, 5], [0., 0.1]] pop1_pop3 = [1, 3, 6, [1, 5], [0., 0.1]]
table_initial_count = [] table_final_count = [] for rate_idx in range(len(rateVec)): inputRate = rateVec[rate_idx] timeInterval = timeIntervalVec[rate_idx] snn.delay_SP_max = timeInterval for inputProb in inputProbVec: nameFile = 'simR' + str(inputRate) + 'P' + str(inputProb) print('Plot for Rate: ' + str(inputRate) + ' and Input Prob: ' + str(inputProb)) snn.delay_SP_max = timeInterval SNN = snn.LIF_Network(neurons, int(inputRate * timeInterval)) SNN.initial_noise() sim_results = tF.test(repetitions, SNN, inputProb) dp.write_simulation_results(sim_results, nameFile) # sim_results = dp.read_simulation_results(nameFile) spikeCountEvolution = spike_count_evolution(sim_results, neurons=neurons) table_initial_count.append(spikeCountEvolution[0]) table_final_count.append(spikeCountEvolution[1]) pF.savePlots = False endMain = time.time() print('Time main: ' + str(int(endMain - start) / 60) + ' minutes')