def __init__(self, degree, rewiring, allow_self_connections=True, weights=0.0, delays=1, space=None, safe=True, verbose=False, n_connections=None): AbstractConnector.__init__(self, safe, space, verbose) self._rewiring = rewiring self._check_parameters(weights, delays, allow_lists=False) if n_connections is not None: raise NotImplementedError("n_connections is not implemented for" " SmallWorldConnector on this platform") # Get the probabilities up-front for now # TODO: Work out how this can be done statistically pre_positions = self._pre_population.positions post_positions = self._post_population.positions distances = self._space.distances(pre_positions, post_positions, False) self._mask = (distances < degree).as_type(float) self._n_connections = numpy.sum(self._mask)
def __init__(self, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=None): """ :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param `float` weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param `float` delays: -- as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. """ AbstractConnector.__init__(self, safe, space, verbose) self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._check_parameters(weights, delays)
def __init__( self, n, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=False): """ :param `int` n: number of random pre-synaptic neurons connected to output :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param delays: If `None`, all synaptic delays will be set to the global minimum delay. :param `pyNN.Space` space: a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented """ AbstractConnector.__init__(self, safe, space, verbose) self._n_pre = n self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._pre_neurons = None self._check_parameters(weights, delays, allow_lists=False) if isinstance(n, RandomDistribution): raise NotImplementedError( "RandomDistribution is not supported for n in the" " implementation of FixedNumberPreConnector on this platform")
def __init__(self, n, allow_self_connections=True, safe=True, verbose=False): AbstractConnector.__init__(self, safe, verbose) self._post_n = n self._allow_self_connections = allow_self_connections self._post_neurons = None
def __init__( self, weights=0.0, source=None, space=None, safe=True, delays=1, verbose=False): """ :param weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param delays: as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. """ AbstractConnector.__init__(self, safe, space, verbose) if source == 'target': # connection from target self._weights = 1 # to output layer elif source == 'output': # connection from output neuron self._weights = 2 # back onto itself elif source == 'targetPre': # connection from target self._weights = 3 # to previous layer elif source == 'outputPre': # connection from output neuron self._weights = 4 # to previous layer elif source == 'hidden': # connection from hidden neuron self._weights = 5 # back onto itself elif source == 'start': # connection from target to start learning self._weights = 6 # need 2: 1 previous layer, 1 output layer elif source == 'stop': # connection from target to stop learning self._weights = 7 # need 2: 1 previous layer, 1 output layer elif source == 'stopRegion': # connection ending target range self._weights = 8 # to output layer elif source == 'stopRegionPre': # connection ending target range self._weights = 9 # to previous layer elif source == 'startRegion': # connection starting target range self._weights = 10 # to output layer elif source == 'startRegionPre': # connection starting target range self._weights = 11 # to previous layer else: print "\nFor the TargetConnector, we need initialized:" print "source='target', source='output', source='targetPre' or source='outputPre'\n." import sys sys.exit() self._delays = 1 self._check_parameters(self._weights, self._delays)
def __init__( self, num_synapses, safe=True, verbose=False): """ Creates a new connector. """ AbstractConnector.__init__(self, safe, verbose) self._num_synapses = num_synapses self._pre_slices = None self._post_slices = None self._synapses_per_edge = None
def __init__( self, p_connect, allow_self_connections=True, safe=True, verbose=False): AbstractConnector.__init__(self, safe, verbose) self._p_connect = p_connect self._allow_self_connections = allow_self_connections if not 0 <= self._p_connect <= 1: raise exceptions.ConfigurationException( "The probability must be between 0 and 1 (inclusive)")
def __init__(self, weights=0.0, delays=1, allow_self_connections=True # TODO: Add your parameters here ): """ Creates a new MyConnector """ AbstractConnector.__init__(self) self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections
def __init__(self, allow_self_connections=True, safe=True, verbose=None): """ :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. """ AbstractConnector.__init__(self, safe, verbose) self._allow_self_connections = allow_self_connections self._weights = None self._delays = None
def __init__(self, conn_list, safe=True, verbose=False): """ Creates a new FromListConnector. """ AbstractConnector.__init__(self, safe, None, verbose) if conn_list is None or len(conn_list) == 0: self._conn_list = numpy.zeros(0, dtype=self.CONN_LIST_DTYPE) else: temp_conn_list = conn_list if not isinstance(conn_list[0], tuple): temp_conn_list = [tuple(items) for items in conn_list] self._conn_list = numpy.array( temp_conn_list, dtype=self.CONN_LIST_DTYPE)
def __init__( self, p_connect, weights=0.0, delays=1, allow_self_connections=True, safe=True, space=None, verbose=False): AbstractConnector.__init__(self, safe, space, verbose) self._p_connect = p_connect self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._check_parameters(weights, delays, allow_lists=False) if not 0 <= self._p_connect <= 1: raise exceptions.ConfigurationException( "The probability must be between 0 and 1 (inclusive)")
def __init__(self, d_expression, allow_self_connections=True, weights=0.0, delays=1, space=Space(), safe=True, verbose=False, n_connections=None): """ :param `string` d_expression: the right-hand side of a valid python expression for probability, involving 'd', e.g. "exp(-abs(d))", or "d<3", that can be parsed by eval(), that computes the distance dependent distribution :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param `float` weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created, or a distance dependence as per a d_expression. Units nA. :param `float` delays: -- as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. :param `pyNN.Space` space: a Space object, needed if you wish to specify distance- dependent weights or delays :param `int` n_connections: The number of efferent synaptic connections per neuron. """ AbstractConnector.__init__(self, safe, space, verbose) self._d_expression = d_expression self._allow_self_connections = allow_self_connections self._weights = weights self._delays = delays self._check_parameters(weights, delays, allow_lists=False) if n_connections is not None: raise NotImplementedError( "n_connections is not implemented for" " DistanceDependentProbabilityConnector on this platform") # Get the probabilities up-front for now # TODO: Work out how this can be done statistically expand_distances = self._expand_distances(self._d_expression) pre_positions = self._pre_population.positions post_positions = self._post_population.positions # d is apparently unused, but is in fact expected by d_expression # so is used when eval is called d = self._space.distances( # @UnusedVariable pre_positions, post_positions, expand_distances) self._probs = eval(self._d_expression)
def __init__( self, num_synapses, weights=0.0, delays=1, safe=True, verbose=False): """ Creates a new connector. """ AbstractConnector.__init__(self, safe, None, verbose) self._num_synapses = num_synapses self._weights = weights self._delays = delays self._pre_slices = None self._post_slices = None self._synapses_per_subedge = None self._check_parameters(weights, delays)
def __init__( self, n, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=False): AbstractConnector.__init__(self, safe, space, verbose) self._post_n = n self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._post_neurons = None self._check_parameters(weights, delays, allow_lists=False) if isinstance(n, RandomDistribution): raise NotImplementedError( "RandomDistribution is not supported for n in the" " implementation of FixedNumberPostConnector on this platform")
def __init__(self, conn_list, safe=True, verbose=False): """ Creates a new FromListConnector. """ AbstractConnector.__init__(self, safe, verbose) if conn_list is None or len(conn_list) == 0: raise exceptions.InvalidParameterType( "The connection list for the FromListConnector must contain" " at least a list of tuples, each of which should contain:" " (pre_idx, post_idx)") self._conn_list = conn_list # supports setting these at different times self._weights = None self._delays = None self._converted_weights_and_delays = False
def __init__( self, weights=0.0, delays=1, space=None, safe=True, verbose=False): """ :param weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param delays: as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. """ AbstractConnector.__init__(self, safe, space, verbose) self._weights = weights self._delays = delays self._check_parameters(weights, delays)
def __init__(self, p_connect, weights=0.0, delays=1, allow_self_connections=True, safe=True, space=None, verbose=False): AbstractConnector.__init__(self, safe, space, verbose) self._p_connect = p_connect self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._check_parameters(weights, delays, allow_lists=False) if not 0 <= self._p_connect <= 1: raise exceptions.ConfigurationException( "The probability must be between 0 and 1 (inclusive)")
def __init__(self, num_synapses, weights=0.0, delays=1, safe=True, verbose=False): """ Creates a new connector. """ AbstractConnector.__init__(self, safe, None, verbose) self._num_synapses = num_synapses self._weights = weights self._delays = delays self._pre_slices = None self._post_slices = None self._synapses_per_subedge = None self._check_parameters(weights, delays)
def __init__(self, d_expression, allow_self_connections=True, safe=True, verbose=False, n_connections=None): """ :param `string` d_expression: the right-hand side of a valid python expression for probability, involving 'd', e.g. "exp(-abs(d))", or "d<3", that can be parsed by eval(), that computes the distance dependent distribution :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param `pyNN.Space` space: a Space object, needed if you wish to specify distance- dependent weights or delays :param `int` n_connections: The number of efferent synaptic connections per neuron. """ AbstractConnector.__init__(self, safe, verbose) self._d_expression = d_expression self._allow_self_connections = allow_self_connections if n_connections is not None: raise NotImplementedError( "n_connections is not implemented for" " DistanceDependentProbabilityConnector on this platform") # Get the probabilities up-front for now # TODO: Work out how this can be done statistically expand_distances = self._expand_distances(self._d_expression) pre_positions = self._pre_population.positions post_positions = self._post_population.positions # d is apparently unused, but is in fact expected by d_expression # so is used when eval is called d = self._space.distances( # @UnusedVariable # noqa: F841 pre_positions, post_positions, expand_distances) self._probs = eval(self._d_expression)
def __init__( self, degree, rewiring, allow_self_connections=True, weights=0.0, delays=1, space=None, safe=True, verbose=False, n_connections=None): AbstractConnector.__init__(self, safe, space, verbose) self._rewiring = rewiring self._check_parameters(weights, delays, allow_lists=False) if n_connections is not None: raise NotImplementedError( "n_connections is not implemented for" " SmallWorldConnector on this platform") # Get the probabilities up-front for now # TODO: Work out how this can be done statistically pre_positions = self._pre_population.positions post_positions = self._post_population.positions distances = self._space.distances( pre_positions, post_positions, False) self._mask = (distances < degree).as_type(float) self._n_connections = numpy.sum(self._mask)
def __init__(self, weights=0.0, delays=1, space=None, safe=True, verbose=False): """ :param weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param delays: as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. """ AbstractConnector.__init__(self, safe, space, verbose) self._weights = weights self._delays = delays self._check_parameters(weights, delays)
def __init__(self, n, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=False): """ :param `int` n: number of random pre-synaptic neurons connected to output :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param delays: If `None`, all synaptic delays will be set to the global minimum delay. :param `pyNN.Space` space: a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented """ AbstractConnector.__init__(self, safe, space, verbose) self._n_pre = n self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._pre_neurons = None self._check_parameters(weights, delays, allow_lists=False) if isinstance(n, RandomDistribution): raise NotImplementedError( "RandomDistribution is not supported for n in the" " implementation of FixedNumberPreConnector on this platform")
def __init__(self, n, allow_self_connections=True, safe=True, verbose=False): """ :param `int` n: number of random pre-synaptic neurons connected to output :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param `pyNN.Space` space: a Space object, needed if you wish to specify distance- dependent weights or delays - not implemented """ AbstractConnector.__init__(self, safe, verbose) self._n_pre = n self._allow_self_connections = allow_self_connections self._pre_neurons = None
def __init__( self, weights=0.0, delays=1, allow_self_connections=True, space=None, safe=True, verbose=None): """ :param `bool` allow_self_connections: if the connector is used to connect a Population to itself, this flag determines whether a neuron is allowed to connect to itself, or only to other neurons in the Population. :param `float` weights: may either be a float, a !RandomDistribution object, a list/ 1D array with at least as many items as connections to be created. Units nA. :param `float` delays: -- as `weights`. If `None`, all synaptic delays will be set to the global minimum delay. """ AbstractConnector.__init__(self, safe, space, verbose) self._weights = weights self._delays = delays self._allow_self_connections = allow_self_connections self._check_parameters(weights, delays)
def __init__(self, random_number_class, safe=True, verbose=False): """ """ self._random_number_class = random_number_class AbstractConnector.__init__(self, safe, verbose)