plot_spiketrains(spikes.segments[i]) plt.subplot(2, 1, 2) plot_spiketrains(spike.segments[i]) # plt.subplot(4, 1, 3) # plot_signal(spikes.segments[0].analogsignalarrays[0], 0) # plt.subplot(3, 1, 3) # plot_signal(spike.segments[1].analogsignalarrays[0], 0) # plt.xlabel("time (%s)" % spike.segments[0].analogsignalarrays[0].times.units._dimensionality.string) plt.setp(plt.gca().get_xticklabels(), visible=True) # todo: check the structure of segment plt.show() sim.reset() # connection.set(weight = 0.05, delay = 0.2, U = 0.5, tau_rec = 800.0, tau_facil = 0.01) Input_E_connection.set(weight=0.05, delay=0.5) # E_E_connection.set(weight = 0.05, delay = 0.2, U = 0.5, tau_rec = 800.0, tau_facil = 0.01) E_E_connection.set(weight=0.05, delay=0.2, U=0.5, tau_rec=800.0, tau_facil=0.01) print(Excinp.get('spike_times')) stimSpikes = RandomDistribution('uniform', low=0, high=500.0).next([1, 10]) Excinp.set(spike_times=stimSpikes[0, :]) # spikes = Excinp.get_data() # spike = Pexc.get_data()
def reset_pynn(): pynnn.reset()
import pyNN.brian as sim # can of course replace `nest` with `neuron`, `brian`, etc. import matplotlib.pyplot as plt from quantities import nA sim.setup() cell = sim.Population(1, sim.HH_cond_exp()) step_current = sim.DCSource(start=20.0, stop=80.0) step_current.inject_into(cell) cell.record('v') for amp in (-0.2, -0.1, 0.0, 0.1, 0.2): step_current.amplitude = amp sim.run(100.0) sim.reset(annotations={"amplitude": amp * nA}) data = cell.get_data() sim.end() for segment in data.segments: vm = segment.analogsignals[0] plt.plot(vm.times, vm, label=str(segment.annotations["amplitude"])) plt.legend(loc="upper left") plt.xlabel("Time (%s)" % vm.times.units._dimensionality) plt.ylabel("Membrane potential (%s)" % vm.units._dimensionality) plt.show()