예제 #1
0
    def _get_synaptic_data(self,
                           as_list,
                           data_to_get,
                           fixed_values=None,
                           notify=None):
        """
        :param bool as_list:
        :param list(int) data_to_get:
        :param list(tuple(str,int)) fixed_values:
        :param callable(ConnectionHolder,None) notify:
        :rtype: ConnectionHolder
        """
        # pylint: disable=too-many-arguments
        post_vertex = self.__projection_edge.post_vertex
        pre_vertex = self.__projection_edge.pre_vertex

        # If in virtual board mode, the connection data should be set
        if self.__virtual_connection_list is not None:
            connection_holder = ConnectionHolder(
                data_to_get,
                as_list,
                pre_vertex.n_atoms,
                post_vertex.n_atoms,
                self.__virtual_connection_list,
                fixed_values=fixed_values,
                notify=notify)
            connection_holder.finish()
            return connection_holder

        # if not virtual board, make connection holder to be filled in at
        # possible later date
        connection_holder = ConnectionHolder(data_to_get,
                                             as_list,
                                             pre_vertex.n_atoms,
                                             post_vertex.n_atoms,
                                             fixed_values=fixed_values,
                                             notify=notify)

        # If we haven't run, add the holder to get connections, and return it
        # and set up a callback for after run to fill in this connection holder
        if not get_simulator().has_ran:
            self.__synapse_information.add_pre_run_connection_holder(
                connection_holder)
            return connection_holder

        # Otherwise, get the connections now, as we have ran and therefore can
        # get them
        connections = post_vertex.get_connections_from_machine(
            get_simulator().transceiver,
            get_simulator().placements, self.__projection_edge,
            self.__synapse_information)
        if connections is not None:
            connection_holder.add_connections(connections)
            connection_holder.finish()
        return connection_holder
    def _get_synaptic_data(self,
                           as_list,
                           data_to_get,
                           fixed_values=None,
                           notify=None,
                           handle_time_out_configuration=True):
        # pylint: disable=too-many-arguments
        post_vertex = self.__projection_edge.post_vertex
        pre_vertex = self.__projection_edge.pre_vertex

        # If in virtual board mode, the connection data should be set
        if self.__virtual_connection_list is not None:
            post_vertex = self.__projection_edge.post_vertex
            pre_vertex = self.__projection_edge.pre_vertex
            connection_holder = ConnectionHolder(
                data_to_get,
                as_list,
                pre_vertex.n_atoms,
                post_vertex.n_atoms,
                self.__virtual_connection_list,
                fixed_values=fixed_values,
                notify=notify)
            connection_holder.finish()
            return connection_holder

        # if not virtual board, make connection holder to be filled in at
        # possible later date
        connection_holder = ConnectionHolder(data_to_get,
                                             as_list,
                                             pre_vertex.n_atoms,
                                             post_vertex.n_atoms,
                                             fixed_values=fixed_values,
                                             notify=notify)

        # If we haven't run, add the holder to get connections, and return it
        # and set up a callback for after run to fill in this connection holder
        if not self.__spinnaker_control.has_ran:
            post_vertex.add_pre_run_connection_holder(
                connection_holder, self.__projection_edge,
                self.__synapse_information)
            return connection_holder

        # Otherwise, get the connections now, as we have ran and therefore can
        # get them
        self.__get_projection_data(data_to_get, pre_vertex, post_vertex,
                                   connection_holder,
                                   handle_time_out_configuration)
        return connection_holder
    def _get_synaptic_data(
            self, as_list, data_to_get, fixed_values=None, notify=None,
            handle_time_out_configuration=True):
        # pylint: disable=too-many-arguments
        post_vertex = self._projection_edge.post_vertex
        pre_vertex = self._projection_edge.pre_vertex

        # If in virtual board mode, the connection data should be set
        if self._virtual_connection_list is not None:
            post_vertex = self._projection_edge.post_vertex
            pre_vertex = self._projection_edge.pre_vertex
            connection_holder = ConnectionHolder(
                data_to_get, as_list, pre_vertex.n_atoms, post_vertex.n_atoms,
                self._virtual_connection_list, fixed_values=fixed_values,
                notify=notify)
            connection_holder.finish()
            return connection_holder

        # if not virtual board, make connection holder to be filled in at
        # possible later date
        connection_holder = ConnectionHolder(
            data_to_get, as_list, pre_vertex.n_atoms, post_vertex.n_atoms,
            fixed_values=fixed_values, notify=notify)

        # If we haven't run, add the holder to get connections, and return it
        # and set up a callback for after run to fill in this connection holder
        if not self._spinnaker_control.has_ran:
            post_vertex.add_pre_run_connection_holder(
                connection_holder, self._projection_edge,
                self._synapse_information)
            return connection_holder

        # Otherwise, get the connections now, as we have ran and therefore can
        # get them
        self.__get_projection_data(
            data_to_get, pre_vertex, post_vertex, connection_holder,
            handle_time_out_configuration)
        return connection_holder