Exemple #1
0
    def __init__(self,
                 n_neurons,
                 spike_time_file,
                 machine_time_step,
                 timescale_factor,
                 port=None,
                 tag=None,
                 ip_address=None,
                 board_address=None,
                 min_atom=None,
                 max_atom=None,
                 min_time=None,
                 max_time=None,
                 max_on_chip_memory_usage_for_spikes_in_bytes=None,
                 constraints=None,
                 split_value="\t",
                 label="SpikeSourceArray"):
        # pylint: disable=too-many-arguments, too-many-locals
        spike_times = utility_calls.read_spikes_from_file(
            spike_time_file, min_atom, max_atom, min_time, max_time,
            split_value)

        super(SpikeSourceFromFile,
              self).__init__(n_neurons,
                             spike_times,
                             machine_time_step,
                             timescale_factor,
                             port=port,
                             tag=tag,
                             ip_address=ip_address,
                             board_address=board_address,
                             max_on_chip_memory_usage_for_spikes_in_bytes=(
                                 max_on_chip_memory_usage_for_spikes_in_bytes),
                             constraints=constraints,
                             label=label)
Exemple #2
0
 def __init__(
         self, spike_time_file, min_atom=None, max_atom=None, min_time=None,
         max_time=None, split_value="\t"):
     # pylint: disable=too-many-arguments, too-many-locals
     spike_times = utility_calls.read_spikes_from_file(
         spike_time_file, min_atom, max_atom, min_time, max_time,
         split_value)
     super(SpikeSourceFromFile, self).__init__(spike_times)
 def __init__(
         self, spike_time_file, min_atom=None, max_atom=None, min_time=None,
         max_time=None, split_value="\t"):
     # pylint: disable=too-many-arguments, too-many-locals
     spike_times = utility_calls.read_spikes_from_file(
         spike_time_file, min_atom, max_atom, min_time, max_time,
         split_value)
     super(SpikeSourceFromFile, self).__init__(spike_times)
