import pyNN.neuron as sim # can of course replace `neuron` with `nest`, `brian`, etc. import matplotlib.pyplot as plt import numpy as np sim.setup(timestep=0.01) p_in = sim.Population(10, sim.SpikeSourcePoisson(rate=10.0), label="input") p_out = sim.Population(10, sim.EIF_cond_exp_isfa_ista(), label="AdExp neurons") syn = sim.StaticSynapse(weight=0.05) random = sim.FixedProbabilityConnector(p_connect=0.5) connections = sim.Projection(p_in, p_out, random, syn, receptor_type='excitatory') p_in.record('spikes') p_out.record('spikes') # record spikes from all neurons p_out[0:2].record(['v', 'w', 'gsyn_exc']) # record other variables from first two neurons sim.run(500.0) spikes_in = p_in.get_data() data_out = p_out.get_data() fig_settings = { 'lines.linewidth': 0.5, 'axes.linewidth': 0.5, 'axes.labelsize': 'small', 'legend.fontsize': 'small', 'font.size': 8 } plt.rcParams.update(fig_settings) plt.figure(1, figsize=(6, 8))
import pyNN.neuron as sim # can of course replace `nest` with `neuron`, `brian`, etc. import matplotlib.pyplot as plt from quantities import nA from pyNN.random import RandomDistribution, NumpyRNG refractory_period=RandomDistribution('uniform', [2.0, 3.0], rng=NumpyRNG(seed=4242)) sim.setup() pyr_parameters= {'cm': 0.25, 'tau_m': 20.0, 'v_rest': -60, 'v_thresh': -50, 'tau_refrac': refractory_period, 'v_reset': -60, 'v_spike': -50.0, 'a': 1.0, 'b': 0.005, 'tau_w': 600, 'delta_T': 2.5, 'tau_syn_E': 5.0, 'e_rev_E': 0.0, 'tau_syn_I': 10.0, 'e_rev_I': -80 } pyrcell = sim.Population(1, sim.EIF_cond_exp_isfa_ista(**pyr_parameters)) step_current = sim.DCSource(start=20.0, stop=80.0) step_current.inject_into(pyrcell) pyrcell.record('v') print(pyrcell.celltype.recordable) for amp in (-0.2, -0.1, 0.0, 0.1, 0.2,0.3,0.4,0.5): step_current.amplitude = amp sim.run(150.0) sim.reset(annotations={"amplitude": amp * nA}) data = pyrcell.get_data() sim.end() for segment in data.segments: vm = segment.analogsignals[0] plt.plot(vm.times, vm,