def __init__(self,
                 receive_labels=None,
                 send_labels=None,
                 local_host=None,
                 local_port=19999):
        """

        :param receive_labels: Labels of population from which live spikes\
                    will be received.
        :type receive_labels: iterable of str
        :param send_labels: Labels of population to which live spikes will be\
                    sent
        :type send_labels: iterable of str
        :param local_host: Optional specification of the local hostname or\
                    ip address of the interface to listen on
        :type local_host: str
        :param local_port: Optional specification of the local port to listen\
                    on.  Must match the port that the toolchain will send the\
                    notification on (19999 by default)
        :type local_port: int

        """

        LiveEventConnection.__init__(self, "LiveSpikeReceiver", receive_labels,
                                     send_labels, local_host, local_port)
    def __init__(self, receive_labels=None, send_labels=None, local_host=None,
                 local_port=19999):
        """

        :param receive_labels: Labels of population from which live spikes\
                    will be received.
        :type receive_labels: iterable of str
        :param send_labels: Labels of population to which live spikes will be\
                    sent
        :type send_labels: iterable of str
        :param local_host: Optional specification of the local hostname or\
                    ip address of the interface to listen on
        :type local_host: str
        :param local_port: Optional specification of the local port to listen\
                    on.  Must match the port that the toolchain will send the\
                    notification on (19999 by default)
        :type local_port: int

        """

        LiveEventConnection.__init__(
            self, "LiveSpikeReceiver", receive_labels, send_labels,
            local_host, local_port)
    actual_sendvalues.append(x)
    # 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))