Show
Ignore:
Timestamp:
03/12/10 10:14:48 (2 years ago)
Author:
pierre
Message:

Add a method to save Positions into a file. Polish and test the new Connector2 module, by adding a connectors_benchmark script in the unittest that allow to plot graphs of the connections for all the connectors and according to all the parameters. Need to play a bit with, but everything seems to be OK. Andrew, maybe please have a small look, and as soon as you consider that the progress bar, the connections are ok for you, you can commit the new connectors2 module and erase the old one.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/connectors2.py

    r729 r730  
    2424         
    2525    def extract(self, N, distance_matrix=None, sub_mask=None): 
     26        #local_mask is supposed to be a mask of booleans, while  
     27        #sub_mask is a list of cells ids. 
    2628        if isinstance(self.source, basestring): 
    2729            assert distance_matrix is not None 
     
    198200        self.distance_matrix.set_source(src.position)         
    199201        targets = self.projection.post.local_cells[create] 
     202        if not self.allow_self_connections and self.projection.pre == self.projection.post and src in targets: 
     203            i       = numpy.where(targets == src)[0] 
     204            targets = numpy.delete(targets, i) 
     205            create  = numpy.delete(create, i) 
     206         
    200207        weights = self.weights_generator.get(self.N, self.distance_matrix, create) 
    201208        delays  = self.delays_generator.get(self.N, self.distance_matrix, create) 
    202209             
    203         if not self.allow_self_connections and self.projection.pre == self.projection.post and src in targets: 
    204             i       = numpy.where(targets == src)[0] 
    205             weights = numpy.delete(weights, i) 
    206             delays  = numpy.delete(delays, i) 
    207             targets = numpy.delete(targets, i) 
    208          
    209210        if len(targets) > 0: 
    210211            self.projection.connection_manager.connect(src, targets.tolist(), weights, delays)