def test_SetDefaults(self): """SetDefaults""" m = "sample_neuron" cynest.ResetKernel() cynest.SetDefaults(m, {'V_m': -1.}) self.assertEqual(cynest.GetDefaults(m)['V_m'], -1.) try: cynest.SetDefaults(m, {'DUMMY': 0}) except: info = sys.exc_info()[1] if not "DictError" in info.__str__(): self.fail('wrong error message')
def build(self): nest.ResetKernel() nest.SetKernelStatus({'local_num_threads': self.n_threads}) if self.params: nest.SetDefaults(self.model,self.params) self.neuron=nest.Create(self.model,self.n_neurons) self.noise=nest.Create('noise_generator') self.spike=nest.Create('spike_detector') nest.SetStatus(self.spike,[{'to_memory':True, 'to_file':False}])
def test_ModelCreateSimulate(self): """Model Creation and Simulation""" cynest.ResetKernel() cynest.SetDefaults("sample_neuron", {"param": 20}) node = cynest.Create("sample_neuron") cynest.Simulate(1) self.assertEqual(cynest.GetStatus(node)[0]["param"], 30)
del tmp P = a * weight * pylab.convolve(gauss, psp) l = len(P) t_P = convolution_resolution * numpy.linspace( -l / 2., l / 2., l) + pulsetime + 1. # one ms delay ######################################################################### # simulation section nest.ResetKernel() nest.SetStatus([0], [{'resolution': simulation_resolution}]) J = Cm * weight / tau_s * fudge nest.SetDefaults('static_synapse', {'weight': J}) n = nest.Create( 'iaf_psc_alpha', n_neurons, { 'V_th': Vth, 'tau_m': tau_m, 'tau_syn_ex': tau_s, 'C_m': Cm, 'E_L': V0, 'V_reset': V0, 'V_m': V0 }) pp = nest.Create('pulsepacket_generator', n_neurons, { 'pulse_times': [pulsetime], 'activity': a, 'sdev': sdev
# set neuron parameters: neuron_param = { "tau_m": Tau, "t_ref": TauR, "tau_syn_ex": Tau_psc, "tau_syn_in": Tau_psc, "C_m": C, "V_reset": U0, "E_L": U0, "V_m": U0, "V_th": Theta } # set defaults of desired neuron type with chosen parameters: nest.SetDefaults("iaf_psc_exp", neuron_param) # create two neurons of desired type: neurons = nest.Create("iaf_psc_exp", 2) # set properties of dc: nest.SetDefaults("dc_generator", { "amplitude": I0, "start": TIstart, "stop": TIend }) # create dc_generator: dc_gen = nest.Create("dc_generator") # set properties of voltmeter:
import cynest as nest import cynest.voltage_trace nest.ResetKernel() #Parameter set for depression dep_params = {"U": 0.67, "weight": 250.} # parameter set for facilitation fac_params = {"U": 0.1, "tau_fac": 1000., "tau_rec": 100., "weight": 250.} # Here we assign the parameter set to the synapse models t1_params = fac_params # for tsodyks_synapse t2_params = t1_params.copy() # for tsodyks2_synapse nest.SetDefaults("tsodyks_synapse", t1_params) nest.SetDefaults("tsodyks2_synapse", t2_params) nest.SetDefaults("iaf_psc_exp", {"tau_syn_ex": 3.}) neuron = nest.Create("iaf_psc_exp", 3) nest.Connect([neuron[0]], [neuron[1]], model="tsodyks_synapse") nest.Connect([neuron[0]], [neuron[2]], model="tsodyks2_synapse") voltmeter = nest.Create("voltmeter", 2) nest.SetStatus(voltmeter, {"withgid": True, "withtime": True}) nest.Connect([voltmeter[0]], [neuron[1]]) nest.Connect([voltmeter[1]], [neuron[2]]) nest.SetStatus([neuron[0]], "I_e", 376.0) nest.Simulate(500.0) nest.SetStatus([neuron[0]], "I_e", 0.0)
nest.SetKernelStatus({"resolution": dt, "print_time": True}) print("Building network") neuron_params = { "C_m": 1.0, "tau_m": tauMem, "t_ref": 2.0, "E_L": 0.0, "V_reset": 0.0, "V_m": 0.0, "V_th": theta } nest.SetDefaults("iaf_psc_delta", neuron_params) nodes_ex = nest.Create("iaf_psc_delta", NE) nodes_in = nest.Create("iaf_psc_delta", NI) nest.SetDefaults("poisson_generator", {"rate": p_rate}) noise = nest.Create("poisson_generator") espikes = nest.Create("spike_detector") ispikes = nest.Create("spike_detector") nest.SetStatus([espikes], [{ "label": "brunel-py-ex", "withtime": True, "withgid": True }])