Ticket #108: fix_tset.diff

File fix_tset.diff, 1.4 kB (added by mschmucker, 4 months ago)

a patch fixing this bug

  • src/neuron/__init__.py

    old new  
    879879        if self.dim == value_array.shape: # the values are numbers or non-array objects 
    880880            values = value_array.flatten() 
    881881        elif len(value_array.shape) == len(self.dim)+1: # the values are themselves 1D arrays 
    882             values = numpy.reshape(value_array, (self.dim, value_array.size/self.cell.size)) 
     882            newdim = list(self.dim) 
     883            newdim.append(value_array.size/self.cell.size) 
     884            newdim = tuple(newdim) 
     885            values = numpy.reshape(value_array, newdim) 
    883886        else: 
    884887            raise common.InvalidDimensionsError, "Population: %s, value_array: %s" % (str(self.dim), 
    885888                                                                                      str(value_array.shape)) 
    886         values = values.take(numpy.array(self.gidlist)-self.first_id) # take just the values for cells on this machine 
     889        values = values.take(numpy.array(self.gidlist)-self.first_id,  axis = 0) # take just the values for cells on this machine 
    887890        assert len(values) == len(self.gidlist) 
    888          
    889891        # Set the values for each cell 
    890892        for cell, val in zip(self.gidlist, values): 
    891893            if not isinstance(val, str) and hasattr(val, "__len__"):