Changeset 977

Show
Ignore:
Timestamp:
06/08/11 17:34:51 (12 months ago)
Author:
pierre
Message:

Fix a bug when assemblies are launched in parallel and some population are empty on some nodes. Fix also minor syntax in Nemo backend

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common.py

    r961 r977  
    12151215    @property 
    12161216    def _homogeneous_synapses(self): 
    1217         syn = is_conductance(self.populations[0].all_cells[0]) 
    1218         for p in self.populations[1:]: 
    1219             if syn != is_conductance(p.all_cells[0]): 
    1220                 return False 
     1217        syn   = None 
     1218        for count, p in enumerate(self.populations): 
     1219             if len(p.all_cells) > 0: 
     1220                syn = is_conductance(p.all_cells[0]) 
     1221                 
     1222        if syn is not None: 
     1223            for p in self.populations[count:]: 
     1224                if len(p.all_cells) > 0: 
     1225                    if syn != is_conductance(p.all_cells[0]): 
     1226                        return False 
    12211227        return True 
    12221228     
  • trunk/src/nemo/simulator.py

    r957 r977  
    307307        assert len(targets) == len(weights) == len(delays), "%s %s %s" % (len(targets),len(weights),len(delays)) 
    308308        synapse_type = self.synapse_type or "excitatory" 
    309         if isinstance(delays, numpy.ndarray): 
    310             delays = delays.astype(int).tolist() 
     309        delays = numpy.array(delays).astype(int).tolist() 
    311310        if isinstance(weights, numpy.ndarray): 
    312311            weights = weights.tolist()     
    313         source   = int(source) 
    314         if len(targets) == 1: 
    315             targets = int(targets[0]) 
    316             delays  = int(delays[0]) 
    317             weights = weights[0] 
     312        source   = int(source)         
    318313        synapses = state.net.add_synapse(source, targets, delays, weights, self.is_plastic) 
    319314        self.sources.append(source)