def add_input_plot(self, input): """Create a plot of the spike pattern of the input over time.""" fig = plt.figure(figsize=self.figsize) fig.suptitle(input.name) plotRaster(input.spike_times) plt.xlabel('Time steps') plt.ylabel('Input index') plt.xlim(0, input.number_of_time_steps) plt.ylim(0, input.number_of_neurons) plt.title('Source Spikes') plt.tight_layout() plt.show()
def SpikesRasterPlot(name: str, directory: str, data: list, sim_time: int, filetype: str): """ Plot Spike Raster :param name: name of the figure :param directory: directory to the figure :param data: spike times of neurons :param sim_time: simulation time :param filetype: type of file :return: figure: matplotlib figure """ figure = plt.figure() plt.xlim([0, sim_time]) plotRaster(data) SavePlot(figure, directory, name, filetype) return figure
probes['astro2_ip3_voltage'] = astrocyte2.probe( combra.ASTRO_IP3_INTEGRATOR_PROBE.COMPARTMENT_VOLTAGE) probes['astro2_sic_voltage'] = astrocyte2.probe( combra.ASTRO_SIC_GENERATOR_PROBE.COMPARTMENT_VOLTAGE) probes['astro2_sg_spikes'] = astrocyte2.probe( combra.ASTRO_SPIKE_GENERATOR_PROBE.SPIKE) net.run(sim_time) net.disconnect() # Plots fig = plt.figure(1, figsize=(18, 28)) ax0 = plt.subplot(7, 1, 1) ax0.set_xlim(0, sim_time) plotRaster(input_spike_times) plt.ylabel('neuron index') plt.xlabel('time (ms)') plt.title('Presynaptic neurons poisson spikes') ax1 = plt.subplot(7, 1, 2) ax1.set_xlim(0, sim_time) probes['astro1_sr_spikes'].plot() probes['astro2_sr_spikes'].plot() plt.xlabel('time (ms)') plt.title('Astrocyte compartment 1: Spike receiver spikes') ax2 = plt.subplot(7, 1, 3) ax2.set_xlim(0, sim_time) probes['astro1_ip3_voltage'].plot() probes['astro2_ip3_voltage'].plot()
return nan.poisson_spike, post_probes, astro_probes if __name__ == '__main__': net = nx.NxNet() sim_time = 7000 pre_spikes, post_probes, astro_probes = setupNAN(net, sim_time) net.run(sim_time) net.disconnect() """ start plotting """ fig = plt.figure(1, figsize=(18, 28)) ax0 = plt.subplot(6, 1, 1) ax0.set_xlim(0, sim_time) plotRaster(pre_spikes) plt.ylabel('neuron index') plt.xlabel('time (ms)') plt.title('Presynaptic neurons poisson spikes') ax1 = plt.subplot(6, 1, 2) ax1.set_xlim(0, sim_time) astro_probes[0].plot() plt.xlabel('time (ms)') plt.title('Astrocyte compartment 1: Spike receiver spikes') ax2 = plt.subplot(6, 1, 3) ax2.set_xlim(0, sim_time) astro_probes[1].plot() plt.xlabel('time (ms)') plt.title('Astrocyte compartment 2: IP3 integrator voltage')