# append a threading.Timer to list of threads
    mythreads.append(Timer(t,send_str_to_io,args=[iostr]))


def start_threads(label,hook):
  """this starts the timed sender threads"""
  print "starting timer threads"
  for t in mythreads:
    t.start()

# this is a workaround to start the input-via-serial threads along with the simulation
injector_forward = p.Population(
    100, q.SpikeInjector,
    {'port':12346,'virtual_key':0x7000}, label='dummy_injector')
live = LiveEventConnection("LiveSpikeReceiver",send_labels=['dummy_injector'],local_port=19999,receive_labels=None)
live.add_start_callback("dummy_injector",start_threads)

p.run(duration)

# wait for serial senders to finish (just in case)
for t in mythreads:
  t.join()
  
# actual_sendtimes are when packets got actually sent
# but how do we align this with SpiNNaker's time?
# let's just assume first shot was at t=0...
actual_sendtimes = array(actual_sendtimes) - actual_sendtimes[0]

spike_fig = figure("spikes", figsize=(8,8))
rate_fig = figure("rates", figsize=(8,8))
for i,p in enumerate(input_pops):