Exemple #4
0
    def test_script(self):
        """
        test that tests the printing of v from a pre determined recording
        :return:
        """
        try:
            n_neurons = 20  # number of neurons in each population
            current_file_path = os.path.dirname(os.path.abspath(__file__))
            current_spike_file_path = os.path.join(current_file_path,
                                                   "spikes.data")
            current_v_file_path = os.path.join(current_file_path, "v.data")
            current_gsyn_file_path = os.path.join(current_file_path,
                                                  "gsyn.data")
            synfire_run.do_run(n_neurons,
                               max_delay=14,
                               time_step=0.1,
                               neurons_per_core=1,
                               delay=1.7,
                               run_times=[50],
                               spike_path=current_spike_file_path,
                               gsyn_path=current_gsyn_file_path,
                               v_path=current_v_file_path)

            spikes = synfire_run.get_output_pop_spikes()
            v = synfire_run.get_output_pop_voltage()
            gsyn = synfire_run.get_output_pop_gsyn()

            read_in_spikes = utility_calls.read_spikes_from_file(
                current_spike_file_path, 0, n_neurons, 0, 5000)
            read_in_v = utility_calls.read_in_data_from_file(
                current_v_file_path, 0, n_neurons, 0, 5000)
            read_in_gsyn = utility_calls.read_in_data_from_file(
                current_gsyn_file_path, 0, n_neurons, 0, 5000)

            for spike_element, read_element in zip(spikes, read_in_spikes):
                self.assertEqual(round(spike_element[0], 1),
                                 round(read_element[0], 1))
                self.assertEqual(round(spike_element[1], 1),
                                 round(read_element[1], 1))

            for v_element, read_element in zip(v, read_in_v):
                self.assertEqual(round(v_element[0], 1),
                                 round(read_element[0], 1))
                self.assertEqual(round(v_element[1], 1),
                                 round(read_element[1], 1))

            for gsyn_element, read_element in zip(gsyn, read_in_gsyn):
                self.assertEqual(round(gsyn_element[0], 1),
                                 round(read_element[0], 1))
                self.assertEqual(round(gsyn_element[1], 1),
                                 round(read_element[1], 1))
        except SpinnmanTimeoutException as ex:
            # System sometimes times outs
            raise SkipTest(ex)
    def test_script(self):
        """
        test that tests the printing of v from a pre determined recording
        :return:
        """
        synfire_run.do_run(n_neurons,
                           max_delay=14,
                           time_step=1,
                           neurons_per_core=1,
                           delay=1.7,
                           run_times=[50],
                           spike_path=current_spike_file_path,
                           gsyn_path=current_gsyn_file_path,
                           v_path=current_v_file_path,
                           end_before_print=False)
        gsyn = synfire_run.get_output_pop_gsyn()
        v = synfire_run.get_output_pop_voltage()
        spikes = synfire_run.get_output_pop_spikes()

        read_in_spikes = utility_calls.read_spikes_from_file(
            current_spike_file_path, 0, n_neurons, 0, 5000)
        read_in_v = utility_calls.read_in_data_from_file(
            current_v_file_path, 0, n_neurons, 0, 5000)
        read_in_gsyn = utility_calls.read_in_data_from_file(
            current_gsyn_file_path, 0, n_neurons, 0, 5000)

        for spike_element, read_element in zip(spikes, read_in_spikes):
            self.assertEqual(round(spike_element[0], 1),
                             round(read_element[0], 1))
            self.assertEqual(round(spike_element[1], 1),
                             round(read_element[1], 1))

        for v_element, read_element in zip(v, read_in_v):
            self.assertEqual(round(v_element[0], 1), round(read_element[0], 1))
            self.assertEqual(round(v_element[1], 1), round(read_element[1], 1))

        for gsyn_element, read_element in zip(gsyn, read_in_gsyn):
            self.assertEqual(round(gsyn_element[0], 1),
                             round(read_element[0], 1))
            self.assertEqual(round(gsyn_element[1], 1),
                             round(read_element[1], 1))
    def test_print_spikes(self):
        try:
            synfire_run.do_run(n_neurons, time_step=timestep,
                               max_delay=max_delay, delay=delay,
                               neurons_per_core=neurons_per_core,
                               run_times=[runtime],
                               spike_path=current_file_path)
            spikes = synfire_run.get_output_pop_spikes()

            read_in_spikes = utility_calls.read_spikes_from_file(
                current_file_path, min_atom=0, max_atom=n_neurons,
                min_time=0, max_time=500)

            for spike_element, read_element in zip(spikes, read_in_spikes):
                self.assertEqual(round(spike_element[0], 1),
                                 round(read_element[0], 1))
                self.assertEqual(round(spike_element[1], 1),
                                 round(read_element[1], 1))
        except SpinnmanTimeoutException as ex:
            # System intentional overload so may error
            raise SkipTest(ex)
Exemple #7
0
    def test_print_spikes(self):
        synfire_run.do_run(n_neurons,
                           time_step=timestep,
                           max_delay=max_delay,
                           delay=delay,
                           neurons_per_core=neurons_per_core,
                           run_times=[runtime],
                           spike_path=current_file_path)
        spikes = synfire_run.get_output_pop_spikes()

        read_in_spikes = utility_calls.read_spikes_from_file(
            current_file_path,
            min_atom=0,
            max_atom=n_neurons,
            min_time=0,
            max_time=500)

        for spike_element, read_element in zip(spikes, read_in_spikes):
            self.assertEqual(round(spike_element[0], 1),
                             round(read_element[0], 1))
            self.assertEqual(round(spike_element[1], 1),
                             round(read_element[1], 1))
Exemple #8
0
    def __init__(self,
                 n_neurons,
                 spike_time_file,
                 machine_time_step,
                 timescale_factor,
                 port=None,
                 tag=None,
                 ip_address=None,
                 board_address=None,
                 min_atom=None,
                 max_atom=None,
                 min_time=None,
                 max_time=None,
                 max_on_chip_memory_usage_for_spikes_in_bytes=None,
                 constraints=None,
                 split_value="\t",
                 label="SpikeSourceArray"):

        spike_times = utility_calls.read_spikes_from_file(
            spike_time_file, min_atom, max_atom, min_time, max_time,
            split_value)

        SpikeSourceArray.__init__(
            self,
            n_neurons,
            spike_times,
            machine_time_step,
            timescale_factor,
            port=port,
            tag=tag,
            ip_address=ip_address,
            board_address=board_address,
            max_on_chip_memory_usage_for_spikes_in_bytes=(
                max_on_chip_memory_usage_for_spikes_in_bytes),
            constraints=constraints,
            label=label)