Python 使用PyNN-SpiNNaker发送峰值时出错

Python 使用PyNN-SpiNNaker发送峰值时出错,python,neural-network,Python,Neural Network,我试图向我使用connection.send_spike(标签,18)创建的群体中的神经元18发送一个单一峰值。我使用的代码与Jypeter上正确运行的示例相同 # Import the simulator import pyNN.spiNNaker as sim # Other imports used in this example from time import sleep # Set up a function that will start sending spikes whe

我试图向我使用connection.send_spike(标签,18)创建的群体中的神经元18发送一个单一峰值。我使用的代码与Jypeter上正确运行的示例相同

# Import the simulator
import pyNN.spiNNaker as sim

# Other imports used in this example
from time import sleep


# Set up a function that will start sending spikes when the simulation starts.
# This is automatically run in a separate thread from the rest of the simulation.
# This must accept two arguments: 
#    The label of the Population that the callback is registered against, 
#    and the connection the callback is registered against.
def send_spikes(label, connection):
    # Sleep to make sure everything is fully ready
    sleep(0.01)

    # Send a spike to neuron 0
    connection.send_spike(label, 0)

    # Send spikes to neurons 1-4 after 0.1ms
    sleep(0.1)
    connection.send_spikes(label, range(1, 5))


# Keep track of the label of the injector as this needs to match up in several places
injector_label = "injector"

# Create the connection, noting that the label will be a "sender".
# Note the use of local_port=None allows the automatic assignment of a port.
connection = sim.external_devices.SpynnakerLiveSpikesConnection(
    local_port=None, send_labels=[injector_label])

# Add a callback to be called at the start of the simulation
connection.add_start_resume_callback(injector_label, send_spikes)

# Set up the simulation itself
sim.setup(1.0,1.0,10.0)

# Set up the injector population with 5 neurons, 
# simultaneously registering the connection as a listener
injector = sim.Population(
    5, sim.external_devices.SpikeInjector(
        database_notify_port_num=connection.local_port),
    # Critical: Make sure the label is used!
    label=injector_label)

# Set up a Population to receive spikes and record
pop = sim.Population(5, sim.IF_curr_exp(), label="pop")
pop.record("spikes")

# Connect the injector to the population
sim.Projection(injector, pop, sim.OneToOneConnector(), sim.StaticSynapse(weight=5))

# Run the simulation and get the spikes out
sim.run(1000)
spikes = pop.get_data("spikes").segments[0].spiketrains

# End the simulation and display the spikes
sim.end()
print(spikes)
但是,我收到以下错误:

Traceback (most recent call last):
  File "/home/costis/anaconda3/envs/spynslam/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/costis/anaconda3/envs/spynslam/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "<ipython-input-2-9fba9de17725>", line 18, in send_spikes
    connection.send_spike(label, 0)
  File "/home/costis/anaconda3/envs/spynslam/lib/python3.6/site-packages/spynnaker/pyNN/connections/spynnaker_live_spikes_connection.py", line 69, in send_spike
    self.send_spikes(label, [neuron_id], send_full_keys)
  File "/home/costis/anaconda3/envs/spynslam/lib/python3.6/site-packages/spynnaker/pyNN/connections/spynnaker_live_spikes_connection.py", line 84, in send_spikes
    self.send_events(label, neuron_ids, send_full_keys)
  File "/home/costis/anaconda3/envs/spynslam/lib/python3.6/site-packages/spinn_front_end_common/utilities/connections/live_event_connection.py", line 504, in send_events
    x, y, p, ip_address = self.__send_address_details[label]
KeyError: 'injector'
回溯(最近一次呼叫最后一次):
文件“/home/costis/anaconda3/envs/spynslam/lib/python3.6/threading.py”,第916行,在引导程序中
self.run()
文件“/home/costis/anaconda3/envs/spynslam/lib/python3.6/threading.py”,第864行,正在运行
自我目标(*自我参数,**自我参数)
文件“”,第18行,在发送\u尖峰中
连接。发送\u尖峰(标签,0)
文件“/home/costis/anaconda3/envs/spynslam/lib/python3.6/site packages/spynnaker/pyNN/connections/spynnaker\u live\u spikes\u connection.py”,第69行,在send\u spike中
self.send_尖峰(标签,[neuron_id],send_full_键)
文件“/home/costis/anaconda3/envs/spynslam/lib/python3.6/site packages/spynnaker/pyNN/connections/spynnaker\u live\u spikes\u connection.py”,第84行,在send\u spikes中
self.send\u事件(标签、神经元ID、发送完整密钥)
文件“/home/costis/anaconda3/envs/spynslam/lib/python3.6/site packages/spinn\u front\u end\u common/utilities/connections/live\u event\u connection.py”,第504行,在send\u events中
x、 y,p,ip地址=自我。发送地址详细信息[标签]
KeyError:“喷油器”
我也搜索了PyNN代码中的部分,以了解它为什么不工作,并且没有找到任何可能导致此问题的内容。世界上的“注入器”和我尝试过的任何其他单词都在字典中用作键。其余的示例脚本工作正常


任何提示都已通知。谢谢

我正在发布我找到的答案,以防其他人也有同样的问题

输出没有写入数据库;可以通过将“create_database=True”添加到.spynnaker.cfg文件的“[database]”部分来强制执行此操作