Changeset 463

Show
Ignore:
Timestamp:
09/24/08 08:58:30 (2 months ago)
Author:
pierre
Message:

Some minors fixes in neuron2. I'm not really using it, but when i tried to run the benchmark, it seems to me that some minors troubles were here du to the Timer() and to some padding in the output file. Hope I'm right. Also, slight modification of the recording class to save dimensions, in the header, as a list and not as a string of int. It will be much more simple, for postprocessing of the header in NeuroTools

Files:

Legend:

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

    r416 r463  
    733733            f.write(line) 
    734734        f.close() 
     735 
     736# ============================================================================== 
     737#   Utility classes 
     738# ============================================================================== 
     739 
     740Timer = common.Timer 
     741 
     742# ============================================================================== 
  • trunk/src/neuron2/simulator.py

    r424 r463  
    6767    def get(self, gather=False): 
    6868        """Returns the recorded data.""" 
    69         if self.population:  # we return indices (always starting at 0), not IDs. This is what the other modules do, but I think we should really return IDs. 
    70             offset = self.population.first_id 
    71         else: 
    72             offset = 0 
    7369        if self.variable == 'spikes': 
    7470            data = numpy.empty((0,2)) 
     
    7773                spikes = spikes[spikes<=state.t+1e-9] 
    7874                if len(spikes) > 0: 
    79                     new_data = numpy.array([numpy.ones(spikes.shape)*(id-offset), spikes]).T 
     75                    new_data = numpy.array([numpy.ones(spikes.shape)*id, spikes]).T 
    8076                    data = numpy.concatenate((data, new_data)) 
    8177        elif self.variable == 'v': 
     
    8480                v = id._cell.vtrace.toarray() 
    8581                t = id._cell.record_times.toarray() 
    86                 new_data = numpy.array([t, v, numpy.ones(v.shape)*(id-offset)]).T 
     82                new_data = numpy.array([t, v, numpy.ones(v.shape)*id]).T 
    8783                data = numpy.concatenate((data, new_data)) 
    8884        return data 
  • trunk/src/recording.py

    r462 r463  
    8888    # Write header info (e.g., dimensions of the population) 
    8989    if population is not None: 
    90         result.write("# dimensions =" + "\t".join([str(d) for d in population.dim]) + "\n"
     90        result.write("# dimensions = %s\n" %list(population.dim)
    9191        result.write("# first_id = %d\n" % population.first_id) 
    9292        result.write("# last_id = %d\n" % (population.first_id+len(population)-1,)) 
     
    149149        if population is not None: 
    150150            metadata.update({ 
    151                 'dimensions': "\t".join([str(d) for d in population.dim]), 
     151                'dimensions': str(list(population.dim)), 
    152152                'first_id': population.first_id, 
    153153                'last_id': population.first_id + len(population)-1