t = np.arange(0, t_final, dt) sol = odeint(derivativePopulation, initialConditions, t) t_e_spikes = [] t_i_spikes = [] for i in range(num_e): ts_e = lib.spikeDetection(t, sol[:, i], spikeThreshold) t_e_spikes.append(ts_e) index = 5 * num_e for i in range(index, index + num_i): ts_i = lib.spikeDetection(t, sol[:, i], spikeThreshold) t_i_spikes.append(ts_i) lib.display_time(time() - start) lib.spikeToFile(t_e_spikes, "t_e_spikes.txt") lib.spikeToFile(t_i_spikes, "t_i_spikes.txt") # fig, ax = pl.subplots(1, figsize=(7, 3)) # ax[0].plot(t, v, lw=2, c="k") # ax[1].plot(t, a, lw=2, c='k') # ax[0].set_xlim(min(t), max(t)) # ax[0].set_ylim(-100, 50) # ax[1].set_xlabel("time [ms]") # ax[0].set_ylabel("v [mV]") # ax[1].set_ylabel("a [mV]") # ax[0].set_yticks(range(-100, 100, 50)) # ax[1].set_ylim(0, 20) # pl.tight_layout() # pl.savefig("fig_40_3.png") # pl.show()
lfp = np.mean(sol[:, :num_e], axis=1) t_e_spikes = [] t_i_spikes = [] for i in range(num_e): ts_e = lib.spikeDetection(t, sol[:, i], spikeThreshold) t_e_spikes.append(ts_e) index = 5 * num_e for i in range(index, index + num_i): ts_i = lib.spikeDetection(t, sol[:, i], spikeThreshold) t_i_spikes.append(ts_i) lib.display_time(time() - start) lib.spikeToFile(t_e_spikes, "t_e_spikes1.txt") lib.spikeToFile(t_i_spikes, "t_i_spikes1.txt") np.savetxt("lfp1.txt", zip(t, lfp), fmt="%18.6f") # --------------------------------------------------------------# p_ee = 1.0 / num_e p_ei = 1.0 / num_i p_ie = 1.0 / num_i p_ii = 1.0 / num_i u_ee = rand(num_e, num_e) u_ei = rand(num_e, num_i) u_ie = rand(num_i, num_e) u_ii = rand(num_i, num_i) g_ee = (g_hat_ee * (u_ee < p_ee) / (num_e * p_ee)).T g_ei = (g_hat_ei * (u_ei < p_ei) / (num_e * p_ei)).T