Esempio n. 1
0
 def _init_spatial_properties(self, shape, positions=None, **kwargs):
     '''
     Create the positions of the neurons from the graph `shape` attribute
     and computes the connections distances.
     '''
     if shape is not None:
         shape.set_parent(self)
         self._shape = shape
     else:
         self._shape = Shape.rectangle(self,1,1)
     if positions is not None and positions.shape[1] != self.node_nb():
         raise InvalidArgument("Wrong number of neurons in `positions`.")
     b_rnd_pos = True if not self.node_nb() or positions is None else False
     self._pos = self._shape.rnd_distrib() if b_rnd_pos else positions
     Connections.distances(self)