Beispiel #1
0
spike = nest.Create('spike_generator',
                    params={'spike_times': np.array([10.0])})

spike_image = ngpu_nest.CreateNeuronImage(spike, 1)

delay = [1.0, 300.0, 500.0, 700.0]
w = [1.0, 1.0, 1.0, 1.0]
conn_spec = {"rule": "all_to_all"}
for syn in range(4):
    syn_spec = {'receptor': syn, 'weight': w[syn], 'delay': delay[syn]}
    ngpu.Connect(spike_image, neuron, conn_spec, syn_spec)

record = ngpu.CreateRecord("", ["V_m"], [neuron[0]], [0])

nest.Simulate(1000.0)

data_list = ngpu.GetRecordData(record)
t = [row[0] for row in data_list]
V_m = [row[1] for row in data_list]

import matplotlib.pyplot as plt

plt.figure(1)
plt.plot(t, V_m)

plt.draw()
plt.pause(1)
ngpu.waitenter("<Hit Enter To Close>")
plt.close()
Beispiel #2
0
syn_dict0 = {"weight": 0.5, "delay": 1.0, "receptor": 0}
ngpu.Connect(neuron0, parrot0, conn_dict, syn_dict0)
syn_dict1 = {"weight": 0.1, "delay": 1.0, "receptor": 0}
ngpu.Connect(parrot0, neuron1, conn_dict, syn_dict1)
ngpu.Connect(parrot0, parrot1, conn_dict, syn_dict1)

neuron0_record = ngpu.CreateRecord("", ["V_m"], [neuron0[0]], [0])
parrot0_record = ngpu.CreateRecord("", ["V", "spike"],
                                   [parrot0[0], parrot0[0]], [0, 0])
neuron1_record = ngpu.CreateRecord("", ["g1"], [neuron1[0]], [0])
parrot1_record = ngpu.CreateRecord("", ["V", "spike"],
                                   [parrot1[0], parrot1[0]], [0, 0])

ngpu.Simulate()

neuron0_data_list = ngpu.GetRecordData(neuron0_record)
t_neuron0 = [row[0] for row in neuron0_data_list]
V_m = [row[1] for row in neuron0_data_list]

parrot0_data_list = ngpu.GetRecordData(parrot0_record)
t_parrot0 = [row[0] for row in parrot0_data_list]
V_parrot0 = [row[1] for row in parrot0_data_list]
spike_parrot0 = [row[2] for row in parrot0_data_list]

neuron1_data_list = ngpu.GetRecordData(neuron1_record)
t_neuron1 = [row[0] for row in neuron1_data_list]
g1 = [row[1] for row in neuron1_data_list]

parrot1_data_list = ngpu.GetRecordData(parrot1_record)
t_parrot1 = [row[0] for row in parrot1_data_list]
V_parrot1 = [row[1] for row in parrot1_data_list]
Beispiel #3
0
syn_dict2 = {"weight": 2.0, "delay": 20.0, "receptor": 0}
syn_dict3 = {"weight": 3.0, "delay": 30.0, "receptor": 0}

ngpu.Connect(neuron[0:0], spike_det, conn_dict, syn_dict1)

ngpu.Connect(neuron[1:1], spike_det, conn_dict, syn_dict2)

ngpu.Connect(neuron[2:2], spike_det, conn_dict, syn_dict3)

record_n = ngpu.CreateRecord("", ["spike"], [neuron[0]], [0])

record_sd = ngpu.CreateRecord("", ["spike_height"], [spike_det[0]], [0])

ngpu.Simulate()

data_n = ngpu.GetRecordData(record_n)
t_n = [row[0] for row in data_n]
spike_n = [row[1] for row in data_n]

data_sd = ngpu.GetRecordData(record_sd)
t_sd = [row[0] for row in data_sd]
spike_sd = [row[1] for row in data_sd]

for i in range(len(t_n) - 400):
    if spike_n[i] > 0.5:
        j1 = i + 101
        j2 = i + 201
        j3 = i + 301
        if abs(spike_sd[j1] - 1.0) > tolerance:
            print("Expected spike height: 1.0, simulated: ", spike_sd[j1])
            sys.exit(1)
Beispiel #4
0
weight = [0.1, 0.2, 0.5]

conn_spec = {"rule": "all_to_all"}
for syn in range(1):
    syn_spec = {'receptor': syn, 'weight': weight[syn], 'delay': delay[syn]}
    ngpu.Connect(spike, node_image2, conn_spec, syn_spec)

i_neuron_arr = [node_image2[0]]
i_receptor_arr = [0]
var_name_arr = ["port_value"]
record = ngpu.CreateRecord("", var_name_arr, i_neuron_arr, i_receptor_arr)

#print (nest_neuron2[0].global_id)
nest.Simulate(800)

data_sd = ngpu.GetRecordData(record_sd)
t_sd = [row[0] for row in data_sd]
spike_sd = [70.0 * row[1] - 70.0 for row in data_sd]

dmm = multimeter.get()
Vms = dmm["events"]["V_m"]
ts = dmm["events"]["times"]

import matplotlib.pyplot as plt

plt.figure(1)
plt.plot(t_sd, spike_sd, 'r')

#plt.figure(2)
plt.plot(ts, Vms)