Esempio n. 1
0
 def set_weights(self, weight=None, elist=None, distribution=None,
                 parameters=None, noise_scale=None):
     '''
     Set the synaptic weights.
     ..todo ::
         take elist into account in Connections.weights
     
     Parameters
     ----------
     weight : float or class:`numpy.array`, optional (default: None)
         Value or list of the weights (for user defined weights).
     elist : class:`numpy.array`, optional (default: None)
         List of the edges (for user defined weights).
     distribution : class:`string`, optional (default: None)
         Type of distribution (choose among "constant", "uniform", 
         "gaussian", "lognormal", "lin_corr", "log_corr").
     parameters : dict, optional (default: {})
         Dictionary containing the properties of the weight distribution.
     noise_scale : class:`int`, optional (default: None)
         Scale of the multiplicative Gaussian noise that should be applied
         on the weights.
     '''
     if isinstance(weight, float):
         size = self.edge_nb() if elist is None else len(elist)
         weight = np.repeat(weight, size)
     elif not hasattr(weight, "__len__") and weight is not None:
         raise AttributeError('''Invalid `weight` value: must be either
                              float, array-like or None.''')
     if distribution is None:
         distribution = self._w["distribution"]
     if parameters is None:
         parameters = self._w
     Connections.weights(self, elist=elist, wlist=weight,
                         distribution=distribution, parameters=parameters,
                         noise_scale=noise_scale)
Esempio n. 2
0
 def set_weights(self, elist=None, wlist=None, distrib=None,
                 distrib_prop=None, correl=None, noise_scale=None):
     '''
     Set the synaptic weights.
     @todo: take elist into account in Connections.weights
     
     Parameters
     ----------
     elist : class:`numpy.array`, optional (default: None)
         List of the edges (for user defined weights).
     wlist : class:`numpy.array`, optional (default: None)
         List of the weights (for user defined weights).
     distrib : class:`string`, optional (default: None)
         Type of distribution (choose among "constant", "uniform", 
         "gaussian", "lognormal", "lin_corr", "log_corr").
     distrib_prop : dict, optional (default: {})
         Dictoinary containing the properties of the weight distribution.
     correl : class:`string`, optional (default: None)
         Property to which the weights should be correlated.
     noise_scale : class:`int`, optional (default: None)
         Scale of the multiplicative Gaussian noise that should be applied
         on the weights.
     '''
     if distrib is None:
         distrib = self._w["distrib"]
     if distrib_prop is None:
         distrib_prop = (self._w["distrib_prop"] if "distrib_prop" in 
                         self._w.keys() else {})
     if correl is None:
         correl = self._w["correl"] if "correl" in self._w.keys() else None
     Connections.weights(self, elist=elist, wlist=wlist, distrib=distrib,
         correl=correl, distrib_prop=distrib_prop, noise_scale=noise_scale)