Changeset 431

Show
Ignore:
Timestamp:
08/01/08 16:27:53 (3 weeks ago)
Author:
apdavison
Message:

Fixed bug in neuron module: Population.tset() did not properly handle arrays of arrays (ticket #108).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/neuron/__init__.py

    r416 r431  
    879879        if self.dim == value_array.shape: # the values are numbers or non-array objects 
    880880            values = value_array.flatten() 
    881         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)) 
     881        elif self.dim == value_array.shape[:-1]: # the values are themselves 1D arrays 
     882            values = numpy.reshape(value_array, (self.size, value_array.size/self.size)) 
    883883        else: 
    884884            raise common.InvalidDimensionsError, "Population: %s, value_array: %s" % (str(self.dim), 
    885885                                                                                      str(value_array.shape)) 
    886         values = values.take(numpy.array(self.gidlist)-self.first_id) # take just the values for cells on this machine 
     886        values = values.take(numpy.array(self.gidlist)-self.first_id,  axis=0) # take just the values for cells on this machine 
    887887        assert len(values) == len(self.gidlist) 
    888888