Changeset 1024

Show
Ignore:
Timestamp:
12/02/11 14:37:07 (6 months ago)
Author:
pierre
Message:

Fix for ticket 199, to be compatible with the documentation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/connectors.py

    r1015 r1024  
    122122            return values 
    123123        elif isinstance(self.source, numpy.ndarray): 
     124            if len(self.source.shape) == 1: # for OneToOneConnector or AllToAllConnector used from or to only one Neuron    
     125                ## First we reshape the data, and reinit the source_iterator. This is a patch since data are selected according 
     126                ## to the post_synaptic index with local_mask. So therefore, the weights should be in the form of a matrix of size 
     127                ## n_pre lines and n_post columns. If this is a vector, we need to transpose it.  
     128                self.source = self.source.reshape((len(self.source), 1))  
     129                self.source_iterator = iter(self.source) 
    124130            if len(self.source.shape) == 2: 
    125131                source_row = self.source_iterator.next() 
    126132                values     = source_row[self.local_mask] 
    127             elif len(self.source.shape) == 1: # for OneToOneConnector or AllToAllConnector used from or to only one Neuron 
    128                 values = self.source[self.local_mask] 
    129133            else: 
    130134                raise Exception()